Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r73591 - in trunk/libs/spirit/example/qi/compiler_tutorial: conjure1 conjure2 conjure3 conjure_samples mini_c
From: joel_at_[hidden]
Date: 2011-08-07 02:19:51


Author: djowel
Date: 2011-08-07 02:19:50 EDT (Sun, 07 Aug 2011)
New Revision: 73591
URL: http://svn.boost.org/trac/boost/changeset/73591

Log:
Fixed grammar for unary expressions
Text files modified:
   trunk/libs/spirit/example/qi/compiler_tutorial/conjure1/expression_def.hpp | 2 +-
   trunk/libs/spirit/example/qi/compiler_tutorial/conjure2/expression_def.hpp | 2 +-
   trunk/libs/spirit/example/qi/compiler_tutorial/conjure3/expression_def.hpp | 2 +-
   trunk/libs/spirit/example/qi/compiler_tutorial/conjure3/ids.hpp | 12 +++++++++---
   trunk/libs/spirit/example/qi/compiler_tutorial/conjure_samples/operators.cnj | 3 +--
   trunk/libs/spirit/example/qi/compiler_tutorial/mini_c/expression_def.hpp | 2 +-
   6 files changed, 14 insertions(+), 9 deletions(-)

Modified: trunk/libs/spirit/example/qi/compiler_tutorial/conjure1/expression_def.hpp
==============================================================================
--- trunk/libs/spirit/example/qi/compiler_tutorial/conjure1/expression_def.hpp (original)
+++ trunk/libs/spirit/example/qi/compiler_tutorial/conjure1/expression_def.hpp 2011-08-07 02:19:50 EDT (Sun, 07 Aug 2011)
@@ -80,7 +80,7 @@
 
         unary_expr =
                 primary_expr
- | (unary_op > primary_expr)
+ | (unary_op > unary_expr)
             ;
 
         primary_expr =

Modified: trunk/libs/spirit/example/qi/compiler_tutorial/conjure2/expression_def.hpp
==============================================================================
--- trunk/libs/spirit/example/qi/compiler_tutorial/conjure2/expression_def.hpp (original)
+++ trunk/libs/spirit/example/qi/compiler_tutorial/conjure2/expression_def.hpp 2011-08-07 02:19:50 EDT (Sun, 07 Aug 2011)
@@ -46,7 +46,7 @@
 
         unary_expr =
                 primary_expr
- | (tokenid_mask(token_ids::op_unary) > primary_expr)
+ | (tokenid_mask(token_ids::op_unary) > unary_expr)
             ;
 
         primary_expr =

Modified: trunk/libs/spirit/example/qi/compiler_tutorial/conjure3/expression_def.hpp
==============================================================================
--- trunk/libs/spirit/example/qi/compiler_tutorial/conjure3/expression_def.hpp (original)
+++ trunk/libs/spirit/example/qi/compiler_tutorial/conjure3/expression_def.hpp 2011-08-07 02:19:50 EDT (Sun, 07 Aug 2011)
@@ -46,7 +46,7 @@
 
         unary_expr =
                 primary_expr
- | (tokenid_mask(token_ids::op_unary) > primary_expr)
+ | (tokenid_mask(token_ids::op_unary) > unary_expr)
             ;
 
         primary_expr =

Modified: trunk/libs/spirit/example/qi/compiler_tutorial/conjure3/ids.hpp
==============================================================================
--- trunk/libs/spirit/example/qi/compiler_tutorial/conjure3/ids.hpp (original)
+++ trunk/libs/spirit/example/qi/compiler_tutorial/conjure3/ids.hpp 2011-08-07 02:19:50 EDT (Sun, 07 Aug 2011)
@@ -16,7 +16,8 @@
         {
             binary = 0x20000,
             unary = 0x40000,
- assign = 0x80000
+ postfix_unary = 0x80000,
+ assign = 0x100000
         };
     };
 
@@ -134,8 +135,13 @@
             // unary operators with overlaps
             // '++' and '--' can be prefix or postfix
             // (the lexer cannot distinguish which)
- plus_plus = unary_op<op::plus_plus>::value,
- minus_minus = unary_op<op::minus_minus>::value,
+ plus_plus = make_op<
+ op_type::unary
+ | op_type::postfix_unary, op::plus_plus>::value,
+
+ minus_minus = make_op<
+ op_type::unary
+ | op_type::postfix_unary, op::minus_minus>::value,
 
             // unary operators
             compl_ = unary_op<op::compl_>::value,

Modified: trunk/libs/spirit/example/qi/compiler_tutorial/conjure_samples/operators.cnj
==============================================================================
--- trunk/libs/spirit/example/qi/compiler_tutorial/conjure_samples/operators.cnj (original)
+++ trunk/libs/spirit/example/qi/compiler_tutorial/conjure_samples/operators.cnj 2011-08-07 02:19:50 EDT (Sun, 07 Aug 2011)
@@ -125,8 +125,7 @@
     int i = ~zero(); // -1
     int j = -i; // 1
     ++j; // 2
- ++j; // 3
- ++j; // 4
+ ++++j; // 4
     --j; // 3
     return j;
 }

Modified: trunk/libs/spirit/example/qi/compiler_tutorial/mini_c/expression_def.hpp
==============================================================================
--- trunk/libs/spirit/example/qi/compiler_tutorial/mini_c/expression_def.hpp (original)
+++ trunk/libs/spirit/example/qi/compiler_tutorial/mini_c/expression_def.hpp 2011-08-07 02:19:50 EDT (Sun, 07 Aug 2011)
@@ -124,7 +124,7 @@
 
         unary_expr =
                 primary_expr
- | (unary_op > primary_expr)
+ | (unary_op > unary_expr)
             ;
 
         primary_expr =


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk