Changeset 5356 in webkit for trunk/JavaScriptCore/kjs/grammar.cpp


Ignore:
Timestamp:
Nov 2, 2003, 2:51:46 PM (22 years ago)
Author:
darin
Message:

Reviewed by Maciej.

  • changed list manipulation to use Harri Porten's idea of a circular linked list that is built from head to tail rather than building the list backwards and reversing the list when done
  • kjs/grammar.y: Handle CatchNode and FinallyNode in a type-safe way. Change many places that passed 0L to pass nothing at all, or to pass 0.
  • kjs/nodes.h: (KJS::ElementNode::ElementNode): Build a circular list instead of a 0-terminated backwards list. (KJS::ArrayNode::ArrayNode): Break the circular list instead of reversing the list. (KJS::PropertyValueNode::PropertyValueNode): Moved before ObjectLiteralNode so the inline code in ObjectLiteralNode works. Build a circular list instead of a 0-terminated backwards list. Made the case for the first node separate so we don't need a nil check. (KJS::ObjectLiteralNode::ObjectLiteralNode): Break the circular list instead of reversing the list. (KJS::ArgumentListNode::ArgumentListNode): Build a circular list instead of a 0-terminated backwards list. Also, made the constructors inline (moved here from .cpp file). (KJS::ArgumentsNode::ArgumentsNode): Break the circular list instead of reversing the list. (KJS::NewExprNode::NewExprNode): Changed a 0L to 0. (KJS::StatListNode::StatListNode): Make this constructor no longer inline (moved into .cpp file). The one in the .cpp file builds a circular list instead of a 0-terminated backwards list. (KJS::VarDeclListNode::VarDeclListNode): Build a circular list instead of a 0-terminated backwards list. (KJS::VarStatementNode::VarStatementNode): Break the circular list instead of reversing the list. (KJS::BlockNode::BlockNode): Make this constructor no longer inline (moved into .cpp file). The one in the .cpp file breaks the list instead of reversing it. (KJS::ForNode::ForNode): Break the circular list instead of reversing the list. (KJS::CaseClauseNode::CaseClauseNode): Break the circular list instead of reversing the list. (KJS::ClauseListNode::ClauseListNode): Build a circular list instead of a 0-terminated backwards list. (KJS::CaseBlockNode::CaseBlockNode): Make this constructor no longer inline (moved into .cpp file). The one in the .cpp file breaks the list instead of reversing it. (KJS::TryNode::TryNode): Changed constructor to take typed parameters for the catch and finally nodes rather than just Node. (KJS::ParameterNode::ParameterNode): Build a circular list instead of a 0-terminated backwards list. (KJS::FuncDeclNode::FuncDeclNode): Break the circular list instead of reversing the list. (KJS::FuncExprNode::FuncExprNode): Break the circular list instead of reversing the list.
  • kjs/nodes.cpp: (StatListNode::StatListNode): Moved this constructor here, no longer inline. Did the "break circular list" thing instead of the "reverse list" thing. Added setLoc calls to match KJS in the KDE tree; since we don't currently use the JavaScript debugging support, it's unclear whether there's any benefit, but later we might be using it and it's good to be as close as possible. (BlockNode::BlockNode): Moved this constructor here, no longer inline. Did the "break circular list" thing instead of the "reverse list" thing. Added setLoc calls. (CaseBlockNode::CaseBlockNode): Moved this constructor here, no longer inline. Did the "break circular list" thing instead of the "reverse list" thing. (SourceElementsNode::SourceElementsNode): Moved this constructor here, no longer inline. Did the "break circular list" thing instead of the "reverse list" thing. Added setLoc calls.
  • kjs/grammar.cpp: Regenerated.
  • kjs/grammar.cpp.h: Regenerated.
  • kjs/grammar.h: Regenerated.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/kjs/grammar.cpp

    r5314 r5356  
    153153  PropertyValueNode   *plist;
    154154  PropertyNode        *pnode;
     155  CatchNode           *cnode;
     156  FinallyNode         *fnode;
    155157} YYSTYPE;
    156158
     
    318320#if YYDEBUG != 0
    319321static const short yyrline[] = { 0,
    320    165,   167,   168,   169,   170,   171,   174,   180,   182,   183,
    321    184,   185,   186,   187,   190,   192,   193,   196,   198,   202,
    322    204,   207,   209,   212,   214,   218,   220,   221,   224,   226,
    323    227,   228,   229,   232,   234,   237,   239,   240,   241,   244,
    324    246,   249,   251,   254,   256,   259,   261,   262,   265,   267,
    325    268,   269,   270,   271,   272,   273,   274,   275,   276,   277,
    326    280,   282,   283,   284,   287,   289,   290,   293,   295,   296,
    327    297,   300,   302,   304,   306,   308,   310,   312,   316,   318,
    328    319,   320,   321,   324,   326,   329,   331,   334,   336,   339,
    329    341,   345,   347,   351,   353,   357,   359,   363,   365,   366,
    330    367,   368,   369,   370,   371,   372,   373,   374,   375,   378,
    331    380,   383,   385,   386,   387,   388,   389,   390,   391,   392,
    332    393,   394,   395,   396,   397,   400,   402,   405,   407,   410,
    333    413,   422,   424,   428,   430,   433,   437,   441,   444,   451,
    334    453,   457,   459,   460,   463,   466,   469,   472,   477,   479,
    335    482,   484,   488,   489,   495,   497,   501,   502,   509,   511,
    336    515,   516,   522,   527,   532,   534,   538,   540,   543,   545,
    337    548,   550,   553,   555,   558,   563,   567,   569,   570,   573,
    338    577,   581,   583,   586,   588,   593,   595,   598,   601,   605,
    339    608,   612,   614,   617,   619
     322   169,   171,   172,   173,   174,   175,   178,   184,   186,   187,
     323   188,   189,   190,   191,   194,   196,   197,   200,   202,   206,
     324   208,   211,   213,   216,   218,   222,   224,   225,   228,   230,
     325   231,   232,   233,   236,   238,   241,   243,   244,   245,   248,
     326   250,   253,   255,   258,   260,   263,   265,   266,   269,   271,
     327   272,   273,   274,   275,   276,   277,   278,   279,   280,   281,
     328   284,   286,   287,   288,   291,   293,   294,   297,   299,   300,
     329   301,   304,   306,   308,   310,   312,   314,   316,   320,   322,
     330   323,   324,   325,   328,   330,   333,   335,   338,   340,   343,
     331   345,   349,   351,   355,   357,   361,   363,   367,   369,   370,
     332   371,   372,   373,   374,   375,   376,   377,   378,   379,   382,
     333   384,   387,   389,   390,   391,   392,   393,   394,   395,   396,
     334   397,   398,   399,   400,   401,   404,   406,   409,   411,   414,
     335   417,   426,   428,   432,   434,   437,   441,   445,   448,   455,
     336   457,   461,   463,   464,   467,   470,   473,   476,   481,   483,
     337   486,   488,   492,   493,   499,   501,   505,   506,   513,   515,
     338   519,   520,   526,   531,   536,   538,   542,   544,   547,   549,
     339   552,   554,   557,   559,   562,   567,   571,   573,   574,   577,
     340   581,   585,   587,   590,   592,   597,   599,   602,   605,   609,
     341   612,   616,   618,   621,   623
    340342};
    341343#endif
     
    13341336
    13351337case 1:
    1336 #line 166 "grammar.y"
     1338#line 170 "grammar.y"
    13371339{ yyval.node = new NullNode(); ;
    13381340    break;}
    13391341case 2:
    1340 #line 167 "grammar.y"
     1342#line 171 "grammar.y"
    13411343{ yyval.node = new BooleanNode(true); ;
    13421344    break;}
    13431345case 3:
    1344 #line 168 "grammar.y"
     1346#line 172 "grammar.y"
    13451347{ yyval.node = new BooleanNode(false); ;
    13461348    break;}
    13471349case 4:
    1348 #line 169 "grammar.y"
     1350#line 173 "grammar.y"
    13491351{ yyval.node = new NumberNode(yyvsp[0].dval); ;
    13501352    break;}
    13511353case 5:
    1352 #line 170 "grammar.y"
     1354#line 174 "grammar.y"
    13531355{ yyval.node = new StringNode(yyvsp[0].ustr); ;
    13541356    break;}
    13551357case 6:
    1356 #line 171 "grammar.y"
     1358#line 175 "grammar.y"
    13571359{ Lexer *l = Lexer::curr();
    13581360                                     if (!l->scanRegExp()) YYABORT;
     
    13601362    break;}
    13611363case 7:
    1362 #line 175 "grammar.y"
     1364#line 179 "grammar.y"
    13631365{ Lexer *l = Lexer::curr();
    13641366                                     if (!l->scanRegExp()) YYABORT;
     
    13661368    break;}
    13671369case 8:
    1368 #line 181 "grammar.y"
     1370#line 185 "grammar.y"
    13691371{ yyval.node = new ThisNode(); ;
    13701372    break;}
    13711373case 9:
    1372 #line 182 "grammar.y"
     1374#line 186 "grammar.y"
    13731375{ yyval.node = new ResolveNode(*yyvsp[0].ident); ;
    13741376    break;}
    13751377case 12:
    1376 #line 185 "grammar.y"
     1378#line 189 "grammar.y"
    13771379{ yyval.node = new GroupNode(yyvsp[-1].node); ;
    13781380    break;}
    13791381case 13:
    1380 #line 186 "grammar.y"
    1381 { yyval.node = new ObjectLiteralNode(0L); ;
     1382#line 190 "grammar.y"
     1383{ yyval.node = new ObjectLiteralNode(); ;
    13821384    break;}
    13831385case 14:
    1384 #line 187 "grammar.y"
     1386#line 191 "grammar.y"
    13851387{ yyval.node = new ObjectLiteralNode(yyvsp[-1].plist); ;
    13861388    break;}
    13871389case 15:
    1388 #line 191 "grammar.y"
     1390#line 195 "grammar.y"
    13891391{ yyval.node = new ArrayNode(yyvsp[-1].ival); ;
    13901392    break;}
    13911393case 16:
    1392 #line 192 "grammar.y"
     1394#line 196 "grammar.y"
    13931395{ yyval.node = new ArrayNode(yyvsp[-1].elm); ;
    13941396    break;}
    13951397case 17:
    1396 #line 193 "grammar.y"
     1398#line 197 "grammar.y"
    13971399{ yyval.node = new ArrayNode(yyvsp[-1].ival, yyvsp[-3].elm); ;
    13981400    break;}
    13991401case 18:
    1400 #line 197 "grammar.y"
     1402#line 201 "grammar.y"
    14011403{ yyval.elm = new ElementNode(yyvsp[-1].ival, yyvsp[0].node); ;
    14021404    break;}
    14031405case 19:
    1404 #line 199 "grammar.y"
     1406#line 203 "grammar.y"
    14051407{ yyval.elm = new ElementNode(yyvsp[-3].elm, yyvsp[-1].ival, yyvsp[0].node); ;
    14061408    break;}
    14071409case 20:
    1408 #line 203 "grammar.y"
     1410#line 207 "grammar.y"
    14091411{ yyval.ival = 0; ;
    14101412    break;}
    14111413case 22:
    1412 #line 208 "grammar.y"
     1414#line 212 "grammar.y"
    14131415{ yyval.ival = 1; ;
    14141416    break;}
    14151417case 23:
    1416 #line 209 "grammar.y"
     1418#line 213 "grammar.y"
    14171419{ yyval.ival = yyvsp[-1].ival + 1; ;
    14181420    break;}
    14191421case 24:
    1420 #line 213 "grammar.y"
     1422#line 217 "grammar.y"
    14211423{ yyval.plist = new PropertyValueNode(yyvsp[-2].pnode, yyvsp[0].node); ;
    14221424    break;}
    14231425case 25:
    1424 #line 215 "grammar.y"
     1426#line 219 "grammar.y"
    14251427{ yyval.plist = new PropertyValueNode(yyvsp[-2].pnode, yyvsp[0].node, yyvsp[-4].plist); ;
    14261428    break;}
    14271429case 26:
    1428 #line 219 "grammar.y"
     1430#line 223 "grammar.y"
    14291431{ yyval.pnode = new PropertyNode(*yyvsp[0].ident); ;
    14301432    break;}
    14311433case 27:
    1432 #line 220 "grammar.y"
     1434#line 224 "grammar.y"
    14331435{ yyval.pnode = new PropertyNode(Identifier(*yyvsp[0].ustr)); ;
    14341436    break;}
    14351437case 28:
    1436 #line 221 "grammar.y"
     1438#line 225 "grammar.y"
    14371439{ yyval.pnode = new PropertyNode(yyvsp[0].dval); ;
    14381440    break;}
    14391441case 31:
    1440 #line 227 "grammar.y"
     1442#line 231 "grammar.y"
    14411443{ yyval.node = new AccessorNode1(yyvsp[-3].node, yyvsp[-1].node); ;
    14421444    break;}
    14431445case 32:
    1444 #line 228 "grammar.y"
     1446#line 232 "grammar.y"
    14451447{ yyval.node = new AccessorNode2(yyvsp[-2].node, *yyvsp[0].ident); ;
    14461448    break;}
    14471449case 33:
    1448 #line 229 "grammar.y"
     1450#line 233 "grammar.y"
    14491451{ yyval.node = new NewExprNode(yyvsp[-1].node, yyvsp[0].args); ;
    14501452    break;}
    14511453case 35:
    1452 #line 234 "grammar.y"
     1454#line 238 "grammar.y"
    14531455{ yyval.node = new NewExprNode(yyvsp[0].node); ;
    14541456    break;}
    14551457case 36:
    1456 #line 238 "grammar.y"
     1458#line 242 "grammar.y"
    14571459{ yyval.node = new FunctionCallNode(yyvsp[-1].node, yyvsp[0].args); ;
    14581460    break;}
    14591461case 37:
    1460 #line 239 "grammar.y"
     1462#line 243 "grammar.y"
    14611463{ yyval.node = new FunctionCallNode(yyvsp[-1].node, yyvsp[0].args); ;
    14621464    break;}
    14631465case 38:
    1464 #line 240 "grammar.y"
     1466#line 244 "grammar.y"
    14651467{ yyval.node = new AccessorNode1(yyvsp[-3].node, yyvsp[-1].node); ;
    14661468    break;}
    14671469case 39:
    1468 #line 241 "grammar.y"
     1470#line 245 "grammar.y"
    14691471{ yyval.node = new AccessorNode2(yyvsp[-2].node, *yyvsp[0].ident); ;
    14701472    break;}
    14711473case 40:
    1472 #line 245 "grammar.y"
    1473 { yyval.args = new ArgumentsNode(0L); ;
     1474#line 249 "grammar.y"
     1475{ yyval.args = new ArgumentsNode(); ;
    14741476    break;}
    14751477case 41:
    1476 #line 246 "grammar.y"
     1478#line 250 "grammar.y"
    14771479{ yyval.args = new ArgumentsNode(yyvsp[-1].alist); ;
    14781480    break;}
    14791481case 42:
    1480 #line 250 "grammar.y"
     1482#line 254 "grammar.y"
    14811483{ yyval.alist = new ArgumentListNode(yyvsp[0].node); ;
    14821484    break;}
    14831485case 43:
    1484 #line 251 "grammar.y"
     1486#line 255 "grammar.y"
    14851487{ yyval.alist = new ArgumentListNode(yyvsp[-2].alist, yyvsp[0].node); ;
    14861488    break;}
    14871489case 47:
    1488 #line 261 "grammar.y"
     1490#line 265 "grammar.y"
    14891491{ yyval.node = new PostfixNode(yyvsp[-1].node, OpPlusPlus); ;
    14901492    break;}
    14911493case 48:
    1492 #line 262 "grammar.y"
     1494#line 266 "grammar.y"
    14931495{ yyval.node = new PostfixNode(yyvsp[-1].node, OpMinusMinus); ;
    14941496    break;}
    14951497case 50:
    1496 #line 267 "grammar.y"
     1498#line 271 "grammar.y"
    14971499{ yyval.node = new DeleteNode(yyvsp[0].node); ;
    14981500    break;}
    14991501case 51:
    1500 #line 268 "grammar.y"
     1502#line 272 "grammar.y"
    15011503{ yyval.node = new VoidNode(yyvsp[0].node); ;
    15021504    break;}
    15031505case 52:
    1504 #line 269 "grammar.y"
     1506#line 273 "grammar.y"
    15051507{ yyval.node = new TypeOfNode(yyvsp[0].node); ;
    15061508    break;}
    15071509case 53:
    1508 #line 270 "grammar.y"
     1510#line 274 "grammar.y"
    15091511{ yyval.node = new PrefixNode(OpPlusPlus, yyvsp[0].node); ;
    15101512    break;}
    15111513case 54:
    1512 #line 271 "grammar.y"
     1514#line 275 "grammar.y"
    15131515{ yyval.node = new PrefixNode(OpPlusPlus, yyvsp[0].node); ;
    15141516    break;}
    15151517case 55:
    1516 #line 272 "grammar.y"
     1518#line 276 "grammar.y"
    15171519{ yyval.node = new PrefixNode(OpMinusMinus, yyvsp[0].node); ;
    15181520    break;}
    15191521case 56:
    1520 #line 273 "grammar.y"
     1522#line 277 "grammar.y"
    15211523{ yyval.node = new PrefixNode(OpMinusMinus, yyvsp[0].node); ;
    15221524    break;}
    15231525case 57:
    1524 #line 274 "grammar.y"
     1526#line 278 "grammar.y"
    15251527{ yyval.node = new UnaryPlusNode(yyvsp[0].node); ;
    15261528    break;}
    15271529case 58:
    1528 #line 275 "grammar.y"
     1530#line 279 "grammar.y"
    15291531{ yyval.node = new NegateNode(yyvsp[0].node); ;
    15301532    break;}
    15311533case 59:
    1532 #line 276 "grammar.y"
     1534#line 280 "grammar.y"
    15331535{ yyval.node = new BitwiseNotNode(yyvsp[0].node); ;
    15341536    break;}
    15351537case 60:
    1536 #line 277 "grammar.y"
     1538#line 281 "grammar.y"
    15371539{ yyval.node = new LogicalNotNode(yyvsp[0].node); ;
    15381540    break;}
    15391541case 62:
    1540 #line 282 "grammar.y"
     1542#line 286 "grammar.y"
    15411543{ yyval.node = new MultNode(yyvsp[-2].node, yyvsp[0].node, '*'); ;
    15421544    break;}
    15431545case 63:
    1544 #line 283 "grammar.y"
     1546#line 287 "grammar.y"
    15451547{ yyval.node = new MultNode(yyvsp[-2].node, yyvsp[0].node, '/'); ;
    15461548    break;}
    15471549case 64:
    1548 #line 284 "grammar.y"
     1550#line 288 "grammar.y"
    15491551{ yyval.node = new MultNode(yyvsp[-2].node,yyvsp[0].node,'%'); ;
    15501552    break;}
    15511553case 66:
    1552 #line 289 "grammar.y"
     1554#line 293 "grammar.y"
    15531555{ yyval.node = new AddNode(yyvsp[-2].node, yyvsp[0].node, '+'); ;
    15541556    break;}
    15551557case 67:
    1556 #line 290 "grammar.y"
     1558#line 294 "grammar.y"
    15571559{ yyval.node = new AddNode(yyvsp[-2].node, yyvsp[0].node, '-'); ;
    15581560    break;}
    15591561case 69:
    1560 #line 295 "grammar.y"
     1562#line 299 "grammar.y"
    15611563{ yyval.node = new ShiftNode(yyvsp[-2].node, OpLShift, yyvsp[0].node); ;
    15621564    break;}
    15631565case 70:
    1564 #line 296 "grammar.y"
     1566#line 300 "grammar.y"
    15651567{ yyval.node = new ShiftNode(yyvsp[-2].node, OpRShift, yyvsp[0].node); ;
    15661568    break;}
    15671569case 71:
    1568 #line 297 "grammar.y"
     1570#line 301 "grammar.y"
    15691571{ yyval.node = new ShiftNode(yyvsp[-2].node, OpURShift, yyvsp[0].node); ;
    15701572    break;}
    15711573case 73:
    1572 #line 303 "grammar.y"
     1574#line 307 "grammar.y"
    15731575{ yyval.node = new RelationalNode(yyvsp[-2].node, OpLess, yyvsp[0].node); ;
    15741576    break;}
    15751577case 74:
    1576 #line 305 "grammar.y"
     1578#line 309 "grammar.y"
    15771579{ yyval.node = new RelationalNode(yyvsp[-2].node, OpGreater, yyvsp[0].node); ;
    15781580    break;}
    15791581case 75:
    1580 #line 307 "grammar.y"
     1582#line 311 "grammar.y"
    15811583{ yyval.node = new RelationalNode(yyvsp[-2].node, OpLessEq, yyvsp[0].node); ;
    15821584    break;}
    15831585case 76:
    1584 #line 309 "grammar.y"
     1586#line 313 "grammar.y"
    15851587{ yyval.node = new RelationalNode(yyvsp[-2].node, OpGreaterEq, yyvsp[0].node); ;
    15861588    break;}
    15871589case 77:
    1588 #line 311 "grammar.y"
     1590#line 315 "grammar.y"
    15891591{ yyval.node = new RelationalNode(yyvsp[-2].node, OpInstanceOf, yyvsp[0].node); ;
    15901592    break;}
    15911593case 78:
    1592 #line 313 "grammar.y"
     1594#line 317 "grammar.y"
    15931595{ yyval.node = new RelationalNode(yyvsp[-2].node, OpIn, yyvsp[0].node); ;
    15941596    break;}
    15951597case 80:
    1596 #line 318 "grammar.y"
     1598#line 322 "grammar.y"
    15971599{ yyval.node = new EqualNode(yyvsp[-2].node, OpEqEq, yyvsp[0].node); ;
    15981600    break;}
    15991601case 81:
    1600 #line 319 "grammar.y"
     1602#line 323 "grammar.y"
    16011603{ yyval.node = new EqualNode(yyvsp[-2].node, OpNotEq, yyvsp[0].node); ;
    16021604    break;}
    16031605case 82:
    1604 #line 320 "grammar.y"
     1606#line 324 "grammar.y"
    16051607{ yyval.node = new EqualNode(yyvsp[-2].node, OpStrEq, yyvsp[0].node); ;
    16061608    break;}
    16071609case 83:
    1608 #line 321 "grammar.y"
     1610#line 325 "grammar.y"
    16091611{ yyval.node = new EqualNode(yyvsp[-2].node, OpStrNEq, yyvsp[0].node);;
    16101612    break;}
    16111613case 85:
    1612 #line 326 "grammar.y"
     1614#line 330 "grammar.y"
    16131615{ yyval.node = new BitOperNode(yyvsp[-2].node, OpBitAnd, yyvsp[0].node); ;
    16141616    break;}
    16151617case 87:
    1616 #line 331 "grammar.y"
     1618#line 335 "grammar.y"
    16171619{ yyval.node = new BitOperNode(yyvsp[-2].node, OpBitXOr, yyvsp[0].node); ;
    16181620    break;}
    16191621case 89:
    1620 #line 336 "grammar.y"
     1622#line 340 "grammar.y"
    16211623{ yyval.node = new BitOperNode(yyvsp[-2].node, OpBitOr, yyvsp[0].node); ;
    16221624    break;}
    16231625case 91:
    1624 #line 342 "grammar.y"
     1626#line 346 "grammar.y"
    16251627{ yyval.node = new BinaryLogicalNode(yyvsp[-2].node, OpAnd, yyvsp[0].node); ;
    16261628    break;}
    16271629case 93:
    1628 #line 348 "grammar.y"
     1630#line 352 "grammar.y"
    16291631{ yyval.node = new BinaryLogicalNode(yyvsp[-2].node, OpOr, yyvsp[0].node); ;
    16301632    break;}
    16311633case 95:
    1632 #line 354 "grammar.y"
     1634#line 358 "grammar.y"
    16331635{ yyval.node = new ConditionalNode(yyvsp[-4].node, yyvsp[-2].node, yyvsp[0].node); ;
    16341636    break;}
    16351637case 97:
    1636 #line 360 "grammar.y"
     1638#line 364 "grammar.y"
    16371639{ yyval.node = new AssignNode(yyvsp[-2].node, yyvsp[-1].op, yyvsp[0].node);;
    16381640    break;}
    16391641case 98:
    1640 #line 364 "grammar.y"
     1642#line 368 "grammar.y"
    16411643{ yyval.op = OpEqual; ;
    16421644    break;}
    16431645case 99:
    1644 #line 365 "grammar.y"
     1646#line 369 "grammar.y"
    16451647{ yyval.op = OpPlusEq; ;
    16461648    break;}
    16471649case 100:
    1648 #line 366 "grammar.y"
     1650#line 370 "grammar.y"
    16491651{ yyval.op = OpMinusEq; ;
    16501652    break;}
    16511653case 101:
    1652 #line 367 "grammar.y"
     1654#line 371 "grammar.y"
    16531655{ yyval.op = OpMultEq; ;
    16541656    break;}
    16551657case 102:
    1656 #line 368 "grammar.y"
     1658#line 372 "grammar.y"
    16571659{ yyval.op = OpDivEq; ;
    16581660    break;}
    16591661case 103:
    1660 #line 369 "grammar.y"
     1662#line 373 "grammar.y"
    16611663{ yyval.op = OpLShift; ;
    16621664    break;}
    16631665case 104:
    1664 #line 370 "grammar.y"
     1666#line 374 "grammar.y"
    16651667{ yyval.op = OpRShift; ;
    16661668    break;}
    16671669case 105:
    1668 #line 371 "grammar.y"
     1670#line 375 "grammar.y"
    16691671{ yyval.op = OpURShift; ;
    16701672    break;}
    16711673case 106:
    1672 #line 372 "grammar.y"
     1674#line 376 "grammar.y"
    16731675{ yyval.op = OpAndEq; ;
    16741676    break;}
    16751677case 107:
    1676 #line 373 "grammar.y"
     1678#line 377 "grammar.y"
    16771679{ yyval.op = OpXOrEq; ;
    16781680    break;}
    16791681case 108:
    1680 #line 374 "grammar.y"
     1682#line 378 "grammar.y"
    16811683{ yyval.op = OpOrEq; ;
    16821684    break;}
    16831685case 109:
    1684 #line 375 "grammar.y"
     1686#line 379 "grammar.y"
    16851687{ yyval.op = OpModEq; ;
    16861688    break;}
    16871689case 111:
    1688 #line 380 "grammar.y"
     1690#line 384 "grammar.y"
    16891691{ yyval.node = new CommaNode(yyvsp[-2].node, yyvsp[0].node); ;
    16901692    break;}
    16911693case 126:
    1692 #line 401 "grammar.y"
    1693 { yyval.stat = new BlockNode(0L); DBG(yyval.stat, yylsp[0], yylsp[0]); ;
     1694#line 405 "grammar.y"
     1695{ yyval.stat = new BlockNode(0); DBG(yyval.stat, yylsp[0], yylsp[0]); ;
    16941696    break;}
    16951697case 127:
    1696 #line 402 "grammar.y"
     1698#line 406 "grammar.y"
    16971699{ yyval.stat = new BlockNode(yyvsp[-1].srcs); DBG(yyval.stat, yylsp[0], yylsp[0]); ;
    16981700    break;}
    16991701case 128:
    1700 #line 406 "grammar.y"
     1702#line 410 "grammar.y"
    17011703{ yyval.slist = new StatListNode(yyvsp[0].stat); ;
    17021704    break;}
    17031705case 129:
    1704 #line 407 "grammar.y"
     1706#line 411 "grammar.y"
    17051707{ yyval.slist = new StatListNode(yyvsp[-1].slist, yyvsp[0].stat); ;
    17061708    break;}
    17071709case 130:
    1708 #line 411 "grammar.y"
     1710#line 415 "grammar.y"
    17091711{ yyval.stat = new VarStatementNode(yyvsp[-1].vlist);
    17101712                                      DBG(yyval.stat, yylsp[-2], yylsp[0]); ;
    17111713    break;}
    17121714case 131:
    1713 #line 413 "grammar.y"
     1715#line 417 "grammar.y"
    17141716{ if (automatic()) {
    17151717                                          yyval.stat = new VarStatementNode(yyvsp[-1].vlist);
     
    17211723    break;}
    17221724case 132:
    1723 #line 423 "grammar.y"
     1725#line 427 "grammar.y"
    17241726{ yyval.vlist = new VarDeclListNode(yyvsp[0].decl); ;
    17251727    break;}
    17261728case 133:
    1727 #line 425 "grammar.y"
     1729#line 429 "grammar.y"
    17281730{ yyval.vlist = new VarDeclListNode(yyvsp[-2].vlist, yyvsp[0].decl); ;
    17291731    break;}
    17301732case 134:
    1731 #line 429 "grammar.y"
     1733#line 433 "grammar.y"
    17321734{ yyval.decl = new VarDeclNode(*yyvsp[0].ident, 0); ;
    17331735    break;}
    17341736case 135:
    1735 #line 430 "grammar.y"
     1737#line 434 "grammar.y"
    17361738{ yyval.decl = new VarDeclNode(*yyvsp[-1].ident, yyvsp[0].init); ;
    17371739    break;}
    17381740case 136:
    1739 #line 434 "grammar.y"
     1741#line 438 "grammar.y"
    17401742{ yyval.init = new AssignExprNode(yyvsp[0].node); ;
    17411743    break;}
    17421744case 137:
    1743 #line 438 "grammar.y"
     1745#line 442 "grammar.y"
    17441746{ yyval.stat = new EmptyStatementNode(); ;
    17451747    break;}
    17461748case 138:
    1747 #line 442 "grammar.y"
     1749#line 446 "grammar.y"
    17481750{ yyval.stat = new ExprStatementNode(yyvsp[-1].node);
    17491751                                     DBG(yyval.stat, yylsp[-1], yylsp[0]); ;
    17501752    break;}
    17511753case 139:
    1752 #line 444 "grammar.y"
     1754#line 448 "grammar.y"
    17531755{ if (automatic()) {
    17541756                                       yyval.stat = new ExprStatementNode(yyvsp[-1].node);
     
    17581760    break;}
    17591761case 140:
    1760 #line 452 "grammar.y"
    1761 { yyval.stat = new IfNode(yyvsp[-2].node,yyvsp[0].stat,0L);DBG(yyval.stat,yylsp[-4],yylsp[-1]); ;
     1762#line 456 "grammar.y"
     1763{ yyval.stat = new IfNode(yyvsp[-2].node,yyvsp[0].stat,0);DBG(yyval.stat,yylsp[-4],yylsp[-1]); ;
    17621764    break;}
    17631765case 141:
    1764 #line 454 "grammar.y"
     1766#line 458 "grammar.y"
    17651767{ yyval.stat = new IfNode(yyvsp[-4].node,yyvsp[-2].stat,yyvsp[0].stat);DBG(yyval.stat,yylsp[-6],yylsp[-3]); ;
    17661768    break;}
    17671769case 142:
    1768 #line 458 "grammar.y"
     1770#line 462 "grammar.y"
    17691771{ yyval.stat=new DoWhileNode(yyvsp[-4].stat,yyvsp[-1].node);DBG(yyval.stat,yylsp[-5],yylsp[-3]);;
    17701772    break;}
    17711773case 143:
    1772 #line 459 "grammar.y"
     1774#line 463 "grammar.y"
    17731775{ yyval.stat = new WhileNode(yyvsp[-2].node,yyvsp[0].stat);DBG(yyval.stat,yylsp[-4],yylsp[-1]); ;
    17741776    break;}
    17751777case 144:
    1776 #line 461 "grammar.y"
     1778#line 465 "grammar.y"
    17771779{ yyval.stat = new ForNode(yyvsp[-6].node,yyvsp[-4].node,yyvsp[-2].node,yyvsp[0].stat);
    17781780                                     DBG(yyval.stat,yylsp[-8],yylsp[-1]); ;
    17791781    break;}
    17801782case 145:
    1781 #line 464 "grammar.y"
     1783#line 468 "grammar.y"
    17821784{ yyval.stat = new ForNode(yyvsp[-6].vlist,yyvsp[-4].node,yyvsp[-2].node,yyvsp[0].stat);
    17831785                                     DBG(yyval.stat,yylsp[-9],yylsp[-1]); ;
    17841786    break;}
    17851787case 146:
    1786 #line 467 "grammar.y"
     1788#line 471 "grammar.y"
    17871789{ yyval.stat = new ForInNode(yyvsp[-4].node, yyvsp[-2].node, yyvsp[0].stat);
    17881790                                     DBG(yyval.stat,yylsp[-6],yylsp[-1]); ;
    17891791    break;}
    17901792case 147:
    1791 #line 470 "grammar.y"
    1792 { yyval.stat = new ForInNode(*yyvsp[-4].ident,0L,yyvsp[-2].node,yyvsp[0].stat);
     1793#line 474 "grammar.y"
     1794{ yyval.stat = new ForInNode(*yyvsp[-4].ident,0,yyvsp[-2].node,yyvsp[0].stat);
    17931795                                     DBG(yyval.stat,yylsp[-7],yylsp[-1]); ;
    17941796    break;}
    17951797case 148:
    1796 #line 473 "grammar.y"
     1798#line 477 "grammar.y"
    17971799{ yyval.stat = new ForInNode(*yyvsp[-5].ident,yyvsp[-4].init,yyvsp[-2].node,yyvsp[0].stat);
    17981800                                     DBG(yyval.stat,yylsp[-8],yylsp[-1]); ;
    17991801    break;}
    18001802case 149:
    1801 #line 478 "grammar.y"
    1802 { yyval.node = 0L; ;
     1803#line 482 "grammar.y"
     1804{ yyval.node = 0; ;
    18031805    break;}
    18041806case 151:
    1805 #line 483 "grammar.y"
     1807#line 487 "grammar.y"
    18061808{ yyval.stat = new ContinueNode(); DBG(yyval.stat,yylsp[-1],yylsp[0]); ;
    18071809    break;}
    18081810case 152:
    1809 #line 484 "grammar.y"
     1811#line 488 "grammar.y"
    18101812{ if (automatic()) {
    18111813                                       yyval.stat = new ContinueNode(); DBG(yyval.stat,yylsp[-1],yylsp[0]);
     
    18141816    break;}
    18151817case 153:
    1816 #line 488 "grammar.y"
     1818#line 492 "grammar.y"
    18171819{ yyval.stat = new ContinueNode(*yyvsp[-1].ident); DBG(yyval.stat,yylsp[-2],yylsp[0]); ;
    18181820    break;}
    18191821case 154:
    1820 #line 489 "grammar.y"
     1822#line 493 "grammar.y"
    18211823{ if (automatic()) {
    18221824                                       yyval.stat = new ContinueNode(*yyvsp[-1].ident);DBG(yyval.stat,yylsp[-2],yylsp[-1]);
     
    18251827    break;}
    18261828case 155:
    1827 #line 496 "grammar.y"
     1829#line 500 "grammar.y"
    18281830{ yyval.stat = new BreakNode();DBG(yyval.stat,yylsp[-1],yylsp[0]); ;
    18291831    break;}
    18301832case 156:
    1831 #line 497 "grammar.y"
     1833#line 501 "grammar.y"
    18321834{ if (automatic()) {
    18331835                                       yyval.stat = new BreakNode(); DBG(yyval.stat,yylsp[-1],yylsp[-1]);
     
    18361838    break;}
    18371839case 157:
    1838 #line 501 "grammar.y"
     1840#line 505 "grammar.y"
    18391841{ yyval.stat = new BreakNode(*yyvsp[-1].ident); DBG(yyval.stat,yylsp[-2],yylsp[0]); ;
    18401842    break;}
    18411843case 158:
    1842 #line 502 "grammar.y"
     1844#line 506 "grammar.y"
    18431845{ if (automatic()) {
    18441846                                       yyval.stat = new BreakNode(*yyvsp[-1].ident); DBG(yyval.stat,yylsp[-2],yylsp[-1]);
     
    18481850    break;}
    18491851case 159:
    1850 #line 510 "grammar.y"
    1851 { yyval.stat = new ReturnNode(0L); DBG(yyval.stat,yylsp[-1],yylsp[0]); ;
     1852#line 514 "grammar.y"
     1853{ yyval.stat = new ReturnNode(0); DBG(yyval.stat,yylsp[-1],yylsp[0]); ;
    18521854    break;}
    18531855case 160:
    1854 #line 511 "grammar.y"
     1856#line 515 "grammar.y"
    18551857{ if (automatic()) {
    1856                                        yyval.stat = new ReturnNode(0L); DBG(yyval.stat,yylsp[-1],yylsp[-1]);
     1858                                       yyval.stat = new ReturnNode(0); DBG(yyval.stat,yylsp[-1],yylsp[-1]);
    18571859                                     } else
    18581860                                       YYABORT; ;
    18591861    break;}
    18601862case 161:
    1861 #line 515 "grammar.y"
     1863#line 519 "grammar.y"
    18621864{ yyval.stat = new ReturnNode(yyvsp[-1].node); ;
    18631865    break;}
    18641866case 162:
    1865 #line 516 "grammar.y"
     1867#line 520 "grammar.y"
    18661868{ if (automatic())
    18671869                                       yyval.stat = new ReturnNode(yyvsp[-1].node);
     
    18701872    break;}
    18711873case 163:
    1872 #line 523 "grammar.y"
     1874#line 527 "grammar.y"
    18731875{ yyval.stat = new WithNode(yyvsp[-2].node,yyvsp[0].stat);
    18741876                                     DBG(yyval.stat, yylsp[-4], yylsp[-1]); ;
    18751877    break;}
    18761878case 164:
    1877 #line 528 "grammar.y"
     1879#line 532 "grammar.y"
    18781880{ yyval.stat = new SwitchNode(yyvsp[-2].node, yyvsp[0].cblk);
    18791881                                     DBG(yyval.stat, yylsp[-4], yylsp[-1]); ;
    18801882    break;}
    18811883case 165:
    1882 #line 533 "grammar.y"
    1883 { yyval.cblk = new CaseBlockNode(yyvsp[-1].clist, 0L, 0L); ;
     1884#line 537 "grammar.y"
     1885{ yyval.cblk = new CaseBlockNode(yyvsp[-1].clist, 0, 0); ;
    18841886    break;}
    18851887case 166:
    1886 #line 535 "grammar.y"
     1888#line 539 "grammar.y"
    18871889{ yyval.cblk = new CaseBlockNode(yyvsp[-3].clist, yyvsp[-2].ccl, yyvsp[-1].clist); ;
    18881890    break;}
    18891891case 167:
    1890 #line 539 "grammar.y"
    1891 { yyval.clist = 0L; ;
     1892#line 543 "grammar.y"
     1893{ yyval.clist = 0; ;
    18921894    break;}
    18931895case 169:
    1894 #line 544 "grammar.y"
     1896#line 548 "grammar.y"
    18951897{ yyval.clist = new ClauseListNode(yyvsp[0].ccl); ;
    18961898    break;}
    18971899case 170:
    1898 #line 545 "grammar.y"
     1900#line 549 "grammar.y"
    18991901{ yyval.clist = new ClauseListNode(yyvsp[-1].clist, yyvsp[0].ccl); ;
    19001902    break;}
    19011903case 171:
    1902 #line 549 "grammar.y"
    1903 { yyval.ccl = new CaseClauseNode(yyvsp[-1].node, 0L); ;
     1904#line 553 "grammar.y"
     1905{ yyval.ccl = new CaseClauseNode(yyvsp[-1].node); ;
    19041906    break;}
    19051907case 172:
    1906 #line 550 "grammar.y"
     1908#line 554 "grammar.y"
    19071909{ yyval.ccl = new CaseClauseNode(yyvsp[-2].node, yyvsp[0].slist); ;
    19081910    break;}
    19091911case 173:
    1910 #line 554 "grammar.y"
    1911 { yyval.ccl = new CaseClauseNode(0L, 0L);; ;
     1912#line 558 "grammar.y"
     1913{ yyval.ccl = new CaseClauseNode(0); ;
    19121914    break;}
    19131915case 174:
    1914 #line 555 "grammar.y"
    1915 { yyval.ccl = new CaseClauseNode(0L, yyvsp[0].slist); ;
     1916#line 559 "grammar.y"
     1917{ yyval.ccl = new CaseClauseNode(0, yyvsp[0].slist); ;
    19161918    break;}
    19171919case 175:
    1918 #line 559 "grammar.y"
     1920#line 563 "grammar.y"
    19191921{ yyvsp[0].stat->pushLabel(*yyvsp[-2].ident);
    19201922                                     yyval.stat = new LabelNode(*yyvsp[-2].ident, yyvsp[0].stat); ;
    19211923    break;}
    19221924case 176:
    1923 #line 564 "grammar.y"
     1925#line 568 "grammar.y"
    19241926{ yyval.stat = new ThrowNode(yyvsp[-1].node); ;
    19251927    break;}
    19261928case 177:
    1927 #line 568 "grammar.y"
    1928 { yyval.stat = new TryNode(yyvsp[-1].stat, yyvsp[0].node); ;
     1929#line 572 "grammar.y"
     1930{ yyval.stat = new TryNode(yyvsp[-1].stat, yyvsp[0].cnode); ;
    19291931    break;}
    19301932case 178:
    1931 #line 569 "grammar.y"
    1932 { yyval.stat = new TryNode(yyvsp[-1].stat, 0L, yyvsp[0].node); ;
     1933#line 573 "grammar.y"
     1934{ yyval.stat = new TryNode(yyvsp[-1].stat, yyvsp[0].fnode); ;
    19331935    break;}
    19341936case 179:
    1935 #line 570 "grammar.y"
    1936 { yyval.stat = new TryNode(yyvsp[-2].stat, yyvsp[-1].node, yyvsp[0].node); ;
     1937#line 574 "grammar.y"
     1938{ yyval.stat = new TryNode(yyvsp[-2].stat, yyvsp[-1].cnode, yyvsp[0].fnode); ;
    19371939    break;}
    19381940case 180:
    1939 #line 574 "grammar.y"
    1940 { yyval.node = new CatchNode(*yyvsp[-2].ident, yyvsp[0].stat); ;
     1941#line 578 "grammar.y"
     1942{ yyval.cnode = new CatchNode(*yyvsp[-2].ident, yyvsp[0].stat); ;
    19411943    break;}
    19421944case 181:
    1943 #line 578 "grammar.y"
    1944 { yyval.node = new FinallyNode(yyvsp[0].stat); ;
     1945#line 582 "grammar.y"
     1946{ yyval.fnode = new FinallyNode(yyvsp[0].stat); ;
    19451947    break;}
    19461948case 182:
    1947 #line 582 "grammar.y"
    1948 { yyval.func = new FuncDeclNode(*yyvsp[-3].ident, 0L, yyvsp[0].body); ;
     1949#line 586 "grammar.y"
     1950{ yyval.func = new FuncDeclNode(*yyvsp[-3].ident, yyvsp[0].body); ;
    19491951    break;}
    19501952case 183:
    1951 #line 584 "grammar.y"
     1953#line 588 "grammar.y"
    19521954{ yyval.func = new FuncDeclNode(*yyvsp[-4].ident, yyvsp[-2].param, yyvsp[0].body); ;
    19531955    break;}
    19541956case 184:
    1955 #line 587 "grammar.y"
    1956 { yyval.node = new FuncExprNode(0L, yyvsp[0].body); ;
     1957#line 591 "grammar.y"
     1958{ yyval.node = new FuncExprNode(yyvsp[0].body); ;
    19571959    break;}
    19581960case 185:
    1959 #line 589 "grammar.y"
     1961#line 593 "grammar.y"
    19601962{ yyval.node = new FuncExprNode(yyvsp[-2].param, yyvsp[0].body); ;
    19611963    break;}
    19621964case 186:
    1963 #line 594 "grammar.y"
     1965#line 598 "grammar.y"
    19641966{ yyval.param = new ParameterNode(*yyvsp[0].ident); ;
    19651967    break;}
    19661968case 187:
    1967 #line 595 "grammar.y"
     1969#line 599 "grammar.y"
    19681970{ yyval.param = new ParameterNode(yyvsp[-2].param, *yyvsp[0].ident); ;
    19691971    break;}
    19701972case 188:
    1971 #line 599 "grammar.y"
    1972 { yyval.body = new FunctionBodyNode(0L);
     1973#line 603 "grammar.y"
     1974{ yyval.body = new FunctionBodyNode(0);
    19731975                                     DBG(yyval.body, yylsp[-1], yylsp[0]);;
    19741976    break;}
    19751977case 189:
    1976 #line 601 "grammar.y"
     1978#line 605 "grammar.y"
    19771979{ yyval.body = new FunctionBodyNode(yyvsp[-1].srcs);
    19781980                                     DBG(yyval.body, yylsp[-2], yylsp[0]);;
    19791981    break;}
    19801982case 190:
    1981 #line 606 "grammar.y"
    1982 { yyval.prog = new ProgramNode(0L);
     1983#line 610 "grammar.y"
     1984{ yyval.prog = new ProgramNode(0);
    19831985                                     Parser::progNode = yyval.prog; ;
    19841986    break;}
    19851987case 191:
    1986 #line 608 "grammar.y"
     1988#line 612 "grammar.y"
    19871989{ yyval.prog = new ProgramNode(yyvsp[0].srcs);
    19881990                                     Parser::progNode = yyval.prog; ;
    19891991    break;}
    19901992case 192:
    1991 #line 613 "grammar.y"
     1993#line 617 "grammar.y"
    19921994{ yyval.srcs = new SourceElementsNode(yyvsp[0].stat); ;
    19931995    break;}
    19941996case 193:
    1995 #line 614 "grammar.y"
     1997#line 618 "grammar.y"
    19961998{ yyval.srcs = new SourceElementsNode(yyvsp[-1].srcs, yyvsp[0].stat); ;
    19971999    break;}
    19982000case 194:
    1999 #line 618 "grammar.y"
     2001#line 622 "grammar.y"
    20002002{ yyval.stat = yyvsp[0].stat; ;
    20012003    break;}
    20022004case 195:
    2003 #line 619 "grammar.y"
     2005#line 623 "grammar.y"
    20042006{ yyval.stat = yyvsp[0].func; ;
    20052007    break;}
     
    22272229  return 1;
    22282230}
    2229 #line 622 "grammar.y"
     2231#line 626 "grammar.y"
    22302232
    22312233
Note: See TracChangeset for help on using the changeset viewer.