I'm not sure quite what you mean by "keyword". According to the "Lexical rules" section of the JFlex User's Manual, both of your examples use regexes.
It's true that the regexes retrieve
and "retrieve"
are equivalent, but that's just because the sole effect of the "..."
notation is to disable regex metacharacters, and none of the characters in retrieve
are regex metacharacters to begin with. (By the way, you can also wrap just part of a regex in quotation marks; so, for example, retrieve
is also equivalent to r"et"ri"ev"e
.)
The quotation marks are more useful if (say) one of the keywords in your language is +++***+++
, in which case you could write either of these:
\+\+\+\*\*\*\+\+\+ { action code }
"+++***+++" { action code }