Carl Barron | 1 Jun 02:01

Re: swap issue


On May 31, 2009, at 5:09 PM, Jens Weller wrote:

>>   1) get sprint 2.1 from trunk branch not head branch of the svn
>> repository. Spirit 2.1
>> in trunk is up to date, has fewer bugs, etc.
>
> My source is http://svn.boost.org/svn/boost/trunk, is this the right  
> source for spirit

  fine.
>
>>   2)  the errors tell me nothing with out a minimal example producing
>> the problem.
>
> Well, I've prepared a minimal example:
>
> struct data
> {
>    data(std::string str){}
> };
>
> struct Test : qi::grammar<it_type,void(), space_type>
> {
>    Test();
>    qi::rule<it_type,void(),space_type> start;
>    qi::rule<it_type,data*(),space_type> test;
>    void push(data* d){delete d;//do something ;)
>    }
> };
(Continue reading)

Carl Barron | 1 Jun 02:56

Re: <<EOF>>


On May 31, 2009, at 5:54 PM, Hartmut Kaiser wrote:

>>> I managed to implement the <<EOF>> regex without too many
>>> complications, but
>>> unfortunately it messes up the iterator model, as the 'end()'
>>> iterator then
>>> becomes a moving target..!  I have therefore backed out my changes.
>>> The
>>> only way around it if we really wanted it supported is to return the
>>> requested <<EOF>> id and then next time around return a 'real' EOF.
>>> This
>>> seems like total overkill to me especially, as Hartmut has already
>>> mentioned, there are perfectly viable alternatives.
>>>
>>> There is help (including supported regex syntax) in the zip from
>>> http://www.benhanson.net/lexertl/download.html.  However, regex
>>> syntax etc.
>>> will be added into the Spirit.Lex help reasonably soon.
>>>
>>> Regards,
>>>
>>> Ben
>>
>>    =Are the iterators pointing to the user's data really only
>> required to be input iterators?
>> [no backup of these iterators occurs, no saving and restoring of  
>> these
>> iterators, etc].  I really doubt it, but the docs of spirit::lex seem
>> to say input iterators. So I thought I'd ask,
(Continue reading)

Jens Weller | 1 Jun 17:42
Picon
Picon

Re: swap issue

yes. I did now also install fully boost svn.
Before I only had the spirit directory from boost::svn, well that seems not to work.

next problem: no_case isn't working.
Write an extra message for that in a minute.

regards,

Jens Weller

-------- Original-Nachricht --------
> Datum: Sun, 31 May 2009 20:01:43 -0400
> Von: Carl Barron <cbarron413 <at> roadrunner.com>
> An: Spirit General Mailing List <spirit-general <at> lists.sourceforge.net>
> Betreff: Re: [Spirit-general] swap issue

> 
> On May 31, 2009, at 5:09 PM, Jens Weller wrote:
> 
> >>   1) get sprint 2.1 from trunk branch not head branch of the svn
> >> repository. Spirit 2.1
> >> in trunk is up to date, has fewer bugs, etc.
> >
> > My source is http://svn.boost.org/svn/boost/trunk, is this the right  
> > source for spirit
> 
>   fine.
> >
> >>   2)  the errors tell me nothing with out a minimal example producing
> >> the problem.
(Continue reading)

Jens Weller | 1 Jun 17:44
Picon
Picon

spirit2x: no_case fails

Hello Spiritfolks,

no_case is in Spirit2x not working, as I found out today. (also I got the new version this morning, so I'm up to
date here).

My Code:

struct Test : qi::grammar<it_type,void(), space_type>
{
    Test();
    qi::rule<it_type,void(),space_type> start;
    /*void push(data* d){delete d;//do something ;)
    }*/
};

Test::Test():Test::base_type(start)
    {
        using namespace boost::phoenix;
        start = no_case[ lit("test") >> ' '];
    }
