Skip to content

Commit 11d88a1

Browse files
committed
Rename api
1 parent faa656e commit 11d88a1

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

packages/langium/src/parser/cst-node-builder.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ export class CstNodeBuilder {
6868
current.content.push(...nodes);
6969
return;
7070
}
71+
// Otherwise we are at a newly created node
72+
// Instead of adding the hidden nodes here, we search for the first parent node with content
7173
while (current.container) {
7274
const index = current.container.content.indexOf(current);
7375
if (index > 0) {

packages/langium/src/parser/langium-parser.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ export class LangiumParser extends AbstractLangiumParser {
275275
};
276276
}
277277

278-
private getHiddenTokens(token: IToken): IToken[] {
278+
private extractHiddenTokens(token: IToken): IToken[] {
279279
const hiddenTokens = this.lexerResult!.hidden;
280280
if (!hiddenTokens.length) {
281281
return [];
@@ -293,7 +293,7 @@ export class LangiumParser extends AbstractLangiumParser {
293293
consume(idx: number, tokenType: TokenType, feature: AbstractElement): void {
294294
const token = this.wrapper.wrapConsume(idx, tokenType);
295295
if (!this.isRecording() && this.isValidToken(token)) {
296-
const hiddenTokens = this.getHiddenTokens(token);
296+
const hiddenTokens = this.extractHiddenTokens(token);
297297
this.nodeBuilder.addHiddenNodes(hiddenTokens);
298298
const leafNode = this.nodeBuilder.buildLeafNode(token, feature);
299299
const { assignment, isCrossRef } = this.getAssignment(feature);

0 commit comments

Comments
 (0)