-
So I have a parser rule which allows combinations of $.RULE("expr", () => {
$.AT_LEAST_ONE(() => {
$.OR([
{ ALT: () => $.SUBRULE($.choice) },
{ ALT: () => $.SUBRULE($.symbol) },
])
})
}) Assuming I have an expression that consists of both a The I could drill down to the location property which refers back to the input string, but I'm guessing there's a better way? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hello @dhowe If you wrap the alternation: $.OR([
{ ALT: () => $.SUBRULE($.choice) },
{ ALT: () => $.SUBRULE($.symbol) },
]) in its own rule (lets name it "expElement") and invoke that rule from the "loop": $.RULE("expr", () => {
$.AT_LEAST_ONE(() => {
$.SUBRULE($.expElement)
})
}) You will get an orderedList back, at the cost of another level of nesting... |
Beta Was this translation helpful? Give feedback.
Hello @dhowe
If you wrap the alternation:
in its own rule (lets name it "expElement") and invoke that rule from the "loop":
You will get an orderedList back, at the cost of another level of nesting...