Actually this is not needed, but it looks nicer ;-)
Static property yy of type Object
The parsers scope
Static method aop
assignment operation shortcut
Static method bop
binary operation shortcut
Static property tokens of type String
List of grammar tokens, automatically set by Grammar
's constructor
Static property lex of type Object
Use the default jison-lexer
Declare all lexer tokens
ignore white-spaces
hexadecimal number
decimal number
constants
control flow statements
not yet implemented:
r /for\b/ , -> 'FOR'
the following reserved word are not allowed and raise exceptions if used in the wrong place
identifier has to come AFTER reserved words
access context or variable from …
… current scope:
$$ ~ SELF ~ current context
$_ ~ current context's local variables
_$ ~ current context's chain of scopes
__ ~ current context's expression stack
… parent contexts:
_0 ~ current - 1 level (parent) context
_1 ~ current - 2 levels (grand-parent) context
_2 ~ current - 3 levels context
…
_9 ~ current - 10 levels context
… child contexts:
$9 ~ root + 9 levels context
…
$2 ~ root + 2 levels (grand-child) context
$1 ~ root + 1 level (child) context
$0 ~ THIS ~ root context
mind the delibrately reduced set of allowed (start) characters compare with ES3/ES5/ES6
identifier above
double-quoted string
single-quoted string
ignore multiline-comments
accessors below
operators below
Mathematical assigment operators
Bitwise assigment operators
Boolean operators
Not (!) must be lower priority than != and !==
Mathemetical operators
Bitwise operators
Assignment operator
EOF is always last … TODO Figure out why the EOF token is “$”
Operator Precedence
Declare operator precedence from highest to lowest, see Operator Precedence.
Static property operators of type Object
Reverse the operators because jison orders precedence from low to high, and we have it high to low, see Yacc.
Static property startSymbol of type String
The Script is the top-level node in the syntax tree.
To build a grammar, a syntax is needed …
Static property bnf of type Object
… which is notated here in Backus-Naur-Format.
Since we parse bottom-up, all parsing must end here.
TODO use a precompiled “undefined” expression in Script » End
TODO use a precompiled undefined expression in Block » { Seperator }
Mathemetical operations
Boolean operations
Bitwise operations
CONSTRUCTOR and PROTOTYPE should be safe …
… if not remove them here and adjust tests accordingly !
Grammar …
… this time it's jison.coffee !