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 babel parser and is run by a custom javascript engine ( JsWizziRunner ).

Ittf Documents may contain JsWizzi statements in

  • The value part of nodes (ITTF Node Values are interpolated)
    
                                            
    1 caption ${ name.capitalize() }
  • Conditional expression of $if, $elif, $while template commands
    
                                            
    1 $if name.substring(1,2) === 'is'
  • Collection name of $foreach template command
    
                                            
    1 $foreach item in model.getCollection('alfa')
  • Body of $ and $global template commands
    
                                            
    1 $ var beta = 100

Sample JsWizzi expressions and statements

                                
1 ul
2 $ var i = 0;
3 $while i < 10
4 li counting ${i}
5 $ i++;
    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
  • FunctionDeclaration
    Simple function declaration. No prototypes. No function objects; functions cannot be built by code and used like objects.