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


Ignore:
Timestamp:
Dec 28, 2002, 3:07:37 PM (22 years ago)
Author:
kocienda
Message:

Reviewed by Gramps and Ken.
Checked in by Ken.

  • fixed 3134693 -- carsdirect.com crash on used car search, due to large JavaScript array

The parser was using recursion to handle many types of lists.
This meant that we crashed out of stack space when any of the lists were extra big.
I applied the same sort of fix we had already applied a while back for argument lists for
all the other types of lists, including the list of ElementNode that was the reason for
the crash reported here.

  • kjs/grammar.y: Removed ElisionNode altogether and just use a count. Use specific node types for PropertyNameAndValueList and PropertyName.
  • kjs/grammar.cpp: Regenerated.
  • kjs/grammar.cpp.h: Regenerated.
  • kjs/grammar.h: Regenerated.
  • kjs/nodes.h: Elide "ElisionNode", changing objects to keep elision counts instead. Make the ObjectLiteralNode list field be PropertyValueNode, not just Node. Make PropertyValueNode fields have specific types. Add new reverse list functions, calls to those functions in the constructors, and friend declarations as needed so the class that holds the head of a list can reverse the list during parsing.
  • kjs/nodes.cpp: (ElementNode::ref): Use iteration instead of recursion. Also elide "elision". (ElementNode::deref): Ditto. (ElementNode::evaluate): Use iteration instead of recursion, taking advantage of the fact that the linked list is reversed. Also use the elision count rather than an elision list. (ArrayNode::reverseElementList): Reverse the list so we can iterate normally. (ArrayNode::ref): Elide "elision". (ArrayNode::deref): Ditto. (ArrayNode::evaluate): Use elision count instead of elision list. (ObjectLiteralNode::reverseList): Reverse the list so we can iterate normally. (PropertyValueNode::ref): Use iteration instead of recursion. (PropertyValueNode::deref): Use iteration instead of recursion. (PropertyValueNode::evaluate): Use iteration instead of recursion, taking advantage of the fact that the linked list is reversed. (ArgumentListNode::ref): Change code to match the other similar cases we had to revise. (ArgumentListNode::deref): Ditto. (ArgumentListNode::evaluateList): Ditto. (ArgumentsNode::reverseList): Ditto. (VarDeclListNode::ref): Use iteration instead of recursion. (VarDeclListNode::deref): Ditto. (VarDeclListNode::evaluate): Use iteration instead of recursion, taking advantage of the fact that the linked list is reversed. (VarDeclListNode::processVarDecls): Ditto. (VarStatementNode::reverseList): Reverse the list so we can iterate normally. (FunctionBodyNode::FunctionBodyNode): Use BlockNode as the base class, removing most of the FunctionBodyNode class.
  • kjs/nodes2string.cpp: (ElementNode::streamTo): Update for using a count for elision, and reverse linking. (ArrayNode::streamTo): Update for using a count for elision. (PropertyValueNode::streamTo): Update for reverse linking. (ArgumentListNode::streamTo): Update for reverse linking. This has been wrong for a while, since we added the reverse a long time ago. (VarDeclListNode::streamTo): Update for reverse linking. (ParameterNode::streamTo): Update for reverse linking.
File:
1 edited

