diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/parser.l | 3 | ||||
-rw-r--r-- | src/parser.y | 10 |
2 files changed, 12 insertions, 1 deletions
diff --git a/src/parser.l b/src/parser.l index dff6507..59a0358 100644 --- a/src/parser.l +++ b/src/parser.l | |||
@@ -11,7 +11,7 @@ | |||
11 | %x dqstr tdqstr tsqstr | 11 | %x dqstr tdqstr tsqstr |
12 | %% | 12 | %% |
13 | 13 | ||
14 | [-{}<>=+/*,();] { return yytext[0]; } | 14 | [-{}<>=+/*,();:] { return yytext[0]; } |
15 | 15 | ||
16 | game { return tokGame; } | 16 | game { return tokGame; } |
17 | function { return tokFunction; } | 17 | function { return tokFunction; } |
@@ -25,6 +25,7 @@ then { return tokThen; } | |||
25 | else { return tokElse; } | 25 | else { return tokElse; } |
26 | command { return tokCommand; } | 26 | command { return tokCommand; } |
27 | goto { return tokGoto; } | 27 | goto { return tokGoto; } |
28 | not { return tokNot; } | ||
28 | 29 | ||
29 | true { yylval.bValue = true; return tokBool; } | 30 | true { yylval.bValue = true; return tokBool; } |
30 | false { yylval.bValue = false; return tokBool; } | 31 | false { yylval.bValue = false; return tokBool; } |
diff --git a/src/parser.y b/src/parser.y index 9fb2be9..7242df0 100644 --- a/src/parser.y +++ b/src/parser.y | |||
@@ -24,6 +24,7 @@ void yyerror( const char *error ) { printf("%s\n", error ); } | |||
24 | %token tokIf | 24 | %token tokIf |
25 | %token tokThen | 25 | %token tokThen |
26 | %token tokElse | 26 | %token tokElse |
27 | %token tokNot | ||
27 | %token tokCommand | 28 | %token tokCommand |
28 | %token <sValue> tokSituationName | 29 | %token <sValue> tokSituationName |
29 | %token <sValue> tokIdent | 30 | %token <sValue> tokIdent |
@@ -54,6 +55,7 @@ gameExprList: | |||
54 | ; | 55 | ; |
55 | 56 | ||
56 | cmpltGameExpr: gameExpr ';' | 57 | cmpltGameExpr: gameExpr ';' |
58 | | commandDecl | ||
57 | ; | 59 | ; |
58 | 60 | ||
59 | gameExpr: tokIdent '=' expr | 61 | gameExpr: tokIdent '=' expr |
@@ -103,6 +105,14 @@ listValues: expr | |||
103 | dictValues: expr ':' expr | 105 | dictValues: expr ':' expr |
104 | | dictValues ',' expr ':' expr | 106 | | dictValues ',' expr ':' expr |
105 | ; | 107 | ; |
108 | |||
109 | commandDecl: tokCommand ':' tokString commandParamList '{' '}' | ||
110 | ; | ||
111 | |||
112 | commandParamList: | ||
113 | | commandParamList tokString | ||
114 | | commandParamList tokIdent | ||
115 | ; | ||
106 | %% | 116 | %% |
107 | 117 | ||
108 | int main() | 118 | int main() |