help-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Parsing Problem


From: Hans Aberg
Subject: Re: Parsing Problem
Date: Mon, 12 Aug 2002 14:26:24 +0200

At 12:12 +0300 2002/08/12, Ali KATKAR wrote:
>I have a problem about structure parsing. I want to know structure name
>but sdftext doesn't include name. (I use sdf prefix instead of yy)

This looks like a Flex question:
  Help-flex mailing list
  address@hidden
  http://mail.gnu.org/mailman/listinfo/help-flex

It looks as though you want to write some debugging code. Flex returns a
pointer to the lexed text in yytext, temporarily \0 terminates it until the
next scan, giving the length in yyleng. Have you tried:
[A-Za-z_][A-Za-z0-9_]* {
   printf("\t\t<sdftext inside FLEX is %s >\n", yytext);
                          return NAME; }

If you want to put the string into Bison's yytype, use a const char* and
make sure to duplicate the string before returning from the lexer. Then you
have to figure out how to cleanup those dynamically allocated strings. --
Therefore, I use C++, which can do that cleanup automatically.

  Hans Aberg
                  * Email: Hans Aberg <mailto:address@hidden>
                  * Home Page: <http://www.matematik.su.se/~haberg/>
                  * AMS member listing: <http://www.ams.org/cml/>






reply via email to

[Prev in Thread] Current Thread [Next in Thread]