Legend:

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

    r3098 r3192  
    148148  CaseClauseNode      *ccl;
    149149  ElementNode         *elm;
    150   ElisionNode         *eli;
    151150  Operator            op;
     151  PropertyValueNode   *plist;
     152  PropertyNode        *pnode;
    152153} YYSTYPE;
    153154
     
    315316#if YYDEBUG != 0
    316317static const short yyrline[] = { 0,
    317    160,   162,   163,   164,   165,   166,   169,   175,   177,   179,
    318    180,   181,   182,   183,   186,   188,   189,   192,   194,   198,
    319    200,   203,   205,   208,   210,   214,   216,   217,   220,   222,
    320    223,   224,   225,   228,   230,   233,   235,   236,   237,   241,
    321    243,   246,   248,   251,   253,   256,   258,   259,   262,   264,
    322    265,   266,   267,   268,   269,   270,   271,   272,   273,   274,
    323    277,   279,   280,   281,   284,   286,   287,   290,   292,   293,
    324    294,   297,   299,   301,   303,   305,   307,   309,   313,   315,
    325    316,   317,   318,   321,   323,   326,   328,   331,   333,   336,
    326    338,   342,   344,   348,   350,   354,   356,   360,   362,   363,
    327    364,   365,   366,   367,   368,   369,   370,   371,   372,   375,
    328    377,   380,   382,   383,   384,   385,   386,   387,   388,   389,
    329    390,   391,   392,   393,   394,   397,   399,   402,   404,   407,
    330    410,   419,   421,   425,   427,   430,   434,   438,   441,   448,
    331    450,   454,   456,   457,   460,   463,   466,   470,   476,   478,
    332    481,   483,   487,   489,   496,   498,   502,   504,   512,   514,
    333    518,   519,   525,   530,   535,   537,   541,   543,   546,   548,
    334    551,   553,   556,   558,   561,   567,   571,   573,   574,   577,
    335    581,   585,   588,   592,   594,   599,   601,   605,   608,   612,
    336    615,   619,   621,   624,   626
     318   163,   165,   166,   167,   168,   169,   172,   178,   180,   182,
     319   183,   184,   185,   186,   189,   191,   192,   195,   197,   201,
     320   203,   206,   208,   211,   213,   217,   219,   220,   223,   225,
     321   226,   227,   228,   231,   233,   236,   238,   239,   240,   244,
     322   246,   249,   251,   254,   256,   259,   261,   262,   265,   267,
     323   268,   269,   270,   271,   272,   273,   274,   275,   276,   277,
     324   280,   282,   283,   284,   287,   289,   290,   293,   295,   296,
     325   297,   300,   302,   304,   306,   308,   310,   312,   316,   318,
     326   319,   320,   321,   324,   326,   329,   331,   334,   336,   339,
     327   341,   345,   347,   351,   353,   357,   359,   363,   365,   366,
     328   367,   368,   369,   370,   371,   372,   373,   374,   375,   378,
     329   380,   383,   385,   386,   387,   388,   389,   390,   391,   392,
     330   393,   394,   395,   396,   397,   400,   402,   405,   407,   410,
     331   413,   422,   424,   428,   430,   433,   437,   441,   444,   451,
     332   453,   457,   459,   460,   463,   466,   469,   473,   479,   481,
     333   484,   486,   490,   492,   499,   501,   505,   507,   515,   517,
     334   521,   522,   528,   533,   538,   540,   544,   546,   549,   551,
     335   554,   556,   559,   561,   564,   570,   574,   576,   577,   580,
     336   584,   588,   591,   595,   597,   602,   604,   608,   611,   615,
     337   618,   622,   624,   627,   629
    337338};
    338339#endif
     
    12931294
    12941295case 1:
    1295 #line 161 "grammar.y"
     1296#line 164 "grammar.y"
    12961297{ yyval.node = new NullNode(); ;
    12971298    break;}
    12981299case 2:
    1299 #line 162 "grammar.y"
     1300#line 165 "grammar.y"
    13001301{ yyval.node = new BooleanNode(true); ;
    13011302    break;}
    13021303case 3:
    1303 #line 163 "grammar.y"
     1304#line 166 "grammar.y"
    13041305{ yyval.node = new BooleanNode(false); ;
    13051306    break;}
    13061307case 4:
    1307 #line 164 "grammar.y"
     1308#line 167 "grammar.y"
    13081309{ yyval.node = new NumberNode(yyvsp[0].dval); ;
    13091310    break;}
    13101311case 5:
    1311 #line 165 "grammar.y"
     1312#line 168 "grammar.y"
    13121313{ yyval.node = new StringNode(yyvsp[0].ustr); delete yyvsp[0].ustr; ;
    13131314    break;}
    13141315case 6:
    1315 #line 166 "grammar.y"
     1316#line 169 "grammar.y"
    13161317{ Lexer *l = Lexer::curr();
    13171318                                     if (!l->scanRegExp()) YYABORT;
     
    13191320    break;}
    13201321case 7:
    1321 #line 170 "grammar.y"
     1322#line 173 "grammar.y"
    13221323{ Lexer *l = Lexer::curr();
    13231324                                     if (!l->scanRegExp()) YYABORT;
     
    13251326    break;}
    13261327case 8:
    1327 #line 176 "grammar.y"
     1328#line 179 "grammar.y"
    13281329{ yyval.node = new ThisNode(); ;
    13291330    break;}
    13301331case 9:
    1331 #line 177 "grammar.y"
     1332#line 180 "grammar.y"
    13321333{ yyval.node = new ResolveNode(*yyvsp[0].ident);
    13331334                                     delete yyvsp[0].ident; ;
    13341335    break;}
    13351336case 12:
    1336 #line 181 "grammar.y"
     1337#line 184 "grammar.y"
    13371338{ yyval.node = new GroupNode(yyvsp[-1].node); ;
    13381339    break;}
    13391340case 13:
    1340 #line 182 "grammar.y"
     1341#line 185 "grammar.y"
    13411342{ yyval.node = new ObjectLiteralNode(0L); ;
    13421343    break;}
    13431344case 14:
    1344 #line 183 "grammar.y"
    1345 { yyval.node = new ObjectLiteralNode(yyvsp[-1].node); ;
     1345#line 186 "grammar.y"
     1346{ yyval.node = new ObjectLiteralNode(yyvsp[-1].plist); ;
    13461347    break;}
    13471348case 15:
    1348 #line 187 "grammar.y"
    1349 { yyval.node = new ArrayNode(yyvsp[-1].eli); ;
     1349#line 190 "grammar.y"
     1350{ yyval.node = new ArrayNode(yyvsp[-1].ival); ;
    13501351    break;}
    13511352case 16:
    1352 #line 188 "grammar.y"
     1353#line 191 "grammar.y"
    13531354{ yyval.node = new ArrayNode(yyvsp[-1].elm); ;
    13541355    break;}
    13551356case 17:
    1356 #line 189 "grammar.y"
    1357 { yyval.node = new ArrayNode(yyvsp[-1].eli, yyvsp[-3].elm); ;
     1357#line 192 "grammar.y"
     1358{ yyval.node = new ArrayNode(yyvsp[-1].ival, yyvsp[-3].elm); ;
    13581359    break;}
    13591360case 18:
    1360 #line 193 "grammar.y"
    1361 { yyval.elm = new ElementNode(yyvsp[-1].eli, yyvsp[0].node); ;
     1361#line 196 "grammar.y"
     1362{ yyval.elm = new ElementNode(yyvsp[-1].ival, yyvsp[0].node); ;
    13621363    break;}
    13631364case 19:
    1364 #line 195 "grammar.y"
    1365 { yyval.elm = new ElementNode(yyvsp[-3].elm, yyvsp[-1].eli, yyvsp[0].node); ;
     1365#line 198 "grammar.y"
     1366{ yyval.elm = new ElementNode(yyvsp[-3].elm, yyvsp[-1].ival, yyvsp[0].node); ;
    13661367    break;}
    13671368case 20:
    1368 #line 199 "grammar.y"
    1369 { yyval.eli = 0L; ;
     1369#line 202 "grammar.y"
     1370{ yyval.ival = 0; ;
    13701371    break;}
    13711372case 22:
    1372 #line 204 "grammar.y"
    1373 { yyval.eli = new ElisionNode(0L); ;
     1373#line 207 "grammar.y"
     1374{ yyval.ival = 1; ;
    13741375    break;}
    13751376case 23:
    1376 #line 205 "grammar.y"
    1377 { yyval.eli = new ElisionNode(yyvsp[-1].eli); ;
     1377#line 208 "grammar.y"
     1378{ yyval.ival = yyvsp[-1].ival + 1; ;
    13781379    break;}
    13791380case 24:
    1380 #line 209 "grammar.y"
    1381 { yyval.node = new PropertyValueNode(yyvsp[-2].node, yyvsp[0].node); ;
     1381#line 212 "grammar.y"
     1382{ yyval.plist = new PropertyValueNode(yyvsp[-2].pnode, yyvsp[0].node); ;
    13821383    break;}
    13831384case 25:
    1384 #line 211 "grammar.y"
    1385 { yyval.node = new PropertyValueNode(yyvsp[-2].node, yyvsp[0].node, yyvsp[-4].node); ;
     1385#line 214 "grammar.y"
     1386{ yyval.plist = new PropertyValueNode(yyvsp[-2].pnode, yyvsp[0].node, yyvsp[-4].plist); ;
    13861387    break;}
    13871388case 26:
    1388 #line 215 "grammar.y"
    1389 { yyval.node = new PropertyNode(*yyvsp[0].ident); delete yyvsp[0].ident; ;
     1389#line 218 "grammar.y"
     1390{ yyval.pnode = new PropertyNode(*yyvsp[0].ident); delete yyvsp[0].ident; ;
    13901391    break;}
    13911392case 27:
    1392 #line 216 "grammar.y"
    1393 { yyval.node = new PropertyNode(Identifier(*yyvsp[0].ustr)); delete yyvsp[0].ustr; ;
     1393#line 219 "grammar.y"
     1394{ yyval.pnode = new PropertyNode(Identifier(*yyvsp[0].ustr)); delete yyvsp[0].ustr; ;
    13941395    break;}
    13951396case 28:
    1396 #line 217 "grammar.y"
    1397 { yyval.node = new PropertyNode(yyvsp[0].dval); ;
     1397#line 220 "grammar.y"
     1398{ yyval.pnode = new PropertyNode(yyvsp[0].dval); ;
    13981399    break;}
    13991400case 31:
    1400 #line 223 "grammar.y"
     1401#line 226 "grammar.y"
    14011402{ yyval.node = new AccessorNode1(yyvsp[-3].node, yyvsp[-1].node); ;
    14021403    break;}
    14031404case 32:
    1404 #line 224 "grammar.y"
     1405#line 227 "grammar.y"
    14051406{ yyval.node = new AccessorNode2(yyvsp[-2].node, *yyvsp[0].ident); delete yyvsp[0].ident; ;
    14061407    break;}
    14071408case 33:
    1408 #line 225 "grammar.y"
     1409#line 228 "grammar.y"
    14091410{ yyval.node = new NewExprNode(yyvsp[-1].node, yyvsp[0].args); ;
    14101411    break;}
    14111412case 35:
    1412 #line 230 "grammar.y"
     1413#line 233 "grammar.y"
    14131414{ yyval.node = new NewExprNode(yyvsp[0].node); ;
    14141415    break;}
    14151416case 36:
    1416 #line 234 "grammar.y"
     1417#line 237 "grammar.y"
    14171418{ yyval.node = new FunctionCallNode(yyvsp[-1].node, yyvsp[0].args); ;
    14181419    break;}
    14191420case 37:
    1420 #line 235 "grammar.y"
     1421#line 238 "grammar.y"
    14211422{ yyval.node = new FunctionCallNode(yyvsp[-1].node, yyvsp[0].args); ;
    14221423    break;}
    14231424case 38:
    1424 #line 236 "grammar.y"
     1425#line 239 "grammar.y"
    14251426{ yyval.node = new AccessorNode1(yyvsp[-3].node, yyvsp[-1].node); ;
    14261427    break;}
    14271428case 39:
    1428 #line 237 "grammar.y"
     1429#line 240 "grammar.y"
    14291430{ yyval.node = new AccessorNode2(yyvsp[-2].node, *yyvsp[0].ident);
    14301431                                     delete yyvsp[0].ident; ;
    14311432    break;}
    14321433case 40:
    1433 #line 242 "grammar.y"
     1434#line 245 "grammar.y"
    14341435{ yyval.args = new ArgumentsNode(0L); ;
    14351436    break;}
    14361437case 41:
    1437 #line 243 "grammar.y"
     1438#line 246 "grammar.y"
    14381439{ yyval.args = new ArgumentsNode(yyvsp[-1].alist); ;
    14391440    break;}
    14401441case 42:
    1441 #line 247 "grammar.y"
     1442#line 250 "grammar.y"
    14421443{ yyval.alist = new ArgumentListNode(yyvsp[0].node); ;
    14431444    break;}
    14441445case 43:
    1445 #line 248 "grammar.y"
     1446#line 251 "grammar.y"
    14461447{ yyval.alist = new ArgumentListNode(yyvsp[-2].alist, yyvsp[0].node); ;
    14471448    break;}
    14481449case 47:
    1449 #line 258 "grammar.y"
     1450#line 261 "grammar.y"
    14501451{ yyval.node = new PostfixNode(yyvsp[-1].node, OpPlusPlus); ;
    14511452    break;}
    14521453case 48:
    1453 #line 259 "grammar.y"
     1454#line 262 "grammar.y"
    14541455{ yyval.node = new PostfixNode(yyvsp[-1].node, OpMinusMinus); ;
    14551456    break;}
    14561457case 50:
    1457 #line 264 "grammar.y"
     1458#line 267 "grammar.y"
    14581459{ yyval.node = new DeleteNode(yyvsp[0].node); ;
    14591460    break;}
    14601461case 51:
    1461 #line 265 "grammar.y"
     1462#line 268 "grammar.y"
    14621463{ yyval.node = new VoidNode(yyvsp[0].node); ;
    14631464    break;}
    14641465case 52:
    1465 #line 266 "grammar.y"
     1466#line 269 "grammar.y"
    14661467{ yyval.node = new TypeOfNode(yyvsp[0].node); ;
    14671468    break;}
    14681469case 53:
    1469 #line 267 "grammar.y"
     1470#line 270 "grammar.y"
    14701471{ yyval.node = new PrefixNode(OpPlusPlus, yyvsp[0].node); ;
    14711472    break;}
    14721473case 54:
    1473 #line 268 "grammar.y"
     1474#line 271 "grammar.y"
    14741475{ yyval.node = new PrefixNode(OpPlusPlus, yyvsp[0].node); ;
    14751476    break;}
    14761477case 55:
    1477 #line 269 "grammar.y"
     1478#line 272 "grammar.y"
    14781479{ yyval.node = new PrefixNode(OpMinusMinus, yyvsp[0].node); ;
    14791480    break;}
    14801481case 56:
    1481 #line 270 "grammar.y"
     1482#line 273 "grammar.y"
    14821483{ yyval.node = new PrefixNode(OpMinusMinus, yyvsp[0].node); ;
    14831484    break;}
    14841485case 57:
    1485 #line 271 "grammar.y"
     1486#line 274 "grammar.y"
    14861487{ yyval.node = new UnaryPlusNode(yyvsp[0].node); ;
    14871488    break;}
    14881489case 58:
    1489 #line 272 "grammar.y"
     1490#line 275 "grammar.y"
    14901491{ yyval.node = new NegateNode(yyvsp[0].node); ;
    14911492    break;}
    14921493case 59:
    1493 #line 273 "grammar.y"
     1494#line 276 "grammar.y"
    14941495{ yyval.node = new BitwiseNotNode(yyvsp[0].node); ;
    14951496    break;}
    14961497case 60:
    1497 #line 274 "grammar.y"
     1498#line 277 "grammar.y"
    14981499{ yyval.node = new LogicalNotNode(yyvsp[0].node); ;
    14991500    break;}
    15001501case 62:
    1501 #line 279 "grammar.y"
     1502#line 282 "grammar.y"
    15021503{ yyval.node = new MultNode(yyvsp[-2].node, yyvsp[0].node, '*'); ;
    15031504    break;}
    15041505case 63:
    1505 #line 280 "grammar.y"
     1506#line 283 "grammar.y"
    15061507{ yyval.node = new MultNode(yyvsp[-2].node, yyvsp[0].node, '/'); ;
    15071508    break;}
    15081509case 64:
    1509 #line 281 "grammar.y"
     1510#line 284 "grammar.y"
    15101511{ yyval.node = new MultNode(yyvsp[-2].node,yyvsp[0].node,'%'); ;
    15111512    break;}
    15121513case 66:
    1513 #line 286 "grammar.y"
     1514#line 289 "grammar.y"
    15141515{ yyval.node = new AddNode(yyvsp[-2].node, yyvsp[0].node, '+'); ;
    15151516    break;}
    15161517case 67:
    1517 #line 287 "grammar.y"
     1518#line 290 "grammar.y"
    15181519{ yyval.node = new AddNode(yyvsp[-2].node, yyvsp[0].node, '-'); ;
    15191520    break;}
    15201521case 69:
    1521 #line 292 "grammar.y"
     1522#line 295 "grammar.y"
    15221523{ yyval.node = new ShiftNode(yyvsp[-2].node, OpLShift, yyvsp[0].node); ;
    15231524    break;}
    15241525case 70:
    1525 #line 293 "grammar.y"
     1526#line 296 "grammar.y"
    15261527{ yyval.node = new ShiftNode(yyvsp[-2].node, OpRShift, yyvsp[0].node); ;
    15271528    break;}
    15281529case 71:
    1529 #line 294 "grammar.y"
     1530#line 297 "grammar.y"
    15301531{ yyval.node = new ShiftNode(yyvsp[-2].node, OpURShift, yyvsp[0].node); ;
    15311532    break;}
    15321533case 73:
    1533 #line 300 "grammar.y"
     1534#line 303 "grammar.y"
    15341535{ yyval.node = new RelationalNode(yyvsp[-2].node, OpLess, yyvsp[0].node); ;
    15351536    break;}
    15361537case 74:
    1537 #line 302 "grammar.y"
     1538#line 305 "grammar.y"
    15381539{ yyval.node = new RelationalNode(yyvsp[-2].node, OpGreater, yyvsp[0].node); ;
    15391540    break;}
    15401541case 75:
    1541 #line 304 "grammar.y"
     1542#line 307 "grammar.y"
    15421543{ yyval.node = new RelationalNode(yyvsp[-2].node, OpLessEq, yyvsp[0].node); ;
    15431544    break;}
    15441545case 76:
    1545 #line 306 "grammar.y"
     1546#line 309 "grammar.y"
    15461547{ yyval.node = new RelationalNode(yyvsp[-2].node, OpGreaterEq, yyvsp[0].node); ;
    15471548    break;}
    15481549case 77:
    1549 #line 308 "grammar.y"
     1550#line 311 "grammar.y"
    15501551{ yyval.node = new RelationalNode(yyvsp[-2].node, OpInstanceOf, yyvsp[0].node); ;
    15511552    break;}
    15521553case 78:
    1553 #line 310 "grammar.y"
     1554#line 313 "grammar.y"
    15541555{ yyval.node = new RelationalNode(yyvsp[-2].node, OpIn, yyvsp[0].node); ;
    15551556    break;}
    15561557case 80:
    1557 #line 315 "grammar.y"
     1558#line 318 "grammar.y"
    15581559{ yyval.node = new EqualNode(yyvsp[-2].node, OpEqEq, yyvsp[0].node); ;
    15591560    break;}
    15601561case 81:
    1561 #line 316 "grammar.y"
     1562#line 319 "grammar.y"
    15621563{ yyval.node = new EqualNode(yyvsp[-2].node, OpNotEq, yyvsp[0].node); ;
    15631564    break;}
    15641565case 82:
    1565 #line 317 "grammar.y"
     1566#line 320 "grammar.y"
    15661567{ yyval.node = new EqualNode(yyvsp[-2].node, OpStrEq, yyvsp[0].node); ;
    15671568    break;}
    15681569case 83:
    1569 #line 318 "grammar.y"
     1570#line 321 "grammar.y"
    15701571{ yyval.node = new EqualNode(yyvsp[-2].node, OpStrNEq, yyvsp[0].node);;
    15711572    break;}
    15721573case 85:
    1573 #line 323 "grammar.y"
     1574#line 326 "grammar.y"
    15741575{ yyval.node = new BitOperNode(yyvsp[-2].node, OpBitAnd, yyvsp[0].node); ;
    15751576    break;}
    15761577case 87:
    1577 #line 328 "grammar.y"
     1578#line 331 "grammar.y"
    15781579{ yyval.node = new BitOperNode(yyvsp[-2].node, OpBitXOr, yyvsp[0].node); ;
    15791580    break;}
    15801581case 89:
    1581 #line 333 "grammar.y"
     1582#line 336 "grammar.y"
    15821583{ yyval.node = new BitOperNode(yyvsp[-2].node, OpBitOr, yyvsp[0].node); ;
    15831584    break;}
    15841585case 91:
    1585 #line 339 "grammar.y"
     1586#line 342 "grammar.y"
    15861587{ yyval.node = new BinaryLogicalNode(yyvsp[-2].node, OpAnd, yyvsp[0].node); ;
    15871588    break;}
    15881589case 93:
    1589 #line 345 "grammar.y"
     1590#line 348 "grammar.y"
    15901591{ yyval.node = new BinaryLogicalNode(yyvsp[-2].node, OpOr, yyvsp[0].node); ;
    15911592    break;}
    15921593case 95:
    1593 #line 351 "grammar.y"
     1594#line 354 "grammar.y"
    15941595{ yyval.node = new ConditionalNode(yyvsp[-4].node, yyvsp[-2].node, yyvsp[0].node); ;
    15951596    break;}
    15961597case 97:
    1597 #line 357 "grammar.y"
     1598#line 360 "grammar.y"
    15981599{ yyval.node = new AssignNode(yyvsp[-2].node, yyvsp[-1].op, yyvsp[0].node);;
    15991600    break;}
    16001601case 98:
    1601 #line 361 "grammar.y"
     1602#line 364 "grammar.y"
    16021603{ yyval.op = OpEqual; ;
    16031604    break;}
    16041605case 99:
    1605 #line 362 "grammar.y"
     1606#line 365 "grammar.y"
    16061607{ yyval.op = OpPlusEq; ;
    16071608    break;}
    16081609case 100:
    1609 #line 363 "grammar.y"
     1610#line 366 "grammar.y"
    16101611{ yyval.op = OpMinusEq; ;
    16111612    break;}
    16121613case 101:
    1613 #line 364 "grammar.y"
     1614#line 367 "grammar.y"
    16141615{ yyval.op = OpMultEq; ;
    16151616    break;}
    16161617case 102:
    1617 #line 365 "grammar.y"
     1618#line 368 "grammar.y"
    16181619{ yyval.op = OpDivEq; ;
    16191620    break;}
    16201621case 103:
    1621 #line 366 "grammar.y"
     1622#line 369 "grammar.y"
    16221623{ yyval.op = OpLShift; ;
    16231624    break;}
    16241625case 104:
    1625 #line 367 "grammar.y"
     1626#line 370 "grammar.y"
    16261627{ yyval.op = OpRShift; ;
    16271628    break;}
    16281629case 105:
    1629 #line 368 "grammar.y"
     1630#line 371 "grammar.y"
    16301631{ yyval.op = OpURShift; ;
    16311632    break;}
    16321633case 106:
    1633 #line 369 "grammar.y"
     1634#line 372 "grammar.y"
    16341635{ yyval.op = OpAndEq; ;
    16351636    break;}
    16361637case 107:
    1637 #line 370 "grammar.y"
     1638#line 373 "grammar.y"
    16381639{ yyval.op = OpXOrEq; ;
    16391640    break;}
    16401641case 108:
    1641 #line 371 "grammar.y"
     1642#line 374 "grammar.y"
    16421643{ yyval.op = OpOrEq; ;
    16431644    break;}
    16441645case 109:
    1645 #line 372 "grammar.y"
     1646#line 375 "grammar.y"
    16461647{ yyval.op = OpModEq; ;
    16471648    break;}
    16481649case 111:
    1649 #line 377 "grammar.y"
     1650#line 380 "grammar.y"
    16501651{ yyval.node = new CommaNode(yyvsp[-2].node, yyvsp[0].node); ;
    16511652    break;}
    16521653case 126:
    1653 #line 398 "grammar.y"
     1654#line 401 "grammar.y"
    16541655{ yyval.stat = new BlockNode(0L); DBG(yyval.stat, yylsp[0], yylsp[0]); ;
    16551656    break;}
    16561657case 127:
    1657 #line 399 "grammar.y"
     1658#line 402 "grammar.y"
    16581659{ yyval.stat = new BlockNode(yyvsp[-1].srcs); DBG(yyval.stat, yylsp[0], yylsp[0]); ;
    16591660    break;}
    16601661case 128:
    1661 #line 403 "grammar.y"
     1662#line 406 "grammar.y"
    16621663{ yyval.slist = new StatListNode(yyvsp[0].stat); ;
    16631664    break;}
    16641665case 129:
    1665 #line 404 "grammar.y"
     1666#line 407 "grammar.y"
    16661667{ yyval.slist = new StatListNode(yyvsp[-1].slist, yyvsp[0].stat); ;
    16671668    break;}
    16681669case 130:
    1669 #line 408 "grammar.y"
     1670#line 411 "grammar.y"
    16701671{ yyval.stat = new VarStatementNode(yyvsp[-1].vlist);
    16711672                                      DBG(yyval.stat, yylsp[-2], yylsp[0]); ;
    16721673    break;}
    16731674case 131:
    1674 #line 410 "grammar.y"
     1675#line 413 "grammar.y"
    16751676{ if (automatic()) {
    16761677                                          yyval.stat = new VarStatementNode(yyvsp[-1].vlist);
     
    16821683    break;}
    16831684case 132:
    1684 #line 420 "grammar.y"
     1685#line 423 "grammar.y"
    16851686{ yyval.vlist = new VarDeclListNode(yyvsp[0].decl); ;
    16861687    break;}
    16871688case 133:
    1688 #line 422 "grammar.y"
     1689#line 425 "grammar.y"
    16891690{ yyval.vlist = new VarDeclListNode(yyvsp[-2].vlist, yyvsp[0].decl); ;
    16901691    break;}
    16911692case 134:
    1692 #line 426 "grammar.y"
     1693#line 429 "grammar.y"
    16931694{ yyval.decl = new VarDeclNode(*yyvsp[0].ident, 0); delete yyvsp[0].ident; ;
    16941695    break;}
    16951696case 135:
    1696 #line 427 "grammar.y"
     1697#line 430 "grammar.y"
    16971698{ yyval.decl = new VarDeclNode(*yyvsp[-1].ident, yyvsp[0].init); delete yyvsp[-1].ident; ;
    16981699    break;}
    16991700case 136:
    1700 #line 431 "grammar.y"
     1701#line 434 "grammar.y"
    17011702{ yyval.init = new AssignExprNode(yyvsp[0].node); ;
    17021703    break;}
    17031704case 137:
    1704 #line 435 "grammar.y"
     1705#line 438 "grammar.y"
    17051706{ yyval.stat = new EmptyStatementNode(); ;
    17061707    break;}
    17071708case 138:
    1708 #line 439 "grammar.y"
     1709#line 442 "grammar.y"
    17091710{ yyval.stat = new ExprStatementNode(yyvsp[-1].node);
    17101711                                     DBG(yyval.stat, yylsp[-1], yylsp[0]); ;
    17111712    break;}
    17121713case 139:
    1713 #line 441 "grammar.y"
     1714#line 444 "grammar.y"
    17141715{ if (automatic()) {
    17151716                                       yyval.stat = new ExprStatementNode(yyvsp[-1].node);
     
    17191720    break;}
    17201721case 140:
    1721 #line 449 "grammar.y"
     1722#line 452 "grammar.y"
    17221723{ yyval.stat = new IfNode(yyvsp[-2].node,yyvsp[0].stat,0L);DBG(yyval.stat,yylsp[-4],yylsp[-1]); ;
    17231724    break;}
    17241725case 141:
    1725 #line 451 "grammar.y"
     1726#line 454 "grammar.y"
    17261727{ yyval.stat = new IfNode(yyvsp[-4].node,yyvsp[-2].stat,yyvsp[0].stat);DBG(yyval.stat,yylsp[-6],yylsp[-3]); ;
    17271728    break;}
    17281729case 142:
    1729 #line 455 "grammar.y"
     1730#line 458 "grammar.y"
    17301731{ yyval.stat=new DoWhileNode(yyvsp[-4].stat,yyvsp[-1].node);DBG(yyval.stat,yylsp[-5],yylsp[-3]);;
    17311732    break;}
    17321733case 143:
    1733 #line 456 "grammar.y"
     1734#line 459 "grammar.y"
    17341735{ yyval.stat = new WhileNode(yyvsp[-2].node,yyvsp[0].stat);DBG(yyval.stat,yylsp[-4],yylsp[-1]); ;
    17351736    break;}
    17361737case 144:
    1737 #line 458 "grammar.y"
     1738#line 461 "grammar.y"
    17381739{ yyval.stat = new ForNode(yyvsp[-6].node,yyvsp[-4].node,yyvsp[-2].node,yyvsp[0].stat);
    17391740                                     DBG(yyval.stat,yylsp[-8],yylsp[-1]); ;
    17401741    break;}
    17411742case 145:
    1742 #line 461 "grammar.y"
     1743#line 464 "grammar.y"
    17431744{ yyval.stat = new ForNode(yyvsp[-6].vlist,yyvsp[-4].node,yyvsp[-2].node,yyvsp[0].stat);
    17441745                                     DBG(yyval.stat,yylsp[-9],yylsp[-1]); ;
    17451746    break;}
    17461747case 146:
    1747 #line 464 "grammar.y"
     1748#line 467 "grammar.y"
    17481749{ yyval.stat = new ForInNode(yyvsp[-4].node, yyvsp[-2].node, yyvsp[0].stat);
    17491750                                     DBG(yyval.stat,yylsp[-6],yylsp[-1]); ;
    17501751    break;}
    17511752case 147:
    1752 #line 467 "grammar.y"
     1753#line 470 "grammar.y"
    17531754{ yyval.stat = new ForInNode(*yyvsp[-4].ident,0L,yyvsp[-2].node,yyvsp[0].stat);
    17541755                                     DBG(yyval.stat,yylsp[-7],yylsp[-1]);
     
    17561757    break;}
    17571758case 148:
    1758 #line 471 "grammar.y"
     1759#line 474 "grammar.y"
    17591760{ yyval.stat = new ForInNode(*yyvsp[-5].ident,yyvsp[-4].init,yyvsp[-2].node,yyvsp[0].stat);
    17601761                                     DBG(yyval.stat,yylsp[-8],yylsp[-1]);
     
    17621763    break;}
    17631764case 149:
    1764 #line 477 "grammar.y"
     1765#line 480 "grammar.y"
    17651766{ yyval.node = 0L; ;
    17661767    break;}
    17671768case 151:
    1768 #line 482 "grammar.y"
     1769#line 485 "grammar.y"
    17691770{ yyval.stat = new ContinueNode(); DBG(yyval.stat,yylsp[-1],yylsp[0]); ;
    17701771    break;}
    17711772case 152:
    1772 #line 483 "grammar.y"
     1773#line 486 "grammar.y"
    17731774{ if (automatic()) {
    17741775                                       yyval.stat = new ContinueNode(); DBG(yyval.stat,yylsp[-1],yylsp[0]);
     
    17771778    break;}
    17781779case 153:
    1779 #line 487 "grammar.y"
     1780#line 490 "grammar.y"
    17801781{ yyval.stat = new ContinueNode(*yyvsp[-1].ident); DBG(yyval.stat,yylsp[-2],yylsp[0]);
    17811782                                     delete yyvsp[-1].ident; ;
    17821783    break;}
    17831784case 154:
    1784 #line 489 "grammar.y"
     1785#line 492 "grammar.y"
    17851786{ if (automatic()) {
    17861787                                       yyval.stat = new ContinueNode(*yyvsp[-1].ident);DBG(yyval.stat,yylsp[-2],yylsp[-1]);
     
    17901791    break;}
    17911792case 155:
    1792 #line 497 "grammar.y"
     1793#line 500 "grammar.y"
    17931794{ yyval.stat = new BreakNode();DBG(yyval.stat,yylsp[-1],yylsp[0]); ;
    17941795    break;}
    17951796case 156:
    1796 #line 498 "grammar.y"
     1797#line 501 "grammar.y"
    17971798{ if (automatic()) {
    17981799                                       yyval.stat = new BreakNode(); DBG(yyval.stat,yylsp[-1],yylsp[-1]);
     
    18011802    break;}
    18021803case 157:
    1803 #line 502 "grammar.y"
     1804#line 505 "grammar.y"
    18041805{ yyval.stat = new BreakNode(*yyvsp[-1].ident); DBG(yyval.stat,yylsp[-2],yylsp[0]);
    18051806                                     delete yyvsp[-1].ident; ;
    18061807    break;}
    18071808case 158:
    1808 #line 504 "grammar.y"
     1809#line 507 "grammar.y"
    18091810{ if (automatic()) {
    18101811                                       yyval.stat = new BreakNode(*yyvsp[-1].ident); DBG(yyval.stat,yylsp[-2],yylsp[-1]);
     
    18151816    break;}
    18161817case 159:
    1817 #line 513 "grammar.y"
     1818#line 516 "grammar.y"
    18181819{ yyval.stat = new ReturnNode(0L); DBG(yyval.stat,yylsp[-1],yylsp[0]); ;
    18191820    break;}
    18201821case 160:
    1821 #line 514 "grammar.y"
     1822#line 517 "grammar.y"
    18221823{ if (automatic()) {
    18231824                                       yyval.stat = new ReturnNode(0L); DBG(yyval.stat,yylsp[-1],yylsp[-1]);
     
    18261827    break;}
    18271828case 161:
    1828 #line 518 "grammar.y"
     1829#line 521 "grammar.y"
    18291830{ yyval.stat = new ReturnNode(yyvsp[-1].node); ;
    18301831    break;}
    18311832case 162:
    1832 #line 519 "grammar.y"
     1833#line 522 "grammar.y"
    18331834{ if (automatic())
    18341835                                       yyval.stat = new ReturnNode(yyvsp[-1].node);
     
    18371838    break;}
    18381839case 163:
    1839 #line 526 "grammar.y"
     1840#line 529 "grammar.y"
    18401841{ yyval.stat = new WithNode(yyvsp[-2].node,yyvsp[0].stat);
    18411842                                     DBG(yyval.stat, yylsp[-4], yylsp[-1]); ;
    18421843    break;}
    18431844case 164:
    1844 #line 531 "grammar.y"
     1845#line 534 "grammar.y"
    18451846{ yyval.stat = new SwitchNode(yyvsp[-2].node, yyvsp[0].cblk);
    18461847                                     DBG(yyval.stat, yylsp[-4], yylsp[-1]); ;
    18471848    break;}
    18481849case 165:
    1849 #line 536 "grammar.y"
     1850#line 539 "grammar.y"
    18501851{ yyval.cblk = new CaseBlockNode(yyvsp[-1].clist, 0L, 0L); ;
    18511852    break;}
    18521853case 166:
    1853 #line 538 "grammar.y"
     1854#line 541 "grammar.y"
    18541855{ yyval.cblk = new CaseBlockNode(yyvsp[-3].clist, yyvsp[-2].ccl, yyvsp[-1].clist); ;
    18551856    break;}
    18561857case 167:
    1857 #line 542 "grammar.y"
     1858#line 545 "grammar.y"
    18581859{ yyval.clist = 0L; ;
    18591860    break;}
    18601861case 169:
    1861 #line 547 "grammar.y"
     1862#line 550 "grammar.y"
    18621863{ yyval.clist = new ClauseListNode(yyvsp[0].ccl); ;
    18631864    break;}
    18641865case 170:
    1865 #line 548 "grammar.y"
     1866#line 551 "grammar.y"
    18661867{ yyval.clist = yyvsp[-1].clist->append(yyvsp[0].ccl); ;
    18671868    break;}
    18681869case 171:
    1869 #line 552 "grammar.y"
     1870#line 555 "grammar.y"
    18701871{ yyval.ccl = new CaseClauseNode(yyvsp[-1].node, 0L); ;
    18711872    break;}
    18721873case 172:
    1873 #line 553 "grammar.y"
     1874#line 556 "grammar.y"
    18741875{ yyval.ccl = new CaseClauseNode(yyvsp[-2].node, yyvsp[0].slist); ;
    18751876    break;}
    18761877case 173:
    1877 #line 557 "grammar.y"
     1878#line 560 "grammar.y"
    18781879{ yyval.ccl = new CaseClauseNode(0L, 0L);; ;
    18791880    break;}
    18801881case 174:
    1881 #line 558 "grammar.y"
     1882#line 561 "grammar.y"
    18821883{ yyval.ccl = new CaseClauseNode(0L, yyvsp[0].slist); ;
    18831884    break;}
    18841885case 175:
    1885 #line 562 "grammar.y"
     1886#line 565 "grammar.y"
    18861887{ yyvsp[0].stat->pushLabel(*yyvsp[-2].ident);
    18871888                                     yyval.stat = new LabelNode(*yyvsp[-2].ident, yyvsp[0].stat);
     
    18891890    break;}
    18901891case 176:
    1891 #line 568 "grammar.y"
     1892#line 571 "grammar.y"
    18921893{ yyval.stat = new ThrowNode(yyvsp[-1].node); ;
    18931894    break;}
    18941895case 177:
    1895 #line 572 "grammar.y"
     1896#line 575 "grammar.y"
    18961897{ yyval.stat = new TryNode(yyvsp[-1].stat, yyvsp[0].node); ;
    18971898    break;}
    18981899case 178:
    1899 #line 573 "grammar.y"
     1900#line 576 "grammar.y"
    19001901{ yyval.stat = new TryNode(yyvsp[-1].stat, 0L, yyvsp[0].node); ;
    19011902    break;}
    19021903case 179:
    1903 #line 574 "grammar.y"
     1904#line 577 "grammar.y"
    19041905{ yyval.stat = new TryNode(yyvsp[-2].stat, yyvsp[-1].node, yyvsp[0].node); ;
    19051906    break;}
    19061907case 180:
    1907 #line 578 "grammar.y"
     1908#line 581 "grammar.y"
    19081909{ yyval.node = new CatchNode(*yyvsp[-2].ident, yyvsp[0].stat); delete yyvsp[-2].ident; ;
    19091910    break;}
    19101911case 181:
    1911 #line 582 "grammar.y"
     1912#line 585 "grammar.y"
    19121913{ yyval.node = new FinallyNode(yyvsp[0].stat); ;
    19131914    break;}
    19141915case 182:
    1915 #line 586 "grammar.y"
     1916#line 589 "grammar.y"
    19161917{ yyval.func = new FuncDeclNode(*yyvsp[-3].ident, 0L, yyvsp[0].body);
    19171918                                             delete yyvsp[-3].ident; ;
    19181919    break;}
    19191920case 183:
    1920 #line 589 "grammar.y"
     1921#line 592 "grammar.y"
    19211922{ yyval.func = new FuncDeclNode(*yyvsp[-4].ident, yyvsp[-2].param, yyvsp[0].body);
    19221923                                     delete yyvsp[-4].ident; ;
    19231924    break;}
    19241925case 184:
    1925 #line 593 "grammar.y"
     1926#line 596 "grammar.y"
    19261927{ yyval.node = new FuncExprNode(0L, yyvsp[0].body); ;
    19271928    break;}
    19281929case 185:
    1929 #line 595 "grammar.y"
     1930#line 598 "grammar.y"
    19301931{ yyval.node = new FuncExprNode(yyvsp[-2].param, yyvsp[0].body); ;
    19311932    break;}
    19321933case 186:
    1933 #line 600 "grammar.y"
     1934#line 603 "grammar.y"
    19341935{ yyval.param = new ParameterNode(*yyvsp[0].ident); delete yyvsp[0].ident; ;
    19351936    break;}
    19361937case 187:
    1937 #line 601 "grammar.y"
     1938#line 604 "grammar.y"
    19381939{ yyval.param = yyvsp[-2].param->append(*yyvsp[0].ident);
    19391940                                     delete yyvsp[0].ident; ;
    19401941    break;}
    19411942case 188:
    1942 #line 606 "grammar.y"
     1943#line 609 "grammar.y"
    19431944{ yyval.body = new FunctionBodyNode(0L);
    19441945                                     DBG(yyval.body, yylsp[-1], yylsp[0]);;
    19451946    break;}
    19461947case 189:
    1947 #line 608 "grammar.y"
     1948#line 611 "grammar.y"
    19481949{ yyval.body = new FunctionBodyNode(yyvsp[-1].srcs);
    19491950                                     DBG(yyval.body, yylsp[-2], yylsp[0]);;
    19501951    break;}
    19511952case 190:
    1952 #line 613 "grammar.y"
     1953#line 616 "grammar.y"
    19531954{ yyval.prog = new ProgramNode(0L);
    19541955                                     Parser::progNode = yyval.prog; ;
    19551956    break;}
    19561957case 191:
    1957 #line 615 "grammar.y"
     1958#line 618 "grammar.y"
    19581959{ yyval.prog = new ProgramNode(yyvsp[0].srcs);
    19591960                                     Parser::progNode = yyval.prog; ;
    19601961    break;}
    19611962case 192:
    1962 #line 620 "grammar.y"
     1963#line 623 "grammar.y"
    19631964{ yyval.srcs = new SourceElementsNode(yyvsp[0].src); ;
    19641965    break;}
    19651966case 193:
    1966 #line 621 "grammar.y"
     1967#line 624 "grammar.y"
    19671968{ yyval.srcs = new SourceElementsNode(yyvsp[0].srcs, yyvsp[-1].src); ;
    19681969    break;}
    19691970case 194:
    1970 #line 625 "grammar.y"
     1971#line 628 "grammar.y"
    19711972{ yyval.src = new SourceElementNode(yyvsp[0].stat); ;
    19721973    break;}
    19731974case 195:
    1974 #line 626 "grammar.y"
     1975#line 629 "grammar.y"
    19751976{ yyval.src = new SourceElementNode(yyvsp[0].func); ;
    19761977    break;}
     
    21982199  return 1;
    21992200}
    2200 #line 629 "grammar.y"
     2201#line 632 "grammar.y"
    22012202
    22022203
Note: See TracChangeset for help on using the changeset viewer.