Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Have you experienced the %variant mode in Bison development version? It works well, and avoids this nasty POD issue. Have a look at http://www.lrde.epita.fr/~akim/download/bison-2.4.570-7a582.tar.bz2. Look for variant in the documentation. The following example shows what you can do. I need to polish and publish this :( Help would be most welcome.
- %type <::std::string> item;
- %type <::std::list<std::string>> list;
- %%
- result:
- list { std::cout << $1 << std::endl; }
- ;
- list:
- /* nothing */ { /* Generates an empty string list */ }
- | list item { std::swap ($$, $1); $$.push_back ($2); }
- ;
- item:
- TEXT { std::swap ($$, $1); }
- | NUMBER { $$ = string_cast ($1); }
- ;
- %%
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement