help-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Matching opening and closing bracket question


From: Maury Markowitz
Subject: Matching opening and closing bracket question
Date: Wed, 12 Apr 2023 18:38:35 -0400

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?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]