using namespace std;
int main()
{
    Test parser;
    std::string str = "test ";
    std::string::const_iterator iter = str.begin();
    std::string::const_iterator end = str.end();
    bool r = boost::spirit::qi::phrase_parse(iter, end, parser,boost::spirit::ascii::space);
    if (r && iter == end)
    {
(Continue reading)

Hartmut Kaiser | 2 Jun 00:31
Picon
Gravatar

Re: spirit2x: no_case fails

> no_case is in Spirit2x not working, as I found out today. (also I got
> the new version this morning, so I'm up to date here).
> 
> My Code:

[snipped partial code]

> Also "TEST " I've tried ofcourse, but with "test " it runs if I replace
> no_case with lexeme. But I need no_case there.

Since you specified space as the skipper, it will eat the space from the
input right after the lit("test") (which succeeds, btw). If you need to have
the space there, you need to put everything inside a lexeme:

   start = no_case[lexeme[lit("test") >> ' ']];

or

   start = lexeme[no_case[lit("test") >> ' ']];

In addition I'd like to ask you always to submit a full (compiling) example
we could use directly without having to figure out what's missing. This
makes it much easier for us to help you.

Thanks!
Regards Hartmut

------------------------------------------------------------------------------
OpenSolaris 2009.06 is a cutting edge operating system for enterprises 
looking to deploy the next generation of Solaris that includes the latest 
(Continue reading)

Jens Weller | 2 Jun 09:02
Picon
Picon

Re: spirit2x: no_case fails

hm, right. myfault. Somehow I was to blind to see that.

thanks & regards,

Jens Weller

-------- Original-Nachricht --------
> Datum: Mon, 1 Jun 2009 17:31:39 -0500
> Von: "Hartmut Kaiser" <hartmut.kaiser <at> gmail.com>
> An: "\'Spirit General Mailing List\'" <spirit-general <at> lists.sourceforge.net>
> Betreff: Re: [Spirit-general] spirit2x: no_case fails

> > no_case is in Spirit2x not working, as I found out today. (also I got
> > the new version this morning, so I'm up to date here).
> > 
> > My Code:
> 
> [snipped partial code]
> 
> > Also "TEST " I've tried ofcourse, but with "test " it runs if I replace
> > no_case with lexeme. But I need no_case there.
> 
> Since you specified space as the skipper, it will eat the space from the
> input right after the lit("test") (which succeeds, btw). If you need to
> have
> the space there, you need to put everything inside a lexeme:
> 
>    start = no_case[lexeme[lit("test") >> ' ']];
> 
> or
(Continue reading)

Jens Weller | 2 Jun 09:45
Picon
Picon

Re: spirit2x: no_case fails

So, to early solved a to simple problem.

In my case, its still not working.
But my case is a different one, than I have shown in the first mail.
I have a distinct parser rule, which fails:

struct distinct : qi::grammar<it_type,bool(std::string), space_type>
{
    distinct();
    qi::rule<it_type,bool(std::string),space_type> start;
};
distinct::distinct():distinct::base_type(start)
{
    start = lexeme[no_case[lit(_r1)] >>  space[_val =true] ];
}
beeing called like that:
d(construct<std::string>("test"));

well, example is attached.
Also if there is an easier way to this, I appriciate that.
Does spirit2x even have already its own distinct parser maybe?

regards,

Jens Weller

-------- Original-Nachricht --------
> Datum: Mon, 1 Jun 2009 17:31:39 -0500
> Von: "Hartmut Kaiser" <hartmut.kaiser <at> gmail.com>
> An: "\'Spirit General Mailing List\'" <spirit-general <at> lists.sourceforge.net>
(Continue reading)

Carl Barron | 2 Jun 10:28

Re: spirit2x: no_case fails


On Jun 2, 2009, at 3:45 AM, Jens Weller wrote:

> So, to early solved a to simple problem.
>
> In my case, its still not working.
> But my case is a different one, than I have shown in the first mail.
> I have a distinct parser rule, which fails:
>
> struct distinct : qi::grammar<it_type,bool(std::string), space_type>
> {
>    distinct();
>    qi::rule<it_type,bool(std::string),space_type> start;
> };
> distinct::distinct():distinct::base_type(start)
> {
>    start = lexeme[no_case[lit(_r1)] >>  space[_val =true] ];
> }
> beeing called like that:
> d(construct<std::string>("test"));
>
> well, example is attached.
> Also if there is an easier way to this, I appriciate that.
> Does spirit2x even have already its own distinct parser maybe?
>
  If by distinct parser you mean match the whole string not just a  
prefix, ie match "test" but not "testing",  then there is no  
predefined parser but it is simple to write.

in your distinct ctor.
(Continue reading)

Jens Weller | 2 Jun 10:42
Picon
Picon

Re: spirit2x: no_case fails


-------- Original-Nachricht --------
> Datum: Tue, 2 Jun 2009 04:28:39 -0400
> Von: Carl Barron <cbarron413 <at> roadrunner.com>
> An: Spirit General Mailing List <spirit-general <at> lists.sourceforge.net>
> Betreff: Re: [Spirit-general] spirit2x: no_case fails

> 
> On Jun 2, 2009, at 3:45 AM, Jens Weller wrote:
> 
> > So, to early solved a to simple problem.
> >
> > In my case, its still not working.
> > But my case is a different one, than I have shown in the first mail.
> > I have a distinct parser rule, which fails:
> >
> > struct distinct : qi::grammar<it_type,bool(std::string), space_type>
> > {
> >    distinct();
> >    qi::rule<it_type,bool(std::string),space_type> start;
> > };
> > distinct::distinct():distinct::base_type(start)
> > {
> >    start = lexeme[no_case[lit(_r1)] >>  space[_val =true] ];
> > }
> > beeing called like that:
> > d(construct<std::string>("test"));
> >
> > well, example is attached.
> > Also if there is an easier way to this, I appriciate that.
(Continue reading)

Joel de Guzman | 2 Jun 11:28
Picon
Favicon

Re: spirit2x: no_case fails

Jens Weller wrote:

> well, example is attached.
> Also if there is an easier way to this, I appriciate that.
> Does spirit2x even have already its own distinct parser maybe?

This clearly can be a component of the spirit-standard grammar
repository Hartmut and I are starting. It's so easy enough with
Spirit2 though that maybe there's no need for it. See calc6 example:

     vars >> !(alnum | '_')

This makes sure that vars does not follow an alnum or underscore.

Regards,
--

-- 
Joel de Guzman
http://www.boostpro.com
http://spirit.sf.net

------------------------------------------------------------------------------
OpenSolaris 2009.06 is a cutting edge operating system for enterprises 
looking to deploy the next generation of Solaris that includes the latest 
innovations from Sun and the OpenSource community. Download a copy and 
enjoy capabilities such as Networking, Storage and Virtualization. 
Go to: http://p.sf.net/sfu/opensolaris-get

Gmane