help-bison
[Top][All Lists]
Advanced

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

mapping token identifier to value


From: r0ller
Subject: mapping token identifier to value
Date: Fri, 14 Dec 2018 14:21:47 +0100 (CET)

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


reply via email to

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