cant parse "val = 2 * * 2"

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

cant parse "val = 2 * * 2"

Jens Kallup
Hello,

I try out to compile the extend version of yesterday (Larry)
But I fail:

My goal is to produce a user information (error/warning), when the following string
is parsed:

"val = 2 * * 2"

tok.my_mul  equals  '*' in the lexer

The correct form is:
"val = 2 * 2"

Then next problem is in line 5.
It differs from "bool", but how to "throw MyException" ?

Thanks for helping
Jens


   1         term =

  1.                 factor                          [ _val  = qi::_1]
  2.                 >> *(   (tok.my_mul >> skip(space)[
  3.                          tok.my_mul
  4.                         ]                       [lex::_pass = lex::pass_flags::pass_fail ])    // <--- here
  5.                     |   (tok.my_mul >> factor   [ _val *= qi::_1])
  6.                     |   ('/' >> factor          [ _val /= qi::_1])
  7.                     )
  8.                 ;
  9.  
  10.  
  11. /usr/include/boost/proto/transform/default.hpp:154: Fehler: cannot convert 'const boost::spirit::lex::pass_flags' to 'bool' in assignment
  12.          BOOST_PROTO_BINARY_DEFAULT_EVAL(=, assign, make_mutable, make)
  13.          ^
  14.  
  15. /usr/include/boost/proto/transform/default.hpp:154: Fehler: cannot convert 'const boost::spirit::lex::pass_flags' to 'bool' in assignment
  16.  
  17. /usr/include/boost/spirit/home/support/action_dispatch.hpp:178: Fehler: no match for call to '(const boost::phoenix::actor<boost::proto::exprns_::expr<boost::proto::tagns_::tag::assign, boost::proto::argsns_::list2<boost::proto::exprns_::basic_expr<boost::proto::tagns_::tag::terminal, boost::proto::argsns_::term<boost::phoenix::argument<3> >, 0l>, boost::phoenix::actor<boost::proto::exprns_::expr<boost::proto::tagns_::tag::terminal, boost::proto::argsns_::term<boost::spirit::lex::pass_flags>, 0l> > >, 2l> >) (boost::spirit::traits::pass_attribute<boost::spirit::qi::skip_parser<boost::spirit::lex::reference<const boost::spirit::lex::token_def<char>, long unsigned int>, boost::spirit::qi::char_class<boost::spirit::tag::char_code<boost::spirit::tag::space, boost::spirit::char_encoding::ascii> > >, char, void>::type&, boost::spirit::context<boost::fusion::cons<dBaseParser::expression_ast&, boost::fusion::nil>, boost::fusion::vector0<> >&, bool&)'
  18.              f(attr_wrap, context, pass);
  19.               ^
  20.  
  21. /usr/include/boost/type_traits/make_unsigned.hpp:38: Fehler: static assertion failed: (::boost::type_traits::ice_or< ::boost::is_integral<T>::value, ::boost::is_enum<T>::value>::value)
  22.     BOOST_STATIC_ASSERT(
  23.     ^
  24.  
  25. /usr/include/boost/type_traits/make_signed.hpp:38: Fehler: static assertion failed: (::boost::type_traits::ice_or< ::boost::is_integral<T>::value, ::boost::is_enum<T>::value>::value)
  26.     BOOST_STATIC_ASSERT(
  27.     ^

------------------------------------------------------------------------------

_______________________________________________
Spirit-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/spirit-general
Reply | Threaded
Open this post in threaded view
|

Re: cant parse "val = 2 * * 2"

cppljevans
On 08/24/2016 04:41 AM, Jens Kallup wrote:

> Hello,
>
> I try out to compile the extend version of yesterday (Larry)
> But I fail:
>
> My goal is to produce a user information (error/warning), when the
> following string
> is parsed:
>
> "val = 2 * * 2"
>
> tok.my_mul  equals  '*' in the lexer
>
> The correct form is:
> "val = 2 * 2"
>
> Then next problem is in line 5.
> It differs from "bool", but how to "throw MyException" ?
>
> Thanks for helping
> Jens

Again, it would help up help you if you followed the guidelines
Joel mentioned here:

https://sourceforge.net/p/spirit/mailman/spirit-general/thread/npdbg4%24a6o%241%40blaine.gmane.org/#msg35292928

Please also supply some kind of Makefile so it's obvious
what compiler and flags you've used.

-regards,
Larry

[snip]



------------------------------------------------------------------------------
_______________________________________________
Spirit-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/spirit-general
Reply | Threaded
Open this post in threaded view
|

Re: cant parse "val = 2 * * 2"

Jens Kallup
Hello Larry,

please have a look to
https://github.com/paule32/dBase4Linux/blob/master/source/parser/dbase/yymain.cc

I have write the compile steps in g++ 5.4.0
cut all other libs.
Should run, if you add the boost libs??

Then you can see the error message...
Thanks for helping hand(s)
Jens


Am 24.08.2016 um 11:52 schrieb Larry Evans:

> On 08/24/2016 04:41 AM, Jens Kallup wrote:
>> Hello,
>>
>> I try out to compile the extend version of yesterday (Larry)
>> But I fail:
>>
>> My goal is to produce a user information (error/warning), when the
>> following string
>> is parsed:
>>
>> "val = 2 * * 2"
>>
>> tok.my_mul  equals  '*' in the lexer
>>
>> The correct form is:
>> "val = 2 * 2"
>>
>> Then next problem is in line 5.
>> It differs from "bool", but how to "throw MyException" ?
>>
>> Thanks for helping
>> Jens
> Again, it would help up help you if you followed the guidelines
> Joel mentioned here:
>
> https://sourceforge.net/p/spirit/mailman/spirit-general/thread/npdbg4%24a6o%241%40blaine.gmane.org/#msg35292928
>
> Please also supply some kind of Makefile so it's obvious
> what compiler and flags you've used.
>
> -regards,
> Larry
>
> [snip]
>
>
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Spirit-general mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/spirit-general


------------------------------------------------------------------------------
_______________________________________________
Spirit-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/spirit-general