Re: splitted source (decl, def) gives compile errors byy use for test suite
Tom Kulaga <[email protected]>
| Newsgroups | gmane.comp.parsers.spirit.general |
|---|---|
| Message-ID | <CAMWfBPEZTnngOLfNdE991fH0QFqx_OfC-22RqefLsgYNBFfPYg@mail.gmail.com> |
Hi Olaf,
here's what I use hope it helps:
SchematicFileGrammer_def.hpp http://pastebin.com/SUP0WAq3
SchematicFileGrammer.hpp http://pastebin.com/t5hwymCe
SchematicFileParserConfig.hpp http://pastebin.com/VgyrrAVQ
SchematicFileGrammer.cpp http://pastebin.com/sNkQtXuS
error_handler.hpp http://pastebin.com/4HJHTkSS
(There's also the AST define files but i've left them out)
I instatiante my parser at point of use like this
#include "KicadParser/SchematicFile/SchematicFileGrammar.hpp"
#include "KicadParser/SchematicFile/SchematicFileParserConfig.hpp"
auto const schParser =
// we pass our error handler to the parser so we can access
// it later on in our on_error and on_sucess handlers
boost::spirit::x3::with<client::KicadFileParser_grammar::error_handler_tag>(std::ref(error_handler))
[
client::schematicFile()
];
On Thu, 2 Mar 2017 at 19:29 Tom Kulaga <[email protected]> wrote:
> I've got an iterative rule set at home (at least if we're both thinking of
> iterative in the same sense, where rules compose up of other rules). I can
> send some snippets a little later.
>
> As for the testing suite I'll take a look at what I have and see if it
> helps.
>
> On Thu., 2 Mar. 2017, 6:07 pm Olaf Peter, <[email protected]> wrote:
>
> Hello Tom,
>
> > I've had success using the method used in the calc examples:
> >
> > https://github.com/boostorg/spirit/tree/develop/example/x3/calc/calc7
> >
> > Have a
> > String_literal.hpp
> > String_literal_def.hpp
> > String_literal.cpp
>
> yes, I use this approach. The problem rise if I want to test each
> production in a test suite. calc7 shows:
>
> namespace client {
> ...
> namespace calculator_grammar {
> struct expression_class;
> typedef x3::rule<expression_class, ast::expression>
> expression_type;
> BOOST_SPIRIT_DECLARE(expression_type);
> }
> calculator_grammar::expression_type expression();
> }
>
> and expose the top rule, but for testing parts of the grammar a lot of
> them are required.
>
> The other question may be behind: How to clever write iterativ the rule
> definitions to avoid drowning in compiler errors?
>
>
> ------------------------------------------------------------------------------
> 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
>
>
------------------------------------------------------------------------------
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