diff --git a/src/wren_compiler.c b/src/wren_compiler.c index 2256644e..ebedf614 100644 --- a/src/wren_compiler.c +++ b/src/wren_compiler.c @@ -2019,9 +2019,9 @@ GrammarRule rules[] = /* TOKEN_PERCENT */ INFIX_OPERATOR(PREC_TERM, "% "), /* TOKEN_PLUS */ INFIX_OPERATOR(PREC_TERM, "+ "), /* TOKEN_MINUS */ OPERATOR("- "), - /* TOKEN_PIPE */ UNUSED, + /* TOKEN_PIPE */ INFIX_OPERATOR(PREC_BITWISE, "| "), /* TOKEN_PIPEPIPE */ INFIX(PREC_LOGIC, or), - /* TOKEN_AMP */ UNUSED, + /* TOKEN_AMP */ INFIX_OPERATOR(PREC_BITWISE, "& "), /* TOKEN_AMPAMP */ INFIX(PREC_LOGIC, and), /* TOKEN_BANG */ PREFIX_OPERATOR("!"), /* TOKEN_TILDE */ PREFIX_OPERATOR("~"), diff --git a/test/method/operators.wren b/test/method/operators.wren index 48fa74dd..d7df4710 100644 --- a/test/method/operators.wren +++ b/test/method/operators.wren @@ -10,6 +10,8 @@ class Foo { >= other { return "infix >= " + other } == other { return "infix == " + other } != other { return "infix != " + other } + & other { return "infix & " + other } + | other { return "infix | " + other } ! { return "prefix !" } - { return "prefix -" } @@ -27,5 +29,7 @@ IO.print(foo <= "a") // expect: infix <= a IO.print(foo >= "a") // expect: infix >= a IO.print(foo == "a") // expect: infix == a IO.print(foo != "a") // expect: infix != a +IO.print(foo & "a") // expect: infix & a +IO.print(foo | "a") // expect: infix | a IO.print(!foo) // expect: prefix ! IO.print(-foo) // expect: prefix -