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/custom_operators/bitwise.wren b/test/custom_operators/bitwise.wren new file mode 100644 index 00000000..086d2849 --- /dev/null +++ b/test/custom_operators/bitwise.wren @@ -0,0 +1,11 @@ +class Amp { + & that { + return + } +} + +class Pipe { + | that { + return + } +}