Frage

Unlike in flex, /* */ and \\

don't seem to work in jlex. They give the error, "Missing brace at start of lexical action."

War es hilfreich?

Lösung

You can include comments in the first and third sections of your JLex specification (which are the definition and java code sections), but not in the second (rules) part, because JLex will think they are part of a pattern.

Write %state DUMMY

in the declaration section and then writing comments in the rules section like this:

<DUMMY>. { /* this is my comment */ }

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top