<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<id>tag:old.nabble.com,2006:forum-3430</id>
	<title>Nabble - The Spirit Parser Library</title>
	<updated>2009-12-20T16:28:09Z</updated>
	<link rel="self" type="application/atom+xml" href="http://old.nabble.com/The-Spirit-Parser-Library-f3430.xml" />
	<link rel="alternate" type="text/html" href="http://old.nabble.com/The-Spirit-Parser-Library-f3430.html" />
	<subtitle type="html">Spirit is an object oriented recursive descent parser generator framework implemented using template meta-programming techniques.  The Spirit Parser Library home is &lt;a href=&quot;http://sourceforge.net/projects/spirit/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.</subtitle>
	
<entry>
	<id>tag:old.nabble.com,2006:post-26868661</id>
	<title>Re: permutation with all elements required</title>
	<published>2009-12-20T16:28:09Z</published>
	<updated>2009-12-20T16:28:09Z</updated>
	<author>
		<name>Kenny Riddile</name>
	</author>
	<content type="html">&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot;&gt;&lt;tr&gt;&lt;td valign=&quot;top&quot; style=&quot;font: inherit;&quot;&gt;--- On &lt;b&gt;Fri, 12/18/09, Joel de Guzman &lt;i&gt;&amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26868661&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;joel@...&lt;/a&gt;&amp;gt;&lt;/i&gt;&lt;/b&gt; wrote:&lt;br&gt;&lt;blockquote style=&quot;border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;&quot;&gt;&lt;br&gt;From: Joel de Guzman &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26868661&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;joel@...&lt;/a&gt;&amp;gt;&lt;br&gt;Subject: Re: [Spirit-general] permutation with all elements required&lt;br&gt;To: &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26868661&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;spirit-general@...&lt;/a&gt;&lt;br&gt;Date: Friday, December 18, 2009, 10:02 PM&lt;br&gt;&lt;br&gt;&lt;div class=&quot;plainMail&quot;&gt;Carl Barron wrote:&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; On Dec 18, 2009, at 8:25 PM, Joel de Guzman wrote:&lt;br&gt;&amp;gt; &lt;br&gt;&amp;gt;&amp;gt; Carl Barron wrote:&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; On Dec 18, 2009, at 7:13 PM, Joel de Guzman wrote:&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; The attribute of the permutation operator given a rule&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;nbsp; &amp;nbsp; a ^ b ^ c&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; is&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;nbsp; &amp;nbsp;
 vector&amp;lt;optional&amp;lt;A&amp;gt;, optional&amp;lt;B&amp;gt;, optional&amp;lt;C&amp;gt; &amp;gt;&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; After a successful match, you just check that all optionals&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; for A, B and C are initialized (see Boost Optional).&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;vwctor&amp;lt; ...&amp;gt;&amp;nbsp; or tuple&amp;lt;...&amp;gt; ?&lt;br&gt;&amp;gt;&amp;gt; Sorry, yeah, tuple. I'm just used to fusion::vector.&lt;br&gt;&amp;gt; &lt;br&gt;&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;Then phoenix and fusion make this fairly easy for an an arbitrary # of op ^()'s in sequence&lt;br&gt;&amp;gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;a1 ^ a2 ^ .... ^a_n, with one phoenix function for any n.&lt;br&gt;&amp;gt; &lt;br&gt;&amp;gt;&amp;nbsp; &amp;nbsp; use fusion::find_if&amp;nbsp; to test for any optional containing 'nothing' and compare the result to&lt;br&gt;&amp;gt;&amp;nbsp; &amp;nbsp; fusion::end. in a phoenix function.&lt;br&gt;&amp;gt; &lt;br&gt;&amp;gt;&amp;nbsp; &amp;nbsp; Something like:&lt;br&gt;&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br&gt;&amp;gt;&amp;nbsp; &amp;nbsp; class no_empties_impl&lt;br&gt;&amp;gt;&amp;nbsp; &amp;nbsp; {&lt;br&gt;&amp;gt;&amp;nbsp;
 &amp;nbsp; &amp;nbsp; &amp;nbsp; struct&amp;nbsp; optional_empty&lt;br&gt;&amp;gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br&gt;&amp;gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; template &amp;lt;class A&amp;gt;&lt;br&gt;&amp;gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; bool operator () (const A &amp;amp;a) const&lt;br&gt;&amp;gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br&gt;&amp;gt; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;// return true if a is 'empty'.&lt;br&gt;&amp;gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return !a;&lt;br&gt;&amp;gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br&gt;&amp;gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; };&lt;br&gt;&amp;gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;public:&lt;br&gt;&amp;gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; template &amp;lt;class A&amp;gt;&lt;br&gt;&amp;gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; struct result {typedef bool type;};&lt;br&gt;&amp;gt;&amp;nbsp; &lt;br&gt;&amp;gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; template &amp;lt;class A&amp;gt;&lt;br&gt;&amp;gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; bool operator () (const A &amp;amp;a) const&lt;br&gt;&amp;gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br&gt;&amp;gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;
 &amp;nbsp;&amp;nbsp;&amp;nbsp;// look for an empty optional, if any return false else true.&lt;br&gt;&amp;gt; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;return boost::fusion::find_if&amp;lt;optional_empty&amp;gt;(a) == boost::fusion::end(a);&lt;br&gt;&amp;gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br&gt;&amp;gt;&amp;nbsp; &amp;nbsp; };&lt;br&gt;&amp;gt; &lt;br&gt;&amp;gt; Looks like an general implimentation of no_empties&lt;br&gt;&amp;gt; &lt;br&gt;&amp;gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;foo&amp;nbsp; %=&amp;nbsp;&amp;nbsp;&amp;nbsp;a1 ^... ^a_n&amp;nbsp;&amp;nbsp;&amp;nbsp;[_pass = no_empties(qi::_0)];&amp;nbsp; // or is it _1??&amp;nbsp; the fusion seq,&lt;br&gt;&amp;gt; &lt;br&gt;&amp;gt; should provide result for any n.&amp;nbsp;&amp;nbsp;&amp;nbsp;permutation of n parsers n at a time.&lt;/div&gt;&lt;br&gt;Use fusion::all instead of find_if: &lt;a href=&quot;http://tinyurl.com/yzm94gc&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;http://tinyurl.com/yzm94gc&lt;/a&gt;&lt;br&gt;&lt;br&gt;Regards,&lt;br&gt;-- &lt;br&gt;Joel de Guzman&lt;br&gt;&lt;a href=&quot;http://www.boostpro.com&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;http://www.boostpro.com&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;http://spirit.sf.net&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;http://spirit.sf.net&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;http://www.facebook.com/djowel&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;http://www.facebook.com/djowel&lt;/a&gt;&lt;br&gt;&lt;br&gt;Meet me at BoostCon&lt;br&gt;&lt;a href=&quot;http://www.boostcon.com/home&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;http://www.boostcon.com/home&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;http://www.facebook.com/boostcon&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;http://www.facebook.com/boostcon&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;------------------------------------------------------------------------------&lt;br&gt;This SF.Net email is sponsored by the Verizon Developer Community&lt;br&gt;Take advantage of Verizon's best-in-class app development support&lt;br&gt;A streamlined, 14 day to market process makes app distribution fast and easy&lt;br&gt;Join now and get one step closer to millions of Verizon customers&lt;br&gt;&lt;a href=&quot;http://p.sf.net/sfu/verizon-dev2dev&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;http://p.sf.net/sfu/verizon-dev2dev&lt;/a&gt; &lt;br&gt;_______________________________________________&lt;br&gt;Spirit-general mailing list&lt;br&gt;&lt;a ymailto=&quot;mailto:Spirit-general@lists.sourceforge.net&quot; href=&quot;/mc/compose?to=Spirit-general@lists.sourceforge.net&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Spirit-general@...&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;https://lists.sourceforge.net/lists/listinfo/spirit-general&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;https://lists.sourceforge.net/lists/listinfo/spirit-general&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;plainMail&quot;&gt;&lt;br&gt;&lt;/div&gt;&lt;/blockquote&gt;I'm getting a compile error when attempting something similar to this. &amp;nbsp;Here's my code:&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;namespace detail&lt;/div&gt;&lt;div&gt;{&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;class RequireAllImpl&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;{&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;private:&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;struct IsOptionalPopulated&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;template&amp;lt; typename T &amp;gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;bool operator()( const T&amp;amp; t ) const&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp;
 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return t;&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;};&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;public:&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;template&amp;lt; typename T &amp;gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;struct result&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;typedef bool type;&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;};&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;template&amp;lt; typename T &amp;gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;bool operator()( const T&amp;amp; t ) const&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return boost::fusion::all( t, IsOptionalPopulated() ); // no error if I return a constant
 here&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;};&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;} // end namespace detail&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;template&amp;lt; typename T &amp;gt;&lt;/div&gt;&lt;div&gt;bool RequireAll( const T&amp;amp; t )&lt;/div&gt;&lt;div&gt;{&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;return detail::RequireAllImpl()( t );&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;I call this like so:&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;foo %= (a ^ b ^ c)[_pass = RequireAll(_0)];&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;and get this error from boost/fusion/support/detail/category_of.hpp:&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;error C2039: 'category' : is not a member of 'boost::phoenix::actor&amp;lt;Eval&amp;gt;'&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;Am I missing an include?&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;------------------------------------------------------------------------------
&lt;br&gt;This SF.Net email is sponsored by the Verizon Developer Community
&lt;br&gt;Take advantage of Verizon's best-in-class app development support
&lt;br&gt;A streamlined, 14 day to market process makes app distribution fast and easy
&lt;br&gt;Join now and get one step closer to millions of Verizon customers
&lt;br&gt;&lt;a href=&quot;http://p.sf.net/sfu/verizon-dev2dev&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://p.sf.net/sfu/verizon-dev2dev&lt;/a&gt;&amp;nbsp;&lt;br /&gt;_______________________________________________
&lt;br&gt;Spirit-general mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26868661&amp;i=3&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Spirit-general@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://lists.sourceforge.net/lists/listinfo/spirit-general&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://lists.sourceforge.net/lists/listinfo/spirit-general&lt;/a&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/spirit-general-f3432.html&quot; embed=&quot;fixTarget[3432]&quot; target=&quot;_top&quot; &gt;spirit-general&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/permutation-with-all-elements-required-tp26846102p26868661.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26867902</id>
	<title>inputs of models with ranges of values, parsing from text file input streams</title>
	<published>2009-12-20T14:38:14Z</published>
	<updated>2009-12-20T14:38:14Z</updated>
	<author>
		<name>hm567</name>
	</author>
	<content type="html">Hello,

My need is relatively simple and I am not sure I required the full power of spirit to achieve my target.
&lt;br&gt;
However let me pose the simple issue here:&lt;br&gt;

I have models that take inputs that are of boolean/arithmetic types and produce outputs.&lt;br&gt;
All models have a base class, and each model inputs is a class that derives from model_inputs abstract base class.&lt;br&gt;

The inputs for these models can be a set of fixed values (bool or arithmetic) or the same set but of ranges of values. The problem is simple in that if a model required 7 inputs, it requires all of them, but any number between 0 and 7 inputs can be a range of values.&lt;br&gt;

Typically, I wish to be able to write once&lt;br&gt;

&lt;b&gt;struct model1_inputs_fixed {&lt;br&gt;
     double i1;&lt;br&gt;
     double i2;&lt;br&gt;
     int i3;&lt;br&gt;
     static const size_t number_inputs = 3;&lt;br&gt;
};&lt;/b&gt;&lt;br&gt;

and have some mechanism to generate some other struct, that would embed members and flags.&lt;br&gt;
These flags tell whether the object holds a fixed value for some input, or a range of values.&lt;br&gt;
An example may be:&lt;br&gt;

&lt;b&gt;// fixed or range inputs&lt;br&gt;
struct model1_inputs : public model_inputs {&lt;br&gt;
     bool isi1fixed; double i1f; std::pair&lt;double, double&gt; i1r;&lt;br&gt;
     bool isi2fixed; double i2f; std::pair&lt;double, double&gt; i2r;&lt;br&gt;
     bool isi3fixed; double i3f; std::pair&lt;double, double&gt; i3r;&lt;br&gt;
};&lt;/b&gt;&lt;br&gt;

There might be up to 100 different model_inputs classes, so memory layout and runtime performance are not essential in this part of the code, rather clarity and convenience are at a premium&lt;br&gt;

The next step is to be able to I/O these types from text files like:&lt;br&gt;
&lt;br&gt;
i1 = 5&lt;br&gt;
i2 = 14..16&lt;br&gt;
i3 = 0&lt;br&gt;

If an input is missing, repeated or invalid, the inputting function should throw an exception.&lt;br&gt;
The order of the inputs shouldn't matter.&lt;br&gt;

At this stage, I don't see that my models may require more evolved, but if there is a solution that would allow better to accept more complex inputs, it may be worth for me spending the time to learn it.&lt;br&gt;
&lt;br&gt;
Is spirit a reasonable tool for what I think is a simple task?&lt;br&gt;
&lt;br&gt;
I see other libraries that may provide the parsing part (program_options, property_tree) but not the compile-time generation of the model1_inputs and the compile_time parsing from text file of these types.&lt;br&gt;

I will follow the post at http://lists.boost.org/boost-users/2009/12/54770.php as a start, that seems to do what I want, except for the range functionality.&lt;br&gt;  Is the &quot;..&quot; convention reasonable?&lt;br&gt;
&lt;br&gt;
Regards,&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/spirit-general-f3432.html&quot; embed=&quot;fixTarget[3432]&quot; target=&quot;_top&quot; &gt;spirit-general&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/inputs-of-models-with-ranges-of-values%2C-parsing-from-text-file-input-streams-tp26867902p26867902.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26861064</id>
	<title>Re: Lex &amp; Qi question</title>
	<published>2009-12-19T21:01:00Z</published>
	<updated>2009-12-19T21:01:00Z</updated>
	<author>
		<name>CARL BARRON-3</name>
	</author>
	<content type="html">&lt;br&gt;On Dec 19, 2009, at 11:12 PM, Jason McKesson wrote:
