Ticket #137: imcc_fix_new_syntax.patch

File imcc_fix_new_syntax.patch, 2.4 KB (added by whiteknight, 6 years ago)

patch to fix the problem

  • compilers/imcc/imcc.y

     
    17311731            { $$ = iINDEXFETCH(interp, IMCC_INFO(interp)->cur_unit, $1, $3, $5); } 
    17321732   | target '[' keylist ']' '=' var 
    17331733            { $$ = iINDEXSET(interp, IMCC_INFO(interp)->cur_unit, $1, $3, $6); } 
    1734    | target '=' NEW classname COMMA var 
    1735             { $$ = iNEW(interp, IMCC_INFO(interp)->cur_unit, $1, $4, $6, 1); } 
    1736    | target '=' NEW classname '[' keylist ']' 
    1737             { $$ = iNEW(interp, IMCC_INFO(interp)->cur_unit, $1, $4, $6, 1); } 
    1738    | target '=' NEW classname 
    1739             { $$ = iNEW(interp, IMCC_INFO(interp)->cur_unit, $1, $4, NULL, 1); } 
    1740    | target '=' NEW var 
    1741             { $$ = MK_I(interp, IMCC_INFO(interp)->cur_unit, "new", 2, $1, $4); } 
    1742    | target '=' NEW maybe_ns 
    1743             { $$ = MK_I(interp, IMCC_INFO(interp)->cur_unit, "new", 2, $1, $4); } 
    1744    | target '=' NEW maybe_ns COMMA var 
    1745             { $$ = MK_I(interp, IMCC_INFO(interp)->cur_unit, "new", 3, $1, $4, $6); } 
    1746    | target '=' NEW var COMMA var 
    1747             { $$ = MK_I(interp, IMCC_INFO(interp)->cur_unit, "new", 3, $1, $4, $6); } 
    1748    | target '=' NEW var '[' keylist ']' 
    1749             { $$ = MK_I(interp, IMCC_INFO(interp)->cur_unit, "new", 3, $1, $4, $6); } 
    1750        /* NEW is here because it is both PIR and PASM keywords so we 
    1751         * have to handle the token here (or badly hack the lexer). */ 
    1752    | NEW target COMMA var 
    1753             { $$ = MK_I(interp, IMCC_INFO(interp)->cur_unit, "new", 2, $2, $4); } 
    1754    | NEW target COMMA var COMMA var 
    1755             { $$ = MK_I(interp, IMCC_INFO(interp)->cur_unit, "new", 3, $2, $4, $6); } 
    1756    | NEW target COMMA var '[' keylist ']' 
    1757             { $$ = MK_I(interp, IMCC_INFO(interp)->cur_unit, "new", 3, $2, $4, $6); } 
    17581734     /* Subroutine call the short way */ 
    17591735   | target  '=' sub_call 
    17601736         { 
  • compilers/imcc/imcc.l

     
    366366"null"                        return PNULL; 
    367367"int"                         return INTV; 
    368368"num"                         return FLOATV; 
    369 "new"                         return NEW; 
     369 
    370370"pmc"                         return PMCV; 
    371371"string"                      return STRINGV; 
    372372"<<"                          return SHIFT_LEFT;