Carl Barron | 1 Mar 09:45

Re: [Spirit2x] symbols with stack of Lookups for static scoping...continued


On Feb 26, 2009, at 3:51 PM, Bernard Hugueney wrote:

> Dear Spiriters,
>
> I implemented a scopes<Lookup> that contains a std::vector of  
> Lookup, allowing
> me to easily parse symbols (variable names) from different scopes.
>
> However, I would like to be able to prevent redefinition of a  
> variable in the
> same scope (while allowing a new definition to shadow previous  
> definitions).
>
> In order to do that in a clean and efficient way, I thought I should  
> define
> another Lookup: current_scope< scopes<Lookup> >. The current_scope  
> would hold a
> reference to the scopes and forward member function call to the  
> topmost Lookup
> from the stack (in fact, to the back() of the std::vector<Lookup>).
>
> However, I would not be able to default-construct this current_scope  
> Lookup, so
> I would need a way to initialize the lookup field in symbols at  
> construction
> time, with a "lookup(new Lookup( customDataFromConstructor))".
> In my case, the customDataFromConstructor would be a reference to my  
> scopes<>
> previously constructed.
(Continue reading)

at80401 | 2 Mar 05:20
Favicon

why spirti2.0 on_error() not work?

 Hi,
I made some change to simplify mini_xml3.cpp, the changed  parser can parse correctly,
but there is no error message output if parse fail, why ? I don't know any different
with the original one.


Best Regards,
Joe


新浪空间——与朋友开心分享网络新生活!
Attachment (my-mini_xml3.cpp): text/x-c++src, 3543 bytes
------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Spirit-general mailing list
Spirit-general <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spirit-general
phb5000 | 4 Mar 16:35
Picon

parameter count


Hi,

I am currently using the position_iterator to retrieve the character
positions of parsed content.

Eg:

int start = first.get_position().column;
int end = last.get_position().column;

Is there any way to modify the position_iterator or make a new
position_policy in order to get byte positions rather than character
positions?

Eg:

Parsing "
--

-- 
View this message in context: http://www.nabble.com/parameter-count-tp22332435p22332435.html
Sent from the spirit-general mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
Sergei Politov | 4 Mar 20:55
Picon

[spirit2x] std::wstring from kleene star

Hi,

  Suggest I would like to take result of kleene star rule as std::wstring instead of std::vector.

  I'm able to do it in the following maner:
  std::wstring value;
  (*alpha)[ref(value) = construct<std::wstring>(begin(_1), end(_1))];

  Are there simlier ways to do the same thing?

Best Regards,
  Sergei

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Spirit-general mailing list
Spirit-general <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spirit-general
Carl Barron | 5 Mar 01:50

Re: [spirit2x] std::wstring from kleene star


On Mar 4, 2009, at 2:55 PM, Sergei Politov wrote:

> Hi,
>
>   Suggest I would like to take result of kleene star rule as  
> std::wstring instead of std::vector.
>
>   I'm able to do it in the following maner:
>   std::wstring value;
>   (*alpha)[ref(value) = construct<std::wstring>(begin(_1), end(_1))];
>
>   Are there simlier ways to do the same thing?

    foo %= *alpha;

    rule<Iterator,Skipper,std::wstring() > foo;

    looks the simplest.

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
Sergei Politov | 5 Mar 06:52
Picon

Re: [spirit2x] std::wstring from kleene star

Hi,
 
   foo %= *alpha;

   rule<Iterator,Skipper,std::wstring() > foo;

   looks the simplest.
  And the complete solution will be:
    std::wstring value;
    rule<Iterator,Skipper,std::wstring() > foo;
    foo %= *alpha;
....
    foo[ref(value) = _1];

  It does not seem to be much simplier than original one.

  I suppose spirit has actor that converts compatible attributes. Something like:
  (*alpha)[ref(value) = convert(_1)] or
  (*alpha)[ref(value) = convert<std::wstring>(_1)]

Best Regards,
  Sergei
------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Spirit-general mailing list
Spirit-general <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spirit-general
Joel de Guzman | 5 Mar 07:03
Picon
Favicon

Re: [spirit2x] std::wstring from kleene star

Sergei Politov wrote:
> Hi,
>  
> 
>        foo %= *alpha;
> 
>        rule<Iterator,Skipper,std::wstring() > foo;
> 
>        looks the simplest.
> 
>   And the complete solution will be:
>     std::wstring value;
>     rule<Iterator,Skipper,std::wstring() > foo;
>     foo %= *alpha;
> ....
>     foo[ref(value) = _1];
> 
>   It does not seem to be much simplier than original one.
> 
>   I suppose spirit has actor that converts compatible attributes. 
> Something like:
>   (*alpha)[ref(value) = convert(_1)] or
>   (*alpha)[ref(value) = convert<std::wstring>(_1)]

The idea is not to convert at all because that would not be
efficient. Instead, Carl's solution makes the kleene store
the elements in the std::wstring directly. It works because
the kleene only requires an attribute to be a std container
with a push_back member function:

     c.push_back(element)

Any attribute that satisfies this requirement can be used.

Regards,
--

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

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
Sergei Politov | 5 Mar 08:53
Picon

Re: [spirit2x] std::wstring from kleene star

The idea is not to convert at all because that would not be
efficient. Instead, Carl's solution makes the kleene store
the elements in the std::wstring directly. It works because
the kleene only requires an attribute to be a std container
with a push_back member function:

    c.push_back(element)

Any attribute that satisfies this requirement can be used.

Thanks Joel and Carl, seems I got it.

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Spirit-general mailing list
Spirit-general <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spirit-general
Mike Crowder | 5 Mar 23:54
Picon

Welcome you online shopping!

Welcome you online shopping!
i would like to introduce a good company who trades mainly in electornic products.
Now the company is under sales promotion,all the products are sold nearly at its cost.
They provide the best service to customers,they provide you with original products of
good  quality,and what is more,the price is a surprising happiness to you!
It is realy a good chance for shopping.just grasp the opportunity,Now or never!
The web address www.vvcnr.com
Windows Live™ Contacts: Organize your contact list. Check it out.
------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Spirit-general mailing list
Spirit-general <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spirit-general
Charles Gruenwald | 6 Mar 22:11
Picon

quoted strings

Howdy,

I am having a bit of trouble dealing with quoted strings. This rule
previously worked in a grammar I had, but after upgrading recently
things seemed to have changed a bit. I have played around with this
rule in many forms and simply cannot get it to parse the way I would
like.

Basically I want a quoted string that allows escaped nested quotes,
i.e. on the following input:

----------
"this is a quoted string with \"nested quotes\" "
----------

I would like the match to look like the following:

----------
this is a quoted string with "nested quotes"
----------

For some reason, however it seems like I cannot get the rules to drop
the outer quotes on the match. Here is the rule (or one incarnation of
it) that I am trying to use:

 r_string  =  token_node_d[ inner_node_d[ confix_p( '"',
*lex_escape_ch_p, '"' ) ] ]

Any help is greatly appreciated! Thanks!

--charles

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H

Gmane