Skip to content
Snippets Groups Projects
Commit 13f0bdba authored by Stéphane Del Pino's avatar Stéphane Del Pino
Browse files

Remove '^', '&', '|', '&&' and '||' constructions from PEGGrammar

In view of future use of '^' for powers and to simplify reading one will have to
use 'xor', 'and' and 'or'.

Bit-wise operators ('bitand' and 'bitor') will be suppressed in a following commit.
parent 3198ed99
No related branches found
No related tags found
1 merge request!37Feature/language
......@@ -148,12 +148,12 @@ struct postfix_expression : seq< primary_expression, star<postfix_operator> > {}
struct unary_expression : sor< seq< unary_operator, unary_expression >,
postfix_expression > {};
struct and_op : seq< sor<TAO_PEGTL_STRING("&&"), and_kw>, ignored > {};
struct or_op : seq< sor<TAO_PEGTL_STRING("||"), or_kw>, ignored > {};
struct and_op : seq< and_kw, ignored > {};
struct or_op : seq< or_kw, ignored > {};
struct xor_op : seq< sor< one< '^' >, xor_kw>, ignored >{};
struct bitand_op : seq< sor< seq< one< '&' >, not_at< one< '&' > > >, bitand_kw>, ignored >{};
struct bitor_op : seq< sor< seq< one< '|' >, not_at< one< '|' > > >, bitor_kw>, ignored >{};
struct xor_op : seq< xor_kw, ignored >{};
struct bitand_op : seq< bitand_kw, ignored >{};
struct bitor_op : seq< bitor_kw, ignored >{};
struct eqeq_op : seq< TAO_PEGTL_STRING("=="), ignored > {};
struct not_eq_op : seq< TAO_PEGTL_STRING("!="), ignored > {};
......
......@@ -165,7 +165,7 @@ string s; s = "foo";
SECTION("all operators mix")
{
std::string_view data = R"(
1+2 and 3<= 2 * 4 - 1 == 2 or 2>=1 / 5 ^ 6 & 7 && 2 || 1 | 2 <3 >7 xor -2 bitand 2 bitor + true - not false;
1+2 and 3<= 2 * 4 - 1 == 2 or 2>=1 / 5 xor 6 bitand 7 and 2 or 1 bitor 2 <3 >7 xor -2 bitand 2 bitor + true - not false;
)";
std::string_view result = R"(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment