Parsing Expression
Here is how we can parse JavaScript expressions.
Jsep.Node node = new Jsep('1 + 2').parse();
Here is how we can parse JavaScript expressions.
Jsep.Node node = new Jsep('1 + 2').parse();
Supported Unary Operator
Name | Description |
---|---|
- | Negate number |
! | Negate boolean |
++ | Only prefix supported |
-- | Only prefix supported |
Supported Logical Operator
Name | Description | ||
---|---|---|---|
&& | Logical and | ||
\ | \ | Logical or |
Supported Binary Operator
Name | Description |
---|---|
== | Apex == |
!= | Apex != |
=== | Apex == |
!== | Apex != |
< | Apex < |
> | Apex > |
<= | Apex <= |
>= | Apex >= |
+ | Apex + |
- | Apex - |
* | Apex * |
/ | Apex / |
% | Apex Math.mod |
Supported Structure
Name | Description |
---|---|
Conditional Expression(? :) | Yes |
Array Literal | Yes |
Object Literal | Yes |
For example,
ScriptEngine.getInstance.eval('["a", "b"]'); // Array literal
ScriptEngine.getInstance.eval('{ "name": "test", age: 18 }'); // Object literal
Contribute on Github! Edit this section.