|
Boost : |
From: Joel de Guzman (djowel_at_[hidden])
Date: 2003-09-05 19:03:01
Hi Michael,
Please see the FAQ: "The lexeme_d directive and rules"
Thanks,
-- Joel de Guzman http://www.boost-consulting.com http://spirit.sf.net Michael Burbidge <mburbidg_at_[hidden]> wrote: > I have the following very simple grammar: > > struct expr_grammar : public grammar<expr_grammar> > { > template <typename ScannerT> > struct definition > { > definition(expr_grammar const& self) > { > variable_ref > = lexeme_d[ch_p('$') >> symbol] > ; > > symbol > = range_p('a', 'A') > ; > } > > rule<ScannerT> variable_ref, symbol; > > rule<ScannerT> const& start() const { return variable_ref; } > }; > }; > > and the following very simple function that uses this grammar: > > bool parse_expr(char* theExpr) > { > expr_grammar g; > bool result = parse(theExpr, g, space_p).full; > } > > This results in a compiler error because no function or template can be > found for parse. If I remove the lexeme_d directive from the > variable_ref rule then it compiles just fine. How did lexeme_d change > the type of the parameters to parse? How can I fix this so that I can > use lexeme_d to prevent accepting spaces between any of the characters > in variable_ref?
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk