aboutsummaryrefslogtreecommitdiff
path: root/engines/director/lingo/lingo-gr.y
diff options
context:
space:
mode:
authorEugene Sandulenko2016-07-05 10:13:42 +0200
committerEugene Sandulenko2016-08-03 23:40:36 +0200
commitd7bdda559d5c3f8f002cc23be23908cdd07a282e (patch)
tree1c7fd0edc35329cae22995774b36c8a4c1a2e2a7 /engines/director/lingo/lingo-gr.y
parent1808dcdc3011d7e7ceed9cad98410e99ec0f61c0 (diff)
downloadscummvm-rg350-d7bdda559d5c3f8f002cc23be23908cdd07a282e.tar.gz
scummvm-rg350-d7bdda559d5c3f8f002cc23be23908cdd07a282e.tar.bz2
scummvm-rg350-d7bdda559d5c3f8f002cc23be23908cdd07a282e.zip
DIRECTOR: Lingo: Merged if and oneline if grammar
Diffstat (limited to 'engines/director/lingo/lingo-gr.y')
-rw-r--r--engines/director/lingo/lingo-gr.y51
1 files changed, 24 insertions, 27 deletions
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index fd5245d78b..e7b42860c0 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -99,7 +99,6 @@ programline:
| func
| macro
| asgn { g_lingo->code1(g_lingo->c_xpop); }
- | stmtoneliner
| stmt
| error { yyerrok; }
;
@@ -172,13 +171,29 @@ stmt: expr { g_lingo->code1(g_lingo->c_xpop); }
(*g_lingo->_currentScript)[$1 + 5] = end; } /* end, if cond fails */
;
-stmtoneliner: if cond tTHEN begin stmt end {
+ifstmt: if cond tTHEN '\n' stmtlist end tEND tIF {
inst then = 0, end = 0;
- WRITE_UINT32(&then, $4);
+ WRITE_UINT32(&then, $5);
WRITE_UINT32(&end, $6);
(*g_lingo->_currentScript)[$1 + 1] = then; /* thenpart */
- (*g_lingo->_currentScript)[$1 + 3] = end; /* end, if cond fails */
-
+ (*g_lingo->_currentScript)[$1 + 3] = end; /* end, if cond fails */
+ g_lingo->processIf(0, 0); }
+ | if cond tTHEN begin stmt end {
+ inst then = 0, end = 0;
+ WRITE_UINT32(&then, $4);
+ WRITE_UINT32(&end, $6);
+ (*g_lingo->_currentScript)[$1 + 1] = then; /* thenpart */
+ (*g_lingo->_currentScript)[$1 + 3] = end; /* end, if cond fails */
+
+ g_lingo->processIf(0, 0); }
+ | if cond tTHEN '\n' stmtlist end tELSE stmtlist end tEND tIF {
+ inst then = 0, else1 = 0, end = 0;
+ WRITE_UINT32(&then, $5);
+ WRITE_UINT32(&else1, $8);
+ WRITE_UINT32(&end, $9);
+ (*g_lingo->_currentScript)[$1 + 1] = then; /* thenpart */
+ (*g_lingo->_currentScript)[$1 + 2] = else1; /* elsepart */
+ (*g_lingo->_currentScript)[$1 + 3] = end; /* end, if cond fails */
g_lingo->processIf(0, 0); }
| if cond tTHEN begin stmt end '\n' tELSE begin stmt end '\n' {
inst then = 0, else1 = 0, end = 0;
@@ -190,33 +205,15 @@ stmtoneliner: if cond tTHEN begin stmt end {
(*g_lingo->_currentScript)[$1 + 3] = end; /* end, if cond fails */
g_lingo->processIf(0, 0); }
- ;
-
-ifstmt: if cond tTHEN stmtlist end tEND tIF {
- inst then = 0, end = 0;
- WRITE_UINT32(&then, $4);
- WRITE_UINT32(&end, $5);
- (*g_lingo->_currentScript)[$1 + 1] = then; /* thenpart */
- (*g_lingo->_currentScript)[$1 + 3] = end; /* end, if cond fails */
- g_lingo->processIf(0, 0); }
- | if cond tTHEN stmtlist end tELSE stmtlist end tEND tIF {
+ | if cond tTHEN '\n' stmtlist end begin elseifstmt end tEND tIF {
inst then = 0, else1 = 0, end = 0;
- WRITE_UINT32(&then, $4);
+ WRITE_UINT32(&then, $5);
WRITE_UINT32(&else1, $7);
- WRITE_UINT32(&end, $8);
- (*g_lingo->_currentScript)[$1 + 1] = then; /* thenpart */
- (*g_lingo->_currentScript)[$1 + 2] = else1; /* elsepart */
- (*g_lingo->_currentScript)[$1 + 3] = end; /* end, if cond fails */
- g_lingo->processIf(0, 0); }
- | if cond tTHEN stmtlist end begin elseifstmt end tEND tIF {
- inst then = 0, else1 = 0, end = 0;
- WRITE_UINT32(&then, $4);
- WRITE_UINT32(&else1, $6);
- WRITE_UINT32(&end, $8);
+ WRITE_UINT32(&end, $9);
(*g_lingo->_currentScript)[$1 + 1] = then; /* thenpart */
(*g_lingo->_currentScript)[$1 + 2] = else1; /* elsepart */
(*g_lingo->_currentScript)[$1 + 3] = end; /* end, if cond fails */
- g_lingo->processIf(0, $8); }
+ g_lingo->processIf(0, $9); }
;
elseifstmt: elseifstmt elseifstmt1