[Top][All Lists]

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

Re: How to discard data in scanner?

From: Jibin Han
Subject: Re: How to discard data in scanner?
Date: Wed, 05 Mar 2003 17:56:40 -0700

address@hidden wrote:

> I havn't understand your grammar completely. But I think it is easy to skip a
> char or token in lex. When a rule is matched you just don't write codes like "
> return TOKEN". In this way the parser won't see the char or token.

This is also my understanding, but it seems those char are ported to stdout. I 
to re-define ECHO to null, otherwise it seems all the char I do not return to
parser are print out. I am wondering if there is some way to discard those char,
but do not bother about such global viriable as ECHO.


> Regards,
> Johnny Xia.
> Jibin Han <address@hidden> on 03/05/2003 03:39:59 PM
>  To:      address@hidden
>  cc:      (bcc: Johnny Xia/WSH/Wistron)
>  Subject: How to discard data in scanner?
> This document is classified as     Normal
> Hi,
>     The data file I am parsing is kind of this format,
>         name = <value>, <property1>=val1>,<property2>=<val2>
>     In the scanner file, I set some start states, for example, if I read "name
> =",
> then I begin a state, <NAME>, then when I read coma, I begin state PROPERTY1,
> and
> so on.
>     So the coma here is the symbol to change the state. And the rule is like,
>         <NAME>,       { BEGIN(PROPERTY1); }
>         <VALUE1>,       { BEGIN(PROPERTY2); }
>     then when I run the parser, everything is OK, but I see many coma print 
> out,
> it seems I should do something with the coma, but I really do not want to pass
> coma to parser. My question is is there any easy way to discard the coma?
> Thanks.
> _______________________________________________
> address@hidden

reply via email to

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