Suppose I have keyword definitions (case insensitive):
CLASS (c|C)(l|L)(a|A)(s|S){2}
IF (i|I)(f|F)
...more....
Now I want to define a KEYWORD which consists of all the keywords:
KEYWORD (CLASS|IF| ....more....)
IDENTIFIER [^KEYWORD][a-zA-Z0-9]
However, doing this way, it will only treat CLASS as a string and is not substituted with previous definition. Furthermore,I want to use the KEYWORD definition in IDENTIFIER, is it valid (let’s assume KEYWORD is substituted)?
Ok I found out how to use the previous definition here: http://dinosaur.compilertools.net/flex/flex_6.html#SEC6
We must add {} around the previous definitions:
I answer myself for future reference from others.