Pergunta

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?

Foi útil?

Solução

You can do that in one shot with:

.|\n {save_str(yytext);}

Outras dicas

I said it was an easy one.

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

This way all characters and newline are treated.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top