Re: Hello, How to parse lists?
Mikael Asplund <[email protected]>
| Newsgroups | gmane.comp.parsers.spirit.general |
|---|---|
| Message-ID | <[email protected]> |
Hi Jens,
First, the list parser ("%") doesn't need the kleen star ("*") before it, since it parsers one or more entries into a list.
Second, the list parsers is "WHAT to parse, delimited by WHAT" ("entry % delimiter"), so change:
symbol_def_parameter =
(symbol_parameter >> symbol_alpha >> *(qi::char_(',') % symbol_alpha))
;
...into this (one or more entries in list):
symbol_def_parameter =
(symbol_parameter >> (symbol_alpha % qi::char_(',')))
;
... or, if you want ZERO or more entries in your list (notice the minus character that means optional):
symbol_def_parameter =
(symbol_parameter >> -(symbol_alpha % qi::char_(',')))
;
Regards,
Mikael
-----Original Message-----
From: Jens Kallup [mailto:[email protected]]
Sent: Saturday, October 29, 2016 13:11
To: Spirit General Mailing List <[email protected]>
Subject: [Spirit-general] Hello, How to parse lists?
Hello,
How to parse "parameter ccc , ccc, ggg, ddd" ? dynamical - not static!
I get success: "parameter ccc, vv vvv vvv", and this is wrong.
TIA for help
Jens
This rule, I use, is wrong:
symbol_def_parameter =
(symbol_parameter >> symbol_alpha >> *(qi::char_(',') % symbol_alpha))
;
symbol_alpha =
qi::char_("a-zA-Z_") >>
*qi::char_("a-zA-Z0-9_")
;
symbol_parameter = no_case["parameter"];
------------------------------------------------------------------------------
The Command Line: Reinvented for Modern Developers Did the resurgence of CLI tooling catch you by surprise?
Reconnect with the command line and become more productive.
Learn the new .NET and ASP.NET CLI. Get your free copy!
http://sdm.link/telerik
_______________________________________________
Spirit-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/spirit-general
------------------------------------------------------------------------------
The Command Line: Reinvented for Modern Developers
Did the resurgence of CLI tooling catch you by surprise?
Reconnect with the command line and become more productive.
Learn the new .NET and ASP.NET CLI. Get your free copy!
http://sdm.link/telerik