compiler construction - flex Start Conditions (matching string literals) -
compiler construction - flex Start Conditions (matching string literals) -
i'm implementing start status matching c-style strings in flex manual.
the segment i'm concerned is:
<str>\" { /* saw closing quote - done */ begin(initial); *string_buf_ptr = '\0'; /* homecoming string constant token type , * value parser */ }
i have no issue returning token type, i'm unsure how pass string value in situation. if print yytext when token returned, it's holding " terminator.
so how string's value?
thanks in advance; i'm new flex.
you not homecoming yytext
homecoming pointer string_buf
.
yytext
contains terminator because content of lastly regular look matched state. in other cases (but terminator) of example, content of yytext
copied string_buf
(e.g. check lines *string_buf_ptr++=*yptr++;
), buffer holds final string.
compiler-construction flex-lexer
Comments
Post a Comment