I want to parse expressions of the following structure:
compositeKey ::= key (separator key)*
Here is the flex code fragment:
KEY_CHARACTER=[^:\s]
KEY_SEPARATOR=[:]
%state WAITING_KEY
...
<WAITING_KEY> {KEY_CHARACTER}+ { yybegin(WAITING_KEY); return MyTypes.KEY; }
<WAITING_KEY> {KEY_SEPARATOR} { yybegin(WAITING_KEY); return MyTypes.KEY_SEPARATOR; }
Code generated by given flex fragment works fine, but what if I want to get key separator at "runtime"? It actually may be any character, specified by user. How to do it with jflex?