From 5771673d023f0bc1483ad918c7f1e61eec57dc9a Mon Sep 17 00:00:00 2001 From: theo <2022xmm3@kuas.ac.jp> Date: Thu, 27 Oct 2022 11:13:13 +0900 Subject: [PATCH] Correct problem of return on 001.c test of parsimony folder --- ccmeta.leg | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/ccmeta.leg b/ccmeta.leg index 343ab24..bf38cad 100644 --- a/ccmeta.leg +++ b/ccmeta.leg @@ -1461,6 +1461,7 @@ sCharSequence = ( escapeSequence | !EOL [^\"\\] )* #" primaryExpression = stringLiteral | constant | id | META_AT ( META_LCB x:mstmts { $$ = x } | x:mvalue { $$ = eval(globals, x) } + | x:mexp { $$ = eval(globals, x) } ) | l:LPAREN x:expression r:RPAREN { $$= new_C_subexpr(l, x, r) } | l:LPAREN x:compoundStatement r:RPAREN &{gnu} { $$= new_C_subexpr(l, x, r) } @@ -2171,16 +2172,18 @@ _FLOAT128 = '_Float128' !IDREST &{gnu} { $$= newToken("_Float1 # input buffer from moving past it before redirecting input from the imported file metaCatch = META_AT ( m:mvalue { map_append(outputProgram, eval(globals, m)); } - | META_LCB m:mstmts { map_append(outputProgram, m); } + | m:mexp { eval(globals, m) } + | META_LCB m:mstmts { map_append(outputProgram, m) } | META_IMPORT s:META_STRING ";" { inputStackPush(get(s, String, value)) } ) -mvalue = i:META_IDENT { $$ = newGetVariable(i) } - | META_LPAREN i:MO_OPERATION META_RPAREN { $$ = i } - | META_LPAREN ( i:meta_block | i:meta_exp ) META_RPAREN { eval(globals, i); $$ = null } +mvalue = i:META_IDENT { $$ = newGetVariable(i) } + | META_LPAREN i:MO_OPERATION META_RPAREN { $$ = i } + +mexp = META_LPAREN ( i:meta_block | i:meta_exp ) META_RPAREN { $$ = i } -mstmts = { listBegin() } ( s:meta_stmt { eval(globals, s) } )* META_RCB { $$ = listEnd() } +mstmts = { listBegin() } ( s:meta_stmt { eval(globals, s) } )* META_RCB { $$ = listEnd() } # oop ret = eval(globals, s); if (isReturnable(s, ret)) listAppend(ret)