Re: Very basic question about Flex

2019-02-27 Thread workbe...@gmx.at
Found my thinking error... On 27.02.19 15:48, workbe...@gmx.at wrote: Hi again, i tried the first example and when i set .|\n { /* do nothing */ } [_a-zA-Z]+\( { printf("function_name: %s", yytext); } He still matches 324_functionname( =(. I thought it's because of the default route but th

Re: Very basic question about Flex

2019-02-27 Thread workbe...@gmx.at
Hi again, i tried the first example and when i set .|\n { /* do nothing */ } [_a-zA-Z]+\( { printf("function_name: %s", yytext); } He still matches 324_functionname( =(. I thought it's because of the default route but that seems not to be the issue, what am i missing here ? best regards!

Re: Very basic question about Flex

2019-02-22 Thread workbe...@gmx.at
Thanks for you help. Now i've typed in one of the first examples and it throws me an strange error: > flex01.l:99: premature EOF The code looks like this: %{ #include #include #include enum {     LOOKUP = 0,     BOOL,     INT,     FLOAT,     STRING,     VEC2,     VEC3,     VEC4 }; int sta

RE: Very basic question about Flex

2019-02-22 Thread Jannick
On Fri, 22 Feb 2019 17:02:57 +0100, workbe...@gmx.at wrote: > $gcc lex.yy.c -o test -Wall Comparing to your earlier compile statement, you dropped '-lfl' which caused the linking error. To remedy the situation add to the top of the flex file %option noyywrap %option noinput nounput Then the e

Re: Very basic question about Flex

2019-02-22 Thread workbe...@gmx.at
Now i've changed my rules to include whitespace and then the [a-zA-Z]+ rule. The code is now: %{ /**  * First example program for flex  *  */ #include #include %} %% is | am | are | where | was | be | being | been | do | does | did | should | can | could | has | have | had | go { printf("%s

RE: Very basic question about Flex

2019-02-22 Thread Jannick
On Fri, 22 Feb 2019 15:00:51 +0100, workbe...@gmx.at wrote: If you replace > [a-zA-Z]+ { printf("%s is not a verb", yytext); } by [a-zA-Z]+ printf("'%s' is not a verb\n", yytext); you will see that the scanner does exactly what it is expected to do, since the line > .|\n { ECHO; /* no

Re: Very basic question about Flex

2019-02-22 Thread John P. Hartmann
Congratulations on reading the manual. You clearly think that flex matches a line at a time. Not so. Perhaps read the books to the end first? On 2/22/19 15:00, workbe...@gmx.at wrote: Now my question is when i enter one of the verbs it's working normaly like expected, but when i enter for

Re: Very basic question about Flex

2019-02-22 Thread Simon Richter
Hi, On 22.02.19 15:00, workbe...@gmx.at wrote: > [a-zA-Z]+ { printf("%s is not a verb", yytext); } > > .|\n { ECHO; /* normal default anyway */ } > Now my question is when i enter one of the verbs it's working normaly > like expected, but when i enter for example 234someword i also get the > me

Very basic question about Flex

2019-02-22 Thread workbe...@gmx.at
Hi everyone, i've started to read the lex and yacc book and the bison and flex book. now in the first example they have the following code: %{ /**  * First example program for flex  *  */ %} %% is | am | are | where | was | be | being | been | do | does | did | should | can | could | has | h