Skip to content

Commit

Permalink
Rename api
Browse files Browse the repository at this point in the history
  • Loading branch information
msujew committed Jan 15, 2025
1 parent faa656e commit 11d88a1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions packages/langium/src/parser/cst-node-builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ export class CstNodeBuilder {
current.content.push(...nodes);
return;
}
// Otherwise we are at a newly created node
// Instead of adding the hidden nodes here, we search for the first parent node with content
while (current.container) {
const index = current.container.content.indexOf(current);
if (index > 0) {
Expand Down
4 changes: 2 additions & 2 deletions packages/langium/src/parser/langium-parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ export class LangiumParser extends AbstractLangiumParser {
};
}

private getHiddenTokens(token: IToken): IToken[] {
private extractHiddenTokens(token: IToken): IToken[] {
const hiddenTokens = this.lexerResult!.hidden;
if (!hiddenTokens.length) {
return [];
Expand All @@ -293,7 +293,7 @@ export class LangiumParser extends AbstractLangiumParser {
consume(idx: number, tokenType: TokenType, feature: AbstractElement): void {
const token = this.wrapper.wrapConsume(idx, tokenType);
if (!this.isRecording() && this.isValidToken(token)) {
const hiddenTokens = this.getHiddenTokens(token);
const hiddenTokens = this.extractHiddenTokens(token);
this.nodeBuilder.addHiddenNodes(hiddenTokens);
const leafNode = this.nodeBuilder.buildLeafNode(token, feature);
const { assignment, isCrossRef } = this.getAssignment(feature);
Expand Down

0 comments on commit 11d88a1

Please sign in to comment.