All common arithmetic operators are supported. Boolean operators are also fully supported. Boolean expressions are evaluated to be either 1 or 0 (true or false respectively).
An indicates that the operator can be used with the specific type of variable. Refer to the grammar for detailed information about operator precedence.
Double | Complex | String | Vector | ||
Power | ^ | ||||
Boolean Not | ! | ||||
Unary Plus, Unary Minus | +x, -x | ||||
Modulus | % | ||||
Division | / | ||||
Multiplication | * | ||||
Addition, Subtraction | +, - | (only +) | |||
Less or Equal, More or Equal | <=, >= | ||||
Less Than, Greater Than | <, > | ||||
Not Equal, Equal | !=, == | ||||
Boolean And | && | ||||
Boolean Or | || |
Adding operators is currently only possible by modifying the JEP source code. To add an operator to the parser several steps are needed:
Rather than writing the parser by hand in java the parser is created using the JavaCC parser/scanner generator. This reads a file Parser.jjt which is written in a special language which defines the grammer and creates Parser.java and some other java files which implement the parser.
You should read some of the documentation on JavaCC and JJTree before attempting to modify the parser.
There is a three step process used to generate the parser.
This process should automatically be caried out when the project is built using the ANT build.xml file. It is not sufficient to simple recompile all the java files.
Only the Parser.jjt file should be modified, Parser.jj, Parser.java should not be modified as they will be overwritten during the build process. Furthermore ASTConstant.java, ASTFunNode.java, ASTStart.java, ASTVarNode.java, JavaCharStream.java, JJTParserState.java, Node.java, SimpleNode.java, ParseException.java, ParserConstants.java, ParserTokenManager.java, ParseTreeConstants.java, Token.java, TokenMgrError.java should not normally be modified as these are also automatically generated.