LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   regarding a lex sample program... (https://www.linuxquestions.org/questions/linux-software-2/regarding-a-lex-sample-program-442658/)

sam_cit 05-08-2006 12:27 AM

regarding a lex sample program...
 
Hi,
I have the following program,

%%
[^ab]+ { printf("string is %s\n",yytext); }
. { ECHO ; printf("\n");}
%%
int main()
{
yylex();
return(0);
}

when i run it, and give the following input

111a222a333a444

i get the following output,

string is 111
a
string is 222
a
string is 333
a

and thats it... i don't understand why the last string of 444 is not prited, can anyone help me on this...

Thanks And Regards,
Vaairavan.S

narc 05-08-2006 06:46 PM

Quote:

i get the following output,

string is 111
a
string is 222
a
string is 333
a
Which version / platform do you use ? I use flex 2.5.31, and I just ran your program without a hitch.

Code:

[me@lfs6 ~/lex_test]$ echo 111a222a333a444 | ./flex_test
1
1
1
string is a
2
2
2
string is a
3
3
3
string is a
4
4
4

Have you tried adding a white space after 444 and see what happens ? Maybe you can bring the issue to the maintainers of this particular program with such comparative results.

Cheers.
---
narc

sam_cit 05-09-2006 12:16 AM

no actually, ctrl+d is missing at the end of the string... thats why dude...


All times are GMT -5. The time now is 12:46 AM.