3 source/parse.y | 15 +++++++++++++++
4 1 file changed, 15 insertions(+)
6 diff --quilt old/source/parse.y new/source/parse.y
9 @@ -134,6 +134,7 @@ static int nextSymIsField = 0;
13 +%type <inst> thenx elsex
17 @@ -141,6 +142,7 @@ static int nextSymIsField = 0;
19 %nonassoc SYMBOL ARG_LOOKUP
20 %right '=' ADDEQ SUBEQ MULEQ DIVEQ MODEQ ANDEQ OREQ
25 @@ -670,6 +672,10 @@ numexpr: '(' blank expr blank ')'
26 | numexpr or blank numexpr %prec OR {
27 ADD_OP(OP_OR); SET_BR_OFF($2, GetPC());
29 + | numexpr thenx blank numexpr elsex blank numexpr %prec '?' {
30 + SET_BR_OFF($2, $5 + 1); /* thenx limb ends at $5+1 */
31 + SET_BR_OFF($5, GetPC()); /* elsex limb ends here */
33 | incrdecr blank SYMBOL %prec INCR {
34 ADD_OP(OP_PUSH_SYM); ADD_SYM($3); ADD_OP($1);
35 ADD_OP(OP_DUP); ADD_OP(OP_ASSIGN); ADD_SYM($3);
36 @@ -731,6 +737,15 @@ or: OR {
41 + ADD_OP(OP_BRANCH_FALSE); $$ = GetPC();
45 + ADD_OP(OP_BRANCH); $$ = GetPC();