Picon
Favicon

list_p and specialized actions

Hi.

I'm using spirit to parse the path elements of svg.  I'm using some rules  
like:

rule<> sequence = list_p(real_p, !comma_wsp);

I would like to attach a semantic action to the real_p there, but a  
generic semantic action is expected, taking a pair of iterators, instead  
of a semantic action taking a number.  I think the reason for this must be  
the refactorings going on, and indeed, if I use list_p.direct() the  
problem goes away.  If I'm correct, the problem is then that p1 - p2  
expects a generic semantic action.  Can it be made to expect the same kind  
of semantic action as p1?

Regards,
Bruno

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
jens weller | 1 Apr 14:39
Picon
Picon

boost 1.35 and spirit2

Hi,

I'm currently preparing a Project, aming to use boost1.35 for now, and 
later use spirit2 for parsing issues.

Am I right, that I still need the svn Head of boost, as proto f.e. is 
not yet part of the distribution?

And how far is spirit2, will it be ready with the next release of boost?

regards,

Jens Weller

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
Hartmut Kaiser | 1 Apr 15:02
Picon
Gravatar

Re: boost 1.35 and spirit2

Jens,

> I'm currently preparing a Project, aming to use boost1.35 for now, and
> later use spirit2 for parsing issues.
>
> Am I right, that I still need the svn Head of boost, as proto f.e. is
> not yet part of the distribution?

Correct. Boost V1.35 + proto should do as well, though.

> And how far is spirit2, will it be ready with the next release of
> boost?

Yes, we're aiming for the next release (1.36). 

Regards Hartmut

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
Boris | 1 Apr 15:20
Picon

Boost.Regex vs. Boost.Spirit

Can anyone tell me why Boost.Spirit (which reuses Boost.Regex for regular  
expressions) works while the code below where Boost.Regex is used directly  
can not be compiled?

std::string in = "test";

boost::wregex expr(L"test");
boost::match_results<std::string::const_iterator> what;
boost::regex_search(in, what, expr); // COMPILER ERROR

std::string out;
boost::spirit::rxstrlit<wchar_t> expr2(L"test");
boost::spirit::parse(in.c_str(), expr2[boost::spirit::assign_a(out)]);

The basic problem is of course that the regular expressions are based on  
wchar_t while the input string is based on char. Thus I'm not so much  
surprised why Boost.Regex does not work. I'm much more surprised though  
that my compiler (VC++ 2008) doesn't report an error with the code above  
which uses Boost.Spirit.

I don't know why the code using Boost.Spirit compiles (is this  
implementation-dependent or guaranteed behavior)? It would make using  
regular expressions in templates much easier though as regular expressions  
don't seem to depend on the Char type of strings (assuming this is a  
feature I can rely on)?

Boris
Richard Webb | 2 Apr 01:34
Gravatar

[Spirit 2] Compiler warnings from VC9 + warning level 4

I've just tried running the regression tests on the Spirit code in the
trunk\final section of SVN using VC9 on warning level 4, and it produced a
rather large list of warnings (actually, it produced a 13.6 megabyte log file).

Most of the warnings are a combination of
   warning C4100: unreferenced formal parameter
and the fun old
   warning C4512: assignment operator could not be generated

and there are also a few
warning C4127: conditional expression is constant
warning C4244: xxx possible loss of data

Is there any interest in doing something about these before Spirit2 is released?

Thanks,
Richard Webb

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
Hartmut Kaiser | 2 Apr 14:29
Picon
Gravatar

Re: [Spirit 2] Compiler warnings from VC9 + warning level 4

Richard,

> I've just tried running the regression tests on the Spirit code in the
> trunk\final section of SVN using VC9 on warning level 4, and it
> produced a
> rather large list of warnings (actually, it produced a 13.6 megabyte
> log file).
> 
> Most of the warnings are a combination of
>    warning C4100: unreferenced formal parameter
> and the fun old
>    warning C4512: assignment operator could not be generated
> 
> and there are also a few
> warning C4127: conditional expression is constant
> warning C4244: xxx possible loss of data
> 
> Is there any interest in doing something about these before Spirit2 is
> released?

Sure. Do you have a (even if partial) patch?

Regards Hartmut

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
(Continue reading)

Richard Webb | 3 Apr 01:36
Gravatar

Re: [Spirit 2] Compiler warnings from VC9 + warning level 4

Hartmut Kaiser <hartmut.kaiser <at> gmail.com> writes:

> 
> 
> Sure. Do you have a (even if partial) patch?
> 

I've opened a ticket on the Spirit sourceforge tracker, and attached a patch for
a large number of unreferenced parameter warnings - http://tinyurl.com/2vp3zg

I'll look at the other warnings separately.

Thanks,
Richard Webb

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
John | 3 Apr 17:27
Picon

Re: Recursive grammar problem

Niko Demmel <niko.demmel <at> gmx.de> writes:

> 
> The "<<" are typos and are meant to be ">>". Sorry.
> 
> This is in fact almost the same than you have, but you're lacking the 
> '(' and ')' parsers around the recursive call of the group rule in your 
> "right part".
> 
> In terms of your example my version would be:
> 
> group	 =    (interval | (ch_p('(') >> group >> ch_p(')') ))						
>          >>  *(   keyword >> (interval | (ch_p('(') >> group >> ch_p(')') )));
> 
> I think this should work.
> 
> Regards,
> 	Niko

Hello Niko,

sorry for the delay I have not been working on that since last year...
I just tried your suggestion yesterday and it worked great.

Thank you for that!

John

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
(Continue reading)

Hartmut Kaiser | 4 Apr 14:25
Picon
Gravatar

Re: [Spirit 2] Compiler warnings from VC9 + warning level 4

Thanks Richard! I applied your patch to the repository.

Regards Hartmut

> -----Original Message-----
> From: spirit-general-bounces <at> lists.sourceforge.net [mailto:spirit-
> general-bounces <at> lists.sourceforge.net] On Behalf Of Richard Webb
> Sent: Wednesday, April 02, 2008 6:36 PM
> To: spirit-general <at> lists.sourceforge.net
> Subject: Re: [Spirit-general] [Spirit 2] Compiler warnings from VC9 +
> warning level 4
> 
> Hartmut Kaiser <hartmut.kaiser <at> gmail.com> writes:
> 
> >
> >
> > Sure. Do you have a (even if partial) patch?
> >
> 
> I've opened a ticket on the Spirit sourceforge tracker, and attached a
> patch for
> a large number of unreferenced parameter warnings -
> http://tinyurl.com/2vp3zg
> 
> I'll look at the other warnings separately.
> 
> Thanks,
> Richard Webb
> 
> 
(Continue reading)

Olaf Peter | 4 Apr 19:30
Picon
Picon

string matching

Hi,

why does the following rules only hit the first section?

---8<---
             document = ( notes | other ) >> end;

             notes
                 = "[Notes]"
                 >> str[ var( data.notes ) += construct_<std::string>( 
arg1,  arg2 ) ]
                 >> eps_p( '[' )

                 ;

             other
                 = "[Other]"
                 >> str[ var( data.other ) += construct_<std::string>( 
arg1,  arg2 ) ]
                 >> eps_p( '[' )
                 ;

             end = str_p( "[end]" )
                 ;

             str = lexeme_d[ *( anychar_p - ch_p( '[' ) ) ];

--->8---

of
(Continue reading)


Gmane