JsWizzi
JsWizzi is a subset of the ECMA-262 javascript standard used by the wizzi factory for processing ittf documents and build mTrees.JsWizzi uses the quite efficent esprima parserand is run by a custom javascript engine (JsWizziRunner).
Ittf documents may contain Js-Wizzi statements in
- The value part of nodes (ittf node values are interpolated)1 caption ${ name.capitalize() }
- Conditional expression of $if, $elif, $while command nodes1 $if name.substring(1,2) === 'is'
- Collection name of $foreach command node1 $foreach item in model.getCollection('alfa')
- Body of $ and $global command nodes1 $ var beta = 100
Sample JsWizzi expressions and statements
1 ul 2 $ var i = 0; 3 $while i < 10 4 li counting ${i} 5 $ i++;
The esprima syntax tree format is expected to be compatible with the Mozilla SpiderMonkey Parser API.
- Node types implemented by JsWizzi:
- VariableDeclaration
- Statements
- EmptyStatement
- ExpressionStatement
- IfStatement
- WhileStatement
- DoWhileStatement
- ForStatement
- ForInStatement
- BreakStatement
- ContinueStatement
- ReturnStatement
- TODO SwitchStatement
- Expressions
- UnaryExpression: !
- BinaryExpression: +. -, *, /, ==, ===, !=, !==, >=, >, <=, <
- UpdateExpressions: ++, --
- LogicalExpression: &&, ||
- ConditionalExpression: test ? consequent : alternate
- CallExpression
- MemberExpression
- AssignmentExpression: =, *=, /=, %=, +=, -=, <<=, >>=, >>>=, &=, ^=, |=
- ArrayExpression
- ObjectExpression
- FunctionCall
- FunctionDeclarationSimple function declaration. No prototypes. No function objects; functions cannot be built by code and used like objects.