Can someone provide syntax reference for these below?
%x ST_IN_SCRIPTING
%x ST_DOUBLE_QUOTES
%x ST_BACKQUOTE
%x ST_HEREDOC
%x ST_START_HEREDOC
%x ST_END_HEREDOC
%x ST_LOOKING_FOR_PROPERTY
%x ST_LOOKING_FOR_VARNAME
%x ST_VAR_OFFSET
%x ST_COMMENT
%x ST_DOC_COMMENT
%x ST_ONE_LINE_COMMENT
%option stack
LNUM [0-9]+
DNUM ([0-9]*[\.][0-9]+)|([0-9]+[\.][0-9]*)
EXPONENT_DNUM (({LNUM}|{DNUM})[eE][+-]?{LNUM})
HNUM "0x"[0-9a-fA-F]+
LABEL [a-zA-Z_\开发者_开发问答x7f-\xff][a-zA-Z0-9_\x7f-\xff]*
WHITESPACE [ \n\r\t]+
TABS_AND_SPACES [ \t]*
TOKENS [;:,.\[\]()|^&+-/*=%!~$<>?@]
ANY_CHAR (.|[\n])
NEWLINE ("\r"|"\n"|"\r\n")
%option noyylineno
%option noyywrap
So far I'm familiar with these 3 sections in lex,{%...%}
, %%...%%
and the section after %%
,but have never seen syntax for the above yet...
The following statement define a start condition
%x ST_IN_SCRIPTING
In some rule action you'll find BEGIN(ST_IN_SCRIPTING)
and some rule patterns are prefixed by
<ST_IN_SCRIPTING>
.
You'll find more information in the Flex manual
精彩评论