Skip to content

Commit

Permalink
Initial implementation of xor logical operator
Browse files Browse the repository at this point in the history
  • Loading branch information
leonerd committed Feb 18, 2024
1 parent 52b49c4 commit 36ce6ed
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 5 deletions.
4 changes: 2 additions & 2 deletions perly.act

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion perly.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion perly.tab

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion perly.y
Original file line number Diff line number Diff line change
Expand Up @@ -1247,7 +1247,7 @@ termbinop: term[lhs] PLUGIN_HIGH_OP[op] term[rhs]
| term[lhs] PLUGIN_LOGICAL_AND_OP[op] term[rhs]
{ $$ = build_infix_plugin($lhs, $rhs, $op); }
| term[lhs] OROR term[rhs] /* $x || $y */
{ $$ = newLOGOP(OP_OR, 0, $lhs, $rhs); }
{ $$ = newLOGOP($OROR, 0, $lhs, $rhs); }
| term[lhs] PLUGIN_LOGICAL_OR_OP[op] term[rhs]
{ $$ = build_infix_plugin($lhs, $rhs, $op); }
| term[lhs] DORDOR term[rhs] /* $x // $y */
Expand Down
11 changes: 11 additions & 0 deletions toke.c
Original file line number Diff line number Diff line change
Expand Up @@ -6099,6 +6099,16 @@ yyl_caret(pTHX_ char *s)
{
char *d = s;
const bool bof = cBOOL(FEATURE_BITWISE_IS_ENABLED);
if (s[1] == '^') {
s += 2;
if (!PL_lex_allbrackets && PL_lex_fakeeof >=
(*s == '=' ? LEX_FAKEEOF_ASSIGN : LEX_FAKEEOF_LOGIC)) {
s -= 2;
TOKEN(0);
}
pl_yylval.ival = OP_XOR;
OPERATOR(OROR);
}
if (bof && s[1] == '.')
s++;
if (!PL_lex_allbrackets && PL_lex_fakeeof >=
Expand Down Expand Up @@ -6618,6 +6628,7 @@ yyl_verticalbar(pTHX_ char *s)
s -= 2;
TOKEN(0);
}
pl_yylval.ival = OP_OR;
AOPERATOR(OROR);
}

Expand Down

0 comments on commit 36ce6ed

Please sign in to comment.