Georg.Tenckhoff | 29 Apr 10:19

(no subject)

Hallo everybody,

is there any trick to convince flex to auto-complete options entered e.g. from stdin? Posed the same
question differently: Can I access the flex parse tables as a kind of tree structure indicating which
characters are allowed to follow as branches?

Freundliche Grüße / Kind regards

Georg Tenckhoff
lookthree | 27 Jan 22:13

Help please

Hi,
I'm a new Flex user.
I'm having the follow problem:

1. I've created one file Example.l:

%option c++
%option yylineno
%option noyywrap
%option caseless

delim [ \t\n]
ws {delim}+
letter [A-Za-z]
digit [0-9]
id {letter}({letter}|{digit})*
number {digit}+(\.{digit}+)?(E[+\-]?{digit}+)?

%%
            int yylval;
{ws}        {;}
if          { return(IF);}
then        { return(THEN);}
else        { return(ELSE);}
{id}        { return(ID);}
{number}    { return(NUMBER);}
"<"         { yylval = LT; return(RELOP);}
"<="        { yylval = LE; return(RELOP);}
"="         { yylval = EQ; return(RELOP);}
"<>"        { yylval = NE; return(RELOP);}
">"         { yylval = GT; return(RELOP);}
">="        {yylval = GE; return(RELOP);}
.           {return(ERROR);}
%%


and i've run >Flex example.l

and it has returned the file lex.yy.cc.

2. Well, i've created also the main program in c++, let's call it main_prog.cpp:



#include <stdio.h>
#include <ctype.h>
enum {LT, LE, NE, GT, GE, EQ, IF, THEN, ELSE, ID, NUMBER, RELOP, ERROR};
#include <FlexLexer.h>
#include "lex.yy.cc"

int main(int argc, char *argv[])
{
    int token;
    FlexLexer* lexer = new yyFlexLexer();
    while ((token=lexer->yylex()) != 0) {
        switch (token) {
        case RELOP: printf("%s","RELOP"); break;
        case NUMBER: printf("%s","NUMBER"); break;
        case ID: printf("%s","ID"); break;
        case IF: printf("%s","IF"); break;
        case THEN: printf("%s","THEN"); break;
        case ELSE: printf("%s","ELSE");break;
        case ERROR: printf("%s", "illegal character"); break;
        default:
                    printf("%s","UNKNOWN");
                    break;
        }
        printf("%s\n", lexer->YYText());
    }
    return 0;
}

The problem becomes when I compile it using

        g++ main_prog.cpp -o main_prog

,infact the system answer me with:

/usr/include/FlexLexer.h:113: error: redefinition of ‘class yyFlexLexer’
/usr/include/FlexLexer.h:113: error: previous definition of ‘class yyFlexLexer’

thank you for helping me,

Simone.










**********
Scopri la nuova Alice Mail!
1 GB di spazio con antivirus, antispam e fino a 2 GB di allegati.

Registrati GRATIS su http://registra.rossoalice.alice.it/registra/basic/entratabasic.do?entryPoint=footer

_______________________________________________
help-flex mailing list
help-flex <at> gnu.org
http://lists.gnu.org/mailman/listinfo/help-flex
Eric Fowler | 8 Sep 04:25

Flex empty string

I hear a rumor this is the place for online flex discussion.

I am a relative newbie and I want to match NMEA 0183 strings coming from a GPS.

They look like this:
$GPGGA,123519,4807.038,N,01131.000,E,1,08, 0.9,545.4,M,46.9,M,,*47

except when they look like this:

$GPGGA,123519,4807.038,N,01131.000,E,,,,,,,,,*47

In other words, many fields can be blank, but they are always comma - delimited. When they exist they are nicely structured, e.g. {DIGIT}{4}"."{DIGIT}{3} matches a latitude string.

So how do I distinguish between a field with some specific data and a delimiter, and an empty string followed by the same delimiter?

Thanks.

Eric

_______________________________________________
help-flex mailing list
help-flex <at> gnu.org
http://lists.gnu.org/mailman/listinfo/help-flex
Carlos Smith | 2 Jun 15:47

Building flex-2.5.34 from CVS

Hi,

Just want to confirm i succesfully build
flex 2.5.34 fresh from cvs.

The README.cvs says to use

gettext 0.14.5, but it does not work.
Instead you needs gettext-devl (for autopoint)

Also, is ident 2.8 the correct version.
May be it is 2.2.8 ?

-- carlos
harsh | 31 May 08:11

warning

Hi,

 

