Flogromp N. | 2 Dec 15:10
Picon

Re: Parsing of non-strings.



On Nov 29, 2007 5:28 PM, Joel de Guzman <joel <at> boost-consulting.com> wrote:
 
is not clear enough, I can probably write a toy sample that demonstrates

Regards,
--
Joel de Guzman

Joel,

I think I see what you're saying, but I am just learning Spirit at the moment.

If it wouldn't be too much trouble, that toy sample would be greatly appreciated.

- Flogromp N.

-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell.  From the desktop to the data center, Linux is going
mainstream.  Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
_______________________________________________
Spirit-general mailing list
Spirit-general <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spirit-general
Larry Evans | 2 Dec 21:00

Re: What's type of member1 in closure<name, Type1>?

On 11/29/07 22:20, Joel de Guzman wrote:
> Larry Evans wrote:
[snip]
>> OOPS.  Spoke too soon. Changed end_tag to:
>>
>>              end_tag = f_ch_p(close_delimiter(element.tag)) ;
>>
>> to that the char passed to f_ch_p matched the char for start_tag but 
>> this gave:
>>
>> open_close_list_parser.cpp:63: error: no matching function for call to 
[snip]
> You'll either have to make close_delimiter a phoenix "lazy" function
> or use phoenix bind (which does the same thing).

Thanks. The first way works, but I'm having trouble with bind.  Here's
what end_tag was changed to:
<-- cut here --

           #if 0
             phoenix::function_ptr<char, char> const close_delim_lazy
               = &close_delimiter;
             end_tag = f_ch_p(close_delim_lazy(children.tag)) ;
           #else
             end_tag = f_ch_p(phoenix::bind(&close_delimiter));
           #endif
 >-- cut here --

With '#if 1' instead of '#if 0' and the following driver snippet:
<-- cut here --

     demo_print_tree("root{x{a,b,c},y{}}");
     demo_print_tree
     ( debug_utility::demangled_name
       < boost::spirit::grammar
         < utility::tree_parse_print
         >
       >()
     );
 >-- cut here --

I get the expected output:
<-- cut here --

testing.unit-test 
../../../../../bin.v2/sandbox/lje/libs/utility/example/gcc-4.1/debug/str_tree_print_demo.passed
Parse:root{x{a,b,c},y{}}
Printing:
   root
   { x
     { a
     , b
     , c
     }
   , y
     {
     }
   }
   -------------------------
   Parsing succeeded
   -------------------------
Parse:boost::spirit::grammar<utility::tree_parse_print, 
boost::spirit::parser_context<boost::spirit::nil_t> >
Printing:
   boost::spirit::grammar
   < utility::tree_parse_print
   , boost::spirit::parser_context
     < boost::spirit::nil_t
     >
   >
   -------------------------
   Parsing succeeded
   -------------------------
 >-- cut here --

However, with '#if 0' I get compile error:
<-- cut here --

str_tree_print_demo.cpp:41:   instantiated from here
../../../../../boost/spirit/attribute/parametric.hpp:32: error: cannot 
convert 'phoenix::actor<phoenix::composite<phoenix::eq_op, 
phoenix::actor<phoenix::value<char> >, 
phoenix::actor<phoenix::composite<phoenix::function_ptr_action<char, 
char, phoenix::nil_t, phoenix::nil_t, phoenix::nil_t>, phoenix::nil_t, 
phoenix::nil_t, phoenix::nil_t, phoenix::nil_t> >, phoenix::nil_t, 
phoenix::nil_t> >' to 'bool' in return
 >-- cut here --

and this despite the apparent claim of the documentation:
<-- cut here --
     bind(&foo_)

This bind expression results to a lazy-function (see functions) that is 
lazily evaluated. This bind expression is also equivalent to:

     function_ptr<void, int> foo = &foo_;

 >-- cut here --

Now it's no big deal for me to use the longer function_ptr method;
however, I'm just wondering why bind doesn't seem to work as advertised.

Any ideas?

(BTW, thanks for you help on this so far :) )

-regards,
Larry

-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell.  From the desktop to the data center, Linux is going
mainstream.  Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
Larry Evans | 2 Dec 21:11

Re: What's type of member1 in closure<name, Type1>?

