Hi,
First of all I would like to state that
spirit =
str_p("very") >> +ch_p(' ') >>( str_p("nice") | str_p("cool") |
str_p("greate") ) >> +ch_p(' ') >> str_p("parser")
;
So Thanks for that.
But I do face a problem. When assigning ID to nodes of the parse tree.
ex: rule, parser_tag<stringID> > String;
I've attached a sample to demonstrate the problem.
In short:
The grammar below does not produce a parse tree node with a 'stringID'
when the input is a single character 'a'. As soon as I have 2 or more
characters 'aa' then I get a node stringID.
definition(
ExpressionNoStringIDGrammar const& /*self*/)
{
Char =
ch_p('a')
;
String =
( +Char )
;
language =
String
;
}
rule, parser_tag<charID> > Char;
rule, parser_tag<stringID> > String;
rule<ScannerT> language;
BUT:
If I remove the 'Char' parser and substitute it with ch_p('a') then it
works fine , then I always get a node stringID even with a single input
char.
definition(
ExpressionNoStringIDGrammar const& /*self*/)
{
String =
( +ch_p('a') )
;
language =
String
;
}
rule, parser_tag<charID> > Char;
rule, parser_tag<stringID> > String;
rule<ScannerT> language;
Could anyone either explain me what is going on ?
- I'm I doing something wrong or is this a bug or works as designed ?
Thanks Again
Phil.