|
Boost : |
From: joel de guzman (isis-tech_at_[hidden])
Date: 2001-06-02 20:40:20
Hello Alexander,
I tried to send you email. I think it is better if
we deal with details through email so we don't
have to post through boost for issues pertaining
to usage. I'd rather we talk about implementation
and design issues in boost.
Anyway, since I couldn't get through you by
email (or maybe you haven't read my email ?),
here's a quick reply:
try:
Rule<> symbol = Lexeme[ doSymbol (+alnum) ];
because on the contrary, we *don't want* to skip
white spaces here. We want to work on the character
level. Without the Lexeme directive "o n e", for example,
will be valid.
I hope this helps,
Joel de Guzman
> --- In boost_at_y..., "joel de guzman" <isis-tech_at_m...> wrote:
> > From: "Alexander Hirner" :
> > > Action<Symbol> looks like this:
> > > void Process (const string &strSymbol, char const*
> > > end)
> > >
> > > everything compiled fine.
> > > but what would you think is strSymbol by passing
> > > 'one + 3 * 3'
> > > to the scanner/parser in Compile (/*...*/):
> > > one
> > > but it is
> > > one + 3 * 3
> > > , so the whole string?
> > > but
> > > 3 * 3 + one
> > > works contrary?! (strSymbol = "one")
> > >
> > > what am i doing wrong?
> > > thx in advance, ThaFacka
> >
> > OK now I got it. You are doing fine! Nothing wrong.
> > strSymbol points to the first char in the matched string.
> > what you should do is check out 'end'. this points to the
> > last char of the matched string. So the length of the
> > matched string is (end - strSymbol).
> >
> > Hope this helps,
> > Joel de Guzman
>
> I see, after changing my Process func decleration to:
> void Process (const char *str, const char *end)
> and creating strSymbol like that:
> string strSymbol (str, end);
> i get the right string, so:
>
> pi*one
> yields: doSym with "pi", doMult, doSym with "one"
> *but*, if i feed it with:
> pi * one + one, i get these tokens:
> symbol with "pi ", mult, symbol with "one ", add and symbol with "one"
>
> that means that trailing whitespaces are included in the passed
> string (iterator + end)!?
> why? i thought spaces are filterd with scanner (rule, space);
> it would be very nasty to erase them by hand, is this a bug or what?
> i also tried to define the symbol rule as:
> symbol = doSym( +(alnum - space) );
> which should further delete whitespaces in the parsed string, but
> no change...
>
> help appreciated,
> ThaFacka
>
> ps: i _really_ like spirit (and its syntax), stop whining because
> of use of some operators, at least this implementation is quite
> perfect, and every change will bring a disadvantage too...
> though im looking forward to further versions!
>
>
> To unsubscribe, send email to: <mailto:boost-unsubscribe_at_[hidden]>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk