Re: unable to get a parser&lexer going with token types other than int, double or std::string

Seth <[email protected]>
Newsgroups gmane.comp.parsers.spirit.general
Message-ID <[email protected]>
On 10-11-17 20:38, Foelsche, Peter wrote:
>
> Dear All,
>
>  
>
> Always when attempting to have my lexer return other types than
> std::string or int or double IÂ’m getting compiler errors.
>
> I was joking that potentially I need to serialize my objects into/from
> a std::string in order to use spirit.
>
> See attached my code example.
>
> At the top there is a typedef:
>
>  
>
> Typedef std::string token;
>
>  
>
> One can change this typedef to a boost::variant and immediately
> everything breaks.
>
> IÂ’ve been fighting with this for days now.
>
> Thanks for any help.
>
>  
>
> Peter
>

I've just written up an approach that I think Spirit favours on the
related StackOverflow question: https://stackoverflow.com/a/47232006/85371

I stopped clear of transforming to your AST because I don't think I have
the full data types required, or maybe I just don't understand where
you're going with your representation. It looks very generic, and very
generic things usually require the best documentation to explain it.

This, incidentally might explain the pain with some of the documentation
in Boost Libraries: No matter how excellent the docs, it's often still
hard to grasp the general ideas.

I hope this helps,
Seth

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

_______________________________________________
Spirit-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/spirit-general
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.