diff --git a/packages/langium/src/parser/indentation-aware.ts b/packages/langium/src/parser/indentation-aware.ts index a62f17821..79bf645a2 100644 --- a/packages/langium/src/parser/indentation-aware.ts +++ b/packages/langium/src/parser/indentation-aware.ts @@ -54,14 +54,14 @@ export interface IndentationTokenBuilderOptions> + ignoreIndentationDelimiters: Array> } export const indentationBuilderDefaultOptions: IndentationTokenBuilderOptions = { indentTokenName: 'INDENT', dedentTokenName: 'DEDENT', whitespaceTokenName: 'WS', - ignoreIndentationDelimeters: [], + ignoreIndentationDelimiters: [], }; export enum LexingMode { @@ -129,7 +129,7 @@ export class IndentationAwareTokenBuilder 0) { + if (ignoreIndentationDelimiters.length > 0) { const multiModeLexerDef: IMultiModeLexerDefinition = { modes: { [LexingMode.REGULAR]: [dedent, indent, ...otherTokens, ws], diff --git a/packages/langium/test/parser/indentation-aware.test.ts b/packages/langium/test/parser/indentation-aware.test.ts index b79f25708..cb7026bc7 100644 --- a/packages/langium/test/parser/indentation-aware.test.ts +++ b/packages/langium/test/parser/indentation-aware.test.ts @@ -204,7 +204,7 @@ describe('IndentationAwareLexer', () => { }); -describe('IndentationAwareTokenBuilder#ignoreIndentationDelimeters', async () => { +describe('IndentationAwareTokenBuilder#ignoreIndentationDelimiters', async () => { const grammar = ` grammar PythonIfWithLists @@ -232,7 +232,7 @@ describe('IndentationAwareTokenBuilder#ignoreIndentationDelimeters', async () => `; const lexer = await getLexer(grammar, { - ignoreIndentationDelimeters: [ + ignoreIndentationDelimiters: [ ['(', ')'], ['[', ']'], ], @@ -248,7 +248,7 @@ describe('IndentationAwareTokenBuilder#ignoreIndentationDelimeters', async () => expect(errors).toHaveLength(0); }); - test('should ignore indentation inside the given delimeters', async () => { + test('should ignore indentation inside the given delimiters', async () => { const { errors, tokens } = lexer.tokenize(expandToString` return [ false, @@ -267,7 +267,7 @@ describe('IndentationAwareTokenBuilder#ignoreIndentationDelimeters', async () => expect(tokenNames).not.toContain('DEDENT'); }); - test('should handle nested delimeters', async () => { + test('should handle nested delimiters', async () => { const { errors, tokens } = lexer.tokenize(expandToString` return [ [