Matching opening and closing bracket question
Maury Markowitz <[email protected]> Wed, 12 Apr 2023 18:38:35 -0400
| Newsgroups | gmane.comp.parsers.bison.general |
|---|---|
| Message-ID | <[email protected]> |
Very noob question… I am parsing a grammar that allows bracketing using (), [] and <>. It would simplify my code if I could do… open_bracket: ‘(‘ | ‘[‘ | ‘<‘ ; close_bracket: ‘)‘ | ‘]‘ | ‘>’ ; bracketed_expression : open_bracket expression close_bracket ; But this did not work when I tried it, because it would match (100]. I’m not sure that’s something that would actually come up in my use-case, but I’m curious if there is a simple way to address this, or perhaps I just did it wrong?