davidtorosyan/ti-js

Add 'not(' Operator

Opened this issue · 0 comments

The not( operator (wiki post) is equivalent to JavaScript's ! operator, but differs in a few key ways.

  • Everything after the operator is evaluated before not, including logical operators and mathematical expressions.
Disp not(1 and 0
//1
Disp not(1 and 0 or 1
//0
  • A close parenthesis is not required, but can be used to enclose a not( operator within a line
Disp not(1) or 1
//1
Disp not(0) or 0
//1

The operator takes a single argument of the same types as other logical operators, and can be nested.
I foresee this being a fairly simple rule to implement in the parser, considering the already implemented support for other expressions using (.