c++ - Regexp with flex -


i trying write flex rule this:

%% [0-9]+                  yylval=atoi(yytext); return number; [<]                     return langle; [/>]                    return closerangle; [>]                     return rangle; [/]                     return slash; [ a-za-z0-9]            yylval=strdup(yytext); return anything; \n                      /* ignore end of line */; [ \t]+                  /* ignore whitespace */; %% 

when run flex program against file, says:

example4.l:19: warning, rule cannot matched example4.l:20: warning, rule cannot matched 

i guess because in rule [/>] matches either / or > . question how write rule matches / and > together?

i tried documentation: says that:

‘rs’     regular expression ‘r’ followed regular expression ‘s’; called concatenation 

am not doing same? what's wrong? , how cope this?

i guess because in rule [/>] matches either / or > .

exactly.

but question how write rule matches / , > together?

"/>" 

am not doing same?

no. [/] matches / , [>] matches >. [/][>] work. quoted form more normal.


Comments

Popular posts from this blog

php - regexp cyrillic filename not matches -

c# - OpenXML hanging while writing elements -

sql - Select Query has unexpected multiple records (MS Access) -