سؤال

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