jison icon indicating copy to clipboard operation
jison copied to clipboard

definitions inconsistencies between lex and jison

Open mbroadst opened this issue 9 years ago • 1 comments

Hi, I'm attempting to port the ansi C lex grammar here and running into issues with the initial definitions, specifically with the sections:

FS          (f|F|l|L)
IS          (u|U|l|L)*

throwing an Error: Could not parse lex grammar error.

It's my understanding that these should just be regular expressions, so I'm not sure why jison is having trouble parsing them. I'm sure I'm missing something very simple here, but a cursory perusal of the documentation didn't elicit anything on this end - hopefully someone can correct me.

mbroadst avatar Oct 10 '16 21:10 mbroadst

AFAICT this is a 'problem' in the 'vanilla' lexer, which requires double-quotes around literal parts of a lexer rule regex, i.e.

FS          ("f"|"F"|"l"|"L")
IS          ("u"|"U"|"l"|"L")*

should work.

The GerHobbelt fork doesn't exhibit this problem as I augmented the lexer to recognize literal regex parts without the need for quotes, whenever possible, as this was pretty frustrating to me, back when I started out using jison (and having grown up on yacc/bison/lex/flex and similar code generators)

GerHobbelt avatar Jan 31 '17 15:01 GerHobbelt