Re: Hello, How to parse lists?
Jens Kallup <[email protected]>
| Newsgroups | gmane.comp.parsers.spirit.general |
|---|---|
| Message-ID | <[email protected]> |
Hello Seth, thank You!!! This is exactly what i want: symbol_parameter = lexeme[no_case["parameter"]]; symbol_def_parameter = (symbol_parameter >> (symbol_alpha % ',') >> (qi::eoi | qi::eol)); Thank You very much, You made my day! cheers Jens On 10/31/2016 09:15 AM, Seth wrote: > Now you wish for the last one to "fail"? I presume that might be > because end of input has not been reached. You can either check that > the end iterator is reached, or add `>> qi::eoi` to ensure that EOI > (end-of-input) was reached: > > parameter = qi::lexeme["parameter"] >> (ident % ',') >> qi::eoi; > > Then the output becomes > <http://coliru.stacked-crooked.com/a/95c7f4a181ff0713>: > > ===== input 'parameter fff' > > Ok: 1 > > Ident: fff > > ===== input 'parameter fff , ccc' > > Ok: 2 > > Ident: fff > > Ident: ccc > > ===== input 'parameter fff, ccc ddd ddd dd dd' > > Fail > > Remaining unparsed: 'parameter fff, ccc ddd ddd dd dd'... > ------------------------------------------------------------------------------ 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