I get a warning dealing with "yy_flex_realloc" saying that:'void* yy_flex_realloc(void*, yy_size_t)' defined but not used,

I would like to know how it's posssible to avoid it.

 

Best regards,

Harsh

 

DISCLAIMER ========== This e-mail may contain privileged and confidential information which is the property of Persistent Systems Pvt. Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Pvt. Ltd. does not accept any liability for virus infected mails.

_______________________________________________
help-flex mailing list
help-flex <at> gnu.org
http://lists.gnu.org/mailman/listinfo/help-flex
post2li | 29 May 13:09

Flex/Bison Segment Fault?

I am trying to test the code in the book "Lex & Yacc, 2nd", however,
it didn't work as described. Pls.

# uname -a
Linux redhat9 2.4.20-8 #1 Thu Mar 13 17:54:28 EST 2003 i686 i686 i386
GNU/Linux

# flex -V
flex version 2.5.4

# bison -V
bison (GNU Bison) 1.35

# flex -olexa.yy.c ch1-05.l
# bison -obisa.tab.c ch1-05.y
# gcc -o ex bisa.tab.c lexa.yy.c -ll

# ./ex
Segmentation fault
kkc | 25 May 18:34

lex & yacc, Second Edition example compile code problem


I try compile all code using "make" command in linux, but it come back with
compile error, please help.

thank you!

/* output
[work]$ make
flex ch1-01.l
mv lex.yy.c ch1-01.c
gcc -g -o ch1-01.pgm ch1-01.c -ly -ll
/usr/bin/ld: cannot find -ly
collect2: ld returned 1 exit status
make: *** [ch1-01.pgm] Error 1
[work]$

*/
--

-- 
View this message in context: http://www.nabble.com/lex---yacc%2C-Second-Edition-example-compile-code-problem-tf3817146.html#a10806368
Sent from the Gnu - Flex mailing list archive at Nabble.com.
arun kv | 30 Apr 12:54

memory errors ....

  
Hi All, 

I have implemented a parser using lex and yacc ,  my lex and yacc files are named parser.y and scanner.l 
(these files are compiled with flex++ and bison++  to make my parser compatible with C++) 
My parser is working fine but .... 
The issue is when I run my parser with purify (a memory detection tool ) .It gives out memory errors in the flex
and bison generated  source codes (parser.cpp , parser.h and scanner.h )

The purify errors for the parser are : 
IPR :Invalid pointer read , IPW :Invalid pointer write , BSR: Beyond stack read error 
Shown by these variables in parser.cpp 
yystate
yyn    
yyssp  
yyvsp  
yyerrstatus    
yycharl

For detailed purify log please see the attached file. 
What I want to know is that, Is there any way in which I can control these variables form my lex and yacc files. 
Or how else I can fix these memory errors shown by purify. 
Best Regards 
Arun 

Attachment (parser.log): application/octet-stream, 41 KiB
_______________________________________________
help-bison <at> gnu.org http://lists.gnu.org/mailman/listinfo/help-bison
Sachin Puttur | 6 Apr 10:12

hi

hi
There is problem with the file lang_scan.c  which is a lexical scanner 
developed by flex. The error is that it could not find file "y.tab.h". 
can you please able to send this to me ?

Thank you

--

-- 

With Regards
Sachin P B
Altair's Grid Technologies
+91- 9886 379 891 (M)
+91-80- 6629 4500 ext-4794 (O)
henrik.sorensen | 2 Apr 16:41

Getting YY_CURRENT_BUFFER when using reentrant scanner

Hi List,

Just wondering how you are using YY_CURRENT_BUFFER in a reentrant scanner.

When using the %option reentrant, I have to do the following hack to use the 
YY_CURRENT_BUFFER in a function that only takes the yyscan_t yyscanner as 
parameter.

struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* <== HACK HACK */

yy_flush_buffer((YY_CURRENT_BUFFER),yyscanner);

Is there anyother way, that doesnt require the yyg variable ?

thanks for your help
Henrik
Kamel SEGHAIER | 31 Jan 10:31

Segmentation Fault on Flex 2.5.33


> Hi all ,
>
> I have a segmentation fault in file.lex on linux 64 bits in this line of file_lex.c : 
> 
> yy_hold_char = *++yy_c_buf_p
>
> I have no more indication for the debuger.
> When I turn on linux32 I have no segmentation but an error in another file.

> I'm using flex 2.5.33
>
> Is this a Flex bug!!!!!!!!
> Best regards
>

Gmane