Re: [lex][boost 1.44] 2 oddities
Zach Laine <[email protected]> Wed, 17 Nov 2010 15:12:13 -0600
| Newsgroups | gmane.comp.parsers.spirit.devel |
|---|---|
| Message-ID | <[email protected]> |
> That seems to be a cut&paste error. It's fixed in SVN (and I added a couple > of missing specializations while I was at it as well). Great! Thanks. >> Oddity #2: It seems that I have to define >> assign_to_attribute_from_iterators<> for new types, even if I define a >> semantic action that does the assignment. > > Yes, that's true. It's the only way the lexer could know how to convert a > certain input character sequence into your type. Or do I misunderstand > something? No, I was just making sure that *my* understanding of that was correct. >> This further means that any >> semantic action [_val = ...] is useless, because the conversion will >> happen later and overwrite the token's value anyway, right? > > Hmmm, I think these two things are unrelated. The conversion from the input > iterators to your type is one thing, while the assignment inside the > semantic action is another one. Could you elaborate why you believe the > semantic action to be useless? To me, the fact that they are unrelated leads to some slightly wonky behavior. For instance if I: (1) define an assignment to the token value in a semantic action, (2) I still have to specialize assign_to_attribute_from_iterators<>, which is fine, except that (3) my specialization of assign_to_attribute_from_iterators<> gets invoked at parse-time, overwriting the assignment I did at lex-time (1). Am I misunderstanding how it works? That was the behavior I saw, if I'm not mistaken. Zach ------------------------------------------------------------------------------ Beautiful is writing same markup. Internet Explorer 9 supports standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3. Spend less time writing and rewriting code and more time creating great experiences on the web. Be a part of the beta today http://p.sf.net/sfu/msIE9-sfdev2dev