On Fri 13 Sep 2013 10:42:02 AM CEST, 王波 wrote:
Hi,

    This email I also sent to bug-bi...@gnu.org. But It's really a question, I 
don't know Bison how to deal with it.

     The following is my description.

Thanks,

Best regards,
Andy

From: wangbo15541...@hotmail.com
To: bug-bi...@gnu.org
Subject: I can't make sure it's a bug. But I think it's important.
Date: Fri, 13 Sep 2013 15:30:00 +0800




Hi,

     Flex/Bison is powerful.  As a developer, I love them.

     Now, I meet with a problem and can't find a good way to resolve it.
     when Flex read "\n", I add my line number, then ignore it. Flex will read 
another word, then return to bison as a token. Bison will start to reduce and action my 
function. But in my function, I will use the line number which is wrong obviously.

     I have a way to resolve it. When Flex read "\n", I think it can return 
some special character(key word) to make Bison to reduce the statement, then Bison can 
ignore the special character.

    I think Bison should support this way.

    welcome to comment,

    Thanks,

Best regards,
Andy



                                                                                
_______________________________________________
help-bison@gnu.org https://lists.gnu.org/mailman/listinfo/help-bison

Hi,

If the newline is a separator in your grammar (meaning that an expression cannot be spread on two lines), then it should be present in your grammar as a newline token, explicitly. E. g.
list-exp:
 exp newline
| exp newline list-exp
;

Valentin Tolmer

_______________________________________________
help-bison@gnu.org https://lists.gnu.org/mailman/listinfo/help-bison

Reply via email to