문제

I guess this is a simple question, but I have found no reference. I have a small lex file defining some tokens from a string and altering them (actually converting them to uppercase).

Basically it is a list of commands like this:

word {setToUppercase(yytext);}

Where setToUppercase is a procedure to change case and store it.

I need to have the complete entry string with the altered words. Is there a way to define a default token / rest of tokens so I can asociate them with an unaltered storage in an output string?

도움이 되었습니까?

해결책

You can do that in one shot with:

.|\n {save_str(yytext);}

다른 팁

I said it was an easy one.

.   {save_str(yytext);}
\n  {save_str(yytext);}

This way all characters and newline are treated.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top