help-bison
[Top][All Lists]
Advanced

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

Renaming parser file


From: Frans Englich
Subject: Renaming parser file
Date: Sat, 29 Jul 2006 21:08:08 +0000
User-agent: KMail/1.8.50

Hello all,

As can be seen, I do a fair bit of post processing on my parser:

parser:
        cd $(srcdir)
        bison QueryTransformParser.ypp
        mv QueryTransformParser.tab.cpp QueryTransformParser.cpp
        mv QueryTransformParser.tab.hpp QueryTransformParser.h
        sed  -i -e 's/#define [0-9a-zA-Z_]\+ [0-9]\{3\}//' 
$(srcdir)/QueryTransformParser.{cpp,h}
        sed  -i -e 's/#define END_OF_FILE 0//' $(srcdir)/QueryTransformParser.
{cpp,h}

The sed calls remove the defines for the YYTOKENTYPE so I can use the enum 
without trouble.(yytokentype). The mv calls, obviously rename the outputted 
parser.

Can I do these renames with bison directives? I would prefer if my .ypp file 
was completely self contained and that I didn't have to do any 
post-processing.

There is %file-prefix, but I don't see how it helps me since I don't want to 
change the "QueryTransformParser" part. Then there is "%output" which the 
Bison manual says "set the name of the parser file." I don't get what that 
means, or how it differs from %file-prefix.

I already specify %defines and %name-prefix. I'm positive towards renaming 
QueryTransformParser.ypp(such as changing the file extension) if that would 
help.


Cheers,

                Frans




reply via email to

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