&lt;br&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; On 12/19/2009 5:35 PM, Carl Barron wrote:
&lt;br&gt;&amp;gt;&amp;gt; On Dec 19, 2009, at 3:27 PM, Jason McKesson wrote:
&lt;br&gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; I'm trying to write a simple expression parser as the first steps
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; towards something bigger. And I'd like to be able to use Lex to break
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; the input up into tokens. My problem is that combining the two seems to
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; be constraining on the utility of Qi.
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; Here's what I mean. Let's say I have a lexer that looks something like this:
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; template&amp;lt;typename &amp;nbsp;Lexer&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; struct &amp;nbsp;math_tokens &amp;nbsp;: &amp;nbsp;lex::lexer&amp;lt;Lexer&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; {
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; math_tokens()
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; {
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; this-&amp;gt;self.add
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; (&amp;quot;\\+&amp;quot;, &amp;nbsp;ID_PLUS)
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; (&amp;quot;\d+f?&amp;quot;, &amp;nbsp;ID_FLOAT)
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; (&amp;quot;\d*.\d+f?&amp;quot;, &amp;nbsp;ID_FLOAT)
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; (&amp;quot;\d+&amp;quot;, &amp;nbsp;ID_INTEGER)
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; };
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; A parser for this would look something like this:
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; template&amp;lt;typename &amp;nbsp;Iterator&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; struct &amp;nbsp;math_grammar &amp;nbsp;: &amp;nbsp;qi::grammar&amp;lt;Iterator&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; {
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; template&amp;lt;typename &amp;nbsp;TokenDef&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; math_grammar(TokenDef &amp;nbsp;const&amp; &amp;nbsp; tok)
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; : &amp;nbsp;math_grammar::base_type(start)
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; {
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; terminals = qi::token&amp;lt;ID_FLOAT&amp;gt; &amp;nbsp; | qi::token&amp;lt;ID_INTEGER&amp;gt;;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; start &amp;nbsp;= &amp;nbsp; terminals&amp;gt;&amp;gt; &amp;nbsp; qi::token&amp;lt;ID_PLUS&amp;gt; &amp;nbsp; &amp;gt;&amp;gt; &amp;nbsp; terminals;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; qi::rule&amp;lt;Iterator&amp;gt; &amp;nbsp; start;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; qi::rule&amp;lt;Iterator&amp;gt; &amp;nbsp; terminals;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; };
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; I haven't tested this specific code, but you have the general idea of
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; the pattern I'm interested in.
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; The problem is this. If I were to build this purely without lex, the
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; grammar would look something like this:
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; template&amp;lt;typename &amp;nbsp;Iterator&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; struct &amp;nbsp;math_qi_grammar &amp;nbsp;: &amp;nbsp;qi::grammar&amp;lt;Iterator&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; {
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; math_qi_grammar()
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; : &amp;nbsp;math_grammar::base_type(start)
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; {
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; terminals = integer_ | double_;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; start &amp;nbsp;= &amp;nbsp; terminals&amp;gt;&amp;gt; &amp;nbsp; '+'&amp;gt;&amp;gt; &amp;nbsp; terminals;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; qi::rule&amp;lt;Iterator&amp;gt; &amp;nbsp; start;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; qi::rule&amp;lt;Iterator&amp;gt; &amp;nbsp; terminals;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; };
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; The difference is this. If I put a semantic action on 'integer_', the
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; action gets the synthesized attribute value as a parameter. This
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; attribute is an integer. If I put a semantic action on
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; 'qi::token&amp;lt;ID_INTEGER&amp;gt;', the synthesized attribute is a string. This is
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; not as useful as getting an integer, as I now must find a way to convert
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; this string into an integer.
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; Is there some way to combine Lex and Qi that still provides useful
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; synthesized attribute behavior of Qi? Is there something I can wrap the
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;quot;qi::token&amp;lt;ID_INTEGER&amp;gt;&amp;quot; parser in that will provide a properly
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; synthesized attribute?
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;Spirit::lex is desigmed to be used with spirit::qi. a token_def&amp;lt;X&amp;gt; &amp;nbsp;holds a boost::variant&amp;lt; &amp;nbsp;boost::interator_range&amp;lt;SourceIteratorType&amp;gt;, X&amp;gt;. &amp;nbsp;the attribute of a token_def&amp;lt;X&amp;gt; &amp;nbsp;is X. &amp;nbsp;The conversion from an iterator range to X occurs when the token is parsed successfully.
&lt;br&gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp;Use naned token defs like
&lt;br&gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;math_tokens()
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;{
&lt;br&gt;&amp;gt;&amp;gt; 	plus = '+';	// plus is a literal +.
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; integer = ...; &amp;nbsp; // integer
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; real = ...; &amp;nbsp; &amp;nbsp; &amp;nbsp;// real number;
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;// now integer must be added to self before real so a real is a real that is not an integer.
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; this-&amp;gt;self = &amp;nbsp;plus | integer | real;
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;}
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;lex::token_def&amp;lt;&amp;gt; &amp;nbsp;plus;
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;lex::token,def&amp;lt;int&amp;gt; &amp;nbsp;integer;
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;lex::token_def&amp;lt;double&amp;gt; &amp;nbsp;real;
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp;};
&lt;br&gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp;now in your qi::grammar you refer to the tokens by name they will be converted to their attribute
&lt;br&gt;&amp;gt;&amp;gt; values when qi first successes in matching the token.
&lt;br&gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; start = terminals&amp;gt;&amp;gt; &amp;nbsp;tok.plus&amp;gt;&amp;gt; &amp;nbsp;terminals; &amp;nbsp;// EA tuple&amp;lt;variant,variant&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; terminals = &amp;nbsp;tok.integer | tok.real; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // EA variant&amp;lt;int,double&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;Does this make any sense?
&lt;br&gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; Yes it does. Thanks.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; Obviously, there's some code somewhere that converts the iterator range 
&lt;br&gt;&amp;gt; into the token_def's type. Can you hook something into this to do 
&lt;br&gt;&amp;gt; specialized processing for generating an arbitrary attribute?
&lt;/div&gt;&amp;nbsp; Yes &amp;nbsp;via &amp;nbsp; assign_to_attribute_from_iterator specialization in boost::spirit::traits.
&lt;br&gt;&lt;br&gt;&amp;nbsp; The parser api in token_def&amp;lt;X&amp;gt; calls a spirit function assign_to which uses the hook
&lt;br&gt;&amp;nbsp;assign_to_attribute_from_iterators to do the actual assignment. &amp;nbsp;See the advanced section
&lt;br&gt;on customization points for details on customization points [ often denoted CP on this list]
&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;------------------------------------------------------------------------------
&lt;br&gt;This SF.Net email is sponsored by the Verizon Developer Community
&lt;br&gt;Take advantage of Verizon's best-in-class app development support
&lt;br&gt;A streamlined, 14 day to market process makes app distribution fast and easy
&lt;br&gt;Join now and get one step closer to millions of Verizon customers
&lt;br&gt;&lt;a href=&quot;http://p.sf.net/sfu/verizon-dev2dev&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://p.sf.net/sfu/verizon-dev2dev&lt;/a&gt;&amp;nbsp;
&lt;br&gt;_______________________________________________
&lt;br&gt;Spirit-general mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26861064&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Spirit-general@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://lists.sourceforge.net/lists/listinfo/spirit-general&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://lists.sourceforge.net/lists/listinfo/spirit-general&lt;/a&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/spirit-general-f3432.html&quot; embed=&quot;fixTarget[3432]&quot; target=&quot;_top&quot; &gt;spirit-general&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Lex---Qi-question-tp26858265p26861064.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26860894</id>
	<title>Re: Lex &amp; Qi question</title>
	<published>2009-12-19T20:12:51Z</published>
	<updated>2009-12-19T20:12:51Z</updated>
	<author>
		<name>Jason McKesson</name>
	</author>
	<content type="html">On 12/19/2009 5:35 PM, Carl Barron wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; On Dec 19, 2009, at 3:27 PM, Jason McKesson wrote:
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;
&lt;br&gt;&amp;gt;&amp;gt; I'm trying to write a simple expression parser as the first steps
&lt;br&gt;&amp;gt;&amp;gt; towards something bigger. And I'd like to be able to use Lex to break
&lt;br&gt;&amp;gt;&amp;gt; the input up into tokens. My problem is that combining the two seems to
&lt;br&gt;&amp;gt;&amp;gt; be constraining on the utility of Qi.
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; Here's what I mean. Let's say I have a lexer that looks something like this:
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; template&amp;lt;typename &amp;nbsp;Lexer&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; struct &amp;nbsp;math_tokens &amp;nbsp;: &amp;nbsp;lex::lexer&amp;lt;Lexer&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; {
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;math_tokens()
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;{
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;this-&amp;gt;self.add
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;(&amp;quot;\\+&amp;quot;, &amp;nbsp;ID_PLUS)
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;(&amp;quot;\d+f?&amp;quot;, &amp;nbsp;ID_FLOAT)
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;(&amp;quot;\d*.\d+f?&amp;quot;, &amp;nbsp;ID_FLOAT)
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;(&amp;quot;\d+&amp;quot;, &amp;nbsp;ID_INTEGER)
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;;
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;}
&lt;br&gt;&amp;gt;&amp;gt; };
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; A parser for this would look something like this:
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; template&amp;lt;typename &amp;nbsp;Iterator&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; struct &amp;nbsp;math_grammar &amp;nbsp;: &amp;nbsp;qi::grammar&amp;lt;Iterator&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; {
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;template&amp;lt;typename &amp;nbsp;TokenDef&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;math_grammar(TokenDef &amp;nbsp;const&amp; &amp;nbsp; tok)
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;: &amp;nbsp;math_grammar::base_type(start)
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;{
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;terminals = qi::token&amp;lt;ID_FLOAT&amp;gt; &amp;nbsp; | qi::token&amp;lt;ID_INTEGER&amp;gt;;
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;start &amp;nbsp;= &amp;nbsp; terminals&amp;gt;&amp;gt; &amp;nbsp; qi::token&amp;lt;ID_PLUS&amp;gt; &amp;nbsp; &amp;gt;&amp;gt; &amp;nbsp; terminals;
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;}
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;qi::rule&amp;lt;Iterator&amp;gt; &amp;nbsp; start;
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;qi::rule&amp;lt;Iterator&amp;gt; &amp;nbsp; terminals;
&lt;br&gt;&amp;gt;&amp;gt; };
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; I haven't tested this specific code, but you have the general idea of
&lt;br&gt;&amp;gt;&amp;gt; the pattern I'm interested in.
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; The problem is this. If I were to build this purely without lex, the
&lt;br&gt;&amp;gt;&amp;gt; grammar would look something like this:
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; template&amp;lt;typename &amp;nbsp;Iterator&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; struct &amp;nbsp;math_qi_grammar &amp;nbsp;: &amp;nbsp;qi::grammar&amp;lt;Iterator&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; {
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;math_qi_grammar()
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;: &amp;nbsp;math_grammar::base_type(start)
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;{
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;terminals = integer_ | double_;
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;start &amp;nbsp;= &amp;nbsp; terminals&amp;gt;&amp;gt; &amp;nbsp; '+'&amp;gt;&amp;gt; &amp;nbsp; terminals;
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;}
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;qi::rule&amp;lt;Iterator&amp;gt; &amp;nbsp; start;
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;qi::rule&amp;lt;Iterator&amp;gt; &amp;nbsp; terminals;
&lt;br&gt;&amp;gt;&amp;gt; };
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; The difference is this. If I put a semantic action on 'integer_', the
&lt;br&gt;&amp;gt;&amp;gt; action gets the synthesized attribute value as a parameter. This
&lt;br&gt;&amp;gt;&amp;gt; attribute is an integer. If I put a semantic action on
&lt;br&gt;&amp;gt;&amp;gt; 'qi::token&amp;lt;ID_INTEGER&amp;gt;', the synthesized attribute is a string. This is
&lt;br&gt;&amp;gt;&amp;gt; not as useful as getting an integer, as I now must find a way to convert
&lt;br&gt;&amp;gt;&amp;gt; this string into an integer.
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; Is there some way to combine Lex and Qi that still provides useful
&lt;br&gt;&amp;gt;&amp;gt; synthesized attribute behavior of Qi? Is there something I can wrap the
&lt;br&gt;&amp;gt;&amp;gt; &amp;quot;qi::token&amp;lt;ID_INTEGER&amp;gt;&amp;quot; parser in that will provide a properly
&lt;br&gt;&amp;gt;&amp;gt; synthesized attribute?
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; Spirit::lex is desigmed to be used with spirit::qi. a token_def&amp;lt;X&amp;gt; &amp;nbsp;holds a boost::variant&amp;lt; &amp;nbsp;boost::interator_range&amp;lt;SourceIteratorType&amp;gt;, X&amp;gt;. &amp;nbsp;the attribute of a token_def&amp;lt;X&amp;gt; &amp;nbsp;is X. &amp;nbsp;The conversion from an iterator range to X occurs when the token is parsed successfully.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; Use naned token defs like
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; math_tokens()
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; {
&lt;br&gt;&amp;gt; 	plus = '+';	// plus is a literal +.
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;integer = ...; &amp;nbsp; // integer
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;real = ...; &amp;nbsp; &amp;nbsp; &amp;nbsp;// real number;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; // now integer must be added to self before real so a real is a real that is not an integer.
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;this-&amp;gt;self = &amp;nbsp;plus | integer | real;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; lex::token_def&amp;lt;&amp;gt; &amp;nbsp;plus;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; lex::token,def&amp;lt;int&amp;gt; &amp;nbsp;integer;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; lex::token_def&amp;lt;double&amp;gt; &amp;nbsp;real;
&lt;br&gt;&amp;gt; &amp;nbsp; };
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; now in your qi::grammar you refer to the tokens by name they will be converted to their attribute
&lt;br&gt;&amp;gt; values when qi first successes in matching the token.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;start = terminals&amp;gt;&amp;gt; &amp;nbsp;tok.plus&amp;gt;&amp;gt; &amp;nbsp;terminals; &amp;nbsp;// EA tuple&amp;lt;variant,variant&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;terminals = &amp;nbsp;tok.integer | tok.real; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // EA variant&amp;lt;int,double&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; Does this make any sense?
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;
&lt;/div&gt;&lt;br&gt;Yes it does. Thanks.
&lt;br&gt;&lt;br&gt;Obviously, there's some code somewhere that converts the iterator range 
&lt;br&gt;into the token_def's type. Can you hook something into this to do 
&lt;br&gt;specialized processing for generating an arbitrary attribute?
&lt;br&gt;&lt;br&gt;------------------------------------------------------------------------------
&lt;br&gt;This SF.Net email is sponsored by the Verizon Developer Community
&lt;br&gt;Take advantage of Verizon's best-in-class app development support
&lt;br&gt;A streamlined, 14 day to market process makes app distribution fast and easy
&lt;br&gt;Join now and get one step closer to millions of Verizon customers
&lt;br&gt;&lt;a href=&quot;http://p.sf.net/sfu/verizon-dev2dev&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://p.sf.net/sfu/verizon-dev2dev&lt;/a&gt;&amp;nbsp;
&lt;br&gt;_______________________________________________
&lt;br&gt;Spirit-general mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26860894&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Spirit-general@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://lists.sourceforge.net/lists/listinfo/spirit-general&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://lists.sourceforge.net/lists/listinfo/spirit-general&lt;/a&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/spirit-general-f3432.html&quot; embed=&quot;fixTarget[3432]&quot; target=&quot;_top&quot; &gt;spirit-general&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Lex---Qi-question-tp26858265p26860894.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26860682</id>
	<title>Re: Lex &amp; Qi question</title>
	<published>2009-12-19T17:35:08Z</published>
	<updated>2009-12-19T17:35:08Z</updated>
	<author>
		<name>CARL BARRON-3</name>
	</author>
	<content type="html">&lt;br&gt;On Dec 19, 2009, at 3:27 PM, Jason McKesson wrote:
&lt;br&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; I'm trying to write a simple expression parser as the first steps 
&lt;br&gt;&amp;gt; towards something bigger. And I'd like to be able to use Lex to break 
&lt;br&gt;&amp;gt; the input up into tokens. My problem is that combining the two seems to 
&lt;br&gt;&amp;gt; be constraining on the utility of Qi.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; Here's what I mean. Let's say I have a lexer that looks something like this:
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; template &amp;nbsp;&amp;lt;typename &amp;nbsp;Lexer&amp;gt;
&lt;br&gt;&amp;gt; struct &amp;nbsp;math_tokens &amp;nbsp;: &amp;nbsp;lex::lexer&amp;lt;Lexer&amp;gt;
&lt;br&gt;&amp;gt; {
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; math_tokens()
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; {
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; this-&amp;gt;self.add
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; (&amp;quot;\\+&amp;quot;, &amp;nbsp;ID_PLUS)
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; (&amp;quot;\d+f?&amp;quot;, &amp;nbsp;ID_FLOAT)
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; (&amp;quot;\d*.\d+f?&amp;quot;, &amp;nbsp;ID_FLOAT)
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; (&amp;quot;\d+&amp;quot;, &amp;nbsp;ID_INTEGER)
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&amp;gt; };
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; A parser for this would look something like this:
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; template &amp;nbsp;&amp;lt;typename &amp;nbsp;Iterator&amp;gt;
&lt;br&gt;&amp;gt; struct &amp;nbsp;math_grammar &amp;nbsp;: &amp;nbsp;qi::grammar&amp;lt;Iterator&amp;gt;
&lt;br&gt;&amp;gt; {
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; template &amp;nbsp;&amp;lt;typename &amp;nbsp;TokenDef&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; math_grammar(TokenDef &amp;nbsp;const&amp; &amp;nbsp;tok)
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; : &amp;nbsp;math_grammar::base_type(start)
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; {
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; terminals = qi::token&amp;lt;ID_FLOAT&amp;gt; &amp;nbsp;| qi::token&amp;lt;ID_INTEGER&amp;gt;;
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; start &amp;nbsp;= &amp;nbsp; terminals&amp;gt;&amp;gt; &amp;nbsp;qi::token&amp;lt;ID_PLUS&amp;gt; &amp;nbsp;&amp;gt;&amp;gt; &amp;nbsp;terminals;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; qi::rule&amp;lt;Iterator&amp;gt; &amp;nbsp;start;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; qi::rule&amp;lt;Iterator&amp;gt; &amp;nbsp;terminals;
&lt;br&gt;&amp;gt; };
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; I haven't tested this specific code, but you have the general idea of 
&lt;br&gt;&amp;gt; the pattern I'm interested in.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; The problem is this. If I were to build this purely without lex, the 
&lt;br&gt;&amp;gt; grammar would look something like this:
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; template &amp;nbsp;&amp;lt;typename &amp;nbsp;Iterator&amp;gt;
&lt;br&gt;&amp;gt; struct &amp;nbsp;math_qi_grammar &amp;nbsp;: &amp;nbsp;qi::grammar&amp;lt;Iterator&amp;gt;
&lt;br&gt;&amp;gt; {
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; math_qi_grammar()
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; : &amp;nbsp;math_grammar::base_type(start)
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; {
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; terminals = integer_ | double_;
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; start &amp;nbsp;= &amp;nbsp; terminals&amp;gt;&amp;gt; &amp;nbsp;'+'&amp;gt;&amp;gt; &amp;nbsp;terminals;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; qi::rule&amp;lt;Iterator&amp;gt; &amp;nbsp;start;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; qi::rule&amp;lt;Iterator&amp;gt; &amp;nbsp;terminals;
&lt;br&gt;&amp;gt; };
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; The difference is this. If I put a semantic action on 'integer_', the 
&lt;br&gt;&amp;gt; action gets the synthesized attribute value as a parameter. This 
&lt;br&gt;&amp;gt; attribute is an integer. If I put a semantic action on 
&lt;br&gt;&amp;gt; 'qi::token&amp;lt;ID_INTEGER&amp;gt;', the synthesized attribute is a string. This is 
&lt;br&gt;&amp;gt; not as useful as getting an integer, as I now must find a way to convert 
&lt;br&gt;&amp;gt; this string into an integer.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; Is there some way to combine Lex and Qi that still provides useful 
&lt;br&gt;&amp;gt; synthesized attribute behavior of Qi? Is there something I can wrap the 
&lt;br&gt;&amp;gt; &amp;quot;qi::token&amp;lt;ID_INTEGER&amp;gt;&amp;quot; parser in that will provide a properly 
&lt;br&gt;&amp;gt; synthesized attribute?
&lt;/div&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp;Spirit::lex is desigmed to be used with spirit::qi. a token_def&amp;lt;X&amp;gt; holds a boost::variant&amp;lt; boost::interator_range&amp;lt;SourceIteratorType&amp;gt;, X&amp;gt;. &amp;nbsp;the attribute of a token_def&amp;lt;X&amp;gt; is X. &amp;nbsp;The conversion from an iterator range to X occurs when the token is parsed successfully. 
&lt;br&gt;&lt;br&gt;&amp;nbsp;Use naned token defs like
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp;math_tokens()
&lt;br&gt;&amp;nbsp; &amp;nbsp;{
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; plus = '+';	// plus is a literal +.
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; integer = ...; &amp;nbsp; // integer
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; real = ...; &amp;nbsp; &amp;nbsp; &amp;nbsp;// real number;
&lt;br&gt;&amp;nbsp; &amp;nbsp;// now integer must be added to self before real so a real is a real that is not an integer.
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; this-&amp;gt;self = &amp;nbsp;plus | integer | real;
&lt;br&gt;&amp;nbsp; &amp;nbsp;}
&lt;br&gt;&amp;nbsp; &amp;nbsp;lex::token_def&amp;lt;&amp;gt; plus;
&lt;br&gt;&amp;nbsp; &amp;nbsp;lex::token,def&amp;lt;int&amp;gt; integer;
&lt;br&gt;&amp;nbsp; &amp;nbsp;lex::token_def&amp;lt;double&amp;gt; real;
&lt;br&gt;&amp;nbsp;};
&lt;br&gt;&lt;br&gt;&amp;nbsp;now in your qi::grammar you refer to the tokens by name they will be converted to their attribute
&lt;br&gt;values when qi first successes in matching the token.
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; start = terminals &amp;gt;&amp;gt; tok.plus &amp;gt;&amp;gt; terminals; &amp;nbsp;// EA tuple&amp;lt;variant,variant&amp;gt;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; terminals = &amp;nbsp;tok.integer | tok.real; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // EA variant&amp;lt;int,double&amp;gt;
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp;Does this make any sense? &amp;nbsp;
&lt;br&gt;------------------------------------------------------------------------------
&lt;br&gt;This SF.Net email is sponsored by the Verizon Developer Community
&lt;br&gt;Take advantage of Verizon's best-in-class app development support
&lt;br&gt;A streamlined, 14 day to market process makes app distribution fast and easy
&lt;br&gt;Join now and get one step closer to millions of Verizon customers
&lt;br&gt;&lt;a href=&quot;http://p.sf.net/sfu/verizon-dev2dev&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://p.sf.net/sfu/verizon-dev2dev&lt;/a&gt;&amp;nbsp;
&lt;br&gt;_______________________________________________
&lt;br&gt;Spirit-general mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26860682&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Spirit-general@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://lists.sourceforge.net/lists/listinfo/spirit-general&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://lists.sourceforge.net/lists/listinfo/spirit-general&lt;/a&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/spirit-general-f3432.html&quot; embed=&quot;fixTarget[3432]&quot; target=&quot;_top&quot; &gt;spirit-general&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Lex---Qi-question-tp26858265p26860682.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26858265</id>
	<title>Lex &amp; Qi question</title>
	<published>2009-12-19T12:27:50Z</published>
	<updated>2009-12-19T12:27:50Z</updated>
	<author>
		<name>Jason McKesson</name>
	</author>
	<content type="html">I'm trying to write a simple expression parser as the first steps 
&lt;br&gt;towards something bigger. And I'd like to be able to use Lex to break 
&lt;br&gt;the input up into tokens. My problem is that combining the two seems to 
&lt;br&gt;be constraining on the utility of Qi.
&lt;br&gt;&lt;br&gt;Here's what I mean. Let's say I have a lexer that looks something like this:
&lt;br&gt;&lt;br&gt;template &amp;nbsp;&amp;lt;typename &amp;nbsp;Lexer&amp;gt;
&lt;br&gt;struct &amp;nbsp;math_tokens &amp;nbsp;: &amp;nbsp;lex::lexer&amp;lt;Lexer&amp;gt;
&lt;br&gt;{
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;math_tokens()
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;{
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;this-&amp;gt;self.add
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;(&amp;quot;\\+&amp;quot;, &amp;nbsp;ID_PLUS)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;(&amp;quot;\d+f?&amp;quot;, &amp;nbsp;ID_FLOAT)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;(&amp;quot;\d*.\d+f?&amp;quot;, &amp;nbsp;ID_FLOAT)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;(&amp;quot;\d+&amp;quot;, &amp;nbsp;ID_INTEGER)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;}
&lt;br&gt;};
&lt;br&gt;&lt;br&gt;A parser for this would look something like this:
&lt;br&gt;&lt;br&gt;template &amp;nbsp;&amp;lt;typename &amp;nbsp;Iterator&amp;gt;
&lt;br&gt;struct &amp;nbsp;math_grammar &amp;nbsp;: &amp;nbsp;qi::grammar&amp;lt;Iterator&amp;gt;
&lt;br&gt;{
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;template &amp;nbsp;&amp;lt;typename &amp;nbsp;TokenDef&amp;gt;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;math_grammar(TokenDef &amp;nbsp;const&amp; &amp;nbsp;tok)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;: &amp;nbsp;math_grammar::base_type(start)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;{
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;terminals = qi::token&amp;lt;ID_FLOAT&amp;gt; &amp;nbsp;| qi::token&amp;lt;ID_INTEGER&amp;gt;;
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;start &amp;nbsp;= &amp;nbsp; terminals&amp;gt;&amp;gt; &amp;nbsp;qi::token&amp;lt;ID_PLUS&amp;gt; &amp;nbsp;&amp;gt;&amp;gt; &amp;nbsp;terminals;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;}
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;qi::rule&amp;lt;Iterator&amp;gt; &amp;nbsp;start;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;qi::rule&amp;lt;Iterator&amp;gt; &amp;nbsp;terminals;
&lt;br&gt;};
&lt;br&gt;&lt;br&gt;I haven't tested this specific code, but you have the general idea of 
&lt;br&gt;the pattern I'm interested in.
&lt;br&gt;&lt;br&gt;The problem is this. If I were to build this purely without lex, the 
&lt;br&gt;grammar would look something like this:
&lt;br&gt;&lt;br&gt;template &amp;nbsp;&amp;lt;typename &amp;nbsp;Iterator&amp;gt;
&lt;br&gt;struct &amp;nbsp;math_qi_grammar &amp;nbsp;: &amp;nbsp;qi::grammar&amp;lt;Iterator&amp;gt;
&lt;br&gt;{
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;math_qi_grammar()
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;: &amp;nbsp;math_grammar::base_type(start)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;{
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;terminals = integer_ | double_;
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;start &amp;nbsp;= &amp;nbsp; terminals&amp;gt;&amp;gt; &amp;nbsp;'+'&amp;gt;&amp;gt; &amp;nbsp;terminals;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;}
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;qi::rule&amp;lt;Iterator&amp;gt; &amp;nbsp;start;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;qi::rule&amp;lt;Iterator&amp;gt; &amp;nbsp;terminals;
&lt;br&gt;};
&lt;br&gt;&lt;br&gt;The difference is this. If I put a semantic action on 'integer_', the 
&lt;br&gt;action gets the synthesized attribute value as a parameter. This 
&lt;br&gt;attribute is an integer. If I put a semantic action on 
&lt;br&gt;'qi::token&amp;lt;ID_INTEGER&amp;gt;', the synthesized attribute is a string. This is 
&lt;br&gt;not as useful as getting an integer, as I now must find a way to convert 
&lt;br&gt;this string into an integer.
&lt;br&gt;&lt;br&gt;Is there some way to combine Lex and Qi that still provides useful 
&lt;br&gt;synthesized attribute behavior of Qi? Is there something I can wrap the 
&lt;br&gt;&amp;quot;qi::token&amp;lt;ID_INTEGER&amp;gt;&amp;quot; parser in that will provide a properly 
&lt;br&gt;synthesized attribute?
&lt;br&gt;&lt;br&gt;Now, I do understand that there is a difference between &amp;quot;double_&amp;quot; and 
&lt;br&gt;the particular tokens that give ID_FLOAT that I wrote in the Lex 
&lt;br&gt;example. Namely, the optional trailing 'f' character that identifies a 
&lt;br&gt;sequence of digits as a floating-point value. So in my above example, I 
&lt;br&gt;would have to manually convert the Lex tokens into some kind of float 
&lt;br&gt;(possibly with a Karma converter?) in order to get the right value. But 
&lt;br&gt;there should be a simple way to get an integer from a token that parses 
&lt;br&gt;integers, yes?
&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;------------------------------------------------------------------------------
&lt;br&gt;This SF.Net email is sponsored by the Verizon Developer Community
&lt;br&gt;Take advantage of Verizon's best-in-class app development support
&lt;br&gt;A streamlined, 14 day to market process makes app distribution fast and easy
&lt;br&gt;Join now and get one step closer to millions of Verizon customers
&lt;br&gt;&lt;a href=&quot;http://p.sf.net/sfu/verizon-dev2dev&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://p.sf.net/sfu/verizon-dev2dev&lt;/a&gt;&amp;nbsp;
&lt;br&gt;_______________________________________________
&lt;br&gt;Spirit-general mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26858265&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Spirit-general@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://lists.sourceforge.net/lists/listinfo/spirit-general&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://lists.sourceforge.net/lists/listinfo/spirit-general&lt;/a&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/spirit-general-f3432.html&quot; embed=&quot;fixTarget[3432]&quot; target=&quot;_top&quot; &gt;spirit-general&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Lex---Qi-question-tp26858265p26858265.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26852618</id>
	<title>Re: permutation with all elements required</title>
	<published>2009-12-18T20:02:46Z</published>
	<updated>2009-12-18T20:02:46Z</updated>
	<author>
		<name>Joel de Guzman-2</name>
	</author>
	<content type="html">Carl Barron wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; On Dec 18, 2009, at 8:25 PM, Joel de Guzman wrote:
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt; Carl Barron wrote:
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; On Dec 18, 2009, at 7:13 PM, Joel de Guzman wrote:
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; The attribute of the permutation operator given a rule
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;a ^ b ^ c
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; is
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;vector&amp;lt;optional&amp;lt;A&amp;gt;, optional&amp;lt;B&amp;gt;, optional&amp;lt;C&amp;gt; &amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; After a successful match, you just check that all optionals
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; for A, B and C are initialized (see Boost Optional).
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; vwctor&amp;lt; ...&amp;gt; &amp;nbsp;or tuple&amp;lt;...&amp;gt; ?
&lt;br&gt;&amp;gt;&amp;gt; Sorry, yeah, tuple. I'm just used to fusion::vector.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; &amp;nbsp; Then phoenix and fusion make this fairly easy for an an arbitrary # of op ^()'s in sequence
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; a1 ^ a2 ^ .... ^a_n, with one phoenix function for any n.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;use fusion::find_if &amp;nbsp;to test for any optional containing 'nothing' and compare the result to
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;fusion::end. in a phoenix function.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;Something like:
&lt;br&gt;&amp;gt; &amp;nbsp; 
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;class no_empties_impl
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;{
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;struct &amp;nbsp;optional_empty
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;template &amp;lt;class A&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;bool operator () (const A &amp;a) const
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{
&lt;br&gt;&amp;gt; 	 &amp;nbsp; &amp;nbsp; // return true if a is 'empty'.
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return !a;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;};
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; public:
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;template &amp;lt;class A&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;struct result {typedef bool type;};
&lt;br&gt;&amp;gt; &amp;nbsp;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;template &amp;lt;class A&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;bool operator () (const A &amp;a) const
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{
&lt;br&gt;&amp;gt; 	 &amp;nbsp; // look for an empty optional, if any return false else true.
&lt;br&gt;&amp;gt; 	 &amp;nbsp; return boost::fusion::find_if&amp;lt;optional_empty&amp;gt;(a) == boost::fusion::end(a);
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;};
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; Looks like an general implimentation of no_empties
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; foo &amp;nbsp;%= &amp;nbsp; a1 ^... ^a_n &amp;nbsp; [_pass = no_empties(qi::_0)]; &amp;nbsp;// or is it _1?? &amp;nbsp;the fusion seq,
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; should provide result for any n. &amp;nbsp; permutation of n parsers n at a time.
&lt;/div&gt;&lt;br&gt;Use fusion::all instead of find_if: &lt;a href=&quot;http://tinyurl.com/yzm94gc&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://tinyurl.com/yzm94gc&lt;/a&gt;&lt;br&gt;&lt;br&gt;Regards,
&lt;br&gt;-- 
&lt;br&gt;Joel de Guzman
&lt;br&gt;&lt;a href=&quot;http://www.boostpro.com&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.boostpro.com&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;http://spirit.sf.net&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://spirit.sf.net&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;http://www.facebook.com/djowel&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.facebook.com/djowel&lt;/a&gt;&lt;br&gt;&lt;br&gt;Meet me at BoostCon
&lt;br&gt;&lt;a href=&quot;http://www.boostcon.com/home&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.boostcon.com/home&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;http://www.facebook.com/boostcon&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.facebook.com/boostcon&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;------------------------------------------------------------------------------
&lt;br&gt;This SF.Net email is sponsored by the Verizon Developer Community
&lt;br&gt;Take advantage of Verizon's best-in-class app development support
&lt;br&gt;A streamlined, 14 day to market process makes app distribution fast and easy
&lt;br&gt;Join now and get one step closer to millions of Verizon customers
&lt;br&gt;&lt;a href=&quot;http://p.sf.net/sfu/verizon-dev2dev&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://p.sf.net/sfu/verizon-dev2dev&lt;/a&gt;&amp;nbsp;
&lt;br&gt;_______________________________________________
&lt;br&gt;Spirit-general mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26852618&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Spirit-general@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://lists.sourceforge.net/lists/listinfo/spirit-general&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://lists.sourceforge.net/lists/listinfo/spirit-general&lt;/a&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/spirit-general-f3432.html&quot; embed=&quot;fixTarget[3432]&quot; target=&quot;_top&quot; &gt;spirit-general&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/permutation-with-all-elements-required-tp26846102p26852618.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26852062</id>
	<title>Re: permutation with all elements required</title>
	<published>2009-12-18T17:59:03Z</published>
	<updated>2009-12-18T17:59:03Z</updated>
	<author>
		<name>CARL BARRON-3</name>
	</author>
	<content type="html">&lt;br&gt;On Dec 18, 2009, at 8:25 PM, Joel de Guzman wrote:
&lt;br&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; Carl Barron wrote:
&lt;br&gt;&amp;gt;&amp;gt; On Dec 18, 2009, at 7:13 PM, Joel de Guzman wrote:
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; The attribute of the permutation operator given a rule
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;a ^ b ^ c
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; is
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;vector&amp;lt;optional&amp;lt;A&amp;gt;, optional&amp;lt;B&amp;gt;, optional&amp;lt;C&amp;gt; &amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; After a successful match, you just check that all optionals
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; for A, B and C are initialized (see Boost Optional).
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; vwctor&amp;lt; ...&amp;gt; &amp;nbsp;or tuple&amp;lt;...&amp;gt; ?
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; Sorry, yeah, tuple. I'm just used to fusion::vector.
&lt;/div&gt;&lt;br&gt;&amp;nbsp; Then phoenix and fusion make this fairly easy for an an arbitrary # of op ^()'s in sequence
&lt;br&gt;&amp;nbsp; &amp;nbsp; a1 ^ a2 ^ .... ^a_n, with one phoenix function for any n.
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp;use fusion::find_if &amp;nbsp;to test for any optional containing 'nothing' and compare the result to
&lt;br&gt;&amp;nbsp; &amp;nbsp;fusion::end. in a phoenix function.
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp;Something like:
&lt;br&gt;&amp;nbsp; 
&lt;br&gt;&amp;nbsp; &amp;nbsp;class no_empties_impl
&lt;br&gt;&amp;nbsp; &amp;nbsp;{
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;struct &amp;nbsp;optional_empty
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;template &amp;lt;class A&amp;gt;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;bool operator () (const A &amp;a) const
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// return true if a is 'empty'.
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return !a;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;};
&lt;br&gt;&amp;nbsp; &amp;nbsp; public:
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;template &amp;lt;class A&amp;gt;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;struct result {typedef bool type;};
&lt;br&gt;&amp;nbsp;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;template &amp;lt;class A&amp;gt;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;bool operator () (const A &amp;a) const
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// look for an empty optional, if any return false else true.
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return boost::fusion::find_if&amp;lt;optional_empty&amp;gt;(a) == boost::fusion::end(a);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}
&lt;br&gt;&amp;nbsp; &amp;nbsp;};
&lt;br&gt;&lt;br&gt;Looks like an general implimentation of no_empties
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; foo &amp;nbsp;%= &amp;nbsp; a1 ^... ^a_n &amp;nbsp; [_pass = no_empties(qi::_0)]; &amp;nbsp;// or is it _1?? &amp;nbsp;the fusion seq,
&lt;br&gt;&lt;br&gt;should provide result for any n. &amp;nbsp; permutation of n parsers n at a time.
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 
&lt;br&gt;&amp;nbsp; 
&lt;br&gt;&lt;br&gt;&lt;br&gt;------------------------------------------------------------------------------
&lt;br&gt;This SF.Net email is sponsored by the Verizon Developer Community
&lt;br&gt;Take advantage of Verizon's best-in-class app development support
&lt;br&gt;A streamlined, 14 day to market process makes app distribution fast and easy
&lt;br&gt;Join now and get one step closer to millions of Verizon customers
&lt;br&gt;&lt;a href=&quot;http://p.sf.net/sfu/verizon-dev2dev&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://p.sf.net/sfu/verizon-dev2dev&lt;/a&gt;&amp;nbsp;
&lt;br&gt;_______________________________________________
&lt;br&gt;Spirit-general mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26852062&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Spirit-general@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://lists.sourceforge.net/lists/listinfo/spirit-general&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://lists.sourceforge.net/lists/listinfo/spirit-general&lt;/a&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/spirit-general-f3432.html&quot; embed=&quot;fixTarget[3432]&quot; target=&quot;_top&quot; &gt;spirit-general&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/permutation-with-all-elements-required-tp26846102p26852062.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26851897</id>
	<title>Re: permutation with all elements required</title>
	<published>2009-12-18T17:25:00Z</published>
	<updated>2009-12-18T17:25:00Z</updated>
	<author>
		<name>Joel de Guzman-2</name>
	</author>
	<content type="html">Carl Barron wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; On Dec 18, 2009, at 7:13 PM, Joel de Guzman wrote:
&lt;br&gt;&amp;gt;&amp;gt; The attribute of the permutation operator given a rule
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; a ^ b ^ c
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; is
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; vector&amp;lt;optional&amp;lt;A&amp;gt;, optional&amp;lt;B&amp;gt;, optional&amp;lt;C&amp;gt; &amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; After a successful match, you just check that all optionals
&lt;br&gt;&amp;gt;&amp;gt; for A, B and C are initialized (see Boost Optional).
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;vwctor&amp;lt; ...&amp;gt; &amp;nbsp;or tuple&amp;lt;...&amp;gt; ?
&lt;/div&gt;&lt;br&gt;Sorry, yeah, tuple. I'm just used to fusion::vector.
&lt;br&gt;&lt;br&gt;Regards,
&lt;br&gt;-- 
&lt;br&gt;Joel de Guzman
&lt;br&gt;&lt;a href=&quot;http://www.boostpro.com&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.boostpro.com&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;http://spirit.sf.net&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://spirit.sf.net&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;http://www.facebook.com/djowel&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.facebook.com/djowel&lt;/a&gt;&lt;br&gt;&lt;br&gt;Meet me at BoostCon
&lt;br&gt;&lt;a href=&quot;http://www.boostcon.com/home&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.boostcon.com/home&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;http://www.facebook.com/boostcon&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.facebook.com/boostcon&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;------------------------------------------------------------------------------
&lt;br&gt;This SF.Net email is sponsored by the Verizon Developer Community
&lt;br&gt;Take advantage of Verizon's best-in-class app development support
&lt;br&gt;A streamlined, 14 day to market process makes app distribution fast and easy
&lt;br&gt;Join now and get one step closer to millions of Verizon customers
&lt;br&gt;&lt;a href=&quot;http://p.sf.net/sfu/verizon-dev2dev&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://p.sf.net/sfu/verizon-dev2dev&lt;/a&gt;&amp;nbsp;
&lt;br&gt;_______________________________________________
&lt;br&gt;Spirit-general mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26851897&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Spirit-general@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://lists.sourceforge.net/lists/listinfo/spirit-general&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://lists.sourceforge.net/lists/listinfo/spirit-general&lt;/a&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/spirit-general-f3432.html&quot; embed=&quot;fixTarget[3432]&quot; target=&quot;_top&quot; &gt;spirit-general&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/permutation-with-all-elements-required-tp26846102p26851897.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26851815</id>
	<title>Re: permutation with all elements required</title>
	<published>2009-12-18T17:12:15Z</published>
	<updated>2009-12-18T17:12:15Z</updated>
	<author>
		<name>CARL BARRON-3</name>
	</author>
	<content type="html">&lt;br&gt;On Dec 18, 2009, at 7:13 PM, Joel de Guzman wrote:
&lt;br&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; Kenneth Riddile wrote:
&lt;br&gt;&amp;gt;&amp;gt; How can I express a permutation in Spirit where each element is required 
&lt;br&gt;&amp;gt;&amp;gt; to be present? &amp;nbsp;ie:
&lt;br&gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt; a ^ b ^ c would only match:
&lt;br&gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt; a b c
&lt;br&gt;&amp;gt;&amp;gt; a c b
&lt;br&gt;&amp;gt;&amp;gt; b a c
&lt;br&gt;&amp;gt;&amp;gt; b c a
&lt;br&gt;&amp;gt;&amp;gt; c a b
&lt;br&gt;&amp;gt;&amp;gt; c b a
&lt;br&gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt; and not:
&lt;br&gt;&amp;gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt; a b
&lt;br&gt;&amp;gt;&amp;gt; b a
&lt;br&gt;&amp;gt;&amp;gt; c a
&lt;br&gt;&amp;gt;&amp;gt; ...
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; The attribute of the permutation operator given a rule
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; a ^ b ^ c
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; is
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; vector&amp;lt;optional&amp;lt;A&amp;gt;, optional&amp;lt;B&amp;gt;, optional&amp;lt;C&amp;gt; &amp;gt;
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; After a successful match, you just check that all optionals
&lt;br&gt;&amp;gt; for A, B and C are initialized (see Boost Optional).
&lt;br&gt;&amp;gt; 
&lt;/div&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp;vwctor&amp;lt; ...&amp;gt; &amp;nbsp;or tuple&amp;lt;...&amp;gt; ?
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp;
&lt;br&gt;&lt;br&gt;------------------------------------------------------------------------------
&lt;br&gt;This SF.Net email is sponsored by the Verizon Developer Community
&lt;br&gt;Take advantage of Verizon's best-in-class app development support
&lt;br&gt;A streamlined, 14 day to market process makes app distribution fast and easy
&lt;br&gt;Join now and get one step closer to millions of Verizon customers
&lt;br&gt;&lt;a href=&quot;http://p.sf.net/sfu/verizon-dev2dev&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://p.sf.net/sfu/verizon-dev2dev&lt;/a&gt;&amp;nbsp;
&lt;br&gt;_______________________________________________
&lt;br&gt;Spirit-general mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26851815&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Spirit-general@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://lists.sourceforge.net/lists/listinfo/spirit-general&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://lists.sourceforge.net/lists/listinfo/spirit-general&lt;/a&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/spirit-general-f3432.html&quot; embed=&quot;fixTarget[3432]&quot; target=&quot;_top&quot; &gt;spirit-general&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/permutation-with-all-elements-required-tp26846102p26851815.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26851727</id>
	<title>Re: permutation with all elements required</title>
	<published>2009-12-18T16:13:45Z</published>
	<updated>2009-12-18T16:13:45Z</updated>
	<author>
		<name>Joel de Guzman-2</name>
	</author>
	<content type="html">Kenneth Riddile wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; How can I express a permutation in Spirit where each element is required 
&lt;br&gt;&amp;gt; to be present? &amp;nbsp;ie:
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; a ^ b ^ c would only match:
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; a b c
&lt;br&gt;&amp;gt; a c b
&lt;br&gt;&amp;gt; b a c
&lt;br&gt;&amp;gt; b c a
&lt;br&gt;&amp;gt; c a b
&lt;br&gt;&amp;gt; c b a
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; and not:
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; a b
&lt;br&gt;&amp;gt; b a
&lt;br&gt;&amp;gt; c a
&lt;br&gt;&amp;gt; ...
&lt;/div&gt;&lt;br&gt;The attribute of the permutation operator given a rule
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;a ^ b ^ c
&lt;br&gt;&lt;br&gt;is
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;vector&amp;lt;optional&amp;lt;A&amp;gt;, optional&amp;lt;B&amp;gt;, optional&amp;lt;C&amp;gt; &amp;gt;
&lt;br&gt;&lt;br&gt;After a successful match, you just check that all optionals
&lt;br&gt;for A, B and C are initialized (see Boost Optional).
&lt;br&gt;&lt;br&gt;Regards,
&lt;br&gt;-- 
&lt;br&gt;Joel de Guzman
&lt;br&gt;&lt;a href=&quot;http://www.boostpro.com&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.boostpro.com&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;http://spirit.sf.net&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://spirit.sf.net&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;http://www.facebook.com/djowel&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.facebook.com/djowel&lt;/a&gt;&lt;br&gt;&lt;br&gt;Meet me at BoostCon
&lt;br&gt;&lt;a href=&quot;http://www.boostcon.com/home&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.boostcon.com/home&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;http://www.facebook.com/boostcon&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.facebook.com/boostcon&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;------------------------------------------------------------------------------
&lt;br&gt;This SF.Net email is sponsored by the Verizon Developer Community
&lt;br&gt;Take advantage of Verizon's best-in-class app development support
&lt;br&gt;A streamlined, 14 day to market process makes app distribution fast and easy
&lt;br&gt;Join now and get one step closer to millions of Verizon customers
&lt;br&gt;&lt;a href=&quot;http://p.sf.net/sfu/verizon-dev2dev&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://p.sf.net/sfu/verizon-dev2dev&lt;/a&gt;&amp;nbsp;
&lt;br&gt;_______________________________________________
&lt;br&gt;Spirit-general mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26851727&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Spirit-general@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://lists.sourceforge.net/lists/listinfo/spirit-general&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://lists.sourceforge.net/lists/listinfo/spirit-general&lt;/a&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/spirit-general-f3432.html&quot; embed=&quot;fixTarget[3432]&quot; target=&quot;_top&quot; &gt;spirit-general&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/permutation-with-all-elements-required-tp26846102p26851727.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26851027</id>
	<title>Re: permutation with all elements required</title>
	<published>2009-12-18T15:14:09Z</published>
	<updated>2009-12-18T15:14:09Z</updated>
	<author>
		<name>bytecolor-2</name>
	</author>
	<content type="html">Kenneth Riddile &amp;lt;kfriddile &amp;lt;at&amp;gt; yahoo.com&amp;gt; writes:
&lt;br&gt;&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; How can I express a permutation in Spirit where each element is required to be
&lt;br&gt;present? &amp;nbsp;ie:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; a ^ b ^ c would only match:
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; a b c
&lt;br&gt;&amp;gt; a c b
&lt;br&gt;&amp;gt; b a c
&lt;br&gt;&amp;gt; b c a
&lt;br&gt;&amp;gt; c a b
&lt;br&gt;&amp;gt; c b a
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; and not:
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; a b
&lt;br&gt;&amp;gt; b a
&lt;br&gt;&amp;gt; c a
&lt;br&gt;&amp;gt; ...
&lt;br&gt;&amp;gt; 
&lt;/div&gt;&lt;br&gt;I think you have this backwards?
&lt;br&gt;&lt;br&gt;I believe a ^ b ^ c will match:
&lt;br&gt;a, b, c, ab, ac, bc, cb, abc, cba, etc.
&lt;br&gt;&lt;br&gt;IOW, every example you gave.
&lt;br&gt;&lt;br&gt;If I'm understanding, you want to match a AND b AND c in any order.
&lt;br&gt;So something like:
&lt;br&gt;foo
&lt;br&gt;&amp;nbsp; &amp;nbsp; = char_(&amp;quot;abc&amp;quot;)[_a = _1] &amp;gt;&amp;gt; !lit(_a) &amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; char_(&amp;quot;abc&amp;quot;)[_b = _1] &amp;gt;&amp;gt; !(lit(_a) | lit(_b)) &amp;gt;&amp;gt;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; char_(&amp;quot;abc&amp;quot;)
&lt;br&gt;&amp;nbsp; &amp;nbsp; ;
&lt;br&gt;&lt;br&gt;Probably much better ways to do this, but that should work
&lt;br&gt;(for simple characters, any way)
&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;------------------------------------------------------------------------------
&lt;br&gt;This SF.Net email is sponsored by the Verizon Developer Community
&lt;br&gt;Take advantage of Verizon's best-in-class app development support
&lt;br&gt;A streamlined, 14 day to market process makes app distribution fast and easy
&lt;br&gt;Join now and get one step closer to millions of Verizon customers
&lt;br&gt;&lt;a href=&quot;http://p.sf.net/sfu/verizon-dev2dev&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://p.sf.net/sfu/verizon-dev2dev&lt;/a&gt;&amp;nbsp;
&lt;br&gt;_______________________________________________
&lt;br&gt;Spirit-general mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26851027&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Spirit-general@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://lists.sourceforge.net/lists/listinfo/spirit-general&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://lists.sourceforge.net/lists/listinfo/spirit-general&lt;/a&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/spirit-general-f3432.html&quot; embed=&quot;fixTarget[3432]&quot; target=&quot;_top&quot; &gt;spirit-general&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/permutation-with-all-elements-required-tp26846102p26851027.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26846102</id>
	<title>permutation with all elements required</title>
	<published>2009-12-18T08:37:30Z</published>
	<updated>2009-12-18T08:37:30Z</updated>
	<author>
		<name>Kenny Riddile</name>
	</author>
	<content type="html">&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot;&gt;&lt;tr&gt;&lt;td valign=&quot;top&quot; style=&quot;font: inherit;&quot;&gt;How can I express a permutation in Spirit where each element is required to be present? &amp;nbsp;ie:&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;a ^ b ^ c would only match:&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;a b c&lt;/div&gt;&lt;div&gt;a c b&lt;/div&gt;&lt;div&gt;b a c&lt;/div&gt;&lt;div&gt;b c a&lt;/div&gt;&lt;div&gt;c a b&lt;/div&gt;&lt;div&gt;c b a&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;and not:&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;a b&lt;/div&gt;&lt;div&gt;b a&lt;/div&gt;&lt;div&gt;c a&lt;/div&gt;&lt;div&gt;...&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;------------------------------------------------------------------------------
&lt;br&gt;This SF.Net email is sponsored by the Verizon Developer Community
&lt;br&gt;Take advantage of Verizon's best-in-class app development support
&lt;br&gt;A streamlined, 14 day to market process makes app distribution fast and easy
&lt;br&gt;Join now and get one step closer to millions of Verizon customers
&lt;br&gt;&lt;a href=&quot;http://p.sf.net/sfu/verizon-dev2dev&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://p.sf.net/sfu/verizon-dev2dev&lt;/a&gt;&amp;nbsp;&lt;br /&gt;_______________________________________________
&lt;br&gt;Spirit-general mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26846102&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Spirit-general@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://lists.sourceforge.net/lists/listinfo/spirit-general&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://lists.sourceforge.net/lists/listinfo/spirit-general&lt;/a&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/spirit-general-f3432.html&quot; embed=&quot;fixTarget[3432]&quot; target=&quot;_top&quot; &gt;spirit-general&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/permutation-with-all-elements-required-tp26846102p26846102.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26825968</id>
	<title>Re: Spirit 2.1 numeric parsing</title>
	<published>2009-12-17T02:24:06Z</published>
	<updated>2009-12-17T02:24:06Z</updated>
	<author>
		<name>Joel de Guzman-2</name>
	</author>
	<content type="html">Glenn Macgregor wrote:
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; This works fine as all numerics (2 &amp; 3.6) are handled in the double 
&lt;br&gt;&amp;gt; rule. I have a need to distinguish between a double and a long (and 
&lt;br&gt;&amp;gt; potentially ulong as well). I have changed my grammar to:
&lt;br&gt;&lt;br&gt;strict_real_policies is your friend. See &lt;a href=&quot;http://tinyurl.com/ybftj8v&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://tinyurl.com/ybftj8v&lt;/a&gt;.
&lt;br&gt;Example:
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;using boost::spirit::qi::strict_real_policies;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;real_parser&amp;lt;double, strict_real_policies&amp;lt;double&amp;gt; &amp;gt; strict_double;
&lt;br&gt;&lt;br&gt;If you also need to distinguish ulong, then use ulong_ and explicitly
&lt;br&gt;parse the sign yourself to distinguish signedness.
&lt;br&gt;&lt;br&gt;Regards,
&lt;br&gt;-- 
&lt;br&gt;Joel de Guzman
&lt;br&gt;&lt;a href=&quot;http://www.boostpro.com&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.boostpro.com&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;http://spirit.sf.net&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://spirit.sf.net&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;http://www.facebook.com/djowel&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.facebook.com/djowel&lt;/a&gt;&lt;br&gt;&lt;br&gt;Meet me at BoostCon
&lt;br&gt;&lt;a href=&quot;http://www.boostcon.com/home&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.boostcon.com/home&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;http://www.facebook.com/boostcon&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.facebook.com/boostcon&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;------------------------------------------------------------------------------
&lt;br&gt;This SF.Net email is sponsored by the Verizon Developer Community
&lt;br&gt;Take advantage of Verizon's best-in-class app development support
&lt;br&gt;A streamlined, 14 day to market process makes app distribution fast and easy
&lt;br&gt;Join now and get one step closer to millions of Verizon customers
&lt;br&gt;&lt;a href=&quot;http://p.sf.net/sfu/verizon-dev2dev&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://p.sf.net/sfu/verizon-dev2dev&lt;/a&gt;&amp;nbsp;
&lt;br&gt;_______________________________________________
&lt;br&gt;Spirit-general mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26825968&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Spirit-general@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://lists.sourceforge.net/lists/listinfo/spirit-general&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://lists.sourceforge.net/lists/listinfo/spirit-general&lt;/a&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/spirit-general-f3432.html&quot; embed=&quot;fixTarget[3432]&quot; target=&quot;_top&quot; &gt;spirit-general&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Spirit-2.1-numeric-parsing-tp26825525p26825968.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26825525</id>
	<title>Spirit 2.1 numeric parsing</title>
	<published>2009-12-17T01:43:44Z</published>
	<updated>2009-12-17T01:43:44Z</updated>
	<author>
		<name>Glenn Macgregor-3</name>
	</author>
	<content type="html">&lt;html xmlns:v=&quot;urn:schemas-microsoft-com:vml&quot; xmlns:o=&quot;urn:schemas-microsoft-com:office:office&quot; xmlns:w=&quot;urn:schemas-microsoft-com:office:word&quot; xmlns:x=&quot;urn:schemas-microsoft-com:office:excel&quot; xmlns:p=&quot;urn:schemas-microsoft-com:office:powerpoint&quot; xmlns:a=&quot;urn:schemas-microsoft-com:office:access&quot; xmlns:dt=&quot;uuid:C2F41010-65B3-11d1-A29F-00AA00C14882&quot; xmlns:s=&quot;uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882&quot; xmlns:rs=&quot;urn:schemas-microsoft-com:rowset&quot; xmlns:Z=&quot;urn:schemas-microsoft-com:&quot; xmlns:b=&quot;urn:schemas-microsoft-com:office:publisher&quot; xmlns:ss=&quot;urn:schemas-microsoft-com:office:spreadsheet&quot; xmlns:c=&quot;urn:schemas-microsoft-com:office:component:spreadsheet&quot; xmlns:odc=&quot;urn:schemas-microsoft-com:office:odc&quot; xmlns:oa=&quot;urn:schemas-microsoft-com:office:activation&quot; xmlns:html=&quot;http://www.w3.org/TR/REC-html40&quot; xmlns:q=&quot;http://schemas.xmlsoap.org/soap/envelope/&quot; xmlns:rtc=&quot;http://microsoft.com/officenet/conferencing&quot; xmlns:D=&quot;DAV:&quot; xmlns:Repl=&quot;http://schemas.microsoft.com/repl/&quot; xmlns:mt=&quot;http://schemas.microsoft.com/sharepoint/soap/meetings/&quot; xmlns:x2=&quot;http://schemas.microsoft.com/office/excel/2003/xml&quot; xmlns:ppda=&quot;http://www.passport.com/NameSpace.xsd&quot; xmlns:ois=&quot;http://schemas.microsoft.com/sharepoint/soap/ois/&quot; xmlns:dir=&quot;http://schemas.microsoft.com/sharepoint/soap/directory/&quot; xmlns:ds=&quot;http://www.w3.org/2000/09/xmldsig#&quot; xmlns:dsp=&quot;http://schemas.microsoft.com/sharepoint/dsp&quot; xmlns:udc=&quot;http://schemas.microsoft.com/data/udc&quot; xmlns:xsd=&quot;http://www.w3.org/2001/XMLSchema&quot; xmlns:sub=&quot;http://schemas.microsoft.com/sharepoint/soap/2002/1/alerts/&quot; xmlns:ec=&quot;http://www.w3.org/2001/04/xmlenc#&quot; xmlns:sp=&quot;http://schemas.microsoft.com/sharepoint/&quot; xmlns:sps=&quot;http://schemas.microsoft.com/sharepoint/soap/&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; xmlns:udcs=&quot;http://schemas.microsoft.com/data/udc/soap&quot; xmlns:udcxf=&quot;http://schemas.microsoft.com/data/udc/xmlfile&quot; xmlns:udcp2p=&quot;http://schemas.microsoft.com/data/udc/parttopart&quot; xmlns:wf=&quot;http://schemas.microsoft.com/sharepoint/soap/workflow/&quot; xmlns:dsss=&quot;http://schemas.microsoft.com/office/2006/digsig-setup&quot; xmlns:dssi=&quot;http://schemas.microsoft.com/office/2006/digsig&quot; xmlns:mdssi=&quot;http://schemas.openxmlformats.org/package/2006/digital-signature&quot; xmlns:mver=&quot;http://schemas.openxmlformats.org/markup-compatibility/2006&quot; xmlns:m=&quot;http://schemas.microsoft.com/office/2004/12/omml&quot; xmlns:mrels=&quot;http://schemas.openxmlformats.org/package/2006/relationships&quot; xmlns:spwp=&quot;http://microsoft.com/sharepoint/webpartpages&quot; xmlns:ex12t=&quot;http://schemas.microsoft.com/exchange/services/2006/types&quot; xmlns:ex12m=&quot;http://schemas.microsoft.com/exchange/services/2006/messages&quot; xmlns:pptsl=&quot;http://schemas.microsoft.com/sharepoint/soap/SlideLibrary/&quot; xmlns:spsl=&quot;http://microsoft.com/webservices/SharePointPortalServer/PublishedLinksService&quot; xmlns:st=&quot;&amp;#1;&quot; xmlns=&quot;http://www.w3.org/TR/REC-html40&quot;&gt;

&lt;head&gt;
&lt;meta http-equiv=Content-Type content=&quot;text/html; charset=us-ascii&quot;&gt;
&lt;meta name=Generator content=&quot;Microsoft Word 12 (filtered medium)&quot;&gt;

&lt;!--[if gte mso 9]&gt;&lt;xml&gt;
 &lt;o:shapedefaults v:ext=&quot;edit&quot; spidmax=&quot;1026&quot; /&gt;
&lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;
 &lt;o:shapelayout v:ext=&quot;edit&quot;&gt;
  &lt;o:idmap v:ext=&quot;edit&quot; data=&quot;1&quot; /&gt;
 &lt;/o:shapelayout&gt;&lt;/xml&gt;&lt;![endif]--&gt;
&lt;/head&gt;

&lt;body lang=EN-IE link=blue vlink=purple&gt;

&lt;div class=Section1&gt;

&lt;p class=MsoNormal&gt;Hi All,&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;Thanks for all the help thus far, it has been invaluable. I
now want to distinguish between ints, uint and floats in the parser, is that
possible?&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;I currently have:&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/p&gt;

&lt;p class=MsoNormal style='text-indent:36.0pt;text-autospace:none'&gt;&lt;span style='font-size:10.0pt;font-family:&quot;Courier New&quot;'&gt;mIdent&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal style='text-autospace:none'&gt;&lt;span style='font-size:10.0pt;
font-family:&quot;Courier New&quot;'&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
= raw[lexeme[alpha &amp;gt;&amp;gt; *(alnum | &lt;span style='color:#A31515'&gt;&amp;quot;_&amp;quot;&lt;/span&gt;)]]&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal style='text-autospace:none'&gt;&lt;span style='font-size:10.0pt;
font-family:&quot;Courier New&quot;'&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal style='text-autospace:none'&gt;&lt;span style='font-size:10.0pt;
font-family:&quot;Courier New&quot;'&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal style='text-autospace:none'&gt;&lt;span style='font-size:10.0pt;
font-family:&quot;Courier New&quot;'&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mPrimary&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal style='text-autospace:none'&gt;&lt;span style='font-size:10.0pt;
font-family:&quot;Courier New&quot;'&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
= mIdent[_val = _1]&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal style='text-autospace:none'&gt;&lt;span style='font-size:10.0pt;
font-family:&quot;Courier New&quot;'&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
| double_[_val = _1]&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal style='text-autospace:none'&gt;&lt;span style='font-size:10.0pt;
font-family:&quot;Courier New&quot;'&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
| &lt;span style='color:#A31515'&gt;'('&lt;/span&gt; &amp;gt;&amp;gt; mOrExpr[_val = _1] &amp;gt;&amp;gt; &lt;span style='color:#A31515'&gt;')'&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal style='text-autospace:none'&gt;&lt;span style='font-size:10.0pt;
font-family:&quot;Courier New&quot;'&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
| (&lt;span style='color:#A31515'&gt;'!'&lt;/span&gt; &amp;gt;&amp;gt; mPrimary)[_val =
notOperator(_1)]&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal style='text-autospace:none'&gt;&lt;span style='font-size:10.0pt;
font-family:&quot;Courier New&quot;'&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
| (&lt;span style='color:#A31515'&gt;'-'&lt;/span&gt; &amp;gt;&amp;gt; mPrimary)[_val =
negateOperator(_1)]&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;span style='font-size:10.0pt;font-family:&quot;Courier New&quot;'&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&amp;#8230;.&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;This works fine as all numerics (2 &amp;amp; 3.6) are handled in
the double rule. I have a need to distinguish between a double and a long (and
potentially ulong as well). I have changed my grammar to:&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/p&gt;

&lt;p class=MsoNormal style='text-indent:36.0pt;text-autospace:none'&gt;&lt;span style='font-size:10.0pt;font-family:&quot;Courier New&quot;'&gt;mPrimary&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal style='text-autospace:none'&gt;&lt;span style='font-size:10.0pt;
font-family:&quot;Courier New&quot;'&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
= mIdent[_val = _1]&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal style='text-autospace:none'&gt;&lt;span style='font-size:10.0pt;
font-family:&quot;Courier New&quot;'&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
| double_[_val = _1]&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal style='text-autospace:none'&gt;&lt;span style='font-size:10.0pt;
font-family:&quot;Courier New&quot;'&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |
int_[_val = _1]&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal style='text-autospace:none'&gt;&lt;span style='font-size:10.0pt;
font-family:&quot;Courier New&quot;'&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
| &lt;span style='color:#A31515'&gt;'('&lt;/span&gt; &amp;gt;&amp;gt; mOrExpr[_val = _1] &amp;gt;&amp;gt; &lt;span style='color:#A31515'&gt;')'&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal style='text-autospace:none'&gt;&lt;span style='font-size:10.0pt;
font-family:&quot;Courier New&quot;'&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
| (&lt;span style='color:#A31515'&gt;'!'&lt;/span&gt; &amp;gt;&amp;gt; mPrimary)[_val =
notOperator(_1)]&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal style='text-autospace:none'&gt;&lt;span style='font-size:10.0pt;
font-family:&quot;Courier New&quot;'&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
| (&lt;span style='color:#A31515'&gt;'-'&lt;/span&gt; &amp;gt;&amp;gt; mPrimary)[_val =
negateOperator(_1)]&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;span style='font-size:10.0pt;font-family:&quot;Courier New&quot;'&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;span style='font-size:10.0pt;font-family:&quot;Courier New&quot;'&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;span style='font-size:10.0pt;font-family:&quot;Courier New&quot;'&gt;Which
still read everything in the double rule. So I moved to:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/p&gt;

&lt;p class=MsoNormal style='text-indent:36.0pt;text-autospace:none'&gt;&lt;span style='font-size:10.0pt;font-family:&quot;Courier New&quot;'&gt;mPrimary&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal style='text-autospace:none'&gt;&lt;span style='font-size:10.0pt;
font-family:&quot;Courier New&quot;'&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
= mIdent[_val = _1]&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal style='text-autospace:none'&gt;&lt;span style='font-size:10.0pt;
font-family:&quot;Courier New&quot;'&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |
int_[_val = _1]&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal style='text-autospace:none'&gt;&lt;span style='font-size:10.0pt;
font-family:&quot;Courier New&quot;'&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
| double_[_val = _1]&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal style='text-autospace:none'&gt;&lt;span style='font-size:10.0pt;
font-family:&quot;Courier New&quot;'&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
| &lt;span style='color:#A31515'&gt;'('&lt;/span&gt; &amp;gt;&amp;gt; mOrExpr[_val = _1] &amp;gt;&amp;gt; &lt;span style='color:#A31515'&gt;')'&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal style='text-autospace:none'&gt;&lt;span style='font-size:10.0pt;
font-family:&quot;Courier New&quot;'&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
| (&lt;span style='color:#A31515'&gt;'!'&lt;/span&gt; &amp;gt;&amp;gt; mPrimary)[_val =
notOperator(_1)]&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal style='text-autospace:none'&gt;&lt;span style='font-size:10.0pt;
font-family:&quot;Courier New&quot;'&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
| (&lt;span style='color:#A31515'&gt;'-'&lt;/span&gt; &amp;gt;&amp;gt; mPrimary)[_val =
negateOperator(_1)]&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;span style='font-size:10.0pt;font-family:&quot;Courier New&quot;'&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;span style='font-size:10.0pt;font-family:&quot;Courier New&quot;'&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;span style='font-size:10.0pt;font-family:&quot;Courier New&quot;'&gt;This
now read all numerics in the int rule so I lost all decimal places on reals. I
have read that I can use the longest_d but it seems to have been removed in the
Spirit 2.1. What, if any, is the prefered way to distinguish between double,
long and unsigned long values in a grammar?&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;span style='font-size:10.0pt;font-family:&quot;Courier New&quot;'&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;span style='font-size:10.0pt;font-family:&quot;Courier New&quot;'&gt;Thanks&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;span style='font-size:10.0pt;font-family:&quot;Courier New&quot;'&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;span style='font-size:10.0pt;font-family:&quot;Courier New&quot;'&gt;&amp;nbsp;Glenn&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/p&gt;

&lt;/div&gt;

&lt;/body&gt;

&lt;/html&gt;
&lt;br /&gt;------------------------------------------------------------------------------
&lt;br&gt;This SF.Net email is sponsored by the Verizon Developer Community
&lt;br&gt;Take advantage of Verizon's best-in-class app development support
&lt;br&gt;A streamlined, 14 day to market process makes app distribution fast and easy
&lt;br&gt;Join now and get one step closer to millions of Verizon customers
&lt;br&gt;&lt;a href=&quot;http://p.sf.net/sfu/verizon-dev2dev&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://p.sf.net/sfu/verizon-dev2dev&lt;/a&gt;&amp;nbsp;&lt;br /&gt;_______________________________________________
&lt;br&gt;Spirit-general mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26825525&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Spirit-general@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://lists.sourceforge.net/lists/listinfo/spirit-general&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://lists.sourceforge.net/lists/listinfo/spirit-general&lt;/a&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/spirit-general-f3432.html&quot; embed=&quot;fixTarget[3432]&quot; target=&quot;_top&quot; &gt;spirit-general&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Spirit-2.1-numeric-parsing-tp26825525p26825525.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26824698</id>
	<title>Re: phrase_parse() or parse()?</title>
	<published>2009-12-17T00:24:35Z</published>
	<updated>2009-12-17T00:24:35Z</updated>
	<author>
		<name>OvermindDL1</name>
	</author>
	<content type="html">On Thu, Dec 17, 2009 at 12:44 AM, Tan, Tom (Shanghai) &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26824698&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;TTan@...&lt;/a&gt;&amp;gt; wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; Hi, this might be a naive question, but I have a question that cannot be
&lt;br&gt;&amp;gt; answered even after reading the doc:
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Except for the apparent different signatures,
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; -          what are the differences of parse() and phrase_parse() in terms
&lt;br&gt;&amp;gt; of  implementation, performance etc ?
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; -          When to use which?
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; -          Is one a shortcut to a special case of another? And if so, which
&lt;br&gt;&amp;gt; one?
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; I am especially puzzled by term “phrase level” compared to “character level”
&lt;br&gt;&amp;gt; as appearing here: “The first form parse works on the character level. The
&lt;br&gt;&amp;gt; second phrase_parse works on the phrase level and requires skip parser “ ,
&lt;br&gt;&amp;gt; isn’t comparing starting from “the character level”? How is phrase defined
&lt;br&gt;&amp;gt; here?
&lt;/div&gt;&lt;br&gt;&lt;br&gt;phrase -&amp;gt; for parsing a grammar with no explicit skipper (but it may
&lt;br&gt;still have a skipper internally by using the skip[] directive).
&lt;br&gt;parse_phrase -&amp;gt; for parsing a grammar with an explicit skipper
&lt;br&gt;&lt;br&gt;Example:
&lt;br&gt;rule&amp;lt;Iterator, blank_type&amp;gt; rule_skip;
&lt;br&gt;rule&amp;lt;Iterator&amp;gt; rule_noskip1;
&lt;br&gt;&lt;br&gt;These work:
&lt;br&gt;parse_phrase(b,e, rule_skip, blank);
&lt;br&gt;parse(b,e, rule_noskip)
&lt;br&gt;parse_phrase(b,e, rule_noskip, unused);
&lt;br&gt;parse(b,e, skip(blank)[rule_skip]);
&lt;br&gt;parse_phrase(b,e, skip(blank)[rule_skip], unused);
&lt;br&gt;&lt;br&gt;(I hope I got the syntax right, I am tired...)
&lt;br&gt;&lt;br&gt;These do not work (fail to compile):
&lt;br&gt;parse_phrase(b,e, rule_noskip, blank);
&lt;br&gt;parse(b,e, rule_skip)
&lt;br&gt;&lt;br&gt;------------------------------------------------------------------------------
&lt;br&gt;This SF.Net email is sponsored by the Verizon Developer Community
&lt;br&gt;Take advantage of Verizon's best-in-class app development support
&lt;br&gt;A streamlined, 14 day to market process makes app distribution fast and easy
&lt;br&gt;Join now and get one step closer to millions of Verizon customers
&lt;br&gt;&lt;a href=&quot;http://p.sf.net/sfu/verizon-dev2dev&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://p.sf.net/sfu/verizon-dev2dev&lt;/a&gt;&amp;nbsp;
&lt;br&gt;_______________________________________________
&lt;br&gt;Spirit-general mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26824698&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Spirit-general@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://lists.sourceforge.net/lists/listinfo/spirit-general&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://lists.sourceforge.net/lists/listinfo/spirit-general&lt;/a&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/spirit-general-f3432.html&quot; embed=&quot;fixTarget[3432]&quot; target=&quot;_top&quot; &gt;spirit-general&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/phrase_parse%28%29-or-parse%28%29--tp26824597p26824698.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26824597</id>
	<title>phrase_parse() or parse()?</title>
	<published>2009-12-16T23:44:08Z</published>
	<updated>2009-12-16T23:44:08Z</updated>
	<author>
		<name>Tan, Tom (Shanghai)</name>
	</author>
	<content type="html">&lt;html xmlns:v=&quot;urn:schemas-microsoft-com:vml&quot; xmlns:o=&quot;urn:schemas-microsoft-com:office:office&quot; xmlns:w=&quot;urn:schemas-microsoft-com:office:word&quot; xmlns:x=&quot;urn:schemas-microsoft-com:office:excel&quot; xmlns:p=&quot;urn:schemas-microsoft-com:office:powerpoint&quot; xmlns:a=&quot;urn:schemas-microsoft-com:office:access&quot; xmlns:dt=&quot;uuid:C2F41010-65B3-11d1-A29F-00AA00C14882&quot; xmlns:s=&quot;uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882&quot; xmlns:rs=&quot;urn:schemas-microsoft-com:rowset&quot; xmlns:Z=&quot;urn:schemas-microsoft-com:&quot; xmlns:b=&quot;urn:schemas-microsoft-com:office:publisher&quot; xmlns:ss=&quot;urn:schemas-microsoft-com:office:spreadsheet&quot; xmlns:c=&quot;urn:schemas-microsoft-com:office:component:spreadsheet&quot; xmlns:odc=&quot;urn:schemas-microsoft-com:office:odc&quot; xmlns:oa=&quot;urn:schemas-microsoft-com:office:activation&quot; xmlns:html=&quot;http://www.w3.org/TR/REC-html40&quot; xmlns:q=&quot;http://schemas.xmlsoap.org/soap/envelope/&quot; xmlns:rtc=&quot;http://microsoft.com/officenet/conferencing&quot; xmlns:D=&quot;DAV:&quot; xmlns:Repl=&quot;http://schemas.microsoft.com/repl/&quot; xmlns:mt=&quot;http://schemas.microsoft.com/sharepoint/soap/meetings/&quot; xmlns:x2=&quot;http://schemas.microsoft.com/office/excel/2003/xml&quot; xmlns:ppda=&quot;http://www.passport.com/NameSpace.xsd&quot; xmlns:ois=&quot;http://schemas.microsoft.com/sharepoint/soap/ois/&quot; xmlns:dir=&quot;http://schemas.microsoft.com/sharepoint/soap/directory/&quot; xmlns:ds=&quot;http://www.w3.org/2000/09/xmldsig#&quot; xmlns:dsp=&quot;http://schemas.microsoft.com/sharepoint/dsp&quot; xmlns:udc=&quot;http://schemas.microsoft.com/data/udc&quot; xmlns:xsd=&quot;http://www.w3.org/2001/XMLSchema&quot; xmlns:sub=&quot;http://schemas.microsoft.com/sharepoint/soap/2002/1/alerts/&quot; xmlns:ec=&quot;http://www.w3.org/2001/04/xmlenc#&quot; xmlns:sp=&quot;http://schemas.microsoft.com/sharepoint/&quot; xmlns:sps=&quot;http://schemas.microsoft.com/sharepoint/soap/&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; xmlns:udcs=&quot;http://schemas.microsoft.com/data/udc/soap&quot; xmlns:udcxf=&quot;http://schemas.microsoft.com/data/udc/xmlfile&quot; xmlns:udcp2p=&quot;http://schemas.microsoft.com/data/udc/parttopart&quot; xmlns:wf=&quot;http://schemas.microsoft.com/sharepoint/soap/workflow/&quot; xmlns:dsss=&quot;http://schemas.microsoft.com/office/2006/digsig-setup&quot; xmlns:dssi=&quot;http://schemas.microsoft.com/office/2006/digsig&quot; xmlns:mdssi=&quot;http://schemas.openxmlformats.org/package/2006/digital-signature&quot; xmlns:mver=&quot;http://schemas.openxmlformats.org/markup-compatibility/2006&quot; xmlns:m=&quot;http://schemas.microsoft.com/office/2004/12/omml&quot; xmlns:mrels=&quot;http://schemas.openxmlformats.org/package/2006/relationships&quot; xmlns:spwp=&quot;http://microsoft.com/sharepoint/webpartpages&quot; xmlns:ex12t=&quot;http://schemas.microsoft.com/exchange/services/2006/types&quot; xmlns:ex12m=&quot;http://schemas.microsoft.com/exchange/services/2006/messages&quot; xmlns:pptsl=&quot;http://schemas.microsoft.com/sharepoint/soap/SlideLibrary/&quot; xmlns:spsl=&quot;http://microsoft.com/webservices/SharePointPortalServer/PublishedLinksService&quot; xmlns:st=&quot;&amp;#1;&quot; xmlns=&quot;http://www.w3.org/TR/REC-html40&quot;&gt;

&lt;head&gt;
&lt;meta http-equiv=Content-Type content=&quot;text/html; charset=us-ascii&quot;&gt;
&lt;meta name=Generator content=&quot;Microsoft Word 12 (filtered medium)&quot;&gt;

&lt;!--[if gte mso 9]&gt;&lt;xml&gt;
 &lt;o:shapedefaults v:ext=&quot;edit&quot; spidmax=&quot;1026&quot; /&gt;
&lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;
 &lt;o:shapelayout v:ext=&quot;edit&quot;&gt;
  &lt;o:idmap v:ext=&quot;edit&quot; data=&quot;1&quot; /&gt;
 &lt;/o:shapelayout&gt;&lt;/xml&gt;&lt;![endif]--&gt;
&lt;/head&gt;

&lt;body lang=EN-US link=blue vlink=purple&gt;

&lt;div class=Section1&gt;

&lt;p class=MsoNormal&gt;Hi, this might be a naive question, but I have a question
that cannot be answered even after reading the doc:&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;Except for the apparent different signatures, &lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;

&lt;p class=MsoListParagraph style='text-indent:-18.0pt;mso-list:l0 level1 lfo1'&gt;&lt;![if !supportLists]&gt;&lt;span style='mso-list:Ignore'&gt;-&lt;span style='font:7.0pt &quot;Times New Roman&quot;'&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;![endif]&gt;what are the differences of parse() and phrase_parse()
in terms of&amp;nbsp; implementation, performance etc ? &lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;

&lt;p class=MsoListParagraph style='text-indent:-18.0pt;mso-list:l0 level1 lfo1'&gt;&lt;![if !supportLists]&gt;&lt;span style='mso-list:Ignore'&gt;-&lt;span style='font:7.0pt &quot;Times New Roman&quot;'&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;![endif]&gt;When to use which? &lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;

&lt;p class=MsoListParagraph style='text-indent:-18.0pt;mso-list:l0 level1 lfo1'&gt;&lt;![if !supportLists]&gt;&lt;span style='mso-list:Ignore'&gt;-&lt;span style='font:7.0pt &quot;Times New Roman&quot;'&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;![endif]&gt;Is one a shortcut to a special case of another? And if
so, which one?&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;

&lt;p class=MsoListParagraph style='margin-left:0cm'&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/p&gt;

&lt;p class=MsoListParagraph style='margin-left:0cm'&gt;I am especially puzzled by
term &amp;#8220;phrase level&amp;#8221; compared to &amp;#8220;character level&amp;#8221; as
appearing here: &amp;#8220;&lt;span class=apple-style-span&gt;&lt;span style='font-size:
7.0pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;color:black'&gt;The first form&lt;/span&gt;&lt;/span&gt;&lt;span class=apple-converted-space&gt;&lt;span style='font-size:7.0pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;
color:black'&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span class=identifier&gt;&lt;span style='font-size:
10.0pt;font-family:&quot;Courier New&quot;;color:black'&gt;parse&lt;/span&gt;&lt;/span&gt;&lt;span class=apple-converted-space&gt;&lt;span style='font-size:7.0pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;
color:black'&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span class=apple-style-span&gt;&lt;span style='font-size:7.0pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;color:black'&gt;works on
the character level. The second&lt;/span&gt;&lt;/span&gt;&lt;span class=apple-converted-space&gt;&lt;span style='font-size:7.0pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;color:black'&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span class=identifier&gt;&lt;span style='font-size:10.0pt;font-family:&quot;Courier New&quot;;
color:black'&gt;phrase_parse&lt;/span&gt;&lt;/span&gt;&lt;span class=apple-converted-space&gt;&lt;span style='font-size:7.0pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;color:black'&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span class=apple-style-span&gt;&lt;span style='font-size:7.0pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;
color:black'&gt;works on the phrase level and requires skip parser&lt;/span&gt;&lt;/span&gt; &amp;#8220;
, isn&amp;#8217;t comparing starting from &amp;#8220;&lt;span class=apple-style-span&gt;&lt;span style='font-size:7.0pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;color:black'&gt;the
character level&lt;/span&gt;&lt;/span&gt;&amp;#8221;? How is phrase defined here?&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;

&lt;p class=MsoListParagraph style='margin-left:0cm'&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/p&gt;

&lt;p class=MsoListParagraph style='margin-left:0cm'&gt;Thanks,&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;

&lt;p class=MsoListParagraph style='margin-left:0cm'&gt;-Tom&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;

&lt;/div&gt;

&lt;/body&gt;

&lt;/html&gt;
&lt;br /&gt;------------------------------------------------------------------------------
&lt;br&gt;This SF.Net email is sponsored by the Verizon Developer Community
&lt;br&gt;Take advantage of Verizon's best-in-class app development support
&lt;br&gt;A streamlined, 14 day to market process makes app distribution fast and easy
&lt;br&gt;Join now and get one step closer to millions of Verizon customers
&lt;br&gt;&lt;a href=&quot;http://p.sf.net/sfu/verizon-dev2dev&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://p.sf.net/sfu/verizon-dev2dev&lt;/a&gt;&amp;nbsp;&lt;br /&gt;_______________________________________________
&lt;br&gt;Spirit-general mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26824597&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Spirit-general@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://lists.sourceforge.net/lists/listinfo/spirit-general&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://lists.sourceforge.net/lists/listinfo/spirit-general&lt;/a&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/spirit-general-f3432.html&quot; embed=&quot;fixTarget[3432]&quot; target=&quot;_top&quot; &gt;spirit-general&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/phrase_parse%28%29-or-parse%28%29--tp26824597p26824597.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26824001</id>
	<title>Re: match |foobar| not |foo bar |</title>
	<published>2009-12-16T22:53:29Z</published>
	<updated>2009-12-16T22:53:29Z</updated>
	<author>
		<name>Michael Caisse-2</name>
	</author>
	<content type="html">Carl Barron wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; On Dec 16, 2009, at 11:22 PM, OvermindDL1 wrote:
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; 
&lt;br&gt;&amp;gt;&amp;gt; On Wed, Dec 16, 2009 at 6:42 PM, Carl Barron &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26824001&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;cbarron413@...&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; 
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; result is the &amp;nbsp;'short answere' and no explicit actions.
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; 
&lt;br&gt;&amp;gt;&amp;gt; Well he is wanting to convert spaces to underscores, so he would need
&lt;br&gt;&amp;gt;&amp;gt; actions in that case, or make his own terminal. &amp;nbsp;I just do not know if
&lt;br&gt;&amp;gt;&amp;gt; he wants one underscore per space, or if he wants one underscore per
&lt;br&gt;&amp;gt;&amp;gt; set of spaces. &amp;nbsp;His code signifies the latter.
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; 
&lt;br&gt;&amp;gt; &amp;nbsp; Don't need actions or more primitives. to do the latter. [or the former with a minor change]
&lt;br&gt;&amp;gt; &amp;nbsp; 
&lt;/div&gt;&lt;br&gt;That was clever Carl.
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;&lt;br&gt;----------------------------------
&lt;br&gt;Michael Caisse
&lt;br&gt;Object Modeling Designs
&lt;br&gt;www.objectmodelingdesigns.com
&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;------------------------------------------------------------------------------
&lt;br&gt;This SF.Net email is sponsored by the Verizon Developer Community
&lt;br&gt;Take advantage of Verizon's best-in-class app development support
&lt;br&gt;A streamlined, 14 day to market process makes app distribution fast and easy
&lt;br&gt;Join now and get one step closer to millions of Verizon customers
&lt;br&gt;&lt;a href=&quot;http://p.sf.net/sfu/verizon-dev2dev&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://p.sf.net/sfu/verizon-dev2dev&lt;/a&gt;&amp;nbsp;
&lt;br&gt;_______________________________________________
&lt;br&gt;Spirit-general mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26824001&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Spirit-general@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://lists.sourceforge.net/lists/listinfo/spirit-general&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://lists.sourceforge.net/lists/listinfo/spirit-general&lt;/a&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/spirit-general-f3432.html&quot; embed=&quot;fixTarget[3432]&quot; target=&quot;_top&quot; &gt;spirit-general&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/match-%7Cfoobar%7C-not-%7Cfoo-bar-%7C-tp26810968p26824001.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26823562</id>
	<title>Re: match |foobar| not |foo bar |</title>
	<published>2009-12-16T21:47:34Z</published>
	<updated>2009-12-16T21:47:34Z</updated>
	<author>
		<name>bytecolor-2</name>
	</author>
	<content type="html">OvermindDL1 &amp;lt;overminddl1 &amp;lt;at&amp;gt; gmail.com&amp;gt; writes:
&lt;br&gt;&lt;br&gt;&amp;gt; Well he is wanting to convert spaces to underscores, so he would need
&lt;br&gt;&amp;gt; actions in that case, or make his own terminal. &amp;nbsp;I just do not know if
&lt;br&gt;&amp;gt; he wants one underscore per space, or if he wants one underscore per
&lt;br&gt;&amp;gt; set of spaces. &amp;nbsp;His code signifies the latter.
&lt;br&gt;&lt;br&gt;I did actually want to squeeze the whitespace. Sorry if I wasn't clear
&lt;br&gt;on that. I was more concerned with the trailing ws in the original
&lt;br&gt;post.
&lt;br&gt;&lt;br&gt;lexeme[&amp;alpha &amp;gt;&amp;gt; (+alnum[_val += _1] %
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; (+blank &amp;gt;&amp;gt; &amp;alnum)[_val += '_'])]
&lt;br&gt;|a| &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; -&amp;gt; a
&lt;br&gt;|a b &amp;nbsp;| &amp;nbsp; &amp;nbsp; -&amp;gt; a_b
&lt;br&gt;| a &amp;nbsp; b &amp;nbsp;| &amp;nbsp;-&amp;gt; a_b
&lt;br&gt;| a b &amp;nbsp; 9| &amp;nbsp;-&amp;gt; a_b_9
&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;------------------------------------------------------------------------------
&lt;br&gt;This SF.Net email is sponsored by the Verizon Developer Community
&lt;br&gt;Take advantage of Verizon's best-in-class app development support
&lt;br&gt;A streamlined, 14 day to market process makes app distribution fast and easy
&lt;br&gt;Join now and get one step closer to millions of Verizon customers
&lt;br&gt;&lt;a href=&quot;http://p.sf.net/sfu/verizon-dev2dev&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://p.sf.net/sfu/verizon-dev2dev&lt;/a&gt;&amp;nbsp;
&lt;br&gt;_______________________________________________
&lt;br&gt;Spirit-general mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26823562&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Spirit-general@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://lists.sourceforge.net/lists/listinfo/spirit-general&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://lists.sourceforge.net/lists/listinfo/spirit-general&lt;/a&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/spirit-general-f3432.html&quot; embed=&quot;fixTarget[3432]&quot; target=&quot;_top&quot; &gt;spirit-general&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/match-%7Cfoobar%7C-not-%7Cfoo-bar-%7C-tp26810968p26823562.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26823349</id>
	<title>Re: match |foobar| not |foo bar |</title>
	<published>2009-12-16T21:10:40Z</published>
	<updated>2009-12-16T21:10:40Z</updated>
	<author>
		<name>OvermindDL1</name>
	</author>
	<content type="html">On Wed, Dec 16, 2009 at 9:51 PM, Carl Barron &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26823349&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;cbarron413@...&lt;/a&gt;&amp;gt; wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; On Dec 16, 2009, at 11:22 PM, OvermindDL1 wrote:
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; On Wed, Dec 16, 2009 at 6:42 PM, Carl Barron &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26823349&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;cbarron413@...&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; result is the  'short answere' and no explicit actions.
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; Well he is wanting to convert spaces to underscores, so he would need
&lt;br&gt;&amp;gt;&amp;gt; actions in that case, or make his own terminal.  I just do not know if
&lt;br&gt;&amp;gt;&amp;gt; he wants one underscore per space, or if he wants one underscore per
&lt;br&gt;&amp;gt;&amp;gt; set of spaces.  His code signifies the latter.
&lt;br&gt;&amp;gt;  Don't need actions or more primitives. to do the latter. [or the former with a minor change]
&lt;/div&gt;&lt;br&gt;Yeah, quite true...
&lt;br&gt;To replace any number of spaces by an underscore:
&lt;br&gt;&lt;br&gt;// No need for raw or lexeme with this rule type
&lt;br&gt;// This will replace any number of blanks with a single _
&lt;br&gt;rule&amp;lt;Iterator, std::string()&amp;gt; r = alpha &amp;gt;&amp;gt; *(
&lt;br&gt;((omit[+blank]&amp;gt;&amp;gt;attr('_'))|eps) &amp;gt;&amp;gt; alnum));
&lt;br&gt;&lt;br&gt;Probably not the most pretty it could be, and you do not need all of
&lt;br&gt;those parenthesis (but I am parenthesis-happy), but it should work.
&lt;br&gt;&lt;br&gt;------------------------------------------------------------------------------
&lt;br&gt;This SF.Net email is sponsored by the Verizon Developer Community
&lt;br&gt;Take advantage of Verizon's best-in-class app development support
&lt;br&gt;A streamlined, 14 day to market process makes app distribution fast and easy
&lt;br&gt;Join now and get one step closer to millions of Verizon customers
&lt;br&gt;&lt;a href=&quot;http://p.sf.net/sfu/verizon-dev2dev&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://p.sf.net/sfu/verizon-dev2dev&lt;/a&gt;&amp;nbsp;
&lt;br&gt;_______________________________________________
&lt;br&gt;Spirit-general mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26823349&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Spirit-general@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://lists.sourceforge.net/lists/listinfo/spirit-general&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://lists.sourceforge.net/lists/listinfo/spirit-general&lt;/a&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/spirit-general-f3432.html&quot; embed=&quot;fixTarget[3432]&quot; target=&quot;_top&quot; &gt;spirit-general&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/match-%7Cfoobar%7C-not-%7Cfoo-bar-%7C-tp26810968p26823349.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26823174</id>
	<title>Re: match |foobar| not |foo bar |</title>
	<published>2009-12-16T20:51:56Z</published>
	<updated>2009-12-16T20:51:56Z</updated>
	<author>
		<name>CARL BARRON-3</name>
	</author>
	<content type="html">&lt;br&gt;On Dec 16, 2009, at 11:22 PM, OvermindDL1 wrote:
&lt;br&gt;&lt;br&gt;&amp;gt; On Wed, Dec 16, 2009 at 6:42 PM, Carl Barron &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26823174&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;cbarron413@...&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt;&amp;gt; result is the &amp;nbsp;'short answere' and no explicit actions.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; Well he is wanting to convert spaces to underscores, so he would need
&lt;br&gt;&amp;gt; actions in that case, or make his own terminal. &amp;nbsp;I just do not know if
&lt;br&gt;&amp;gt; he wants one underscore per space, or if he wants one underscore per
&lt;br&gt;&amp;gt; set of spaces. &amp;nbsp;His code signifies the latter.
&lt;br&gt;&amp;nbsp; Don't need actions or more primitives. to do the latter. [or the former with a minor change]
&lt;br&gt;&lt;br /&gt; &lt;br /&gt;------------------------------------------------------------------------------
&lt;br&gt;This SF.Net email is sponsored by the Verizon Developer Community
&lt;br&gt;Take advantage of Verizon's best-in-class app development support
&lt;br&gt;A streamlined, 14 day to market process makes app distribution fast and easy
&lt;br&gt;Join now and get one step closer to millions of Verizon customers
&lt;br&gt;&lt;a href=&quot;http://p.sf.net/sfu/verizon-dev2dev&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://p.sf.net/sfu/verizon-dev2dev&lt;/a&gt;&amp;nbsp;&lt;br /&gt;_______________________________________________
&lt;br&gt;Spirit-general mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26823174&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Spirit-general@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://lists.sourceforge.net/lists/listinfo/spirit-general&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://lists.sourceforge.net/lists/listinfo/spirit-general&lt;/a&gt;&lt;br&gt;&lt;div class=&quot;small&quot;&gt;&lt;br/&gt;&lt;img src=&quot;http://old.nabble.com/images/icon_attachment.gif&quot; &gt; &lt;strong&gt;main.cpp&lt;/strong&gt; (776 bytes) &lt;a href=&quot;http://old.nabble.com/attachment/26823174/0/main.cpp&quot; target=&quot;_top&quot;&gt;Download Attachment&lt;/a&gt;&lt;/div&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/spirit-general-f3432.html&quot; embed=&quot;fixTarget[3432]&quot; target=&quot;_top&quot; &gt;spirit-general&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/match-%7Cfoobar%7C-not-%7Cfoo-bar-%7C-tp26810968p26823174.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26822945</id>
	<title>Re: match |foobar| not |foo bar |</title>
	<published>2009-12-16T20:22:50Z</published>
	<updated>2009-12-16T20:22:50Z</updated>
	<author>
		<name>OvermindDL1</name>
	</author>
	<content type="html">On Wed, Dec 16, 2009 at 6:42 PM, Carl Barron &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26822945&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;cbarron413@...&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt; result is the  'short answere' and no explicit actions.
&lt;br&gt;&lt;br&gt;Well he is wanting to convert spaces to underscores, so he would need
&lt;br&gt;actions in that case, or make his own terminal. &amp;nbsp;I just do not know if
&lt;br&gt;he wants one underscore per space, or if he wants one underscore per
&lt;br&gt;set of spaces. &amp;nbsp;His code signifies the latter.
&lt;br&gt;&lt;br&gt;------------------------------------------------------------------------------
&lt;br&gt;This SF.Net email is sponsored by the Verizon Developer Community
&lt;br&gt;Take advantage of Verizon's best-in-class app development support
&lt;br&gt;A streamlined, 14 day to market process makes app distribution fast and easy
&lt;br&gt;Join now and get one step closer to millions of Verizon customers
&lt;br&gt;&lt;a href=&quot;http://p.sf.net/sfu/verizon-dev2dev&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://p.sf.net/sfu/verizon-dev2dev&lt;/a&gt;&amp;nbsp;
&lt;br&gt;_______________________________________________
&lt;br&gt;Spirit-general mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26822945&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Spirit-general@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://lists.sourceforge.net/lists/listinfo/spirit-general&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://lists.sourceforge.net/lists/listinfo/spirit-general&lt;/a&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/spirit-general-f3432.html&quot; embed=&quot;fixTarget[3432]&quot; target=&quot;_top&quot; &gt;spirit-general&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/match-%7Cfoobar%7C-not-%7Cfoo-bar-%7C-tp26810968p26822945.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26822119</id>
	<title>Re: match |foobar| not |foo bar |</title>
	<published>2009-12-16T17:44:29Z</published>
	<updated>2009-12-16T17:44:29Z</updated>
	<author>
		<name>bytecolor-2</name>
	</author>
	<content type="html">Daniel James &amp;lt;daniel_james &amp;lt;at&amp;gt; fmail.co.uk&amp;gt; writes:
&lt;br&gt;&lt;br&gt;&amp;gt; Sorry, it's actually due to backtracking, it calls the action after
&lt;br&gt;&amp;gt; parsing the trailing blanks, but before realising that they're not
&lt;br&gt;&amp;gt; followed by an 'alnum' and backtracking. So the solution is to check
&lt;br&gt;&amp;gt; before the action:
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; lexeme[&amp;alpha
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;gt;&amp;gt; (+alnum[_val += _1] % (+blank &amp;gt;&amp;gt; &amp;alnum)[_val += &amp;quot;_&amp;quot;])]
&lt;br&gt;&amp;gt; 
&lt;br&gt;&lt;br&gt;I think we have a winner. I believe the word `elegant' is appropriate
&lt;br&gt;here. That's a very cool bit of code.
&lt;br&gt;&lt;br&gt;&amp;gt; No, that's wrong (see above). Even if it was right, you can't call
&lt;br&gt;&amp;gt; members of phoenix placeholders like that (since they can't overload
&lt;br&gt;&amp;gt; '.'), you have to either use bind, or by using '-&amp;gt;*'.
&lt;br&gt;&lt;br&gt;I need to read up on actors.
&lt;br&gt;&lt;br&gt;I think Spirit is similar to my brain in that I'm only utilizing a
&lt;br&gt;small percentage of its potential.
&lt;br&gt;&lt;br&gt;Thanks for the lesson Daniel.
&lt;br&gt;&lt;br&gt;You know I was thinking (I do that a lot) there must be literally
&lt;br&gt;hundreds of unique parsers like this on the list. If they could
&lt;br&gt;somehow be categorized and stored... Actually finding what you are
&lt;br&gt;looking for in the repo might prove to be a challenge though.
&lt;br&gt;Maybe tags.
&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;------------------------------------------------------------------------------
&lt;br&gt;This SF.Net email is sponsored by the Verizon Developer Community
&lt;br&gt;Take advantage of Verizon's best-in-class app development support
&lt;br&gt;A streamlined, 14 day to market process makes app distribution fast and easy
&lt;br&gt;Join now and get one step closer to millions of Verizon customers
&lt;br&gt;&lt;a href=&quot;http://p.sf.net/sfu/verizon-dev2dev&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://p.sf.net/sfu/verizon-dev2dev&lt;/a&gt;&amp;nbsp;
&lt;br&gt;_______________________________________________
&lt;br&gt;Spirit-general mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26822119&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Spirit-general@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://lists.sourceforge.net/lists/listinfo/spirit-general&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://lists.sourceforge.net/lists/listinfo/spirit-general&lt;/a&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/spirit-general-f3432.html&quot; embed=&quot;fixTarget[3432]&quot; target=&quot;_top&quot; &gt;spirit-general&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/match-%7Cfoobar%7C-not-%7Cfoo-bar-%7C-tp26810968p26822119.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26822849</id>
	<title>Re: match |foobar| not |foo bar |</title>
	<published>2009-12-16T17:42:33Z</published>
	<updated>2009-12-16T17:42:33Z</updated>
	<author>
		<name>CARL BARRON-3</name>
	</author>
	<content type="html">&lt;br&gt;On Dec 16, 2009, at 8:23 AM, bytecolor wrote:
&lt;br&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; I'd like to parse:
&lt;br&gt;&amp;gt; an identifier with spaces in it
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; So I use:
&lt;br&gt;&amp;gt; lexeme[alpha &amp;gt;&amp;gt; *(alpha | blank)]
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; but it matches
&lt;br&gt;&amp;gt; |an identifier with spaces in it &amp;nbsp; | &amp;nbsp;&amp;lt;- trailing whitespace
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; instead of
&lt;br&gt;&amp;gt; |an identifier with spaces in it| &amp;nbsp; &amp;nbsp; &amp;lt;- no trailing whitespace
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; I'm already incorporating semantic actions to convert the blanks to
&lt;br&gt;&amp;gt; underscores, so it would be nothing to chop the trailing whitespace
&lt;br&gt;&amp;gt; at the same time. But I was wondering if there was a way to do this.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; In a Python regular expression, it would be:
&lt;br&gt;&amp;gt; [A-Za-z](?:[A-Za-z0-9 \v\t]*[A-Za-z0-9])?
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; Which I thought would translate to:
&lt;br&gt;&amp;gt; alpha &amp;gt;&amp;gt; -(*(alnum | blank) &amp;gt;&amp;gt; alnum)
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; With [_val += _1] all around it compiles but does not match. I think
&lt;br&gt;&amp;gt; *(alnum | blank) is greedy, not leaving anything for the last alnum,
&lt;br&gt;&amp;gt; unlike the Python regex. Even though I'm using the greedy op there
&lt;br&gt;&amp;gt; instead of *?.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; Just a curiosity, really.
&lt;/div&gt;&lt;br&gt;&amp;nbsp; Short answer &amp;nbsp; var = &amp;nbsp;raw[lexeme[ alpha &amp;gt;&amp;gt; *(*blank &amp;gt;&amp;gt; alnum) ]];
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp;a ( b | c)* b &amp;nbsp; in EBNF &amp;nbsp;[qi notation but not desired &amp;nbsp;a &amp;gt;&amp;gt; *( b|c ) &amp;gt;&amp;gt; b]
&lt;br&gt;The problem is qi would match all the b's inside the op *() so we need to be more specific. We want
&lt;br&gt;what ever is matched in op *() to end with a b. &amp;nbsp;*c &amp;gt;&amp;gt; b &amp;nbsp;does the trick.
&lt;br&gt;&amp;nbsp; &amp;nbsp;var = &amp;nbsp; alpha &amp;gt;&amp;gt; *( *blank &amp;gt;&amp;gt; alnum));
&lt;br&gt;&lt;br&gt;&amp;nbsp; lexeme to not apply the skipper, and raw to get it as an iterator_range, which is convertable to
&lt;br&gt;std::string.
&lt;br&gt;&lt;br&gt;result is the &amp;nbsp;'short answere' and no explicit actions.
&lt;br&gt;&lt;br&gt;&lt;br&gt;------------------------------------------------------------------------------
&lt;br&gt;This SF.Net email is sponsored by the Verizon Developer Community
&lt;br&gt;Take advantage of Verizon's best-in-class app development support
&lt;br&gt;A streamlined, 14 day to market process makes app distribution fast and easy
&lt;br&gt;Join now and get one step closer to millions of Verizon customers
&lt;br&gt;&lt;a href=&quot;http://p.sf.net/sfu/verizon-dev2dev&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://p.sf.net/sfu/verizon-dev2dev&lt;/a&gt;&amp;nbsp;
&lt;br&gt;_______________________________________________
&lt;br&gt;Spirit-general mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26822849&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Spirit-general@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://lists.sourceforge.net/lists/listinfo/spirit-general&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://lists.sourceforge.net/lists/listinfo/spirit-general&lt;/a&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/spirit-general-f3432.html&quot; embed=&quot;fixTarget[3432]&quot; target=&quot;_top&quot; &gt;spirit-general&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/match-%7Cfoobar%7C-not-%7Cfoo-bar-%7C-tp26810968p26822849.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26821420</id>
	<title>Re: match |foobar| not |foo bar |</title>
	<published>2009-12-16T17:00:30Z</published>
	<updated>2009-12-16T17:00:30Z</updated>
	<author>
		<name>Daniel James</name>
	</author>
	<content type="html">2009/12/16 bytecolor &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26821420&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;bytecolor@...&lt;/a&gt;&amp;gt;:
&lt;br&gt;&amp;gt; Daniel James &amp;lt;daniel_james &amp;lt;at&amp;gt; fmail.co.uk&amp;gt; writes:
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; lexeme[α
&lt;br&gt;&lt;br&gt;Funny, something thinks that '&amp;alpha' is the html character entity '&amp;alpha;'.
&lt;br&gt;&lt;br&gt;&amp;gt;&amp;gt; lexeme[&amp;alpha
&lt;br&gt;&amp;gt;&amp;gt;     &amp;gt;&amp;gt; (+alnum[_val += _1] % (+blank)[_val += &amp;quot;_&amp;quot;])]
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; I had been looking at the peek operator but couldn't quite figure out
&lt;br&gt;&amp;gt; how to incorporate it. Make sense now. I actually had *blank after
&lt;br&gt;&amp;gt; the initial alpha. I tried a few dozen variants but a trailing '_'
&lt;br&gt;&amp;gt; still gets appended.
&lt;br&gt;&lt;br&gt;Sorry, it's actually due to backtracking, it calls the action after
&lt;br&gt;parsing the trailing blanks, but before realising that they're not
&lt;br&gt;followed by an 'alnum' and backtracking. So the solution is to check
&lt;br&gt;before the action:
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; lexeme[&amp;alpha
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;gt;&amp;gt; (+alnum[_val += _1] % (+blank &amp;gt;&amp;gt; &amp;alnum)[_val += &amp;quot;_&amp;quot;])]
&lt;br&gt;&lt;br&gt;This kind of problem turns up when putting actions inside expressions,
&lt;br&gt;it doesn't happen with synthesized attributes.
&lt;br&gt;&lt;br&gt;&amp;gt; I *think* (+blank) is triggering the action even if it does not match
&lt;br&gt;&amp;gt; on the final pass. I tried using a few variations of:&amp;gt; (+blank)[if_(_1.size())[_val += '_']]
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; but I get 'no size() member error'.
&lt;br&gt;&lt;br&gt;No, that's wrong (see above). Even if it was right, you can't call
&lt;br&gt;members of phoenix placeholders like that (since they can't overload
&lt;br&gt;'.'), you have to either use bind, or by using '-&amp;gt;*'.
&lt;br&gt;&lt;br&gt;&amp;gt; I can't tell what (+blank) is
&lt;br&gt;&amp;gt; synthesizing. I though it would be a vector&amp;lt;char&amp;gt;, but from the
&lt;br&gt;&amp;gt; error diag it looks like the parens are creating a
&lt;br&gt;&amp;gt; vector1&amp;lt;vector&amp;lt;char&amp;gt; &amp;gt;. Not sure.
&lt;br&gt;&lt;br&gt;It's 'std::vector&amp;lt;char&amp;gt;'. What you're seeing is the way spirit packs
&lt;br&gt;the attributes when it calls the actions. The phoenix placeholders
&lt;br&gt;that spirit provides unpacks these attributes. If you don't use those
&lt;br&gt;placeholders you have to do it yourself manually (not advisable).
&lt;br&gt;&lt;br&gt;Daniel
&lt;br&gt;&lt;br&gt;------------------------------------------------------------------------------
&lt;br&gt;This SF.Net email is sponsored by the Verizon Developer Community
&lt;br&gt;Take advantage of Verizon's best-in-class app development support
&lt;br&gt;A streamlined, 14 day to market process makes app distribution fast and easy
&lt;br&gt;Join now and get one step closer to millions of Verizon customers
&lt;br&gt;&lt;a href=&quot;http://p.sf.net/sfu/verizon-dev2dev&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://p.sf.net/sfu/verizon-dev2dev&lt;/a&gt;&amp;nbsp;
&lt;br&gt;_______________________________________________
&lt;br&gt;Spirit-general mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26821420&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Spirit-general@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://lists.sourceforge.net/lists/listinfo/spirit-general&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://lists.sourceforge.net/lists/listinfo/spirit-general&lt;/a&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/spirit-general-f3432.html&quot; embed=&quot;fixTarget[3432]&quot; target=&quot;_top&quot; &gt;spirit-general&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/match-%7Cfoobar%7C-not-%7Cfoo-bar-%7C-tp26810968p26821420.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26820143</id>
	<title>Re: match |foobar| not |foo bar |</title>
	<published>2009-12-16T15:05:25Z</published>
	<updated>2009-12-16T15:05:25Z</updated>
	<author>
		<name>bytecolor-2</name>
	</author>
	<content type="html">Daniel James &amp;lt;daniel_james &amp;lt;at&amp;gt; fmail.co.uk&amp;gt; writes:
&lt;br&gt;&lt;br&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; Do you want it to match 'a b'? How about:
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; lexeme[α
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;gt;&amp;gt; (+alnum[_val += _1] % blank[_val += &amp;quot;_&amp;quot;])]
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; The 'α' matches a character but doesn't consume it. And if you
&lt;br&gt;&amp;gt; want to allow more than one consecutive whitespace character:
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; lexeme[α
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;gt;&amp;gt; (+alnum[_val += _1] % (+blank)[_val += &amp;quot;_&amp;quot;])]
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; Daniel
&lt;/div&gt;&lt;br&gt;I had been looking at the peek operator but couldn't quite figure out
&lt;br&gt;how to incorporate it. Make sense now. I actually had *blank after
&lt;br&gt;the initial alpha. I tried a few dozen variants but a trailing '_'
&lt;br&gt;still gets appended.
&lt;br&gt;&lt;br&gt;I *think* (+blank) is triggering the action even if it does not match
&lt;br&gt;on the final pass. I tried using a few variations of:
&lt;br&gt;&lt;br&gt;(+blank)[if_(_1.size())[_val += '_']]
&lt;br&gt;&lt;br&gt;but I get 'no size() member error'. I can't tell what (+blank) is
&lt;br&gt;synthesizing. I though it would be a vector&amp;lt;char&amp;gt;, but from the
&lt;br&gt;error diag it looks like the parens are creating a
&lt;br&gt;vector1&amp;lt;vector&amp;lt;char&amp;gt; &amp;gt;. Not sure.
&lt;br&gt;&lt;br&gt;&lt;br&gt;------------------------------------------------------------------------------
&lt;br&gt;This SF.Net email is sponsored by the Verizon Developer Community
&lt;br&gt;Take advantage of Verizon's best-in-class app development support
&lt;br&gt;A streamlined, 14 day to market process makes app distribution fast and easy
&lt;br&gt;Join now and get one step closer to millions of Verizon customers
&lt;br&gt;&lt;a href=&quot;http://p.sf.net/sfu/verizon-dev2dev&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://p.sf.net/sfu/verizon-dev2dev&lt;/a&gt;&amp;nbsp;
&lt;br&gt;_______________________________________________
&lt;br&gt;Spirit-general mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26820143&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Spirit-general@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://lists.sourceforge.net/lists/listinfo/spirit-general&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://lists.sourceforge.net/lists/listinfo/spirit-general&lt;/a&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/spirit-general-f3432.html&quot; embed=&quot;fixTarget[3432]&quot; target=&quot;_top&quot; &gt;spirit-general&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/match-%7Cfoobar%7C-not-%7Cfoo-bar-%7C-tp26810968p26820143.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26819852</id>
	<title>Re: hanging grammar??</title>
	<published>2009-12-16T14:46:09Z</published>
	<updated>2009-12-16T14:46:09Z</updated>
	<author>
		<name>dWiGhT-TX</name>
	</author>
	<content type="html">Ok... figured out that the &amp;quot;eoi&amp;quot; was the issue... 
&lt;br&gt;&lt;br&gt;changing these lines makes it work as expected:
&lt;br&gt;&amp;nbsp; &amp;nbsp; lines2Convert %= ((oneLine | twoLine | bypassLine)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;gt;&amp;gt; ( eol[_val += '\n'] );
&lt;br&gt;&amp;nbsp; &amp;nbsp; bypassLine %= *(char_ - eol);
&lt;br&gt;&lt;br&gt;&lt;br&gt;... sometimes you just have to search before posting... &amp;quot;; )
&lt;br&gt;&lt;br&gt;dWiGhT
&lt;br&gt;&lt;br&gt;&lt;blockquote class=&quot;quote light-black dark-border-color&quot;&gt;&lt;div class=&quot;quote light-border-color&quot;&gt;
&lt;div class=&quot;quote-author&quot; style=&quot;font-weight: bold;&quot;&gt;dWiGhT-TX wrote:&lt;/div&gt;
&lt;div class=&quot;quote-message shrinkable-quote&quot;&gt;First a disclaimer: &amp;nbsp;I'm a Spirit virgin and just starting to play around with
&lt;br&gt;v2.1... so please keep that in mind. &amp;nbsp;(thanks)
&lt;br&gt;&lt;br&gt;Ok... playing around with Spirit v2.1 and put this together to take a string as
&lt;br&gt;input and output the converted string as a little test.
&lt;br&gt;&lt;br&gt;Here is the part of the grammar:
&lt;br&gt;...
&lt;br&gt;&amp;nbsp; &amp;nbsp; convertLines = eps[_val = &amp;quot;&amp;quot;] &amp;gt;&amp;gt; *lines2Convert[_val += _1];
&lt;br&gt;&amp;nbsp; &amp;nbsp; lines2Convert %= ((oneLine | twoLine ) &amp;gt;&amp;gt; (eol[_val += '\n'] | eoi));
&lt;br&gt;&amp;nbsp; &amp;nbsp; oneLine = lit(&amp;quot;one&amp;quot;)[_val = &amp;quot;ONE&amp;quot;];
&lt;br&gt;&amp;nbsp; &amp;nbsp; twoLine = lit(&amp;quot;two&amp;quot;)[_val = &amp;quot;TWO&amp;quot;];
&lt;br&gt;...
&lt;br&gt;&lt;br&gt;All the rules are defined as having the std::string attribute. &amp;nbsp;I use
&lt;br&gt;qi::parse() to parse so that I don't use a skip parser.
&lt;br&gt;&lt;br&gt;This works correctly for parsing something like this, &amp;quot;one\ntwo\ntwo\none&amp;quot;
&lt;br&gt;returning &amp;quot;ONE\nTWO\nTWO\nONE&amp;quot;.
&lt;br&gt;&lt;br&gt;So now if I want it to handle lines that don't start with &amp;quot;one&amp;quot; or &amp;quot;two&amp;quot; by just
&lt;br&gt;passing them though I add the rule &amp;quot;bypassLine&amp;quot;
&lt;br&gt;...
&lt;br&gt;&amp;nbsp; &amp;nbsp; lines2Convert %= ((oneLine | twoLine | bypassLine)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;gt;&amp;gt; (eol[_val += '\n'] | eoi));
&lt;br&gt;&amp;nbsp; &amp;nbsp; bypassLine %= *(char_ - (eol | eoi));
&lt;br&gt;...
&lt;br&gt;&lt;br&gt;This will hang when parsing this &amp;quot;one\ntwo\nNotALine\ntwo\none\n&amp;quot; (actually it
&lt;br&gt;hangs with anything passed to it)...
&lt;br&gt;&lt;br&gt;couple of things:
&lt;br&gt;1) I can't determine what is going on, it looks like it should work
&lt;br&gt;2) Is there any good way to debug something like this?
&lt;br&gt;&lt;br&gt;&lt;b&gt;Thanks in advance!!!&lt;/b&gt;&lt;br&gt;&lt;br&gt;dWiGhT
&lt;/div&gt;
&lt;/div&gt;&lt;/blockquote&gt;
&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/spirit-general-f3432.html&quot; embed=&quot;fixTarget[3432]&quot; target=&quot;_top&quot; &gt;spirit-general&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/hanging-grammar---tp26819267p26819852.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26819267</id>
	<title>hanging grammar??</title>
	<published>2009-12-16T14:03:48Z</published>
	<updated>2009-12-16T14:03:48Z</updated>
	<author>
		<name>dWiGhT-TX</name>
	</author>
	<content type="html">First a disclaimer: &amp;nbsp;I'm a Spirit virgin and just starting to play around with
&lt;br&gt;v2.1... so please keep that in mind. &amp;nbsp;(thanks)
&lt;br&gt;&lt;br&gt;Ok... playing around with Spirit v2.1 and put this together to take a string as
&lt;br&gt;input and output the converted string as a little test.
&lt;br&gt;&lt;br&gt;Here is the part of the grammar:
&lt;br&gt;...
&lt;br&gt;&amp;nbsp; &amp;nbsp; convertLines = eps[_val = &amp;quot;&amp;quot;] &amp;gt;&amp;gt; *lines2Convert[_val += _1];
&lt;br&gt;&amp;nbsp; &amp;nbsp; lines2Convert %= ((oneLine | twoLine ) &amp;gt;&amp;gt; (eol[_val += '\n'] | eoi));
&lt;br&gt;&amp;nbsp; &amp;nbsp; oneLine = lit(&amp;quot;one&amp;quot;)[_val = &amp;quot;ONE&amp;quot;];
&lt;br&gt;&amp;nbsp; &amp;nbsp; twoLine = lit(&amp;quot;two&amp;quot;)[_val = &amp;quot;TWO&amp;quot;];
&lt;br&gt;...
&lt;br&gt;&lt;br&gt;All the rules are defined as having the std::string attribute. &amp;nbsp;I use
&lt;br&gt;qi::parse() to parse so that I don't use a skip parser.
&lt;br&gt;&lt;br&gt;This works correctly for parsing something like this, &amp;quot;one\ntwo\ntwo\none&amp;quot;
&lt;br&gt;returning &amp;quot;ONE\nTWO\nTWO\nONE&amp;quot;.
&lt;br&gt;&lt;br&gt;So now if I want it to handle lines that don't start with &amp;quot;one&amp;quot; or &amp;quot;two&amp;quot; by just
&lt;br&gt;passing them though I add the rule &amp;quot;bypassLine&amp;quot;
&lt;br&gt;...
&lt;br&gt;&amp;nbsp; &amp;nbsp; lines2Convert %= ((oneLine | twoLine | bypassLine)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;gt;&amp;gt; (eol[_val += '\n'] | eoi));
&lt;br&gt;&amp;nbsp; &amp;nbsp; bypassLine %= *(char_ - (eol | eoi));
&lt;br&gt;...
&lt;br&gt;&lt;br&gt;This will hang when parsing this &amp;quot;one\ntwo\nNotALine\ntwo\none\n&amp;quot; (actually it
&lt;br&gt;hangs with anything passed to it)...
&lt;br&gt;&lt;br&gt;couple of things:
&lt;br&gt;1) I can't determine what is going on, it looks like it should work
&lt;br&gt;2) Is there any good way to debug something like this?
&lt;br&gt;&lt;br&gt;&lt;b&gt;Thanks in advance!!!&lt;/b&gt;&lt;br&gt;&lt;br&gt;dWiGhT
&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/spirit-general-f3432.html&quot; embed=&quot;fixTarget[3432]&quot; target=&quot;_top&quot; &gt;spirit-general&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/hanging-grammar---tp26819267p26819267.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26814819</id>
	<title>Re: match |foobar| not |foo bar |</title>
	<published>2009-12-16T09:12:39Z</published>
	<updated>2009-12-16T09:12:39Z</updated>
	<author>
		<name>Daniel James</name>
	</author>
	<content type="html">2009/12/16 bytecolor &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26814819&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;bytecolor@...&lt;/a&gt;&amp;gt;:
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Ah, thanks OvermindDL1. I had to finesse it a bit:
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; lexeme[alpha[_val += _1]
&lt;br&gt;&amp;gt;       &amp;gt;&amp;gt; -(+alnum[_val += _1] % blank[_val += &amp;quot;_&amp;quot;])]
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; No more chopper.
&lt;br&gt;&lt;br&gt;Do you want it to match 'a b'? How about:
&lt;br&gt;&lt;br&gt;lexeme[&amp;alpha
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;gt;&amp;gt; (+alnum[_val += _1] % blank[_val += &amp;quot;_&amp;quot;])]
&lt;br&gt;&lt;br&gt;The '&amp;alpha' matches a character but doesn't consume it. And if you
&lt;br&gt;want to allow more than one consecutive whitespace character:
&lt;br&gt;&lt;br&gt;lexeme[&amp;alpha
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;gt;&amp;gt; (+alnum[_val += _1] % (+blank)[_val += &amp;quot;_&amp;quot;])]
&lt;br&gt;&lt;br&gt;Daniel
&lt;br&gt;&lt;br&gt;------------------------------------------------------------------------------
&lt;br&gt;This SF.Net email is sponsored by the Verizon Developer Community
&lt;br&gt;Take advantage of Verizon's best-in-class app development support
&lt;br&gt;A streamlined, 14 day to market process makes app distribution fast and easy
&lt;br&gt;Join now and get one step closer to millions of Verizon customers
&lt;br&gt;&lt;a href=&quot;http://p.sf.net/sfu/verizon-dev2dev&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://p.sf.net/sfu/verizon-dev2dev&lt;/a&gt;&amp;nbsp;
&lt;br&gt;_______________________________________________
&lt;br&gt;Spirit-general mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26814819&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Spirit-general@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://lists.sourceforge.net/lists/listinfo/spirit-general&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://lists.sourceforge.net/lists/listinfo/spirit-general&lt;/a&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/spirit-general-f3432.html&quot; embed=&quot;fixTarget[3432]&quot; target=&quot;_top&quot; &gt;spirit-general&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/match-%7Cfoobar%7C-not-%7Cfoo-bar-%7C-tp26810968p26814819.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26814365</id>
	<title>calc_ast: ast analysis</title>
	<published>2009-12-16T08:47:57Z</published>
	<updated>2009-12-16T08:47:57Z</updated>
	<author>
		<name>hauns</name>
	</author>
	<content type="html">one of the advertised benefits for spirit2 is the fact that the ast comes for free (albeit not very well documented). as some of you know i have been looking into the calc2_ast example recently.
&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://svn.boost.org/trac/boost/browser/trunk/libs/spirit/example/qi/calc2_ast.cpp&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://svn.boost.org/trac/boost/browser/trunk/libs/spirit/example/qi/calc2_ast.cpp&lt;/a&gt;&amp;nbsp;
&lt;br&gt;&lt;br&gt;i am interested in tagging the tree with level numbers. e.g., topmost (level 0) is an (binary) operator, which has a left and right and side expression underneath (levels 1, each). is there an elegant way to get to those levels? specifically,
&lt;br&gt;- should i attempt the level tagging while parsing, i.e., in the grammar (i currently do not see a way how a parsing rule can know about is parent, i.e., the rule it was called from)
&lt;br&gt;- or should this ideally be done in a post processing step (i.e., walking the tree akin to ast_print and trying to keep an index somehow)
&lt;br&gt;- for both alternatives i do not see how to pass down an index elegantly as it is all based on rigid boost interfaces (apply_visitor) 
&lt;br&gt;&lt;br&gt;i'd like to do the right thing from the beginning, so any insights/suggestions (maybe with reference to the example) are very much appreciated.
&lt;br&gt;&lt;br&gt;&lt;br&gt;------------------------------------------------------------------------------
&lt;br&gt;This SF.Net email is sponsored by the Verizon Developer Community
&lt;br&gt;Take advantage of Verizon's best-in-class app development support
&lt;br&gt;A streamlined, 14 day to market process makes app distribution fast and easy
&lt;br&gt;Join now and get one step closer to millions of Verizon customers
&lt;br&gt;&lt;a href=&quot;http://p.sf.net/sfu/verizon-dev2dev&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://p.sf.net/sfu/verizon-dev2dev&lt;/a&gt;&amp;nbsp;
&lt;br&gt;_______________________________________________
&lt;br&gt;Spirit-general mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26814365&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Spirit-general@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://lists.sourceforge.net/lists/listinfo/spirit-general&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://lists.sourceforge.net/lists/listinfo/spirit-general&lt;/a&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/spirit-general-f3432.html&quot; embed=&quot;fixTarget[3432]&quot; target=&quot;_top&quot; &gt;spirit-general&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/calc_ast%3A-ast-analysis-tp26814365p26814365.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26813448</id>
	<title>Re: ast for expressions: phoenix functions</title>
	<published>2009-12-16T07:52:43Z</published>
	<updated>2009-12-16T07:52:43Z</updated>
	<author>
		<name>hauns</name>
	</author>
	<content type="html">i didn't try this one but declaring TWO locals worked. thanks 
&lt;br&gt;everyone who contributed!i feel much more comfortable with the
&lt;br&gt;&amp;nbsp;framework now, only after a few days.
&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;------------------------------------------------------------------------------
&lt;br&gt;This SF.Net email is sponsored by the Verizon Developer Community
&lt;br&gt;Take advantage of Verizon's best-in-class app development support
&lt;br&gt;A streamlined, 14 day to market process makes app distribution fast and easy
&lt;br&gt;Join now and get one step closer to millions of Verizon customers
&lt;br&gt;&lt;a href=&quot;http://p.sf.net/sfu/verizon-dev2dev&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://p.sf.net/sfu/verizon-dev2dev&lt;/a&gt;&amp;nbsp;
&lt;br&gt;_______________________________________________
&lt;br&gt;Spirit-general mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26813448&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Spirit-general@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://lists.sourceforge.net/lists/listinfo/spirit-general&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://lists.sourceforge.net/lists/listinfo/spirit-general&lt;/a&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/spirit-general-f3432.html&quot; embed=&quot;fixTarget[3432]&quot; target=&quot;_top&quot; &gt;spirit-general&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/ast-for-expressions%3A-phoenix-functions-tp26776527p26813448.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26812674</id>
	<title>Re: match |foobar| not |foo bar |</title>
	<published>2009-12-16T07:13:47Z</published>
	<updated>2009-12-16T07:13:47Z</updated>
	<author>
		<name>bytecolor-2</name>
	</author>
	<content type="html">OvermindDL1 &amp;lt;overminddl1 &amp;lt;at&amp;gt; gmail.com&amp;gt; writes:
&lt;br&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; Remember, Spirit is a PEG parser, in PEG, *EVERYTHING* is greedy. &amp;nbsp;You
&lt;br&gt;&amp;gt; might try this:
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; raw[alpha &amp;gt;&amp;gt; (alnum%blank)]
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; That should return a string (raw returns a string that is matches by
&lt;br&gt;&amp;gt; the containing) that starts with an alpha, and is following by alnum
&lt;br&gt;&amp;gt; and blanks, but does not end with a blank.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; % means do the left separated by the right, meaning the right can be
&lt;br&gt;&amp;gt; contained, but will not appear at the end.
&lt;/div&gt;&lt;br&gt;Ah, thanks OvermindDL1. I had to finesse it a bit:
&lt;br&gt;&lt;br&gt;lexeme[alpha[_val += _1]
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;gt;&amp;gt; -(+alnum[_val += _1] % blank[_val += &amp;quot;_&amp;quot;])]
&lt;br&gt;&lt;br&gt;No more chopper.
&lt;br&gt;&lt;br&gt;&lt;br&gt;------------------------------------------------------------------------------
&lt;br&gt;This SF.Net email is sponsored by the Verizon Developer Community
&lt;br&gt;Take advantage of Verizon's best-in-class app development support
&lt;br&gt;A streamlined, 14 day to market process makes app distribution fast and easy
&lt;br&gt;Join now and get one step closer to millions of Verizon customers
&lt;br&gt;&lt;a href=&quot;http://p.sf.net/sfu/verizon-dev2dev&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://p.sf.net/sfu/verizon-dev2dev&lt;/a&gt;&amp;nbsp;
&lt;br&gt;_______________________________________________
&lt;br&gt;Spirit-general mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26812674&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Spirit-general@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://lists.sourceforge.net/lists/listinfo/spirit-general&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://lists.sourceforge.net/lists/listinfo/spirit-general&lt;/a&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/spirit-general-f3432.html&quot; embed=&quot;fixTarget[3432]&quot; target=&quot;_top&quot; &gt;spirit-general&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/match-%7Cfoobar%7C-not-%7Cfoo-bar-%7C-tp26810968p26812674.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26812546</id>
	<title>Re: Parsing simple sequence of two double values</title>
	<published>2009-12-16T07:06:55Z</published>
	<updated>2009-12-16T07:06:55Z</updated>
	<author>
		<name>benCFD</name>
	</author>
	<content type="html">I'm sorry, it was my fault. It didn't recompile correctly. It's working fine now!
&lt;br&gt;&lt;br&gt;Thanks a lot!
&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;blockquote class=&quot;quote light-black dark-border-color&quot;&gt;&lt;div class=&quot;quote light-border-color&quot;&gt;
&lt;div class=&quot;quote-author&quot; style=&quot;font-weight: bold;&quot;&gt;Hartmut Kaiser wrote:&lt;/div&gt;
&lt;div class=&quot;quote-message shrinkable-quote&quot;&gt;&amp;gt; I'm currently doing my first steps with Spirit 2.1. I'm trying to parse
&lt;br&gt;&amp;gt; a
&lt;br&gt;&amp;gt; very simple sequence of two double values. My parsing and main methods
&lt;br&gt;&amp;gt; look
&lt;br&gt;&amp;gt; like this:
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; template &amp;lt;typename Iterator&amp;gt;
&lt;br&gt;&amp;gt; bool Parse(Iterator first, Iterator last)
&lt;br&gt;&amp;gt; {
&lt;br&gt;&amp;gt; 	using ascii::space;
&lt;br&gt;&amp;gt; 	using qi::phrase_parse;
&lt;br&gt;&amp;gt; 	using qi::double_;
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; 	bool r = phrase_parse(
&lt;br&gt;&amp;gt; 		first,
&lt;br&gt;&amp;gt; 		last,
&lt;br&gt;&amp;gt; 		double_ &amp;gt;&amp;gt; double_,
&lt;br&gt;&amp;gt; 		space
&lt;br&gt;&amp;gt; 	);
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; 	if(first != last)
&lt;br&gt;&amp;gt; 		return false; &amp;nbsp;// method returns here
&lt;br&gt;&amp;gt; 	return r;
&lt;br&gt;&amp;gt; }
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; int main()
&lt;br&gt;&amp;gt; {
&lt;br&gt;&amp;gt; 	cout &amp;lt;&amp;lt; &amp;quot;Input: &amp;quot;;
&lt;br&gt;&amp;gt; 	string str;
&lt;br&gt;&amp;gt; 	cin &amp;gt;&amp;gt; str;
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; 	if(Parse(str.begin(), str.end()))
&lt;br&gt;&amp;gt; 		cout &amp;lt;&amp;lt; &amp;quot;Parsing successful&amp;quot; &amp;lt;&amp;lt; endl;
&lt;br&gt;&amp;gt; 	else
&lt;br&gt;&amp;gt; 		cout &amp;lt;&amp;lt; &amp;quot;Parsing failed&amp;quot; &amp;lt;&amp;lt; endl;
&lt;br&gt;&amp;gt; 	getchar();
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; 	return 0;
&lt;br&gt;&amp;gt; }
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; However if I input a sequence like &amp;quot;123 456&amp;quot; and start parsing, the
&lt;br&gt;&amp;gt; message
&lt;br&gt;&amp;gt; returns false, because of the inequality check of the iterators. A more
&lt;br&gt;&amp;gt; complex rule like
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; double_ &amp;gt;&amp;gt; *(' ' &amp;gt;&amp;gt; double_)
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; works quite well, even for the above mentioned example of &amp;quot;123 456&amp;quot;.
&lt;br&gt;&amp;gt; What's
&lt;br&gt;&amp;gt; the problem with my code?
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; It is probably a silly beginner's problem, I'm sorry. But I've been
&lt;br&gt;&amp;gt; trying
&lt;br&gt;&amp;gt; to sort it out for two days now ...
&lt;br&gt;&lt;br&gt;Your code leaves a newline character at the end of the input which won't be
&lt;br&gt;matched by your grammar. So the input will not consumed completely. Use
&lt;br&gt;ascii::blank as your skipper and it will work.
&lt;br&gt;&lt;br&gt;Regards Hartmut
&lt;br&gt;&lt;br&gt;---------------
&lt;br&gt;Meet me at BoostCon
&lt;br&gt;www.boostcon.com
&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;------------------------------------------------------------------------------
&lt;br&gt;This SF.Net email is sponsored by the Verizon Developer Community
&lt;br&gt;Take advantage of Verizon's best-in-class app development support
&lt;br&gt;A streamlined, 14 day to market process makes app distribution fast and easy
&lt;br&gt;Join now and get one step closer to millions of Verizon customers
&lt;br&gt;&lt;a href=&quot;http://p.sf.net/sfu/verizon-dev2dev&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://p.sf.net/sfu/verizon-dev2dev&lt;/a&gt;&amp;nbsp;
&lt;br&gt;_______________________________________________
&lt;br&gt;Spirit-general mailing list
&lt;br&gt;Spirit-general@lists.sourceforge.net
&lt;br&gt;&lt;a href=&quot;https://lists.sourceforge.net/lists/listinfo/spirit-general&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://lists.sourceforge.net/lists/listinfo/spirit-general&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;&lt;/blockquote&gt;
&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/spirit-general-f3432.html&quot; embed=&quot;fixTarget[3432]&quot; target=&quot;_top&quot; &gt;spirit-general&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Parsing-simple-sequence-of-two-double-values-tp26812013p26812546.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26812483</id>
	<title>Re: Parsing simple sequence of two double values</title>
	<published>2009-12-16T07:03:22Z</published>
	<updated>2009-12-16T07:03:22Z</updated>
	<author>
		<name>benCFD</name>
	</author>
	<content type="html">Hartmut, thank you very much for your quick response. 
&lt;br&gt;I really seem to be too stupid for this framework. I've replaced my &amp;quot;space&amp;quot; skipping parser with &amp;quot;blank&amp;quot; but this doesn't solve the problem. I'm still getting the same result ... 
&lt;br&gt;&lt;br&gt;using ascii::blank;
&lt;br&gt;using qi::phrase_parse;
&lt;br&gt;using qi::double_;
&lt;br&gt;&lt;br&gt;bool r = phrase_parse(
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; first,
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; last,
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; double_ &amp;gt;&amp;gt; double_,
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; blank
&lt;br&gt;);
&lt;br&gt;&lt;br&gt;&lt;blockquote class=&quot;quote light-black dark-border-color&quot;&gt;&lt;div class=&quot;quote light-border-color&quot;&gt;
&lt;div class=&quot;quote-author&quot; style=&quot;font-weight: bold;&quot;&gt;Hartmut Kaiser wrote:&lt;/div&gt;
&lt;div class=&quot;quote-message shrinkable-quote&quot;&gt;&amp;gt; I'm currently doing my first steps with Spirit 2.1. I'm trying to parse
&lt;br&gt;&amp;gt; a
&lt;br&gt;&amp;gt; very simple sequence of two double values. My parsing and main methods
&lt;br&gt;&amp;gt; look
&lt;br&gt;&amp;gt; like this:
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; template &amp;lt;typename Iterator&amp;gt;
&lt;br&gt;&amp;gt; bool Parse(Iterator first, Iterator last)
&lt;br&gt;&amp;gt; {
&lt;br&gt;&amp;gt; 	using ascii::space;
&lt;br&gt;&amp;gt; 	using qi::phrase_parse;
&lt;br&gt;&amp;gt; 	using qi::double_;
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; 	bool r = phrase_parse(
&lt;br&gt;&amp;gt; 		first,
&lt;br&gt;&amp;gt; 		last,
&lt;br&gt;&amp;gt; 		double_ &amp;gt;&amp;gt; double_,
&lt;br&gt;&amp;gt; 		space
&lt;br&gt;&amp;gt; 	);
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; 	if(first != last)
&lt;br&gt;&amp;gt; 		return false; &amp;nbsp;// method returns here
&lt;br&gt;&amp;gt; 	return r;
&lt;br&gt;&amp;gt; }
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; int main()
&lt;br&gt;&amp;gt; {
&lt;br&gt;&amp;gt; 	cout &amp;lt;&amp;lt; &amp;quot;Input: &amp;quot;;
&lt;br&gt;&amp;gt; 	string str;
&lt;br&gt;&amp;gt; 	cin &amp;gt;&amp;gt; str;
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; 	if(Parse(str.begin(), str.end()))
&lt;br&gt;&amp;gt; 		cout &amp;lt;&amp;lt; &amp;quot;Parsing successful&amp;quot; &amp;lt;&amp;lt; endl;
&lt;br&gt;&amp;gt; 	else
&lt;br&gt;&amp;gt; 		cout &amp;lt;&amp;lt; &amp;quot;Parsing failed&amp;quot; &amp;lt;&amp;lt; endl;
&lt;br&gt;&amp;gt; 	getchar();
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; 	return 0;
&lt;br&gt;&amp;gt; }
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; However if I input a sequence like &amp;quot;123 456&amp;quot; and start parsing, the
&lt;br&gt;&amp;gt; message
&lt;br&gt;&amp;gt; returns false, because of the inequality check of the iterators. A more
&lt;br&gt;&amp;gt; complex rule like
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; double_ &amp;gt;&amp;gt; *(' ' &amp;gt;&amp;gt; double_)
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; works quite well, even for the above mentioned example of &amp;quot;123 456&amp;quot;.
&lt;br&gt;&amp;gt; What's
&lt;br&gt;&amp;gt; the problem with my code?
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; It is probably a silly beginner's problem, I'm sorry. But I've been
&lt;br&gt;&amp;gt; trying
&lt;br&gt;&amp;gt; to sort it out for two days now ...
&lt;br&gt;&lt;br&gt;Your code leaves a newline character at the end of the input which won't be
&lt;br&gt;matched by your grammar. So the input will not consumed completely. Use
&lt;br&gt;ascii::blank as your skipper and it will work.
&lt;br&gt;&lt;br&gt;Regards Hartmut
&lt;br&gt;&lt;br&gt;---------------
&lt;br&gt;Meet me at BoostCon
&lt;br&gt;www.boostcon.com
&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;------------------------------------------------------------------------------
&lt;br&gt;This SF.Net email is sponsored by the Verizon Developer Community
&lt;br&gt;Take advantage of Verizon's best-in-class app development support
&lt;br&gt;A streamlined, 14 day to market process makes app distribution fast and easy
&lt;br&gt;Join now and get one step closer to millions of Verizon customers
&lt;br&gt;&lt;a href=&quot;http://p.sf.net/sfu/verizon-dev2dev&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://p.sf.net/sfu/verizon-dev2dev&lt;/a&gt;&amp;nbsp;
&lt;br&gt;_______________________________________________
&lt;br&gt;Spirit-general mailing list
&lt;br&gt;Spirit-general@lists.sourceforge.net
&lt;br&gt;&lt;a href=&quot;https://lists.sourceforge.net/lists/listinfo/spirit-general&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://lists.sourceforge.net/lists/listinfo/spirit-general&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;&lt;/blockquote&gt;
&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/spirit-general-f3432.html&quot; embed=&quot;fixTarget[3432]&quot; target=&quot;_top&quot; &gt;spirit-general&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Parsing-simple-sequence-of-two-double-values-tp26812013p26812483.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26812492</id>
	<title>Re: Qi and boost::arrays</title>
	<published>2009-12-16T07:03:01Z</published>
	<updated>2009-12-16T07:03:01Z</updated>
	<author>
		<name>Hartmut Kaiser</name>
	</author>
	<content type="html">&amp;gt; &amp;gt; It's now fixed in SVN. The fix has the nice side effect of not
&lt;br&gt;&amp;gt; requiring
&lt;br&gt;&amp;gt; &amp;gt; the
&lt;br&gt;&amp;gt; &amp;gt; container to be default constructible anymore, BTW.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; Thanks, Hartmut. I'd like to give this a try, but I haven't been using
&lt;br&gt;&amp;gt; Spirit from SVN. Is it as simple as replacing Spirit in my Boost folder
&lt;br&gt;&amp;gt; with a checkout from the repository?
&lt;br&gt;&lt;br&gt;Yes, this should do the trick. Just put the checked out spirit folder in
&lt;br&gt;front of your boost root onto the include search path of your compiler (see
&lt;br&gt;here for some hints: &lt;a href=&quot;http://tinyurl.com/y9gdtnn&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://tinyurl.com/y9gdtnn&lt;/a&gt;).
&lt;br&gt;&lt;br&gt;Regards Hartmut
&lt;br&gt;&lt;br&gt;---------------
&lt;br&gt;Meet me at BoostCon
&lt;br&gt;www.boostcon.com
&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;------------------------------------------------------------------------------
&lt;br&gt;This SF.Net email is sponsored by the Verizon Developer Community
&lt;br&gt;Take advantage of Verizon's best-in-class app development support
&lt;br&gt;A streamlined, 14 day to market process makes app distribution fast and easy
&lt;br&gt;Join now and get one step closer to millions of Verizon customers
&lt;br&gt;&lt;a href=&quot;http://p.sf.net/sfu/verizon-dev2dev&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://p.sf.net/sfu/verizon-dev2dev&lt;/a&gt;&amp;nbsp;
&lt;br&gt;_______________________________________________
&lt;br&gt;Spirit-general mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26812492&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Spirit-general@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://lists.sourceforge.net/lists/listinfo/spirit-general&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://lists.sourceforge.net/lists/listinfo/spirit-general&lt;/a&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/spirit-general-f3432.html&quot; embed=&quot;fixTarget[3432]&quot; target=&quot;_top&quot; &gt;spirit-general&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Qi-and-boost%3A%3Aarrays-tp26729625p26812492.html" />
</entry>

</feed>
