Replace object parser with lalr library
This commit is contained in:
parent
8f87c3bc33
commit
1293136343
13 changed files with 499 additions and 995 deletions
33
Objects/private/parser/oscript.g
Normal file
33
Objects/private/parser/oscript.g
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
oscript {
|
||||
%whitespace "[ \t\r\n]*";
|
||||
|
||||
scope:
|
||||
'{' statements '}' [scope]
|
||||
| ;
|
||||
|
||||
statements:
|
||||
statements ';' statement ';' [stm_scope_append]
|
||||
| statement [stm_scope_create]
|
||||
| ;
|
||||
|
||||
statement:
|
||||
statementVar [tmp]
|
||||
| statementLog [tmp];
|
||||
|
||||
statementVar: 'var' id [stm_defVar];
|
||||
statementLog: 'print' value [stm_log];
|
||||
|
||||
value:
|
||||
boolean [expr_bool]
|
||||
| integer [expr_int]
|
||||
| real [expr_float]
|
||||
| string [expr_string]
|
||||
|
|
||||
;
|
||||
|
||||
id: "[a-z]";
|
||||
boolean: "true|false";
|
||||
integer: "(\+|\-)?[0-9]+";
|
||||
real: "(\+|\-)?[0-9]+(\.[0-9]+)?((e|E)(\+|\-)?[0-9]+)?";
|
||||
string: "[\"']:string:";
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue