Skip to content

Commit 1ef6131

Browse files
committed
compiler: add failing test related to leadingSpaces inside lex
1 parent e4b0aec commit 1ef6131

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

packages/compiler/test/test-wasm.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2002,3 +2002,18 @@ test('parameterized rules: growing parameters should not blow the stack', t => {
20022002
{message: /Excessively deep specialization/}
20032003
);
20042004
});
2005+
2006+
test.failing('leadingSpaces in a lexical context', async t => {
2007+
const wasmGrammar = await compileAndLoad(`
2008+
G {
2009+
Start = ">" "a" digit
2010+
| ">" #(" a" letter)
2011+
}
2012+
`);
2013+
t.is(matchWithInput(wasmGrammar, '> ab'), 1);
2014+
const root = wasmGrammar._getCstRoot();
2015+
t.is(root.ctorName, 'Start');
2016+
const [_, a, letter] = root.children; // eslint-disable-line no-unused-vars
2017+
t.falsy(a.leadingSpaces);
2018+
t.falsy(letter.leadingSpaces);
2019+
});

0 commit comments

Comments
 (0)