質問

Unlike in flex, /* */ and \\

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

役に立ちましたか?

解決

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 */ }

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top