mapping token identifier to value

r0ller <[email protected]>
Newsgroups gmane.comp.parsers.bison.general
Message-ID <[email protected]>
Hi Akim,

I'm trying to get rid of numbering tokens and let bison do that but it seems to be more difficult than I thought. Although, I managed to come up with an idea as I'm anyway generating the bison source I could generate a map like:

    std::map<std::string, unsigned int> symbol2token={<!-- -->
            { "t_Con", yy::parser::token::t_Con },
            ...
    };

and could then get the values simply by:

symbol2token.find("t_Con")->second;

However, still wanted to ask if there's any better solution maybe one that I overlooked and is provided by bison itself;)

Best regards,
r0ller
_______________________________________________
[email protected] https://lists.gnu.org/mailman/listinfo/help-bison
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.