On 12/02/07 14:00, Larry Evans wrote:
> On 11/29/07 22:20, Joel de Guzman wrote:
>> Larry Evans wrote:
[snip]
>> You'll either have to make close_delimiter a phoenix "lazy" function
>> or use phoenix bind (which does the same thing).
> 
> Thanks. The first way works, but I'm having trouble with bind.  Here's
> what end_tag was changed to:
> <-- cut here --
> 
>            #if 0
>              phoenix::function_ptr<char, char> const close_delim_lazy
>                = &close_delimiter;
>              end_tag = f_ch_p(close_delim_lazy(children.tag)) ;
>            #else
>              end_tag = f_ch_p(phoenix::bind(&close_delimiter));
My big OOPS!  Obviously this should have been:
                end_tag =
                  f_ch_p(phoenix::bind(&close_delimiter)(children.tag));

Sorry for noise :(
>            #endif
>  >-- cut here --

-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell.  From the desktop to the data center, Linux is going
mainstream.  Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
CARL BARRON | 3 Dec 11:18

where is mpl/apply_if.hpp

Just attempted to use phoenix 1x container functions and find
boost/mpl/apply_if.hpp does not exist in my copies of boost 1.34.1
and one from the cvs marked 1.35. Where is it.  Not ultra immediate
problem since snarfing needed elements of stl-containers.hpp, I did
not need to include the file of 'concepts' and hence not include
apply_if.hpp. but where is it??
/ 
*======================================================================= 
======
     Phoenix v1.2
     Copyright (c) 2004 Angus Leeming

     Use, modification and distribution is subject to the Boost Software
     License, Version 1.0. (See accompanying file LICENSE_1_0.txt or  
copy at
     http://www.boost.org/LICENSE_1_0.txt)
======================================================================== 
======*/
#ifndef PHOENIX_STL_CONTAINER_TRAITS_HPP
#define PHOENIX_STL_CONTAINER_TRAITS_HPP

/////////////////////////////////////////////////////////////////////// 
////////
#include <boost/config.hpp>
#include <boost/mpl/bool.hpp>
#include <boost/mpl/apply_if.hpp>  // <- this line ???
#include <boost/mpl/identity.hpp>

-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell.  From the desktop to the data center, Linux is going
mainstream.  Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
Joel de Guzman | 3 Dec 13:35
Picon
Favicon

Re: where is mpl/apply_if.hpp

CARL BARRON wrote:
> Just attempted to use phoenix 1x container functions and find
> boost/mpl/apply_if.hpp does not exist in my copies of boost 1.34.1
> and one from the cvs marked 1.35. Where is it.  Not ultra immediate
> problem since snarfing needed elements of stl-containers.hpp, I did
> not need to include the file of 'concepts' and hence not include
> apply_if.hpp. but where is it??

You are looking at an older version. Use this one:
http://spirit.sourceforge.net/dl_more/stl-phx.zip

Regards,
--

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

-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell.  From the desktop to the data center, Linux is going
mainstream.  Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
Erik Zeek | 3 Dec 18:02
Picon
Favicon

Trouble compiling YAC.

When I try to build YAC (http://www.lyx.org/~leeming/yac/) on my F8 and Gentoo
systems (Boost 1.34.1 on both), I get the errors shown in the attached file.
On the Gentoo system, I was able to build YAC with Boost 1.33.1 but
Boost 1.34.0
also failed.

My searches of the web didn't turn up any useful results.  Has anyone else
encountered this?  Does anyone have a workaround?

Thanks,
Erik

P.S.  For those of you who don't feel like unzipping the attached file, here's
the beginning and ending of the error message:

/usr/include/boost/spirit/phoenix/operators.hpp: In static member
function 'static const T
phoenix::unary_operator<phoenix::logical_not_op, T>::eval(const T&) [with T =
double*]':
/usr/include/boost/spirit/phoenix/operators.hpp:805:   instantiated
from 'typename phoenix::unary_operator<phoenix::logical_not_op,
T>::result_type phoenix::logical_not_op::operator()(T0&) const [with T0 =
double*]'
/usr/include/boost/spirit/phoenix/composite.hpp:219:   instantiated
from 'typename phoenix::actor_result<phoenix::composite<OperationT,
A, phoenix::nil_t, phoenix::nil_t, phoenix::nil_t, phoenix::nil_t,
phoenix::nil_t, phoen

<snip/>

ser_iteration_policy<yac::skip_grammar, boost::spirit::iteration_policy>,
boost::spirit::match_policy, boost::spirit::action_policy> >,
AttrT = std::basic_string<char, std::char_traits<char>, std::allocator<char>
>]'
yac.cpp:342:   instantiated from here
/usr/include/boost/spirit/phoenix/operators.hpp:244: error: cannot
convert 'bool' to 'double* const' in return

--

-- 
Erik Zeek
SMTS, Org 5444, MS-1153
Sandia National Laboratories
Phone: 505-845-0513
Attachment (yac.log.gz): application/x-gzip, 1322 bytes
-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell.  From the desktop to the data center, Linux is going
mainstream.  Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
_______________________________________________
Spirit-general mailing list
Spirit-general <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spirit-general
Rainer Huebner | 3 Dec 19:17
Picon
Favicon

on vacation.


I will be out of the office starting  03.12.2007 and will not return until
02.01.2008.

I will respond to your message when I return.

-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell.  From the desktop to the data center, Linux is going
mainstream.  Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
Larry Evans | 3 Dec 21:03

Re: Parsing of non-strings.

On 12/02/07 08:10, Flogromp N. wrote:
 >
 > On Nov 29, 2007 5:28 PM, Joel de Guzman <joel <at> boost-consulting.com
 > <mailto:joel <at> boost-consulting.com>> wrote:
 >
 >     is not clear enough, I can probably write a toy sample that 
demonstrates
 >
 >     Regards,
 >     --
 >     Joel de Guzman
[snip]
 > If it wouldn't be too much trouble, that toy sample would be greatly
 > appreciated.
 >
 > - Flogromp N.
 >
Now that I've looked closer at the example proto_static_disp.cpp code
I suggested earlier to Flogromp in this post:

http://article.gmane.org/gmane.comp.parsers.spirit.general/12638

I see it wouldn't work because instead of a literal character string,
e.g.:

   "xxx"

or literal character, e.g.:

   'x'

as one argument to the grammar operators:

   http://www.boost.org/libs/spirit/doc/operators.html

there would have to be elements of Flogromps unions.  The way this
worked in proto_static_disp.cpp was an instance of the union was
simply used as an argument to the operator(e.g. on line 312 there:

       |   vocabulary<terminal>::variable<vocabulary<terminal>::par_left>()

where the rhs of operator| is an instance of the union representing
the left parenthesis (par_left).

So, I guess the way to make this work in spirit is to add to the
overloads of these operators so that they can take elements from
Flogromp's union.  Or maybe define a template class, analogous to, for
example, the chlit<CharT> template class, whose template argument is
one element of Flogromp's union.  Then these could be used as
arguments to the operators.

Is that, in general, how it could be done?

-regards,
Larry

-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell.  From the desktop to the data center, Linux is going
mainstream.  Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
Joel de Guzman | 3 Dec 23:56
Picon
Favicon

Re: Trouble compiling YAC.

Erik Zeek wrote:
> When I try to build YAC (http://www.lyx.org/~leeming/yac/) on my F8 and Gentoo
> systems (Boost 1.34.1 on both), I get the errors shown in the attached file.
> On the Gentoo system, I was able to build YAC with Boost 1.33.1 but
> Boost 1.34.0
> also failed.
> 
> My searches of the web didn't turn up any useful results.  Has anyone else
> encountered this?  Does anyone have a workaround?

It would be best to contact Angus Leeming, the author. I'm not
sure if he still lurks here. Haven't seen him around for
some time now. You can search the list for his address.

Regards,
--

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

-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell.  From the desktop to the data center, Linux is going
mainstream.  Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
Larry Evans | 4 Dec 02:07

Re: Parsing of non-strings.

On 12/03/07 14:03, Larry Evans wrote:
> On 12/02/07 08:10, Flogromp N. wrote:
>  >
>  > On Nov 29, 2007 5:28 PM, Joel de Guzman <joel <at> boost-consulting.com
>  > <mailto:joel <at> boost-consulting.com>> wrote:
>  >
>  >     is not clear enough, I can probably write a toy sample that 
> demonstrates
[snip]
> 
> So, I guess the way to make this work in spirit is to add to the
> overloads of these operators so that they can take elements from
> Flogromp's union.  Or maybe define a template class, analogous to, for
> example, the chlit<CharT> template class, whose template argument is
> one element of Flogromp's union.  Then these could be used as
> arguments to the operators.
> 
> Is that, in general, how it could be done?
> 
I tried this, with the result shown in

   boost vault/Strings Text Processing/calc_plain_tag_union_tok.zip

Apparently the compiler is expecting a digit where what I want is
some instance of the tag.  I tried to mimic what chlit did, and
called it toklit where the CTOR arg was an element of an
enumeration; however, it fails to compile.

Any idea what's wrong?

-regards,
Larry

-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell.  From the desktop to the data center, Linux is going
mainstream.  Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4

Gmane