summaryrefslogtreecommitdiff
path: root/src/parser.y
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2011-12-18 00:56:43 -0700
committerMike Buland <eichlan@xagasoft.com>2011-12-18 00:56:43 -0700
commit1368849e36e1b5ecd0d595b713ca73f9d88da38b (patch)
tree856bd29ef562f8310d5a1c6c950e100851f96a3a /src/parser.y
parentcfa0ff5e6a45ce2d17fe18a09268acb2c0eb6724 (diff)
downloadstage-1368849e36e1b5ecd0d595b713ca73f9d88da38b.tar.gz
stage-1368849e36e1b5ecd0d595b713ca73f9d88da38b.tar.bz2
stage-1368849e36e1b5ecd0d595b713ca73f9d88da38b.tar.xz
stage-1368849e36e1b5ecd0d595b713ca73f9d88da38b.zip
Minor tweaks.
Now the game metadata can be read without reading anything else from the file, making it much easier to report info about a game rapidly.
Diffstat (limited to 'src/parser.y')
-rw-r--r--src/parser.y40
1 files changed, 24 insertions, 16 deletions
diff --git a/src/parser.y b/src/parser.y
index 95bd00d..ef9d10b 100644
--- a/src/parser.y
+++ b/src/parser.y
@@ -35,6 +35,7 @@ void yyerror( YYLTYPE *llocp, yyscan_t yyscanner, const char *error )
35%} 35%}
36 36
37%token tokGame 37%token tokGame
38%token tokGlobal
38%token tokFunction 39%token tokFunction
39%token tokSituation 40%token tokSituation
40%token tokSetup 41%token tokSetup
@@ -78,22 +79,26 @@ void yyerror( YYLTYPE *llocp, yyscan_t yyscanner, const char *error )
78%left '-' '+' 79%left '-' '+'
79 80
80%% 81%%
81input: gameDecl bodyDecl 82input: gameDecls globalDecl bodyDecl
82 ; 83 ;
83 84
84gameDecl: tokGame '{' gameExprList '}' 85gameDecls:
86 | gameDecls tokGame '.' tokIdent '=' literal ';'
87 ;
88
89globalDecl: tokGlobal '{' globalExprList '}'
85 ; 90 ;
86 91
87gameExprList: 92globalExprList:
88 | gameExprList cmpltGameExpr 93 | globalExprList cmpltGlobalExpr
89 ; 94 ;
90 95
91cmpltGameExpr: gameExpr ';' 96cmpltGlobalExpr: globalExpr ';'
92 | commandDecl 97 | commandDecl
93 ; 98 ;
94 99
95gameExpr: tokIdent '=' expr 100globalExpr: tokIdent '=' expr
96 ; 101 ;
97 102
98bodyDecl: 103bodyDecl:
99 | bodyDecl situation 104 | bodyDecl situation
@@ -137,11 +142,15 @@ varRef: tokIdent
137 | tokSituation '.' tokIdent 142 | tokSituation '.' tokIdent
138 ; 143 ;
139 144
140expr: tokInt 145literal: tokInt
141 | tokFloat 146 | tokFloat
142 | tokString 147 | tokString
143 | tokBool 148 | tokBool
144 | tokNull 149 | tokNull
150 | tokSituationName
151 ;
152
153expr: literal
145 | tokIdent '(' listValues ')' 154 | tokIdent '(' listValues ')'
146 | varRef 155 | varRef
147 | varRef '=' expr 156 | varRef '=' expr
@@ -149,7 +158,6 @@ expr: tokInt
149 | varRef tokMinusAssign expr 158 | varRef tokMinusAssign expr
150 | varRef tokTimesAssign expr 159 | varRef tokTimesAssign expr
151 | varRef tokDivideAssign expr 160 | varRef tokDivideAssign expr
152 | tokSituationName
153 | expr '+' expr 161 | expr '+' expr
154 | expr '-' expr 162 | expr '-' expr
155 | expr '/' expr 163 | expr '/' expr