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