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


Ignore:
Timestamp:
Jan 13, 2003, 7:49:23 AM (22 years ago)
Author:
darin
Message:

Reviewed by Maciej.

  • turned more recursion into iteration, and fixed some backwards stuff
  • kjs/grammar.y: Use the normal idiom for CaseClauses and FormalParameterList rather than using append().
  • kjs/grammar.cpp: Regenerated.
  • kjs/nodes.h: Change ClauseListNode and ParameterNode to use the normal idiom, and got rid of append methods. Also added friend declarations and calls to reverseList().
  • kjs/nodes.cpp: (StatListNode::ref): Iteration, not recursion. (StatListNode::deref): Iteration, not recursion. (StatListNode::execute): Iteration, not recursion. (StatListNode::processVarDecls): Iteration, not recursion. (CaseClauseNode::reverseList): Added. (ClauseListNode::ref): Iteration, not recursion. (ClauseListNode::deref): Iteration, not recursion. (ClauseListNode::processVarDecls): Iteration, not recursion. (CaseBlockNode::reverseLists): Added. (ParameterNode::ref): Iteration, not recursion. (ParameterNode::deref): Iteration, not recursion. (FuncDeclNode::reverseParameterList): Added. (FuncExprNode::reverseParameterList): Added. (SourceElementsNode::ref): Iteration, not recursion. (SourceElementsNode::deref): Iteration, not recursion. (SourceElementsNode::execute): Use variable name of n to match other functions. (SourceElementsNode::processFuncDecl): Ditto. (SourceElementsNode::processVarDecls): Ditto.
  • kjs/nodes2string.cpp: (SourceStream::operator<<): Used a switch statement for a bit of added clarity. (ElementNode::streamTo): Iteration, not recursion. (PropertyValueNode::streamTo): Iteration, not recursion. (ArgumentListNode::streamTo): Iteration, not recursion. (StatListNode::streamTo): Iteration, not recursion, and fixed order. (VarDeclListNode::streamTo): Iteration, not recursion. (ClauseListNode::streamTo): Used for statement to match other functions. (CaseBlockNode::streamTo): Used for statement to match other functions. (ParameterNode::streamTo): Iteration, not recursion. (SourceElementsNode::streamTo): Iteration, not recursion, and fixed order that has been backwards since I changed how this works in nodes.cpp.
File:
1 edited

Legend:

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

    r3215 r3313  
    333333   520,   521,   527,   532,   537,   539,   543,   545,   548,   550,
    334334   553,   555,   558,   560,   563,   569,   573,   575,   576,   579,
    335    583,   587,   590,   594,   596,   601,   603,   607,   610,   614,
    336    617,   621,   623,   626,   628
     335   583,   587,   590,   594,   596,   601,   603,   606,   609,   613,
     336   616,   620,   622,   625,   627
    337337};
    338338#endif
     
    19021902case 170:
    19031903#line 550 "grammar.y"
    1904 { yyval.clist = yyvsp[-1].clist->append(yyvsp[0].ccl); ;
     1904{ yyval.clist = new ClauseListNode(yyvsp[-1].clist, yyvsp[0].ccl); ;
    19051905    break;}
    19061906case 171:
     
    19741974case 187:
    19751975#line 603 "grammar.y"
    1976 { yyval.param = yyvsp[-2].param->append(*yyvsp[0].ident);
    1977                                      delete yyvsp[0].ident; ;
     1976{ yyval.param = new ParameterNode(yyvsp[-2].param, *yyvsp[0].ident); delete yyvsp[0].ident; ;
    19781977    break;}
    19791978case 188:
    1980 #line 608 "grammar.y"
     1979#line 607 "grammar.y"
    19811980{ yyval.body = new FunctionBodyNode(0L);
    19821981                                     DBG(yyval.body, yylsp[-1], yylsp[0]);;
    19831982    break;}
    19841983case 189:
    1985 #line 610 "grammar.y"
     1984#line 609 "grammar.y"
    19861985{ yyval.body = new FunctionBodyNode(yyvsp[-1].srcs);
    19871986                                     DBG(yyval.body, yylsp[-2], yylsp[0]);;
    19881987    break;}
    19891988case 190:
    1990 #line 615 "grammar.y"
     1989#line 614 "grammar.y"
    19911990{ yyval.prog = new ProgramNode(0L);
    19921991                                     Parser::progNode = yyval.prog; ;
    19931992    break;}
    19941993case 191:
    1995 #line 617 "grammar.y"
     1994#line 616 "grammar.y"
    19961995{ yyval.prog = new ProgramNode(yyvsp[0].srcs);
    19971996                                     Parser::progNode = yyval.prog; ;
    19981997    break;}
    19991998case 192:
     1999#line 621 "grammar.y"
     2000{ yyval.srcs = new SourceElementsNode(yyvsp[0].stat); ;
     2001    break;}
     2002case 193:
    20002003#line 622 "grammar.y"
    2001 { yyval.srcs = new SourceElementsNode(yyvsp[0].stat); ;
    2002     break;}
    2003 case 193:
    2004 #line 623 "grammar.y"
    20052004{ yyval.srcs = new SourceElementsNode(yyvsp[-1].srcs, yyvsp[0].stat); ;
    20062005    break;}
    20072006case 194:
     2007#line 626 "grammar.y"
     2008{ yyval.stat = yyvsp[0].stat; ;
     2009    break;}
     2010case 195:
    20082011#line 627 "grammar.y"
    2009 { yyval.stat = yyvsp[0].stat; ;
    2010     break;}
    2011 case 195:
    2012 #line 628 "grammar.y"
    20132012{ yyval.stat = yyvsp[0].func; ;
    20142013    break;}
     
    22362235  return 1;
    22372236}
    2238 #line 631 "grammar.y"
     2237#line 630 "grammar.y"
    22392238
    22402239
Note: See TracChangeset for help on using the changeset viewer.