Chevrotain / chevrotain

Parser Building Toolkit for JavaScript
https://chevrotain.io
Apache License 2.0
2.44k stars 199 forks source link

Is Possible to Check the wheather the token is consumed more than once #2021

Closed Siva-Harish98 closed 3 months ago

Siva-Harish98 commented 3 months ago
T.RULE('additionExpression', () => {
T.SUBRULE(T.multiplicationExpression, { LABEL: 'lhs' });
T.MANY(() => {
T.CONSUME(ArithmeticOperator);
                T.OR([
                    { ALT: () => T.SUBRULE3(T.onKey) },
                    { ALT: () => T.SUBRULE2(T.multiplicationExpression, { LABEL: 'rhs' }) }
                ])
        });
    });

in above code i dont want to restrict the subrule more than one time

msujew commented 3 months ago

I'm closing this in favor of https://github.com/Chevrotain/chevrotain/discussions/2020, since this isn't an actionable issue.