Closed dhowe closed 2 years ago
I'm sure this is super obvious (I'm a new user), but how to define a parser rule that says one or more of a few options:
element: (chars | choice | symbol)+;
Is the proper way to create a sub-rule for each option (as below,) or can I simply say AT_LEAST_ONE(OR [{ALT: ..., }])
$.RULE("element-part", () => { $.OR([ { ALT: () => $.SUBRULE($.chars) }, { ALT: () => $.SUBRULE($.choice) }, { ALT: () => $.SUBRULE($.symbol) }, ]) }) $.RULE("element", () => { $.AT_LEAST_ONE(() => $.SUBRULE($.element-part")); });
I'm sure this is super obvious (I'm a new user), but how to define a parser rule that says one or more of a few options:
Is the proper way to create a sub-rule for each option (as below,) or can I simply say AT_LEAST_ONE(OR [{ALT: ..., }])