home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 20 / AACD20.BIN / AACD / Programming / Jikes / Source / src / javaact.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2001-02-24  |  107.2 KB  |  4,586 lines

  1. #line 427 "java.g"
  2. //
  3. // This software is subject to the terms of the IBM Jikes Compiler Open
  4. // Source License Agreement available at the following URL:
  5. // http://www.ibm.com/research/jikes.
  6. // Copyright (C) 1996, 1998, International Business Machines Corporation
  7. // and others.  All Rights Reserved.
  8. // You must accept the terms of that agreement to use this software.
  9. //
  10.  
  11. #include "platform.h"
  12. #include "parser.h"
  13. #include "ast.h"
  14.  
  15. #undef HEADERS
  16. #include "javaact.h"
  17.  
  18. #ifdef    HAVE_JIKES_NAMESPACE
  19. namespace Jikes {    // Open namespace Jikes block
  20. #endif
  21.  
  22. //****************************************************************************//
  23. //****************************************************************************//
  24. //*                                                                          *//
  25. //* Below, we show each rule of the Java grammar together with the semantic  *//
  26. //* action that is invoked when the parser performs a reduction by that rule.*//
  27. //*                                                                          *//
  28. //****************************************************************************//
  29. //****************************************************************************//
  30.  
  31.  
  32. //
  33. // Rule 1:  Goal -> CompilationUnit
  34. //
  35. #line 459 "java.g"
  36. //
  37. // Given a rule of the form A ::= x1 x2 ... xn        n >= 1
  38. //
  39. // Do nothing - Whatever Ast was produced for x1 is inherited by A.
  40. //
  41. void Parser::BadAction(void) { assert(false); }
  42. void Parser::NoAction(void) {}
  43.  
  44. //
  45. // Rule 2:  Goal ::= BodyMarker ConstructorBody
  46. //
  47. #line 471 "java.g"
  48. //
  49. // This rule was added to allow the parser to recognize the body of a
  50. // funtion (constructor or method, as the definition of the body of a
  51. // method is subsumed by the definition of the body of a constructor)
  52. // out of context. Note that the artificial terminal BodyMarker is
  53. // added here to prevent an ordinary parse from accepting a body as
  54. // a valid input - i.e., to recognize a body out-of-context, the
  55. // BodyMarker terminal must be inserted in front of the input stream
  56. // containing the body in question.
  57. //
  58. void Parser::Act2(void)
  59. {
  60.     Sym(1) = Sym(2);
  61. }
  62.  
  63. //
  64. // Rule 3:  Literal ::= IntegerLiteral
  65. //
  66. #line 496 "java.g"
  67. void Parser::Act3(void)
  68. {
  69.     Sym(1) = ast_pool -> NewIntegerLiteral(Token(1));
  70. }
  71.  
  72. //
  73. // Rule 4:  Literal ::= LongLiteral
  74. //
  75. #line 505 "java.g"
  76. void Parser::Act4(void)
  77. {
  78.     Sym(1) = ast_pool -> NewLongLiteral(Token(1));
  79. }
  80.  
  81. //
  82. // Rule 5:  Literal ::= FloatingPointLiteral
  83. //
  84. #line 514 "java.g"
  85. void Parser::Act5(void)
  86. {
  87.     Sym(1) = ast_pool -> NewFloatingPointLiteral(Token(1));
  88. }
  89.  
  90. //
  91. // Rule 6:  Literal ::= DoubleLiteral
  92. //
  93. #line 523 "java.g"
  94. void Parser::Act6(void)
  95. {
  96.     Sym(1) = ast_pool -> NewDoubleLiteral(Token(1));
  97. }
  98.  
  99. //
  100. // Rule 7:  Literal -> BooleanLiteral
  101. //
  102. // void NoAction(void);
  103. //
  104.  
  105. //
  106. // Rule 8:  Literal ::= CharacterLiteral
  107. //
  108. #line 536 "java.g"
  109. void Parser::Act8(void)
  110. {
  111.     Sym(1) = ast_pool -> NewCharacterLiteral(Token(1));
  112. }
  113.  
  114. //
  115. // Rule 9:  Literal ::= StringLiteral
  116. //
  117. #line 545 "java.g"
  118. void Parser::Act9(void)
  119. {
  120.     Sym(1) = ast_pool -> NewStringLiteral(Token(1));
  121. }
  122.  
  123. //
  124. // Rule 10:  Literal ::= null
  125. //
  126. #line 554 "java.g"
  127. void Parser::Act10(void)
  128. {
  129.     Sym(1) = ast_pool -> NewNullLiteral(Token(1));
  130. }
  131.  
  132. //
  133. // Rule 11:  BooleanLiteral ::= true
  134. //
  135. #line 563 "java.g"
  136. void Parser::Act11(void)
  137. {
  138.     Sym(1) = ast_pool -> NewTrueLiteral(Token(1));
  139. }
  140.  
  141. //
  142. // Rule 12:  BooleanLiteral ::= false
  143. //
  144. #line 572 "java.g"
  145. void Parser::Act12(void)
  146. {
  147.     Sym(1) = ast_pool -> NewFalseLiteral(Token(1));
  148. }
  149.  
  150. //
  151. // Rule 13:  Type -> PrimitiveType
  152. //
  153. // void NoAction(void);
  154. //
  155.  
  156. //
  157. // Rule 14:  Type -> ReferenceType
  158. //
  159. // void NoAction(void);
  160. //
  161.  
  162. //
  163. // Rule 15:  PrimitiveType -> NumericType
  164. //
  165. // void NoAction(void);
  166. //
  167.  
  168. //
  169. // Rule 16:  PrimitiveType ::= boolean
  170. //
  171. #line 595 "java.g"
  172. void Parser::Act16(void)
  173. {
  174.     Sym(1) = ast_pool -> NewPrimitiveType(Ast::BOOLEAN, Token(1));
  175. }
  176.  
  177. //
  178. // Rule 17:  NumericType -> IntegralType
  179. //
  180. // void NoAction(void);
  181. //
  182.  
  183. //
  184. // Rule 18:  NumericType -> FloatingPointType
  185. //
  186. // void NoAction(void);
  187. //
  188.  
  189. //
  190. // Rule 19:  IntegralType ::= byte
  191. //
  192. #line 612 "java.g"
  193. void Parser::Act19(void)
  194. {
  195.     Sym(1) = ast_pool -> NewPrimitiveType(Ast::BYTE, Token(1));
  196. }
  197.  
  198. //
  199. // Rule 20:  IntegralType ::= short
  200. //
  201. #line 621 "java.g"
  202. void Parser::Act20(void)
  203. {
  204.     Sym(1) = ast_pool -> NewPrimitiveType(Ast::SHORT, Token(1));
  205. }
  206.  
  207. //
  208. // Rule 21:  IntegralType ::= int
  209. //
  210. #line 630 "java.g"
  211. void Parser::Act21(void)
  212. {
  213.     Sym(1) = ast_pool -> NewPrimitiveType(Ast::INT, Token(1));
  214. }
  215.  
  216. //
  217. // Rule 22:  IntegralType ::= long
  218. //
  219. #line 639 "java.g"
  220. void Parser::Act22(void)
  221. {
  222.     Sym(1) = ast_pool -> NewPrimitiveType(Ast::LONG, Token(1));
  223. }
  224.  
  225. //
  226. // Rule 23:  IntegralType ::= char
  227. //
  228. #line 648 "java.g"
  229. void Parser::Act23(void)
  230. {
  231.     Sym(1) = ast_pool -> NewPrimitiveType(Ast::CHAR, Token(1));
  232. }
  233.  
  234. //
  235. // Rule 24:  FloatingPointType ::= float
  236. //
  237. #line 657 "java.g"
  238. void Parser::Act24(void)
  239. {
  240.     Sym(1) = ast_pool -> NewPrimitiveType(Ast::FLOAT, Token(1));
  241. }
  242.  
  243. //
  244. // Rule 25:  FloatingPointType ::= double
  245. //
  246. #line 666 "java.g"
  247. void Parser::Act25(void)
  248. {
  249.     Sym(1) = ast_pool -> NewPrimitiveType(Ast::DOUBLE, Token(1));
  250. }
  251.  
  252. //
  253. // Rule 26:  ReferenceType -> ClassOrInterfaceType
  254. //
  255. // void NoAction(void);
  256. //
  257.  
  258. //
  259. // Rule 27:  ReferenceType -> ArrayType
  260. //
  261. // void NoAction(void);
  262. //
  263.  
  264. //
  265. // Rule 28:  ClassOrInterfaceType -> Name
  266. //
  267. // void NoAction(void);
  268. //
  269.  
  270. //
  271. // Rule 29:  ArrayType ::= PrimitiveType Dims
  272. //
  273. #line 695 "java.g"
  274. void Parser::MakeArrayType(void)
  275. {
  276.     AstArrayType *p = ast_pool -> NewArrayType();
  277.     p -> type     = Sym(1);
  278.     //
  279.     // The list of modifiers is guaranteed not empty
  280.     //
  281.     {
  282.         AstListNode *tail = (AstListNode *) Sym(2);
  283.         p -> AllocateBrackets(tail -> index + 1);
  284.         AstListNode *root = tail;
  285.         do
  286.         {
  287.             root = root -> next;
  288.             p -> AddBrackets((AstBrackets *) root -> element);
  289.         } while(root != tail);
  290.         FreeCircularList(tail);
  291.     }
  292.     Sym(1) = p;
  293. }
  294.  
  295. //
  296. // Rule 30:  ArrayType ::= Name Dims
  297. //
  298. // void MakeArrayType(void);
  299. //
  300.  
  301. //
  302. // Rule 31:  ClassType -> ClassOrInterfaceType
  303. //
  304. // void NoAction(void);
  305. //
  306.  
  307. //
  308. // Rule 32:  InterfaceType -> ClassOrInterfaceType
  309. //
  310. // void NoAction(void);
  311. //
  312.  
  313. //
  314. // Rule 33:  Name -> SimpleName
  315. //
  316. // void NoAction(void);
  317. //
  318.  
  319. //
  320. // Rule 34:  Name -> QualifiedName
  321. //
  322. // void NoAction(void);
  323. //
  324.  
  325. //
  326. // Rule 35:  SimpleName ::= Identifier
  327. //
  328. #line 745 "java.g"
  329. void Parser::MakeSimpleName(void)
  330. {
  331.     Sym(1) = ast_pool -> NewSimpleName(Token(1));
  332. }
  333.  
  334. //
  335. // Rule 36:  QualifiedName ::= Name DOT Identifier
  336. //
  337. #line 754 "java.g"
  338. void Parser::MakeFieldAccess(void)
  339. {
  340.     AstFieldAccess *p = ast_pool -> NewFieldAccess();
  341.     p -> base = (AstExpression *) Sym(1);
  342.     p -> dot_token = Token(2);
  343.     p -> identifier_token = Token(3);
  344.     Sym(1) = p;
  345. }
  346.  
  347. //
  348. // Rule 37:  CompilationUnit ::= PackageDeclarationopt ImportDeclarationsopt TypeDeclarationsopt
  349. //
  350. #line 769 "java.g"
  351. void Parser::Act37(void)
  352. {
  353.     AstCompilationUnit *p = ast_pool -> NewCompilationUnit();
  354.     p -> package_declaration_opt = (AstPackageDeclaration *) Sym(1);
  355.     if (Sym(2) != NULL)
  356.     {
  357.         AstListNode *tail = (AstListNode *) Sym(2);
  358.         p -> AllocateImportDeclarations(tail -> index + 1);
  359.         AstListNode *root = tail;
  360.         do
  361.         {
  362.             root = root -> next;
  363.             p -> AddImportDeclaration((AstImportDeclaration *) root -> element);
  364.         } while(root != tail);
  365.         FreeCircularList(tail);
  366.     }
  367.     if (Sym(3) != NULL)
  368.     {
  369.         AstListNode *tail = (AstListNode *) Sym(3);
  370.         p -> AllocateTypeDeclarations(tail -> index + 1);
  371.         AstListNode *root = tail;
  372.         do
  373.         {
  374.             root = root -> next;
  375.             p -> AddTypeDeclaration(root -> element);
  376.         } while(root != tail);
  377.         FreeCircularList(tail);
  378.     }
  379.     Sym(1) = p;
  380. }
  381.  
  382. //
  383. // Rule 38:  ImportDeclarations ::= ImportDeclaration
  384. //
  385. #line 804 "java.g"
  386. //
  387. // Note that the list is circular so as to preserve the order of the elements
  388. //
  389. void Parser::Act38(void)
  390. {
  391.     AstListNode *p = AllocateListNode();
  392.     p -> next = p;
  393.     p -> element = Sym(1);
  394.     p -> index = 0;
  395.  
  396.     Sym(1) = p;
  397. }
  398.  
  399. //
  400. // Rule 39:  ImportDeclarations ::= ImportDeclarations ImportDeclaration
  401. //
  402. #line 821 "java.g"
  403. //
  404. // Note that the list is circular so as to preserve the order of the elements
  405. //
  406. void Parser::Act39(void)
  407. {
  408.     AstListNode *tail = (AstListNode *) Sym(1);
  409.  
  410.     AstListNode *p = AllocateListNode();
  411.     p -> element = Sym(2);
  412.     p -> index = tail -> index + 1;
  413.  
  414.     p -> next = tail -> next;
  415.     tail -> next = p;
  416.  
  417.     Sym(1) = p;
  418. }
  419.  
  420. //
  421. // Rule 40:  TypeDeclarations ::= TypeDeclaration
  422. //
  423. #line 842 "java.g"
  424. //
  425. // Note that the list is circular so as to preserve the order of the elements
  426. //
  427. void Parser::Act40(void)
  428. {
  429.     AstListNode *p = AllocateListNode();
  430.     p -> next = p;
  431.     p -> element = Sym(1);
  432.     p -> index = 0;
  433.  
  434.     Sym(1) = p;
  435. }
  436.  
  437. //
  438. // Rule 41:  TypeDeclarations ::= TypeDeclarations TypeDeclaration
  439. //
  440. #line 859 "java.g"
  441. //
  442. // Note that the list is circular so as to preserve the order of the elements
  443. //
  444. void Parser::Act41(void)
  445. {
  446.     AstListNode *tail = (AstListNode *) Sym(1);
  447.  
  448.     AstListNode *p = AllocateListNode();
  449.     p -> element = Sym(2);
  450.     p -> index = tail -> index + 1;
  451.  
  452.     p -> next = tail -> next;
  453.     tail -> next = p;
  454.  
  455.     Sym(1) = p;
  456. }
  457.  
  458. //
  459. // Rule 42:  PackageDeclaration ::= package Name PackageHeaderMarker SEMICOLON
  460. //
  461. #line 880 "java.g"
  462. void Parser::Act42(void)
  463. {
  464.     AstPackageDeclaration *p = ast_pool -> NewPackageDeclaration();
  465.     p -> package_token   = Token(1);
  466.     p -> name            = (AstExpression *) Sym(2);
  467.     p -> semicolon_token = Token(3);
  468.     Sym(1) = p;
  469. }
  470.  
  471. //
  472. // Rule 43:  ImportDeclaration -> SingleTypeImportDeclaration
  473. //
  474. // void NoAction(void);
  475. //
  476.  
  477. //
  478. // Rule 44:  ImportDeclaration -> TypeImportOnDemandDeclaration
  479. //
  480. // void NoAction(void);
  481. //
  482.  
  483. //
  484. // Rule 45:  SingleTypeImportDeclaration ::= import Name SEMICOLON
  485. //
  486. #line 901 "java.g"
  487. void Parser::Act45(void)
  488. {
  489.     AstImportDeclaration *p = ast_pool -> NewImportDeclaration();
  490.     p -> import_token    = Token(1);
  491.     p -> name            = (AstExpression *) Sym(2);
  492.     p -> star_token_opt  = 0;
  493.     p -> semicolon_token = Token(3);
  494.     Sym(1) = p;
  495. }
  496.  
  497. //
  498. // Rule 46:  TypeImportOnDemandDeclaration ::= import Name DOT MULTIPLY SEMICOLON
  499. //
  500. #line 915 "java.g"
  501. void Parser::Act46(void)
  502. {
  503.     AstImportDeclaration *p = ast_pool -> NewImportDeclaration();
  504.     p -> import_token         = Token(1);
  505.     p -> name                 = (AstExpression *) Sym(2);
  506.     p -> star_token_opt       = Token(4);
  507.     p -> semicolon_token      = Token(5);
  508.     Sym(1) = p;
  509. }
  510.  
  511. //
  512. // Rule 47:  TypeDeclaration -> ClassDeclaration
  513. //
  514. // void NoAction(void);
  515. //
  516.  
  517. //
  518. // Rule 48:  TypeDeclaration -> InterfaceDeclaration
  519. //
  520. // void NoAction(void);
  521. //
  522.  
  523. //
  524. // Rule 49:  TypeDeclaration ::= SEMICOLON
  525. //
  526. #line 937 "java.g"
  527. void Parser::Act49(void)
  528. {
  529.     Sym(1) = ast_pool -> NewEmptyDeclaration(Token(1));
  530. }
  531.  
  532. //
  533. // Rule 50:  Modifiers ::= Modifier
  534. //
  535. #line 948 "java.g"
  536. //
  537. // Note that the list is circular so as to preserve the order of the elements
  538. //
  539. void Parser::Act50(void)
  540. {
  541.     AstListNode *p = AllocateListNode();
  542.     p -> next = p;
  543.     p -> element = Sym(1);
  544.     p -> index = 0;
  545.  
  546.     Sym(1) = p;
  547. }
  548.  
  549. //
  550. // Rule 51:  Modifiers ::= Modifiers Modifier
  551. //
  552. #line 965 "java.g"
  553. //
  554. // Note that the list is circular so as to preserve the order of the elements
  555. //
  556. void Parser::Act51(void)
  557. {
  558.     AstListNode *tail = (AstListNode *) Sym(1);
  559.  
  560.     AstListNode *p = AllocateListNode();
  561.     p -> element = Sym(2);
  562.     p -> index = tail -> index + 1;
  563.  
  564.     p -> next = tail -> next;
  565.     tail -> next = p;
  566.  
  567.     Sym(1) = p;
  568. }
  569.  
  570. //
  571. // Rule 52:  Modifier ::= public
  572. //
  573. #line 986 "java.g"
  574. void Parser::Act52(void)
  575. {
  576.     Sym(1) = ast_pool -> NewModifier(Ast::PUBLIC, Token(1));
  577. }
  578.  
  579. //
  580. // Rule 53:  Modifier ::= protected
  581. //
  582. #line 995 "java.g"
  583. void Parser::Act53(void)
  584. {
  585.     Sym(1) = ast_pool -> NewModifier(Ast::PROTECTED, Token(1));
  586. }
  587.  
  588. //
  589. // Rule 54:  Modifier ::= private
  590. //
  591. #line 1004 "java.g"
  592. void Parser::Act54(void)
  593. {
  594.     Sym(1) = ast_pool -> NewModifier(Ast::PRIVATE, Token(1));
  595. }
  596.  
  597. //
  598. // Rule 55:  Modifier ::= static
  599. //
  600. #line 1013 "java.g"
  601. void Parser::Act55(void)
  602. {
  603.     Sym(1) = ast_pool -> NewModifier(Ast::STATIC, Token(1));
  604. }
  605.  
  606. //
  607. // Rule 56:  Modifier ::= abstract
  608. //
  609. #line 1022 "java.g"
  610. void Parser::Act56(void)
  611. {
  612.     Sym(1) = ast_pool -> NewModifier(Ast::ABSTRACT, Token(1));
  613. }
  614.  
  615. //
  616. // Rule 57:  Modifier ::= final
  617. //
  618. #line 1031 "java.g"
  619. void Parser::Act57(void)
  620. {
  621.     Sym(1) = ast_pool -> NewModifier(Ast::FINAL, Token(1));
  622. }
  623.  
  624. //
  625. // Rule 58:  Modifier ::= native
  626. //
  627. #line 1040 "java.g"
  628. void Parser::Act58(void)
  629. {
  630.     Sym(1) = ast_pool -> NewModifier(Ast::NATIVE, Token(1));
  631. }
  632.  
  633. //
  634. // Rule 59:  Modifier ::= strictfp
  635. //
  636. #line 1049 "java.g"
  637. void Parser::Act59(void)
  638. {
  639.     Sym(1) = ast_pool -> NewModifier(Ast::STRICTFP, Token(1));
  640. }
  641.  
  642. //
  643. // Rule 60:  Modifier ::= synchronized
  644. //
  645. #line 1058 "java.g"
  646. void Parser::Act60(void)
  647. {
  648.     Sym(1) = ast_pool -> NewModifier(Ast::SYNCHRONIZED, Token(1));
  649. }
  650.  
  651. //
  652. // Rule 61:  Modifier ::= transient
  653. //
  654. #line 1067 "java.g"
  655. void Parser::Act61(void)
  656. {
  657.     Sym(1) = ast_pool -> NewModifier(Ast::TRANSIENT, Token(1));
  658. }
  659.  
  660. //
  661. // Rule 62:  Modifier ::= volatile
  662. //
  663. #line 1076 "java.g"
  664. void Parser::Act62(void)
  665. {
  666.     Sym(1) = ast_pool -> NewModifier(Ast::VOLATILE, Token(1));
  667. }
  668.  
  669. //
  670. // Rule 63:  ClassDeclaration ::= Modifiersopt class Identifier Superopt Interfacesopt ClassBody
  671. //
  672. #line 1092 "java.g"
  673. void Parser::Act63(void)
  674. {
  675.     AstClassDeclaration *p = ast_pool -> NewClassDeclaration();
  676.     if (Sym(1) != NULL)
  677.     {
  678.         AstListNode *tail = (AstListNode *) Sym(1);
  679.         p -> AllocateClassModifiers(tail -> index + 1);
  680.         AstListNode *root = tail;
  681.         do
  682.         {
  683.             root = root -> next;
  684.             p -> AddClassModifier((AstModifier *) root -> element);
  685.         } while(root != tail);
  686.         FreeCircularList(tail);
  687.     }
  688.     p -> class_token          = Token(2);
  689.     p -> identifier_token     = Token(3);
  690.     p -> super_opt            = (AstExpression *) Sym(4);
  691.     if (Sym(5) != NULL)
  692.     {
  693.         AstListNode *tail = (AstListNode *) Sym(5);
  694.         p -> AllocateInterfaces(tail -> index + 1);
  695.         AstListNode *root = tail;
  696.         do
  697.         {
  698.             root = root -> next;
  699.             p -> AddInterface((AstExpression *) root -> element);
  700.         } while(root != tail);
  701.         FreeCircularList(tail);
  702.     }
  703.     p -> class_body = (AstClassBody *) Sym(6);
  704.     Sym(1) = p;
  705. }
  706.  
  707. //
  708. // Rule 64:  Super ::= extends ClassType
  709. //
  710. #line 1130 "java.g"
  711. void Parser::SetSym1ToSym2(void) { Sym(1) = Sym(2); }
  712.  
  713. //
  714. // Rule 65:  Interfaces ::= implements InterfaceTypeList
  715. //
  716. // void SetSym1ToSym2(void);
  717. //
  718.  
  719. //
  720. // Rule 66:  InterfaceTypeList ::= InterfaceType
  721. //
  722. #line 1143 "java.g"
  723. //
  724. // Note that the list is circular so as to preserve the order of the elements
  725. //
  726. void Parser::Act66(void)
  727. {
  728.     AstListNode *p = AllocateListNode();
  729.     p -> next = p;
  730.     p -> element = Sym(1);
  731.     p -> index = 0;
  732.  
  733.     Sym(1) = p;
  734. }
  735.  
  736. //
  737. // Rule 67:  InterfaceTypeList ::= InterfaceTypeList COMMA InterfaceType
  738. //
  739. #line 1160 "java.g"
  740. //
  741. // Note that the list is circular so as to preserve the order of the elements
  742. //
  743. void Parser::Act67(void)
  744. {
  745.     AstListNode *tail = (AstListNode *) Sym(1);
  746.  
  747.     AstListNode *p = AllocateListNode();
  748.     p -> element = Sym(3);
  749.     p -> index = tail -> index + 1;
  750.  
  751.     p -> next = tail -> next;
  752.     tail -> next = p;
  753.  
  754.     Sym(1) = p;
  755. }
  756.  
  757. //
  758. // Rule 68:  ClassBody ::= LBRACE ClassBodyDeclarationsopt RBRACE
  759. //
  760. #line 1181 "java.g"
  761. void Parser::Act68(void)
  762. {
  763.     AstClassBody *p = ast_pool -> NewClassBody();
  764.     if (parse_header_only)
  765.         p -> mark_unparsed();
  766.  
  767.     p -> left_brace_token = Token(1);
  768.     if (Sym(2) != NULL)
  769.     {
  770.         int num_instance_variables = 0,
  771.             num_class_variables = 0,
  772.             num_methods = 0,
  773.             num_constructors = 0,
  774.             num_static_initializers = 0,
  775.             num_inner_classes = 0,
  776.             num_inner_interfaces = 0,
  777.             num_blocks = 0,
  778.             num_empty_declarations = 0;
  779.  
  780.         AstListNode *tail = (AstListNode *) Sym(2);
  781.         p -> AllocateClassBodyDeclarations(tail -> index + 1);
  782.         AstListNode *root = tail;
  783.         do
  784.         {
  785.             root = root -> next;
  786.             p -> AddClassBodyDeclaration(root -> element);
  787.  
  788.             AstFieldDeclaration *field_declaration = root -> element -> FieldDeclarationCast();
  789.             if (field_declaration)
  790.             {
  791.                 for (int i = 0; i < field_declaration -> NumVariableModifiers(); i++)
  792.                 {
  793.                     if (field_declaration -> VariableModifier(i) -> kind == Ast::STATIC)
  794.                     {
  795.                         field_declaration -> MarkStatic();
  796.                         break;
  797.                     }
  798.                 }
  799.                 if (field_declaration -> StaticFieldCast())
  800.                      num_class_variables++;
  801.                 else num_instance_variables++;
  802.             }
  803.             else if (root -> element -> MethodDeclarationCast())
  804.             {
  805.                 num_methods++;
  806.             }
  807.             else if (root -> element -> ConstructorDeclarationCast())
  808.             {
  809.                 num_constructors++;
  810.             }
  811.             else if (root -> element -> StaticInitializerCast())
  812.             {
  813.                 num_static_initializers++;
  814.             }
  815.             else if (root -> element -> ClassDeclarationCast())
  816.             {
  817.                 num_inner_classes++;
  818.             }
  819.             else if (root -> element -> InterfaceDeclarationCast())
  820.             {
  821.                 num_inner_interfaces++;
  822.             }
  823.             else if (root -> element -> BlockCast())
  824.             {
  825.                 num_blocks++;
  826.             }
  827.             else num_empty_declarations++;
  828.         } while(root != tail);
  829.  
  830.         p -> AllocateInstanceVariables(num_instance_variables);
  831.         p -> AllocateClassVariables(num_class_variables);
  832.         p -> AllocateMethods(num_methods);
  833.         p -> AllocateConstructors(num_constructors);
  834.         p -> AllocateStaticInitializers(num_static_initializers);
  835.         p -> AllocateNestedClasses(num_inner_classes);
  836.         p -> AllocateNestedInterfaces(num_inner_interfaces);
  837.         p -> AllocateBlocks(num_blocks);
  838.         p -> AllocateEmptyDeclarations(num_empty_declarations);
  839.  
  840.         root = tail;
  841.         do
  842.         {
  843.             root = root -> next;
  844.  
  845.             AstFieldDeclaration *field_declaration;
  846.             AstMethodDeclaration *method_declaration;
  847.             AstConstructorDeclaration *constructor_declaration;
  848.             AstStaticInitializer *static_initializer;
  849.             AstClassDeclaration *class_declaration;
  850.             AstInterfaceDeclaration *interface_declaration;
  851.             AstBlock *block;
  852.  
  853.             if ((field_declaration = root -> element -> FieldDeclarationCast()))
  854.             {
  855.                 if (field_declaration -> StaticFieldCast())
  856.                      p -> AddClassVariable(field_declaration);
  857.                 else p -> AddInstanceVariable(field_declaration);
  858.             }
  859.             else if ((method_declaration = root -> element -> MethodDeclarationCast()))
  860.             {
  861.                 p -> AddMethod(method_declaration);
  862.             }
  863.             else if ((constructor_declaration = root -> element -> ConstructorDeclarationCast()))
  864.             {
  865.                 p -> AddConstructor(constructor_declaration);
  866.             }
  867.             else if ((static_initializer = root -> element -> StaticInitializerCast()))
  868.             {
  869.                 p -> AddStaticInitializer(static_initializer);
  870.             }
  871.             else if ((class_declaration = root -> element -> ClassDeclarationCast()))
  872.             {
  873.                 p -> AddNestedClass(class_declaration);
  874.             }
  875.             else if ((interface_declaration = root -> element -> InterfaceDeclarationCast()))
  876.             {
  877.                 p -> AddNestedInterface(interface_declaration);
  878.             }
  879.             else if ((block = root -> element -> BlockCast()))
  880.             {
  881.                 p -> AddBlock(block);
  882.             }
  883.             else // assert(block = root -> element -> EmptyDeclarationCast())
  884.             {
  885.                 p -> AddEmptyDeclaration((AstEmptyDeclaration *) root -> element);
  886.             }
  887.         } while(root != tail);
  888.         FreeCircularList(tail);
  889.     }
  890.     p -> right_brace_token = Token(3);
  891.     p -> pool = body_pool; // from now on, this is the storage pool to use for this type
  892.     Sym(1) = p;
  893. }
  894.  
  895. //
  896. // Rule 69:  ClassBodyDeclarations ::= ClassBodyDeclaration
  897. //
  898. #line 1319 "java.g"
  899. //
  900. // Note that the list is circular so as to preserve the order of the elements
  901. //
  902. void Parser::Act69(void)
  903. {
  904.     AstListNode *p = AllocateListNode();
  905.     p -> next = p;
  906.     p -> element = Sym(1);
  907.     p -> index = 0;
  908.  
  909.     Sym(1) = p;
  910. }
  911.  
  912. //
  913. // Rule 70:  ClassBodyDeclarations ::= ClassBodyDeclarations ClassBodyDeclaration
  914. //
  915. #line 1336 "java.g"
  916. //
  917. // Note that the list is circular so as to preserve the order of the elements
  918. //
  919. void Parser::Act70(void)
  920. {
  921.     AstListNode *tail = (AstListNode *) Sym(1);
  922.  
  923.     AstListNode *p = AllocateListNode();
  924.     p -> element = Sym(2);
  925.     p -> index = tail -> index + 1;
  926.  
  927.     p -> next = tail -> next;
  928.     tail -> next = p;
  929.  
  930.     Sym(1) = p;
  931. }
  932.  
  933. //
  934. // Rule 71:  ClassBodyDeclaration -> ClassMemberDeclaration
  935. //
  936. // void NoAction(void);
  937. //
  938.  
  939. //
  940. // Rule 72:  ClassBodyDeclaration -> StaticInitializer
  941. //
  942. // void NoAction(void);
  943. //
  944.  
  945. //
  946. // Rule 73:  ClassBodyDeclaration -> ConstructorDeclaration
  947. //
  948. // void NoAction(void);
  949. //
  950.  
  951. //
  952. // Rule 74:  ClassBodyDeclaration ::= MethodHeaderMarker Block
  953. //
  954. #line 1370 "java.g"
  955. void Parser::Act74(void)
  956. {
  957.     Sym(1) = Sym(2);
  958. }
  959.  
  960. //
  961. // Rule 75:  ClassMemberDeclaration -> FieldDeclaration
  962. //
  963. // void NoAction(void);
  964. //
  965.  
  966. //
  967. // Rule 76:  ClassMemberDeclaration -> MethodDeclaration
  968. //
  969. // void NoAction(void);
  970. //
  971.  
  972. //
  973. // Rule 77:  ClassMemberDeclaration -> ClassDeclaration
  974. //
  975. // void NoAction(void);
  976. //
  977.  
  978. //
  979. // Rule 78:  ClassMemberDeclaration -> InterfaceDeclaration
  980. //
  981. // void NoAction(void);
  982. //
  983.  
  984. //
  985. // Rule 79:  ClassMemberDeclaration ::= SEMICOLON
  986. //
  987. #line 1404 "java.g"
  988. void Parser::Act79(void)
  989. {
  990.     Sym(1) = ast_pool -> NewEmptyDeclaration(Token(1));
  991. }
  992.  
  993. //
  994. // Rule 80:  FieldDeclaration ::= Modifiersopt Type VariableDeclarators SEMICOLON
  995. //
  996. #line 1423 "java.g"
  997. void Parser::Act80(void)
  998. {
  999.     AstFieldDeclaration *p = ast_pool -> NewFieldDeclaration();
  1000.     if (Sym(1) != NULL)
  1001.     {
  1002.         AstListNode *tail = (AstListNode *) Sym(1);
  1003.         p -> AllocateVariableModifiers(tail -> index + 1);
  1004.         AstListNode *root = tail;
  1005.         do
  1006.         {
  1007.             root = root -> next;
  1008.             p -> AddVariableModifier((AstModifier *) root -> element);
  1009.         } while(root != tail);
  1010.         FreeCircularList(tail);
  1011.     }
  1012.     p -> type = Sym(2);
  1013.     //
  1014.     // The list of declarators is guaranteed not empty
  1015.     //
  1016.     {
  1017.         AstListNode *tail = (AstListNode *) Sym(3);
  1018.         p -> AllocateVariableDeclarators(tail -> index + 1);
  1019.         AstListNode *root = tail;
  1020.         do
  1021.         {
  1022.             root = root -> next;
  1023.             p -> AddVariableDeclarator((AstVariableDeclarator *) root -> element);
  1024.         } while(root != tail);
  1025.         FreeCircularList(tail);
  1026.     }
  1027.     p -> semicolon_token      = Token(4);
  1028.     Sym(1) = p;
  1029. }
  1030.  
  1031. //
  1032. // Rule 81:  VariableDeclarators ::= VariableDeclarator
  1033. //
  1034. #line 1461 "java.g"
  1035. //
  1036. // Note that the list is circular so as to preserve the order of the elements
  1037. //
  1038. void Parser::Act81(void)
  1039. {
  1040.     AstListNode *p = AllocateListNode();
  1041.     p -> next = p;
  1042.     p -> element = Sym(1);
  1043.     p -> index = 0;
  1044.  
  1045.     Sym(1) = p;
  1046. }
  1047.  
  1048. //
  1049. // Rule 82:  VariableDeclarators ::= VariableDeclarators COMMA VariableDeclarator
  1050. //
  1051. #line 1478 "java.g"
  1052. //
  1053. // Note that the list is circular so as to preserve the order of the elements
  1054. //
  1055. void Parser::Act82(void)
  1056. {
  1057.     AstListNode *tail = (AstListNode *) Sym(1);
  1058.  
  1059.     AstListNode *p = AllocateListNode();
  1060.     p -> element = Sym(3);
  1061.     p -> index = tail -> index + 1;
  1062.  
  1063.     p -> next = tail -> next;
  1064.     tail -> next = p;
  1065.  
  1066.     Sym(1) = p;
  1067. }
  1068.  
  1069. //
  1070. // Rule 83:  VariableDeclarator ::= VariableDeclaratorId
  1071. //
  1072. #line 1499 "java.g"
  1073. void Parser::Act83(void)
  1074. {
  1075.     AstVariableDeclarator *p = ast_pool -> NewVariableDeclarator();
  1076.     p -> variable_declarator_name = (AstVariableDeclaratorId *) Sym(1);
  1077.     p -> variable_initializer_opt = NULL;
  1078.     Sym(1) = p;
  1079. }
  1080.  
  1081. //
  1082. // Rule 84:  VariableDeclarator ::= VariableDeclaratorId EQUAL VariableInitializer
  1083. //
  1084. #line 1511 "java.g"
  1085. void Parser::Act84(void)
  1086. {
  1087.     AstVariableDeclarator *p = ast_pool -> NewVariableDeclarator();
  1088.     p -> variable_declarator_name = (AstVariableDeclaratorId *) Sym(1);
  1089.     p -> variable_initializer_opt = Sym(3);
  1090.     Sym(1) = p;
  1091. }
  1092.  
  1093. //
  1094. // Rule 85:  VariableDeclaratorId ::= Identifier Dimsopt
  1095. //
  1096. #line 1523 "java.g"
  1097. void Parser::Act85(void)
  1098. {
  1099.     AstVariableDeclaratorId *p = ast_pool -> NewVariableDeclaratorId();
  1100.     p -> identifier_token = Token(1);
  1101.     if (Sym(2) != NULL)
  1102.     {
  1103.         AstListNode *tail = (AstListNode *) Sym(2);
  1104.         p -> AllocateBrackets(tail -> index + 1);
  1105.         AstListNode *root = tail;
  1106.         do
  1107.         {
  1108.             root = root -> next;
  1109.             p -> AddBrackets((AstBrackets *) root -> element);
  1110.         } while(root != tail);
  1111.         FreeCircularList(tail);
  1112.     }
  1113.     Sym(1) = p;
  1114. }
  1115.  
  1116. //
  1117. // Rule 86:  VariableInitializer -> Expression
  1118. //
  1119. // void NoAction(void);
  1120. //
  1121.  
  1122. //
  1123. // Rule 87:  VariableInitializer -> ArrayInitializer
  1124. //
  1125. // void NoAction(void);
  1126. //
  1127.  
  1128. //
  1129. // Rule 88:  MethodDeclaration ::= MethodHeader MethodHeaderMarker MethodBody
  1130. //
  1131. #line 1571 "java.g"
  1132. void Parser::Act88(void)
  1133. {
  1134.     ((AstMethodDeclaration *) Sym(1)) -> method_body = (AstStatement *) Sym(3);
  1135. }
  1136.  
  1137. //
  1138. // Rule 89:  MethodHeader ::= Modifiersopt Type MethodDeclarator Throwsopt
  1139. //
  1140. #line 1580 "java.g"
  1141. void Parser::Act89(void)
  1142. {
  1143.     AstMethodDeclaration *p = ast_pool -> NewMethodDeclaration();
  1144.     if (Sym(1) != NULL)
  1145.     {
  1146.         AstListNode *tail = (AstListNode *) Sym(1);
  1147.         p -> AllocateMethodModifiers(tail -> index + 1);
  1148.         AstListNode *root = tail;
  1149.         do
  1150.         {
  1151.             root = root -> next;
  1152.             p -> AddMethodModifier((AstModifier *) root -> element);
  1153.         } while(root != tail);
  1154.         FreeCircularList(tail);
  1155.     }
  1156.     p -> type              = Sym(2);
  1157.     p -> method_declarator = (AstMethodDeclarator *) Sym(3);
  1158.     if (Sym(4) != NULL)
  1159.     {
  1160.         AstListNode *tail = (AstListNode *) Sym(4);
  1161.         p -> AllocateThrows(tail -> index + 1);
  1162.         AstListNode *root = tail;
  1163.         do
  1164.         {
  1165.             root = root -> next;
  1166.             p -> AddThrow((AstExpression *) root -> element);
  1167.         } while(root != tail);
  1168.         FreeCircularList(tail);
  1169.     }
  1170.     Sym(1) = p;
  1171. }
  1172.  
  1173. //
  1174. // Rule 90:  MethodHeader ::= Modifiersopt void MethodDeclarator Throwsopt
  1175. //
  1176. #line 1616 "java.g"
  1177. void Parser::Act90(void)
  1178. {
  1179.     AstMethodDeclaration *p = ast_pool -> NewMethodDeclaration();
  1180.     if (Sym(1) != NULL)
  1181.     {
  1182.         AstListNode *tail = (AstListNode *) Sym(1);
  1183.         p -> AllocateMethodModifiers(tail -> index + 1);
  1184.         AstListNode *root = tail;
  1185.         do
  1186.         {
  1187.             root = root -> next;
  1188.             p -> AddMethodModifier((AstModifier *) root -> element);
  1189.         } while(root != tail);
  1190.         FreeCircularList(tail);
  1191.     }
  1192.     p -> type              = ast_pool -> NewPrimitiveType(Ast::VOID_TYPE, Token(2));
  1193.     p -> method_declarator = (AstMethodDeclarator *) Sym(3);
  1194.     if (Sym(4) != NULL)
  1195.     {
  1196.         AstListNode *tail = (AstListNode *) Sym(4);
  1197.         p -> AllocateThrows(tail -> index + 1);
  1198.         AstListNode *root = tail;
  1199.         do
  1200.         {
  1201.             root = root -> next;
  1202.             p -> AddThrow((AstExpression *) root -> element);
  1203.         } while(root != tail);
  1204.         FreeCircularList(tail);
  1205.     }
  1206.     Sym(1) = p;
  1207. }
  1208.  
  1209. //
  1210. // Rule 91:  MethodDeclarator ::= Identifier LPAREN FormalParameterListopt RPAREN Dimsopt
  1211. //
  1212. #line 1652 "java.g"
  1213. void Parser::Act91(void)
  1214. {
  1215.     AstMethodDeclarator *p = ast_pool -> NewMethodDeclarator();
  1216.     p -> identifier_token        = Token(1);
  1217.     p -> left_parenthesis_token  = Token(2);
  1218.     if (Sym(3) != NULL)
  1219.     {
  1220.         AstListNode *tail = (AstListNode *) Sym(3);
  1221.         p -> AllocateFormalParameters(tail -> index + 1);
  1222.         AstListNode *root = tail;
  1223.         do
  1224.         {
  1225.             root = root -> next;
  1226.             p -> AddFormalParameter((AstFormalParameter *) root -> element);
  1227.         } while(root != tail);
  1228.         FreeCircularList(tail);
  1229.     }
  1230.     p -> right_parenthesis_token = Token(4);
  1231.     if (Sym(5) != NULL)
  1232.     {
  1233.         AstListNode *tail = (AstListNode *) Sym(5);
  1234.         p -> AllocateBrackets(tail -> index + 1);
  1235.         AstListNode *root = tail;
  1236.         do
  1237.         {
  1238.             root = root -> next;
  1239.             p -> AddBrackets((AstBrackets *) root -> element);
  1240.         } while(root != tail);
  1241.         FreeCircularList(tail);
  1242.     }
  1243.     Sym(1) = p;
  1244. }
  1245.  
  1246. //
  1247. // Rule 92:  FormalParameterList ::= FormalParameter
  1248. //
  1249. #line 1689 "java.g"
  1250. //
  1251. // Note that the list is circular so as to preserve the order of the elements
  1252. //
  1253. void Parser::Act92(void)
  1254. {
  1255.     AstListNode *p = AllocateListNode();
  1256.     p -> next = p;
  1257.     p -> element = Sym(1);
  1258.     p -> index = 0;
  1259.  
  1260.     Sym(1) = p;
  1261. }
  1262.  
  1263. //
  1264. // Rule 93:  FormalParameterList ::= FormalParameterList COMMA FormalParameter
  1265. //
  1266. #line 1706 "java.g"
  1267. //
  1268. // Note that the list is circular so as to preserve the order of the elements
  1269. //
  1270. void Parser::Act93(void)
  1271. {
  1272.     AstListNode *tail = (AstListNode *) Sym(1);
  1273.  
  1274.     AstListNode *p = AllocateListNode();
  1275.     p -> element = Sym(3);
  1276.     p -> index = tail -> index + 1;
  1277.  
  1278.     p -> next = tail -> next;
  1279.     tail -> next = p;
  1280.  
  1281.     Sym(1) = p;
  1282. }
  1283.  
  1284. //
  1285. // Rule 94:  FormalParameter ::= Type VariableDeclaratorId
  1286. //
  1287. #line 1727 "java.g"
  1288. void Parser::Act94(void)
  1289. {
  1290.     AstFormalParameter *p = ast_pool -> NewFormalParameter();
  1291.     p -> type = Sym(1);
  1292.  
  1293.     AstVariableDeclarator *formal_declarator = ast_pool -> NewVariableDeclarator();
  1294.     formal_declarator -> variable_declarator_name = (AstVariableDeclaratorId *) Sym(2);
  1295.     formal_declarator -> variable_initializer_opt = NULL;
  1296.  
  1297.     p -> formal_declarator = formal_declarator;
  1298.  
  1299.     Sym(1) = p;
  1300. }
  1301.  
  1302. //
  1303. // Rule 95:  FormalParameter ::= Modifiers Type VariableDeclaratorId
  1304. //
  1305. #line 1746 "java.g"
  1306. void Parser::Act95(void)
  1307. {
  1308.     AstFormalParameter *p = ast_pool -> NewFormalParameter();
  1309.     //
  1310.     // The list of modifiers is guaranteed not empty
  1311.     //
  1312.     {
  1313.         AstListNode *tail = (AstListNode *) Sym(1);
  1314.         p -> AllocateParameterModifiers(tail -> index + 1);
  1315.         AstListNode *root = tail;
  1316.         do
  1317.         {
  1318.             root = root -> next;
  1319.             p -> AddParameterModifier((AstModifier *) root -> element);
  1320.         } while(root != tail);
  1321.         FreeCircularList(tail);
  1322.     }
  1323.  
  1324.     p -> type = Sym(2);
  1325.  
  1326.     AstVariableDeclarator *formal_declarator = ast_pool -> NewVariableDeclarator();
  1327.     formal_declarator -> variable_declarator_name = (AstVariableDeclaratorId *) Sym(3);
  1328.     formal_declarator -> variable_initializer_opt = NULL;
  1329.  
  1330.     p -> formal_declarator = formal_declarator;
  1331.  
  1332.     Sym(1) = p;
  1333. }
  1334.  
  1335. //
  1336. // Rule 96:  Throws ::= throws ClassTypeList
  1337. //
  1338. // void SetSym1ToSym2(void);
  1339. //
  1340.  
  1341. //
  1342. // Rule 97:  ClassTypeList ::= ClassType
  1343. //
  1344. #line 1786 "java.g"
  1345. //
  1346. // Note that the list is circular so as to preserve the order of the elements
  1347. //
  1348. void Parser::Act97(void)
  1349. {
  1350.     AstListNode *p = AllocateListNode();
  1351.     p -> next = p;
  1352.     p -> element = Sym(1);
  1353.     p -> index = 0;
  1354.  
  1355.     Sym(1) = p;
  1356. }
  1357.  
  1358. //
  1359. // Rule 98:  ClassTypeList ::= ClassTypeList COMMA ClassType
  1360. //
  1361. #line 1803 "java.g"
  1362. //
  1363. // Note that the list is circular so as to preserve the order of the elements
  1364. //
  1365. void Parser::Act98(void)
  1366. {
  1367.     AstListNode *tail = (AstListNode *) Sym(1);
  1368.  
  1369.     AstListNode *p = AllocateListNode();
  1370.     p -> element = Sym(3);
  1371.     p -> index = tail -> index + 1;
  1372.  
  1373.     p -> next = tail -> next;
  1374.     tail -> next = p;
  1375.  
  1376.     Sym(1) = p;
  1377. }
  1378.  
  1379. //
  1380. // Rule 99:  MethodBody -> Block
  1381. //
  1382. // void NoAction(void);
  1383. //
  1384.  
  1385. //
  1386. // Rule 100:  MethodBody ::= SEMICOLON
  1387. //
  1388. #line 1828 "java.g"
  1389. void Parser::MakeEmptyStatement(void)
  1390. {
  1391.     Sym(1) = ast_pool -> NewEmptyStatement(Token(1));
  1392. }
  1393.  
  1394. //
  1395. // Rule 101:  StaticInitializer ::= static MethodHeaderMarker Block
  1396. //
  1397. #line 1839 "java.g"
  1398. void Parser::Act101(void)
  1399. {
  1400.     AstStaticInitializer *p = ast_pool -> NewStaticInitializer();
  1401.     p -> static_token = Token(1);
  1402.     p -> block        = (AstBlock *) Sym(3);
  1403.     Sym(1) = p;
  1404. }
  1405.  
  1406. //
  1407. // Rule 102:  ConstructorDeclaration ::= Modifiersopt ConstructorDeclarator Throwsopt MethodHeaderMarker ConstructorBody
  1408. //
  1409. #line 1864 "java.g"
  1410. void Parser::Act102(void)
  1411. {
  1412.     AstConstructorBlock *block = Sym(5) -> ConstructorBlockCast();
  1413.     if (! block)
  1414.     {
  1415.         block = ast_pool -> NewConstructorBlock();
  1416.         block -> left_brace_token                    = Sym(5) -> LeftToken();
  1417.         block -> explicit_constructor_invocation_opt = NULL;
  1418.         block -> block                               = (AstBlock *) Sym(5);
  1419.         block -> right_brace_token                   = Sym(5) -> RightToken();
  1420.     }
  1421.  
  1422.     AstConstructorDeclaration *p = ast_pool -> NewConstructorDeclaration();
  1423.  
  1424.     if (Sym(1) != NULL)
  1425.     {
  1426.         AstListNode *tail = (AstListNode *) Sym(1);
  1427.         p -> AllocateConstructorModifiers(tail -> index + 1);
  1428.         AstListNode *root = tail;
  1429.         do
  1430.         {
  1431.             root = root -> next;
  1432.             p -> AddConstructorModifier((AstModifier *) root -> element);
  1433.         } while(root != tail);
  1434.         FreeCircularList(tail);
  1435.     }
  1436.     p -> constructor_declarator = (AstMethodDeclarator *) Sym(2);
  1437.     if (Sym(3) != NULL)
  1438.     {
  1439.         AstListNode *tail = (AstListNode *) Sym(3);
  1440.         p -> AllocateThrows(tail -> index + 1);
  1441.         AstListNode *root = tail;
  1442.         do
  1443.         {
  1444.             root = root -> next;
  1445.             p -> AddThrow((AstExpression *) root -> element);
  1446.         } while(root != tail);
  1447.         FreeCircularList(tail);
  1448.     }
  1449.     p -> constructor_body       = block;
  1450.  
  1451.     Sym(1) = p;
  1452. }
  1453.  
  1454. //
  1455. // Rule 103:  ConstructorDeclarator ::= Identifier LPAREN FormalParameterListopt RPAREN
  1456. //
  1457. #line 1920 "java.g"
  1458. void Parser::Act103(void)
  1459. {
  1460.     AstMethodDeclarator *p = ast_pool -> NewMethodDeclarator();
  1461.     p -> identifier_token        = Token(1);
  1462.     p -> left_parenthesis_token  = Token(2);
  1463.     if (Sym(3) != NULL)
  1464.     {
  1465.         AstListNode *tail = (AstListNode *) Sym(3);
  1466.         p -> AllocateFormalParameters(tail -> index + 1);
  1467.         AstListNode *root = tail;
  1468.         do
  1469.         {
  1470.             root = root -> next;
  1471.             p -> AddFormalParameter((AstFormalParameter *) root -> element);
  1472.         } while(root != tail);
  1473.         FreeCircularList(tail);
  1474.     }
  1475.     p -> right_parenthesis_token = Token(4);
  1476.     Sym(1) = p;
  1477. }
  1478.  
  1479. //
  1480. // Rule 104:  ConstructorBody -> Block
  1481. //
  1482. // void NoAction(void);
  1483. //
  1484.  
  1485. //
  1486. // Rule 105:  ConstructorBody ::= LBRACE ExplicitConstructorInvocation BlockStatementsopt RBRACE
  1487. //
  1488. #line 1955 "java.g"
  1489. void Parser::Act105(void)
  1490. {
  1491.     AstBlock *block = ast_pool -> NewBlock();
  1492.     if (Sym(3) != NULL)
  1493.     {
  1494.         AstListNode *tail = (AstListNode *) Sym(3);
  1495.         block -> AllocateBlockStatements(tail -> index + 1);
  1496.         AstListNode *root = tail;
  1497.         block -> left_brace_token  = root -> element -> LeftToken();
  1498.         block -> right_brace_token = tail -> element -> RightToken();
  1499.         do
  1500.         {
  1501.             root = root -> next;
  1502.             block -> AddStatement((AstStatement *) root -> element);
  1503.         } while(root != tail);
  1504.         FreeCircularList(tail);
  1505.     }
  1506.     else
  1507.     {
  1508.         block -> left_brace_token  = Token(4);
  1509.         block -> right_brace_token = Token(4);
  1510.     }
  1511.  
  1512.     AstConstructorBlock *p = ast_pool -> NewConstructorBlock();
  1513.     p -> left_brace_token                    = Token(1);
  1514.     p -> explicit_constructor_invocation_opt = Sym(2);
  1515.     p -> block                               = block;
  1516.     p -> right_brace_token                   = Token(4);
  1517.     Sym(1) = p;
  1518. }
  1519.  
  1520. //
  1521. // Rule 106:  ExplicitConstructorInvocation ::= this LPAREN ArgumentListopt RPAREN SEMICOLON
  1522. //
  1523. #line 1990 "java.g"
  1524. void Parser::Act106(void)
  1525. {
  1526.     AstThisCall *p = ast_pool -> NewThisCall();
  1527.     p -> base_opt                = NULL;
  1528.     p -> dot_token_opt           = 0;
  1529.     p -> this_token              = Token(1);
  1530.     p -> left_parenthesis_token  = Token(2);
  1531.     if (Sym(3) != NULL)
  1532.     {
  1533.         AstListNode *tail = (AstListNode *) Sym(3);
  1534.         p -> AllocateArguments(tail -> index + 1);
  1535.         AstListNode *root = tail;
  1536.         do
  1537.         {
  1538.             root = root -> next;
  1539.             p -> AddArgument((AstExpression *) root -> element);
  1540.         } while(root != tail);
  1541.         FreeCircularList(tail);
  1542.     }
  1543.     p -> right_parenthesis_token = Token(4);
  1544.     p -> semicolon_token         = Token(5);
  1545.     Sym(1) = p;
  1546. }
  1547.  
  1548. //
  1549. // Rule 107:  ExplicitConstructorInvocation ::= super LPAREN ArgumentListopt RPAREN SEMICOLON
  1550. //
  1551. #line 2018 "java.g"
  1552. void Parser::Act107(void)
  1553. {
  1554.     AstSuperCall *p = ast_pool -> NewSuperCall();
  1555.     p -> base_opt                = NULL;
  1556.     p -> dot_token_opt           = 0;
  1557.     p -> super_token             = Token(1);
  1558.     p -> left_parenthesis_token  = Token(2);
  1559.     if (Sym(3) != NULL)
  1560.     {
  1561.         AstListNode *tail = (AstListNode *) Sym(3);
  1562.         p -> AllocateArguments(tail -> index + 1);
  1563.         AstListNode *root = tail;
  1564.         do
  1565.         {
  1566.             root = root -> next;
  1567.             p -> AddArgument((AstExpression *) root -> element);
  1568.         } while(root != tail);
  1569.         FreeCircularList(tail);
  1570.     }
  1571.     p -> right_parenthesis_token = Token(4);
  1572.     p -> semicolon_token         = Token(5);
  1573.     Sym(1) = p;
  1574. }
  1575.  
  1576. //
  1577. // Rule 108:  ExplicitConstructorInvocation ::= Primary DOT this LPAREN ArgumentListopt RPAREN SEMICOLON
  1578. //
  1579. #line 2047 "java.g"
  1580. void Parser::Act108(void)
  1581. {
  1582.     AstThisCall *p = ast_pool -> NewThisCall();
  1583.     p -> base_opt               = (AstExpression *) Sym(1);
  1584.     p -> dot_token_opt          = Token(2);
  1585.     p -> this_token             = Token(3);
  1586.     p -> left_parenthesis_token = Token(4);
  1587.     if (Sym(5) != NULL)
  1588.     {
  1589.         AstListNode *tail = (AstListNode *) Sym(5);
  1590.         p -> AllocateArguments(tail -> index + 1);
  1591.         AstListNode *root = tail;
  1592.         do
  1593.         {
  1594.             root = root -> next;
  1595.             p -> AddArgument((AstExpression *) root -> element);
  1596.         } while(root != tail);
  1597.         FreeCircularList(tail);
  1598.     }
  1599.     p -> right_parenthesis_token = Token(6);
  1600.     p -> semicolon_token         = Token(7);
  1601.     Sym(1) = p;
  1602. }
  1603.  
  1604. //
  1605. // Rule 109:  ExplicitConstructorInvocation ::= Primary DOT super LPAREN ArgumentListopt RPAREN SEMICOLON
  1606. //
  1607. #line 2076 "java.g"
  1608. void Parser::MakeQualifiedSuper(void)
  1609. {
  1610.     AstSuperCall *p = ast_pool -> NewSuperCall();
  1611.     p -> base_opt                = (AstExpression *) Sym(1);
  1612.     p -> dot_token_opt           = Token(2);
  1613.     p -> super_token             = Token(3);
  1614.     p -> left_parenthesis_token  = Token(4);
  1615.     if (Sym(5) != NULL)
  1616.     {
  1617.         AstListNode *tail = (AstListNode *) Sym(5);
  1618.         p -> AllocateArguments(tail -> index + 1);
  1619.         AstListNode *root = tail;
  1620.         do
  1621.         {
  1622.             root = root -> next;
  1623.             p -> AddArgument((AstExpression *) root -> element);
  1624.         } while(root != tail);
  1625.         FreeCircularList(tail);
  1626.     }
  1627.     p -> right_parenthesis_token = Token(6);
  1628.     p -> semicolon_token         = Token(7);
  1629.     Sym(1) = p;
  1630. }
  1631.  
  1632. //
  1633. // Rule 110:  ExplicitConstructorInvocation ::= Name DOT super LPAREN ArgumentListopt RPAREN SEMICOLON
  1634. //
  1635. // void MakeQualifiedSuper(void);
  1636. //
  1637.  
  1638. //
  1639. // Rule 111:  InterfaceDeclaration ::= Modifiersopt interface Identifier ExtendsInterfacesopt InterfaceBody
  1640. //
  1641. #line 2119 "java.g"
  1642. void Parser::Act111(void)
  1643. {
  1644.     AstInterfaceDeclaration *p = (AstInterfaceDeclaration *) Sym(5);
  1645.     if (Sym(1) != NULL)
  1646.     {
  1647.         AstListNode *tail = (AstListNode *) Sym(1);
  1648.         p -> AllocateInterfaceModifiers(tail -> index + 1);
  1649.         AstListNode *root = tail;
  1650.         do
  1651.         {
  1652.             root = root -> next;
  1653.             p -> AddInterfaceModifier((AstModifier *) root -> element);
  1654.         } while(root != tail);
  1655.         FreeCircularList(tail);
  1656.     }
  1657.     p -> interface_token  = Token(2);
  1658.     p -> identifier_token = Token(3);
  1659.     if (Sym(4) != NULL)
  1660.     {
  1661.         AstListNode *tail = (AstListNode *) Sym(4);
  1662.         p -> AllocateExtendsInterfaces(tail -> index + 1);
  1663.         AstListNode *root = tail;
  1664.         do
  1665.         {
  1666.             root = root -> next;
  1667.             p -> AddExtendsInterface((AstExpression *) root -> element);
  1668.         } while(root != tail);
  1669.         FreeCircularList(tail);
  1670.     }
  1671.     Sym(1) = p;
  1672. }
  1673.  
  1674. //
  1675. // Rule 112:  ExtendsInterfaces ::= extends InterfaceTypeList
  1676. //
  1677. // void SetSym1ToSym2(void);
  1678. //
  1679.  
  1680. //
  1681. // Rule 113:  InterfaceBody ::= LBRACE InterfaceMemberDeclarationsopt RBRACE
  1682. //
  1683. #line 2162 "java.g"
  1684. void Parser::Act113(void)
  1685. {
  1686.     AstInterfaceDeclaration *p = ast_pool -> NewInterfaceDeclaration();
  1687.     if (parse_header_only)
  1688.         p -> mark_unparsed();
  1689.  
  1690.     p -> left_brace_token = Token(1);
  1691.     if (Sym(2) != NULL)
  1692.     {
  1693.         int num_class_variables = 0,
  1694.             num_methods = 0,
  1695.             num_inner_classes = 0,
  1696.             num_inner_interfaces = 0,
  1697.             num_empty_declarations = 0;
  1698.  
  1699.         AstListNode *tail = (AstListNode *) Sym(2);
  1700.         p -> AllocateInterfaceMemberDeclarations(tail -> index + 1);
  1701.         AstListNode *root = tail;
  1702.         do
  1703.         {
  1704.             root = root -> next;
  1705.             p -> AddInterfaceMemberDeclaration(root -> element);
  1706.  
  1707.             AstFieldDeclaration *field_declaration = root -> element -> FieldDeclarationCast();
  1708.             if (field_declaration)
  1709.             {
  1710.                 field_declaration -> MarkStatic();
  1711.                 num_class_variables++;
  1712.             }
  1713.             else if (root -> element -> MethodDeclarationCast())
  1714.             {
  1715.                 num_methods++;
  1716.             }
  1717.             else if (root -> element -> ClassDeclarationCast())
  1718.             {
  1719.                 num_inner_classes++;
  1720.             }
  1721.             else if (root -> element -> InterfaceDeclarationCast())
  1722.             {
  1723.                 num_inner_interfaces++;
  1724.             }
  1725.             else num_empty_declarations++;
  1726.         } while(root != tail);
  1727.  
  1728.         p -> AllocateClassVariables(num_class_variables);
  1729.         p -> AllocateMethods(num_methods);
  1730.         p -> AllocateNestedClasses(num_inner_classes);
  1731.         p -> AllocateNestedInterfaces(num_inner_interfaces);
  1732.         p -> AllocateEmptyDeclarations(num_empty_declarations);
  1733.  
  1734.         root = tail;
  1735.         do
  1736.         {
  1737.             root = root -> next;
  1738.  
  1739.             AstFieldDeclaration *field_declaration;
  1740.             AstMethodDeclaration *method_declaration;
  1741.             AstClassDeclaration *class_declaration;
  1742.             AstInterfaceDeclaration *interface_declaration;
  1743.  
  1744.             if ((field_declaration = root -> element -> FieldDeclarationCast()))
  1745.             {
  1746.                 p -> AddClassVariable(field_declaration);
  1747.             }
  1748.             else if ((method_declaration = root -> element -> MethodDeclarationCast()))
  1749.             {
  1750.                 p -> AddMethod(method_declaration);
  1751.             }
  1752.             else if ((class_declaration = root -> element -> ClassDeclarationCast()))
  1753.             {
  1754.                 p -> AddNestedClass(class_declaration);
  1755.             }
  1756.             else if ((interface_declaration = root -> element -> InterfaceDeclarationCast()))
  1757.             {
  1758.                 p -> AddNestedInterface(interface_declaration);
  1759.             }
  1760.             else // assert(interface_declaration = root -> element -> EmptyDeclarationCast())
  1761.             {
  1762.                 p -> AddEmptyDeclaration((AstEmptyDeclaration *) root -> element);
  1763.             }
  1764.         } while(root != tail);
  1765.         FreeCircularList(tail);
  1766.     }
  1767.     p -> right_brace_token = Token(3);
  1768.     p -> pool = body_pool; // from now on, this is the storage pool to use for this type
  1769.     Sym(1) = p;
  1770. }
  1771.  
  1772. //
  1773. // Rule 114:  InterfaceMemberDeclarations ::= InterfaceMemberDeclaration
  1774. //
  1775. #line 2254 "java.g"
  1776. //
  1777. // Note that the list is circular so as to preserve the order of the elements
  1778. //
  1779. void Parser::Act114(void)
  1780. {
  1781.     AstListNode *p = AllocateListNode();
  1782.     p -> next = p;
  1783.     p -> element = Sym(1);
  1784.     p -> index = 0;
  1785.  
  1786.     Sym(1) = p;
  1787. }
  1788.  
  1789. //
  1790. // Rule 115:  InterfaceMemberDeclarations ::= InterfaceMemberDeclarations InterfaceMemberDeclaration
  1791. //
  1792. #line 2271 "java.g"
  1793. //
  1794. // Note that the list is circular so as to preserve the order of the elements
  1795. //
  1796. void Parser::Act115(void)
  1797. {
  1798.     AstListNode *tail = (AstListNode *) Sym(1);
  1799.  
  1800.     AstListNode *p = AllocateListNode();
  1801.     p -> element = Sym(2);
  1802.     p -> index = tail -> index + 1;
  1803.  
  1804.     p -> next = tail -> next;
  1805.     tail -> next = p;
  1806.  
  1807.     Sym(1) = p;
  1808. }
  1809.  
  1810. //
  1811. // Rule 116:  InterfaceMemberDeclaration -> ConstantDeclaration
  1812. //
  1813. // void NoAction(void);
  1814. //
  1815.  
  1816. //
  1817. // Rule 117:  InterfaceMemberDeclaration -> AbstractMethodDeclaration
  1818. //
  1819. // void NoAction(void);
  1820. //
  1821.  
  1822. //
  1823. // Rule 118:  InterfaceMemberDeclaration -> ClassDeclaration
  1824. //
  1825. // void NoAction(void);
  1826. //
  1827.  
  1828. //
  1829. // Rule 119:  InterfaceMemberDeclaration -> InterfaceDeclaration
  1830. //
  1831. // void NoAction(void);
  1832. //
  1833.  
  1834. //
  1835. // Rule 120:  InterfaceMemberDeclaration ::= SEMICOLON
  1836. //
  1837. #line 2317 "java.g"
  1838. void Parser::Act120(void)
  1839. {
  1840.     Sym(1) = ast_pool -> NewEmptyDeclaration(Token(1));
  1841. }
  1842.  
  1843. //
  1844. // Rule 121:  ConstantDeclaration -> FieldDeclaration
  1845. //
  1846. // void NoAction(void);
  1847. //
  1848.  
  1849. //
  1850. // Rule 122:  AbstractMethodDeclaration ::= MethodHeader SEMICOLON
  1851. //
  1852. #line 2330 "java.g"
  1853. void Parser::Act122(void)
  1854. {
  1855.     ((AstMethodDeclaration *) Sym(1)) -> method_body = ast_pool -> NewEmptyStatement(Token(2));
  1856. }
  1857.  
  1858. //
  1859. // Rule 123:  ArrayInitializer ::= LBRACE ,opt RBRACE
  1860. //
  1861. #line 2347 "java.g"
  1862. void Parser::Act123(void)
  1863. {
  1864.     AstArrayInitializer *p = ast_pool -> NewArrayInitializer();
  1865.     p -> left_brace_token      = Token(1);
  1866.     p -> right_brace_token     = Token(3);
  1867.     Sym(1) = p;
  1868. }
  1869.  
  1870. //
  1871. // Rule 124:  ArrayInitializer ::= LBRACE VariableInitializers RBRACE
  1872. //
  1873. #line 2359 "java.g"
  1874. void Parser::Act124(void)
  1875. {
  1876.     AstArrayInitializer *p = ast_pool -> NewArrayInitializer();
  1877.     p -> left_brace_token      = Token(1);
  1878.     if (Sym(2) != NULL)
  1879.     {
  1880.         AstListNode *tail = (AstListNode *) Sym(2);
  1881.         p -> AllocateVariableInitializers(tail -> index + 1);
  1882.         AstListNode *root = tail;
  1883.         do
  1884.         {
  1885.             root = root -> next;
  1886.             p -> AddVariableInitializer(root -> element);
  1887.         } while(root != tail);
  1888.         FreeCircularList(tail);
  1889.     }
  1890.     p -> right_brace_token     = Token(3);
  1891.     Sym(1) = p;
  1892. }
  1893.  
  1894. //
  1895. // Rule 125:  ArrayInitializer ::= LBRACE VariableInitializers COMMA RBRACE
  1896. //
  1897. #line 2383 "java.g"
  1898. void Parser::Act125(void)
  1899. {
  1900.     AstArrayInitializer *p = ast_pool -> NewArrayInitializer();
  1901.     p -> left_brace_token      = Token(1);
  1902.     if (Sym(2) != NULL)
  1903.     {
  1904.         AstListNode *tail = (AstListNode *) Sym(2);
  1905.         p -> AllocateVariableInitializers(tail -> index + 1);
  1906.         AstListNode *root = tail;
  1907.         do
  1908.         {
  1909.             root = root -> next;
  1910.             p -> AddVariableInitializer(root -> element);
  1911.         } while(root != tail);
  1912.         FreeCircularList(tail);
  1913.     }
  1914.     p -> right_brace_token     = Token(4);
  1915.     Sym(1) = p;
  1916. }
  1917.  
  1918. //
  1919. // Rule 126:  VariableInitializers ::= VariableInitializer
  1920. //
  1921. #line 2407 "java.g"
  1922. //
  1923. // Note that the list is circular so as to preserve the order of the elements
  1924. //
  1925. void Parser::Act126(void)
  1926. {
  1927.     AstListNode *p = AllocateListNode();
  1928.     p -> next = p;
  1929.     p -> element = Sym(1);
  1930.     p -> index = 0;
  1931.  
  1932.     Sym(1) = p;
  1933. }
  1934.  
  1935. //
  1936. // Rule 127:  VariableInitializers ::= VariableInitializers COMMA VariableInitializer
  1937. //
  1938. #line 2424 "java.g"
  1939. //
  1940. // Note that the list is circular so as to preserve the order of the elements
  1941. //
  1942. void Parser::Act127(void)
  1943. {
  1944.     AstListNode *tail = (AstListNode *) Sym(1);
  1945.  
  1946.     AstListNode *p = AllocateListNode();
  1947.     p -> element = Sym(3);
  1948.     p -> index = tail -> index + 1;
  1949.  
  1950.     p -> next = tail -> next;
  1951.     tail -> next = p;
  1952.  
  1953.     Sym(1) = p;
  1954. }
  1955.  
  1956. //
  1957. // Rule 128:  Block ::= LBRACE BlockStatementsopt RBRACE
  1958. //
  1959. #line 2447 "java.g"
  1960. void Parser::Act128(void)
  1961. {
  1962.     AstBlock *p = ast_pool -> NewBlock();
  1963.     p -> left_brace_token  = Token(1);
  1964.     if (Sym(2) != NULL)
  1965.     {
  1966.         AstListNode *tail = (AstListNode *) Sym(2);
  1967.         p -> AllocateBlockStatements(tail -> index + 1);
  1968.         AstListNode *root = tail;
  1969.         do
  1970.         {
  1971.             root = root -> next;
  1972.             p -> AddStatement((AstStatement *) root -> element);
  1973.         } while(root != tail);
  1974.         FreeCircularList(tail);
  1975.     }
  1976.     p -> right_brace_token = Token(3);
  1977.     Sym(1) = p;
  1978. }
  1979.  
  1980. //
  1981. // Rule 129:  BlockStatements ::= BlockStatement
  1982. //
  1983. #line 2471 "java.g"
  1984. //
  1985. // Note that the list is circular so as to preserve the order of the elements
  1986. //
  1987. void Parser::Act129(void)
  1988. {
  1989.     AstListNode *p = AllocateListNode();
  1990.     p -> next = p;
  1991.     p -> element = Sym(1);
  1992.     p -> index = 0;
  1993.  
  1994.     Sym(1) = p;
  1995. }
  1996.  
  1997. //
  1998. // Rule 130:  BlockStatements ::= BlockStatements BlockStatement
  1999. //
  2000. #line 2488 "java.g"
  2001. //
  2002. // Note that the list is circular so as to preserve the order of the elements
  2003. //
  2004. void Parser::Act130(void)
  2005. {
  2006.     AstListNode *tail = (AstListNode *) Sym(1);
  2007.  
  2008.     AstListNode *p = AllocateListNode();
  2009.     p -> element = Sym(2);
  2010.     p -> index = tail -> index + 1;
  2011.  
  2012.     p -> next = tail -> next;
  2013.     tail -> next = p;
  2014.  
  2015.     Sym(1) = p;
  2016. }
  2017.  
  2018. //
  2019. // Rule 131:  BlockStatement -> LocalVariableDeclarationStatement
  2020. //
  2021. // void NoAction(void);
  2022. //
  2023.  
  2024. //
  2025. // Rule 132:  BlockStatement -> Statement
  2026. //
  2027. // void NoAction(void);
  2028. //
  2029.  
  2030. //
  2031. // Rule 133:  BlockStatement -> ClassDeclaration
  2032. //
  2033. // void NoAction(void);
  2034. //
  2035.  
  2036. //
  2037. // Rule 134:  LocalVariableDeclarationStatement ::= LocalVariableDeclaration SEMICOLON
  2038. //
  2039. #line 2522 "java.g"
  2040. void Parser::Act134(void)
  2041. {
  2042.     ((AstLocalVariableDeclarationStatement *) Sym(1)) -> semicolon_token_opt = Token(2);
  2043. }
  2044.  
  2045. //
  2046. // Rule 135:  LocalVariableDeclaration ::= Type VariableDeclarators
  2047. //
  2048. #line 2531 "java.g"
  2049. void Parser::Act135(void)
  2050. {
  2051.     AstLocalVariableDeclarationStatement *p = ast_pool -> NewLocalVariableDeclarationStatement();
  2052.     p -> type                 = Sym(1);
  2053.     //
  2054.     // The list of declarators is guaranteed not empty
  2055.     //
  2056.     {
  2057.         AstListNode *tail = (AstListNode *) Sym(2);
  2058.         p -> AllocateVariableDeclarators(tail -> index + 1);
  2059.         AstListNode *root = tail;
  2060.         do
  2061.         {
  2062.             root = root -> next;
  2063.             p -> AddVariableDeclarator((AstVariableDeclarator *) root -> element);
  2064.         } while(root != tail);
  2065.         FreeCircularList(tail);
  2066.     }
  2067.     p -> semicolon_token_opt  = 0;
  2068.     Sym(1) = p;
  2069. }
  2070.  
  2071. //
  2072. // Rule 136:  LocalVariableDeclaration ::= Modifiers Type VariableDeclarators
  2073. //
  2074. #line 2558 "java.g"
  2075. void Parser::Act136(void)
  2076. {
  2077.     AstLocalVariableDeclarationStatement *p = ast_pool -> NewLocalVariableDeclarationStatement();
  2078.     //
  2079.     // The list of modifiers is guaranteed not empty
  2080.     //
  2081.     {
  2082.         AstListNode *tail = (AstListNode *) Sym(1);
  2083.         p -> AllocateLocalModifiers(tail -> index + 1);
  2084.         AstListNode *root = tail;
  2085.         do
  2086.         {
  2087.             root = root -> next;
  2088.             p -> AddLocalModifier((AstModifier *) root -> element);
  2089.         } while(root != tail);
  2090.         FreeCircularList(tail);
  2091.     }
  2092.     p -> type = Sym(2);
  2093.     //
  2094.     // The list of declarators is guaranteed not empty
  2095.     //
  2096.     {
  2097.         AstListNode *tail = (AstListNode *) Sym(3);
  2098.         p -> AllocateVariableDeclarators(tail -> index + 1);
  2099.         AstListNode *root = tail;
  2100.         do
  2101.         {
  2102.             root = root -> next;
  2103.             p -> AddVariableDeclarator((AstVariableDeclarator *) root -> element);
  2104.         } while(root != tail);
  2105.         FreeCircularList(tail);
  2106.     }
  2107.     p -> semicolon_token_opt  = 0;
  2108.     Sym(1) = p;
  2109. }
  2110.  
  2111. //
  2112. // Rule 137:  Statement -> StatementWithoutTrailingSubstatement
  2113. //
  2114. // void NoAction(void);
  2115. //
  2116.  
  2117. //
  2118. // Rule 138:  Statement -> LabeledStatement
  2119. //
  2120. // void NoAction(void);
  2121. //
  2122.  
  2123. //
  2124. // Rule 139:  Statement -> IfThenStatement
  2125. //
  2126. // void NoAction(void);
  2127. //
  2128.  
  2129. //
  2130. // Rule 140:  Statement -> IfThenElseStatement
  2131. //
  2132. // void NoAction(void);
  2133. //
  2134.  
  2135. //
  2136. // Rule 141:  Statement -> WhileStatement
  2137. //
  2138. // void NoAction(void);
  2139. //
  2140.  
  2141. //
  2142. // Rule 142:  Statement -> ForStatement
  2143. //
  2144. // void NoAction(void);
  2145. //
  2146.  
  2147. //
  2148. // Rule 143:  StatementNoShortIf -> StatementWithoutTrailingSubstatement
  2149. //
  2150. // void NoAction(void);
  2151. //
  2152.  
  2153. //
  2154. // Rule 144:  StatementNoShortIf -> LabeledStatementNoShortIf
  2155. //
  2156. // void NoAction(void);
  2157. //
  2158.  
  2159. //
  2160. // Rule 145:  StatementNoShortIf -> IfThenElseStatementNoShortIf
  2161. //
  2162. // void NoAction(void);
  2163. //
  2164.  
  2165. //
  2166. // Rule 146:  StatementNoShortIf -> WhileStatementNoShortIf
  2167. //
  2168. // void NoAction(void);
  2169. //
  2170.  
  2171. //
  2172. // Rule 147:  StatementNoShortIf -> ForStatementNoShortIf
  2173. //
  2174. // void NoAction(void);
  2175. //
  2176.  
  2177. //
  2178. // Rule 148:  StatementWithoutTrailingSubstatement -> Block
  2179. //
  2180. // void NoAction(void);
  2181. //
  2182.  
  2183. //
  2184. // Rule 149:  StatementWithoutTrailingSubstatement -> EmptyStatement
  2185. //
  2186. // void NoAction(void);
  2187. //
  2188.  
  2189. //
  2190. // Rule 150:  StatementWithoutTrailingSubstatement -> ExpressionStatement
  2191. //
  2192. // void NoAction(void);
  2193. //
  2194.  
  2195. //
  2196. // Rule 151:  StatementWithoutTrailingSubstatement -> SwitchStatement
  2197. //
  2198. // void NoAction(void);
  2199. //
  2200.  
  2201. //
  2202. // Rule 152:  StatementWithoutTrailingSubstatement -> DoStatement
  2203. //
  2204. // void NoAction(void);
  2205. //
  2206.  
  2207. //
  2208. // Rule 153:  StatementWithoutTrailingSubstatement -> BreakStatement
  2209. //
  2210. // void NoAction(void);
  2211. //
  2212.  
  2213. //
  2214. // Rule 154:  StatementWithoutTrailingSubstatement -> ContinueStatement
  2215. //
  2216. // void NoAction(void);
  2217. //
  2218.  
  2219. //
  2220. // Rule 155:  StatementWithoutTrailingSubstatement -> ReturnStatement
  2221. //
  2222. // void NoAction(void);
  2223. //
  2224.  
  2225. //
  2226. // Rule 156:  StatementWithoutTrailingSubstatement -> SynchronizedStatement
  2227. //
  2228. // void NoAction(void);
  2229. //
  2230.  
  2231. //
  2232. // Rule 157:  StatementWithoutTrailingSubstatement -> ThrowStatement
  2233. //
  2234. // void NoAction(void);
  2235. //
  2236.  
  2237. //
  2238. // Rule 158:  StatementWithoutTrailingSubstatement -> TryStatement
  2239. //
  2240. // void NoAction(void);
  2241. //
  2242.  
  2243. //
  2244. // Rule 159:  EmptyStatement ::= SEMICOLON
  2245. //
  2246. // void MakeEmptyStatement(void);
  2247. //
  2248.  
  2249. //
  2250. // Rule 160:  LabeledStatement ::= Identifier COLON Statement
  2251. //
  2252. #line 2693 "java.g"
  2253. void Parser::MakeLabeledStatement(void)
  2254. {
  2255.     AstBlock *p = Sym(3) -> BlockCast();
  2256.  
  2257.     if (! (p && p -> NumStatements() == 1 &&
  2258.            (p -> Statement(0) -> kind == Ast::FOR   ||
  2259.             p -> Statement(0) -> kind == Ast::WHILE ||
  2260.             p -> Statement(0) -> kind == Ast::DO)))
  2261.     {
  2262.         //
  2263.         // When a statement is labeled, it is enclosed in a block.
  2264.         // This is necessary in order to allow the same name to be
  2265.         // reused to label a subsequent statement at the same nesting
  2266.         // level... See ProcessBlock, ProcessStatement,...
  2267.         //
  2268.         p = ast_pool -> NewBlock();
  2269.         p -> AllocateBlockStatements(1); // allocate 1 element
  2270.         p -> left_brace_token  = Token(1);
  2271.         p -> AddStatement((AstStatement *) Sym(3));
  2272.         p -> right_brace_token = Sym(3) -> RightToken();
  2273.     }
  2274.  
  2275.     p -> AddLabel(Token(1)); // add label to statement
  2276.     Sym(1) = p; // The final result is a block containing the labeled-statement
  2277. }
  2278.  
  2279. //
  2280. // Rule 161:  LabeledStatementNoShortIf ::= Identifier COLON StatementNoShortIf
  2281. //
  2282. // void MakeLabeledStatement(void);
  2283. //
  2284.  
  2285. //
  2286. // Rule 162:  ExpressionStatement ::= StatementExpression SEMICOLON
  2287. //
  2288. #line 2730 "java.g"
  2289. void Parser::Act162(void)
  2290. {
  2291.     ((AstExpressionStatement *) Sym(1)) -> semicolon_token_opt = Token(2);
  2292. }
  2293.  
  2294. //
  2295. // Rule 163:  StatementExpression ::= Assignment
  2296. //
  2297. #line 2739 "java.g"
  2298. void Parser::MakeExpressionStatement(void)
  2299. {
  2300.     AstExpressionStatement *p = ast_pool -> NewExpressionStatement();
  2301.     p -> expression          = (AstExpression *) Sym(1);
  2302.     p -> semicolon_token_opt = 0;
  2303.     Sym(1) = p;
  2304. }
  2305.  
  2306. //
  2307. // Rule 164:  StatementExpression ::= PreIncrementExpression
  2308. //
  2309. // void MakeExpressionStatement(void);
  2310. //
  2311.  
  2312. //
  2313. // Rule 165:  StatementExpression ::= PreDecrementExpression
  2314. //
  2315. // void MakeExpressionStatement(void);
  2316. //
  2317.  
  2318. //
  2319. // Rule 166:  StatementExpression ::= PostIncrementExpression
  2320. //
  2321. // void MakeExpressionStatement(void);
  2322. //
  2323.  
  2324. //
  2325. // Rule 167:  StatementExpression ::= PostDecrementExpression
  2326. //
  2327. // void MakeExpressionStatement(void);
  2328. //
  2329.  
  2330. //
  2331. // Rule 168:  StatementExpression ::= MethodInvocation
  2332. //
  2333. // void MakeExpressionStatement(void);
  2334. //
  2335.  
  2336. //
  2337. // Rule 169:  StatementExpression ::= ClassInstanceCreationExpression
  2338. //
  2339. // void MakeExpressionStatement(void);
  2340. //
  2341.  
  2342. //
  2343. // Rule 170:  IfThenStatement ::= if LPAREN Expression RPAREN Statement
  2344. //
  2345. #line 2793 "java.g"
  2346. void Parser::Act170(void)
  2347. {
  2348.     AstBlock *block = Sym(5) -> BlockCast();
  2349.     if (! block)
  2350.     {
  2351.         block = ast_pool -> NewBlock();
  2352.         block -> AllocateBlockStatements(1); // allocate 1 element
  2353.         block -> left_brace_token  = Token(5);
  2354.         block -> AddStatement((AstStatement *) Sym(5));
  2355.         block -> right_brace_token = Sym(5) -> RightToken();
  2356.     }
  2357.  
  2358.     AstIfStatement *p = ast_pool -> NewIfStatement();
  2359.     p -> if_token            = Token(1);
  2360.     p -> expression          = (AstExpression *) Sym(3);
  2361.     p -> true_statement      = block;
  2362.     p -> false_statement_opt = NULL;
  2363.     Sym(1) = p;
  2364. }
  2365.  
  2366. //
  2367. // Rule 171:  IfThenElseStatement ::= if LPAREN Expression RPAREN StatementNoShortIf else Statement
  2368. //
  2369. #line 2817 "java.g"
  2370. void Parser::MakeIfThenElseStatement(void)
  2371. {
  2372.     AstBlock *true_block = Sym(5) -> BlockCast();
  2373.     if (! true_block)
  2374.     {
  2375.         true_block = ast_pool -> NewBlock();
  2376.         true_block -> AllocateBlockStatements(1); // allocate 1 element
  2377.         true_block -> left_brace_token  = Token(5);
  2378.         true_block -> AddStatement((AstStatement *) Sym(5));
  2379.         true_block -> right_brace_token = Sym(5) -> RightToken();
  2380.     }
  2381.  
  2382.     AstBlock *false_block = Sym(7) -> BlockCast();
  2383.     if (! false_block)
  2384.     {
  2385.         false_block = ast_pool -> NewBlock();
  2386.         false_block -> AllocateBlockStatements(1); // allocate 1 element
  2387.         false_block -> left_brace_token  = Token(7);
  2388.         false_block -> AddStatement((AstStatement *) Sym(7));
  2389.         false_block -> right_brace_token = Sym(7) -> RightToken();
  2390.     }
  2391.  
  2392.     AstIfStatement *p = ast_pool -> NewIfStatement();
  2393.     p -> if_token            = Token(1);
  2394.     p -> expression          = (AstExpression *) Sym(3);
  2395.     p -> true_statement      = true_block;
  2396.     p -> false_statement_opt = false_block;
  2397.     Sym(1) = p;
  2398. }
  2399.  
  2400. //
  2401. // Rule 172:  IfThenElseStatementNoShortIf ::= if LPAREN Expression RPAREN StatementNoShortIf else StatementNoShortIf
  2402. //
  2403. // void MakeIfThenElseStatement(void);
  2404. //
  2405.  
  2406. //
  2407. // Rule 173:  SwitchStatement ::= switch LPAREN Expression RPAREN SwitchBlock
  2408. //
  2409. #line 2858 "java.g"
  2410. void Parser::Act173(void)
  2411. {
  2412.     AstSwitchStatement *p = (AstSwitchStatement *) Sym(5);
  2413.     p -> switch_token = Token(1);
  2414.     p -> expression   = (AstExpression *) Sym(3);
  2415.     Sym(1) = p;
  2416. }
  2417.  
  2418. //
  2419. // Rule 174:  SwitchBlock ::= LBRACE RBRACE
  2420. //
  2421. #line 2870 "java.g"
  2422. void Parser::Act174(void)
  2423. {
  2424.     AstSwitchStatement *p = ast_pool -> NewSwitchStatement();
  2425.  
  2426.     AstBlock *block = ast_pool -> NewBlock();
  2427.     block -> left_brace_token  = Token(1);
  2428.     block -> right_brace_token = Token(2);
  2429.  
  2430.     p -> switch_block = block;
  2431.  
  2432.     Sym(1) = p;
  2433. }
  2434.  
  2435. //
  2436. // Rule 175:  SwitchBlock ::= LBRACE SwitchBlockStatements RBRACE
  2437. //
  2438. #line 2887 "java.g"
  2439. void Parser::Act175(void)
  2440. {
  2441.     AstSwitchStatement *p = ast_pool -> NewSwitchStatement();
  2442.  
  2443.     AstBlock *block = ast_pool -> NewBlock();
  2444.     block -> left_brace_token  = Token(1);
  2445.     if (Sym(2) != NULL)
  2446.     {
  2447.         AstListNode *tail = (AstListNode *) Sym(2);
  2448.         block -> AllocateBlockStatements(tail -> index + 1);
  2449.         AstListNode *root = tail;
  2450.         do
  2451.         {
  2452.             root = root -> next;
  2453.             block -> AddStatement((AstStatement *) root -> element);
  2454.         } while(root != tail);
  2455.         FreeCircularList(tail);
  2456.     }
  2457.     block -> right_brace_token = Token(3);
  2458.  
  2459.     p -> switch_block  = block;
  2460.  
  2461.     Sym(1) = p;
  2462. }
  2463.  
  2464. //
  2465. // Rule 176:  SwitchBlock ::= LBRACE SwitchLabels RBRACE
  2466. //
  2467. #line 2916 "java.g"
  2468. void Parser::Act176(void)
  2469. {
  2470.     AstSwitchStatement *p = ast_pool -> NewSwitchStatement();
  2471.  
  2472.     AstSwitchBlockStatement *q = ast_pool -> NewSwitchBlockStatement();
  2473.     q -> AddStatement(ast_pool -> NewEmptyStatement(Sym(2) -> RightToken()));
  2474.  
  2475.     //
  2476.     // The list of SwitchBlockStatements is never null
  2477.     //
  2478.     {
  2479.         AstListNode *tail = (AstListNode *) Sym(2);
  2480.         q -> AllocateSwitchLabels(tail -> index + 1);
  2481.         AstListNode *root = tail;
  2482.         do
  2483.         {
  2484.             root = root -> next;
  2485.             q -> AddSwitchLabel((AstStatement *) root -> element);
  2486.         } while(root != tail);
  2487.         FreeCircularList(tail);
  2488.     }
  2489.  
  2490.     AstBlock *block = ast_pool -> NewBlock();
  2491.     block -> AllocateBlockStatements(1); // allocate 1 element
  2492.     block -> left_brace_token  = Token(1);
  2493.     block -> AddStatement(q);
  2494.     block -> right_brace_token = Token(3);
  2495.  
  2496.     p -> switch_block  = block;
  2497.  
  2498.     Sym(1) = p;
  2499. }
  2500.  
  2501. //
  2502. // Rule 177:  SwitchBlock ::= LBRACE SwitchBlockStatements SwitchLabels RBRACE
  2503. //
  2504. #line 2953 "java.g"
  2505. void Parser::Act177(void)
  2506. {
  2507.     AstSwitchStatement *p = ast_pool -> NewSwitchStatement();
  2508.  
  2509.     AstBlock *block = ast_pool -> NewBlock();
  2510.     block -> left_brace_token  = Token(1);
  2511.     //
  2512.     // The list of SwitchBlockStatements is never null
  2513.     //
  2514.     {
  2515.         AstListNode *tail = (AstListNode *) Sym(2);
  2516.         block -> AllocateBlockStatements(tail -> index + 2); // +1 because of extra statement for additional SwithLabels
  2517.         AstListNode *root = tail;
  2518.         do
  2519.         {
  2520.             root = root -> next;
  2521.             block -> AddStatement((AstStatement *) root -> element);
  2522.         } while(root != tail);
  2523.         FreeCircularList(tail);
  2524.     }
  2525.  
  2526.     AstSwitchBlockStatement *q = ast_pool -> NewSwitchBlockStatement();
  2527.     q -> AddStatement(ast_pool -> NewEmptyStatement(Sym(3) -> RightToken()));
  2528.  
  2529.     //
  2530.     // The list of SwitchLabels is never null
  2531.     //
  2532.     {
  2533.         AstListNode *tail = (AstListNode *) Sym(3);
  2534.         q -> AllocateSwitchLabels(tail -> index + 1);
  2535.         AstListNode *root = tail;
  2536.         do
  2537.         {
  2538.             root = root -> next;
  2539.             q -> AddSwitchLabel(root -> element);
  2540.         } while(root != tail);
  2541.         FreeCircularList(tail);
  2542.     }
  2543.  
  2544.     block -> AddStatement(q);
  2545.     block -> right_brace_token = Token(4);
  2546.  
  2547.     p -> switch_block  = block;
  2548.  
  2549.     Sym(1) = p;
  2550. }
  2551.  
  2552. //
  2553. // Rule 178:  SwitchBlockStatements ::= SwitchBlockStatement
  2554. //
  2555. #line 3004 "java.g"
  2556. //
  2557. // Note that the list is circular so as to preserve the order of the elements
  2558. //
  2559. void Parser::Act178(void)
  2560. {
  2561.     AstListNode *p = AllocateListNode();
  2562.     p -> next = p;
  2563.     p -> element = Sym(1);
  2564.     p -> index = 0;
  2565.  
  2566.     Sym(1) = p;
  2567. }
  2568.  
  2569. //
  2570. // Rule 179:  SwitchBlockStatements ::= SwitchBlockStatements SwitchBlockStatement
  2571. //
  2572. #line 3021 "java.g"
  2573. //
  2574. // Note that the list is circular so as to preserve the order of the elements
  2575. //
  2576. void Parser::Act179(void)
  2577. {
  2578.     AstListNode *tail = (AstListNode *) Sym(1);
  2579.  
  2580.     AstListNode *p = AllocateListNode();
  2581.     p -> element = Sym(2);
  2582.     p -> index = tail -> index + 1;
  2583.  
  2584.     p -> next = tail -> next;
  2585.     tail -> next = p;
  2586.  
  2587.     Sym(1) = p;
  2588. }
  2589.  
  2590. //
  2591. // Rule 180:  SwitchBlockStatement ::= SwitchLabels BlockStatements
  2592. //
  2593. #line 3042 "java.g"
  2594. void Parser::Act180(void)
  2595. {
  2596.     AstSwitchBlockStatement *p = ast_pool -> NewSwitchBlockStatement();
  2597.     //
  2598.     // The list of SwitchLabels is never null
  2599.     //
  2600.     {
  2601.         AstListNode *tail = (AstListNode *) Sym(1);
  2602.         p -> AllocateSwitchLabels(tail -> index + 1);
  2603.         AstListNode *root = tail;
  2604.         do
  2605.         {
  2606.             root = root -> next;
  2607.             p -> AddSwitchLabel(root -> element);
  2608.         } while(root != tail);
  2609.         FreeCircularList(tail);
  2610.     }
  2611.  
  2612.     //
  2613.     // The list of SwitchBlockStatements is never null
  2614.     //
  2615.     {
  2616.         AstListNode *tail = (AstListNode *) Sym(2);
  2617.         p -> AllocateBlockStatements(tail -> index + 1);
  2618.         AstListNode *root = tail;
  2619.         do
  2620.         {
  2621.             root = root -> next;
  2622.             p -> AddStatement((AstStatement *) root -> element);
  2623.         } while(root != tail);
  2624.         FreeCircularList(tail);
  2625.     }
  2626.     Sym(1) = p;
  2627. }
  2628.  
  2629. //
  2630. // Rule 181:  SwitchLabels ::= SwitchLabel
  2631. //
  2632. #line 3081 "java.g"
  2633. //
  2634. // Note that the list is circular so as to preserve the order of the elements
  2635. //
  2636. void Parser::Act181(void)
  2637. {
  2638.     AstListNode *p = AllocateListNode();
  2639.     p -> next = p;
  2640.     p -> element = Sym(1);
  2641.     p -> index = 0;
  2642.  
  2643.     Sym(1) = p;
  2644. }
  2645.  
  2646. //
  2647. // Rule 182:  SwitchLabels ::= SwitchLabels SwitchLabel
  2648. //
  2649. #line 3098 "java.g"
  2650. //
  2651. // Note that the list is circular so as to preserve the order of the elements
  2652. //
  2653. void Parser::Act182(void)
  2654. {
  2655.     AstListNode *tail = (AstListNode *) Sym(1);
  2656.  
  2657.     AstListNode *p = AllocateListNode();
  2658.     p -> element = Sym(2);
  2659.     p -> index = tail -> index + 1;
  2660.  
  2661.     p -> next = tail -> next;
  2662.     tail -> next = p;
  2663.  
  2664.     Sym(1) = p;
  2665. }
  2666.  
  2667. //
  2668. // Rule 183:  SwitchLabel ::= case ConstantExpression COLON
  2669. //
  2670. #line 3119 "java.g"
  2671. void Parser::Act183(void)
  2672. {
  2673.     AstCaseLabel *p = ast_pool -> NewCaseLabel();
  2674.     p -> case_token  = Token(1);
  2675.     p -> expression  = (AstExpression *) Sym(2);
  2676.     p -> colon_token = Token(3);
  2677.     Sym(1) = p;
  2678. }
  2679.  
  2680. //
  2681. // Rule 184:  SwitchLabel ::= default COLON
  2682. //
  2683. #line 3132 "java.g"
  2684. void Parser::Act184(void)
  2685. {
  2686.     AstDefaultLabel *p = ast_pool -> NewDefaultLabel();
  2687.     p -> default_token = Token(1);
  2688.     p -> colon_token   = Token(2);
  2689.     Sym(1) = p;
  2690. }
  2691.  
  2692. //
  2693. // Rule 185:  WhileStatement ::= while LPAREN Expression RPAREN Statement
  2694. //
  2695. #line 3144 "java.g"
  2696. void Parser::MakeWhileStatement(void)
  2697. {
  2698.     AstWhileStatement *p = ast_pool -> NewWhileStatement();
  2699.     p -> while_token = Token(1);
  2700.     p -> expression  = (AstExpression *) Sym(3);
  2701.     p -> statement   = (AstStatement *) Sym(5);
  2702.  
  2703.     AstBlock *block = ast_pool -> NewBlock();
  2704.     block -> AllocateBlockStatements(1); // allocate 1 element
  2705.     block -> left_brace_token  = Token(1); // point to 'FOR' keyword
  2706.     block -> AddStatement(p);
  2707.     block -> right_brace_token = Sym(5) -> RightToken(); // point to last token in statement
  2708.  
  2709.     Sym(1) = block;
  2710. }
  2711.  
  2712. //
  2713. // Rule 186:  WhileStatementNoShortIf ::= while LPAREN Expression RPAREN StatementNoShortIf
  2714. //
  2715. // void MakeWhileStatement(void);
  2716. //
  2717.  
  2718. //
  2719. // Rule 187:  DoStatement ::= do Statement while LPAREN Expression RPAREN SEMICOLON
  2720. //
  2721. #line 3171 "java.g"
  2722. void Parser::Act187(void)
  2723. {
  2724.     AstDoStatement *p = ast_pool -> NewDoStatement();
  2725.     p -> do_token        = Token(1);
  2726.     p -> statement       = (AstStatement *) Sym(2);
  2727.     p -> while_token     = Token(3);
  2728.     p -> expression      = (AstExpression *) Sym(5);
  2729.     p -> semicolon_token = Token(7);
  2730.  
  2731.     AstBlock *block = ast_pool -> NewBlock();
  2732.     block -> AllocateBlockStatements(1); // allocate 1 element
  2733.     block -> left_brace_token  = Token(1);
  2734.     block -> AddStatement(p);
  2735.     block -> right_brace_token = Token(7);
  2736.  
  2737.     Sym(1) = block;
  2738. }
  2739.  
  2740. //
  2741. // Rule 188:  ForStatement ::= for LPAREN ForInitopt SEMICOLON Expressionopt SEMICOLON ForUpdateopt RPAREN Statement
  2742. //
  2743. #line 3193 "java.g"
  2744. void Parser::MakeForStatement(void)
  2745. {
  2746.     AstForStatement *p = ast_pool -> NewForStatement();
  2747.     p -> for_token = Token(1);
  2748.     if (Sym(3) != NULL)
  2749.     {
  2750.         AstListNode *tail = (AstListNode *) Sym(3);
  2751.         p -> AllocateForInitStatements(tail -> index + 1);
  2752.         AstListNode *root = tail;
  2753.         do
  2754.         {
  2755.             root = root -> next;
  2756.             p -> AddForInitStatement((AstStatement *) root -> element);
  2757.         } while(root != tail);
  2758.         FreeCircularList(tail);
  2759.     }
  2760.     p -> end_expression_opt = (AstExpression *) Sym(5);
  2761.     if (Sym(7) != NULL)
  2762.     {
  2763.         AstListNode *tail = (AstListNode *) Sym(7);
  2764.         p -> AllocateForUpdateStatements(tail -> index + 1);
  2765.         AstListNode *root = tail;
  2766.         do
  2767.         {
  2768.             root = root -> next;
  2769.             p -> AddForUpdateStatement((AstExpressionStatement *) root -> element);
  2770.         } while(root != tail);
  2771.         FreeCircularList(tail);
  2772.     }
  2773.     p -> statement = (AstStatement *) Sym(9);
  2774.  
  2775.     AstBlock *block = ast_pool -> NewBlock();
  2776.     block -> AllocateBlockStatements(1); // allocate 1 element
  2777.     block -> left_brace_token  = Token(1);
  2778.     block -> AddStatement(p);
  2779.     block -> right_brace_token = Sym(9) -> RightToken();
  2780.  
  2781.     Sym(1) = block;
  2782. }
  2783.  
  2784. //
  2785. // Rule 189:  ForStatementNoShortIf ::= for LPAREN ForInitopt SEMICOLON Expressionopt SEMICOLON ForUpdateopt RPAREN...
  2786. //
  2787. // void MakeForStatement(void);
  2788. //
  2789.  
  2790. //
  2791. // Rule 190:  ForInit -> StatementExpressionList
  2792. //
  2793. // void NoAction(void);
  2794. //
  2795.  
  2796. //
  2797. // Rule 191:  ForInit ::= LocalVariableDeclaration
  2798. //
  2799. #line 3248 "java.g"
  2800. //
  2801. // Note that the list is circular so as to preserve the order of the elements
  2802. //
  2803. void Parser::Act191(void)
  2804. {
  2805.     AstListNode *p = AllocateListNode();
  2806.     p -> next = p;
  2807.     p -> element = Sym(1);
  2808.     p -> index = 0;
  2809.  
  2810.     Sym(1) = p;
  2811. }
  2812.  
  2813. //
  2814. // Rule 192:  ForUpdate -> StatementExpressionList
  2815. //
  2816. // void NoAction(void);
  2817. //
  2818.  
  2819. //
  2820. // Rule 193:  StatementExpressionList ::= StatementExpression
  2821. //
  2822. #line 3269 "java.g"
  2823. //
  2824. // Note that the list is circular so as to preserve the order of the elements
  2825. //
  2826. void Parser::Act193(void)
  2827. {
  2828.     AstListNode *p = AllocateListNode();
  2829.     p -> next = p;
  2830.     p -> element = Sym(1);
  2831.     p -> index = 0;
  2832.  
  2833.     Sym(1) = p;
  2834. }
  2835.  
  2836. //
  2837. // Rule 194:  StatementExpressionList ::= StatementExpressionList COMMA StatementExpression
  2838. //
  2839. #line 3286 "java.g"
  2840. //
  2841. // Note that the list is circular so as to preserve the order of the elements
  2842. //
  2843. void Parser::Act194(void)
  2844. {
  2845.     AstListNode *tail = (AstListNode *) Sym(1);
  2846.  
  2847.     AstListNode *p = AllocateListNode();
  2848.     p -> element = Sym(3);
  2849.     p -> index = tail -> index + 1;
  2850.  
  2851.     p -> next = tail -> next;
  2852.     tail -> next = p;
  2853.  
  2854.     Sym(1) = p;
  2855. }
  2856.  
  2857. //
  2858. // Rule 195:  BreakStatement ::= break SEMICOLON
  2859. //
  2860. #line 3313 "java.g"
  2861. void Parser::Act195(void)
  2862. {
  2863.     AstBreakStatement *p = ast_pool -> NewBreakStatement();
  2864.     p -> break_token          = Token(1);
  2865.     p -> identifier_token_opt = 0;
  2866.     p -> semicolon_token      = Token(2);
  2867.     Sym(1) = p;
  2868. }
  2869.  
  2870. //
  2871. // Rule 196:  BreakStatement ::= break Identifier SEMICOLON
  2872. //
  2873. #line 3326 "java.g"
  2874. void Parser::Act196(void)
  2875. {
  2876.     AstBreakStatement *p = ast_pool -> NewBreakStatement();
  2877.     p -> break_token          = Token(1);
  2878.     p -> identifier_token_opt = Token(2);
  2879.     p -> semicolon_token      = Token(3);
  2880.     Sym(1) = p;
  2881. }
  2882.  
  2883. //
  2884. // Rule 197:  ContinueStatement ::= continue SEMICOLON
  2885. //
  2886. #line 3339 "java.g"
  2887. void Parser::Act197(void)
  2888. {
  2889.     AstContinueStatement *p = ast_pool -> NewContinueStatement();
  2890.     p -> continue_token       = Token(1);
  2891.     p -> identifier_token_opt = 0;
  2892.     p -> semicolon_token      = Token(2);
  2893.     Sym(1) = p;
  2894. }
  2895.  
  2896. //
  2897. // Rule 198:  ContinueStatement ::= continue Identifier SEMICOLON
  2898. //
  2899. #line 3352 "java.g"
  2900. void Parser::Act198(void)
  2901. {
  2902.     AstContinueStatement *p = ast_pool -> NewContinueStatement();
  2903.     p -> continue_token       = Token(1);
  2904.     p -> identifier_token_opt = Token(2);
  2905.     p -> semicolon_token      = Token(3);
  2906.     Sym(1) = p;
  2907. }
  2908.  
  2909. //
  2910. // Rule 199:  ReturnStatement ::= return Expressionopt SEMICOLON
  2911. //
  2912. #line 3365 "java.g"
  2913. void Parser::Act199(void)
  2914. {
  2915.     AstReturnStatement *p = ast_pool -> NewReturnStatement();
  2916.     p -> return_token    = Token(1);
  2917.     p -> expression_opt  = (AstExpression *) Sym(2);
  2918.     p -> semicolon_token = Token(3);
  2919.     Sym(1) = p;
  2920. }
  2921.  
  2922. //
  2923. // Rule 200:  ThrowStatement ::= throw Expression SEMICOLON
  2924. //
  2925. #line 3378 "java.g"
  2926. void Parser::Act200(void)
  2927. {
  2928.     AstThrowStatement *p = ast_pool -> NewThrowStatement();
  2929.     p -> throw_token     = Token(1);
  2930.     p -> expression      = (AstExpression *) Sym(2);
  2931.     p -> semicolon_token = Token(3);
  2932.     Sym(1) = p;
  2933. }
  2934.  
  2935. //
  2936. // Rule 201:  SynchronizedStatement ::= synchronized LPAREN Expression RPAREN Block
  2937. //
  2938. #line 3391 "java.g"
  2939. void Parser::Act201(void)
  2940. {
  2941.     AstSynchronizedStatement *p = ast_pool -> NewSynchronizedStatement();
  2942.     p -> synchronized_token = Token(1);
  2943.     p -> expression         = (AstExpression *) Sym(3);
  2944.     p -> block              = (AstBlock *) Sym(5);
  2945.     p -> block -> block_tag = AstBlock::SYNCHRONIZED;
  2946.  
  2947.     Sym(1) = p;
  2948. }
  2949.  
  2950. //
  2951. // Rule 202:  TryStatement ::= try Block Catches
  2952. //
  2953. #line 3406 "java.g"
  2954. void Parser::Act202(void)
  2955. {
  2956.     AstTryStatement *p = ast_pool -> NewTryStatement();
  2957.     p -> try_token          = Token(1);
  2958.     p -> block              = (AstBlock *) Sym(2);
  2959.  
  2960.     //
  2961.     // The list of modifiers is guaranteed not empty
  2962.     //
  2963.     {
  2964.         AstListNode *tail = (AstListNode *) Sym(3);
  2965.         p -> AllocateCatchClauses(tail -> index + 1);
  2966.         AstListNode *root = tail;
  2967.         do
  2968.         {
  2969.             root = root -> next;
  2970.             p -> AddCatchClause((AstCatchClause *) root -> element);
  2971.         } while(root != tail);
  2972.         FreeCircularList(tail);
  2973.     }
  2974.     p -> finally_clause_opt = NULL;
  2975.     Sym(1) = p;
  2976. }
  2977.  
  2978. //
  2979. // Rule 203:  TryStatement ::= try Block Catchesopt Finally
  2980. //
  2981. #line 3434 "java.g"
  2982. void Parser::Act203(void)
  2983. {
  2984.     AstTryStatement *p = ast_pool -> NewTryStatement();
  2985.     p -> try_token      = Token(1);
  2986.     p -> block          = (AstBlock *) Sym(2);
  2987.     p -> block -> block_tag = AstBlock::TRY_CLAUSE_WITH_FINALLY;
  2988.  
  2989.     if (Sym(3) != NULL)
  2990.     {
  2991.         AstListNode *tail = (AstListNode *) Sym(3);
  2992.         p -> AllocateCatchClauses(tail -> index + 1);
  2993.         AstListNode *root = tail;
  2994.         do
  2995.         {
  2996.             root = root -> next;
  2997.             p -> AddCatchClause((AstCatchClause *) root -> element);
  2998.         } while(root != tail);
  2999.         FreeCircularList(tail);
  3000.     }
  3001.  
  3002.     for (int i = 0; i < p -> NumCatchClauses(); i++)
  3003.         p -> CatchClause(i) -> block -> block_tag = AstBlock::TRY_CLAUSE_WITH_FINALLY;
  3004.  
  3005.     p -> finally_clause_opt = (AstFinallyClause *) Sym(4);
  3006.  
  3007.     Sym(1) = p;
  3008. }
  3009.  
  3010. //
  3011. // Rule 204:  Catches ::= CatchClause
  3012. //
  3013. #line 3466 "java.g"
  3014. //
  3015. // Note that the list is circular so as to preserve the order of the elements
  3016. //
  3017. void Parser::Act204(void)
  3018. {
  3019.     AstListNode *p = AllocateListNode();
  3020.     p -> next = p;
  3021.     p -> element = Sym(1);
  3022.     p -> index = 0;
  3023.  
  3024.     Sym(1) = p;
  3025. }
  3026.  
  3027. //
  3028. // Rule 205:  Catches ::= Catches CatchClause
  3029. //
  3030. #line 3483 "java.g"
  3031. //
  3032. // Note that the list is circular so as to preserve the order of the elements
  3033. //
  3034. void Parser::Act205(void)
  3035. {
  3036.     AstListNode *tail = (AstListNode *) Sym(1);
  3037.  
  3038.     AstListNode *p = AllocateListNode();
  3039.     p -> element = Sym(2);
  3040.     p -> index = tail -> index + 1;
  3041.  
  3042.     p -> next = tail -> next;
  3043.     tail -> next = p;
  3044.  
  3045.     Sym(1) = p;
  3046. }
  3047.  
  3048. //
  3049. // Rule 206:  CatchClause ::= catch LPAREN FormalParameter RPAREN Block
  3050. //
  3051. #line 3504 "java.g"
  3052. void Parser::Act206(void)
  3053. {
  3054.     AstCatchClause *p = ast_pool -> NewCatchClause();
  3055.     p -> catch_token      = Token(1);
  3056.     p -> formal_parameter = (AstFormalParameter *) Sym(3);
  3057.     p -> block            = (AstBlock *) Sym(5);
  3058.  
  3059.     Sym(1) = p;
  3060. }
  3061.  
  3062. //
  3063. // Rule 207:  Finally ::= finally Block
  3064. //
  3065. #line 3518 "java.g"
  3066. void Parser::Act207(void)
  3067. {
  3068.     AstFinallyClause *p     = ast_pool -> NewFinallyClause();
  3069.     p -> finally_token      = Token(1);
  3070.     p -> block              = (AstBlock *) Sym(2);
  3071.     p -> block -> block_tag = AstBlock::FINALLY;
  3072.  
  3073.     Sym(1) = p;
  3074. }
  3075.  
  3076. //
  3077. // Rule 208:  Primary -> PrimaryNoNewArray
  3078. //
  3079. // void NoAction(void);
  3080. //
  3081.  
  3082. //
  3083. // Rule 209:  Primary -> ArrayCreationExpression
  3084. //
  3085. // void NoAction(void);
  3086. //
  3087.  
  3088. //
  3089. // Rule 210:  PrimaryNoNewArray -> Literal
  3090. //
  3091. // void NoAction(void);
  3092. //
  3093.  
  3094. //
  3095. // Rule 211:  PrimaryNoNewArray ::= this
  3096. //
  3097. #line 3546 "java.g"
  3098. void Parser::Act211(void)
  3099. {
  3100.     Sym(1) = ast_pool -> NewThisExpression(Token(1));
  3101. }
  3102.  
  3103. //
  3104. // Rule 212:  PrimaryNoNewArray ::= LPAREN Expression RPAREN
  3105. //
  3106. #line 3555 "java.g"
  3107. void Parser::Act212(void)
  3108. {
  3109.     AstParenthesizedExpression *p = ast_pool -> NewParenthesizedExpression();
  3110.     p -> left_parenthesis_token = Token(1);
  3111.     p -> expression = (AstExpression *) Sym(2);
  3112.     p -> right_parenthesis_token = Token(3);
  3113.     Sym(1) = p;
  3114. }
  3115.  
  3116. //
  3117. // Rule 213:  PrimaryNoNewArray -> ClassInstanceCreationExpression
  3118. //
  3119. // void NoAction(void);
  3120. //
  3121.  
  3122. //
  3123. // Rule 214:  PrimaryNoNewArray -> FieldAccess
  3124. //
  3125. // void NoAction(void);
  3126. //
  3127.  
  3128. //
  3129. // Rule 215:  PrimaryNoNewArray ::= Name DOT this
  3130. //
  3131. #line 3577 "java.g"
  3132. void Parser::Act215(void)
  3133. {
  3134.     AstFieldAccess *p = ast_pool -> NewFieldAccess(AstFieldAccess::THIS_TAG);
  3135.     p -> base = (AstExpression *) Sym(1);
  3136.     p -> dot_token = Token(2);
  3137.     p -> identifier_token = Token(3);
  3138.     Sym(1) = p;
  3139. }
  3140.  
  3141. //
  3142. // Rule 216:  PrimaryNoNewArray ::= Type DOT class
  3143. //
  3144. #line 3591 "java.g"
  3145. void Parser::Act216(void)
  3146. {
  3147.     AstFieldAccess *p = ast_pool -> NewFieldAccess(AstFieldAccess::CLASS_TAG);
  3148.     p -> base = ast_pool -> NewTypeExpression(Sym(1));
  3149.     p -> dot_token = Token(2);
  3150.     p -> identifier_token = Token(3);
  3151.     Sym(1) = p;
  3152. }
  3153.  
  3154. //
  3155. // Rule 217:  PrimaryNoNewArray ::= void DOT class
  3156. //
  3157. #line 3605 "java.g"
  3158. void Parser::Act217(void)
  3159. {
  3160.     AstFieldAccess *p = ast_pool -> NewFieldAccess(AstFieldAccess::CLASS_TAG);
  3161.     p -> base = ast_pool -> NewTypeExpression(ast_pool -> NewPrimitiveType(Ast::VOID_TYPE, Token(1)));
  3162.     p -> dot_token = Token(2);
  3163.     p -> identifier_token = Token(3);
  3164.     Sym(1) = p;
  3165. }
  3166.  
  3167. //
  3168. // Rule 218:  PrimaryNoNewArray -> MethodInvocation
  3169. //
  3170. // void NoAction(void);
  3171. //
  3172.  
  3173. //
  3174. // Rule 219:  PrimaryNoNewArray -> ArrayAccess
  3175. //
  3176. // void NoAction(void);
  3177. //
  3178.  
  3179. //
  3180. // Rule 220:  ClassInstanceCreationExpression ::= new ClassType LPAREN ArgumentListopt RPAREN ClassBodyopt
  3181. //
  3182. #line 3631 "java.g"
  3183. void Parser::Act220(void)
  3184. {
  3185.     AstClassInstanceCreationExpression *p = ast_pool -> NewClassInstanceCreationExpression();
  3186.     p -> base_opt                = NULL;
  3187.     p -> dot_token_opt           = 0;
  3188.     p -> new_token               = Token(1);
  3189.     p -> class_type              = ast_pool -> NewTypeExpression(Sym(2));
  3190.     p -> left_parenthesis_token  = Token(3);
  3191.     if (Sym(4) != NULL)
  3192.     {
  3193.         AstListNode *tail = (AstListNode *) Sym(4);
  3194.         p -> AllocateArguments(tail -> index + 1);
  3195.         AstListNode *root = tail;
  3196.         do
  3197.         {
  3198.             root = root -> next;
  3199.             p -> AddArgument((AstExpression *) root -> element);
  3200.         } while(root != tail);
  3201.         FreeCircularList(tail);
  3202.     }
  3203.     p -> right_parenthesis_token = Token(5);
  3204.     p -> class_body_opt          = (AstClassBody *) Sym(6);
  3205.     Sym(1) = p;
  3206. }
  3207.  
  3208. //
  3209. // Rule 221:  ClassInstanceCreationExpression ::= Primary DOT new SimpleName LPAREN ArgumentListopt RPAREN ClassBodyopt
  3210. //
  3211. #line 3661 "java.g"
  3212. void Parser::MakeQualifiedNew(void)
  3213. {
  3214.     AstClassInstanceCreationExpression *p = ast_pool -> NewClassInstanceCreationExpression();
  3215.     p -> base_opt                = (AstExpression *) Sym(1);
  3216.     p -> dot_token_opt           = Token(2);
  3217.     p -> new_token               = Token(3);
  3218.     p -> class_type              = ast_pool -> NewTypeExpression(Sym(4));
  3219.     p -> left_parenthesis_token  = Token(5);
  3220.     if (Sym(6) != NULL)
  3221.     {
  3222.         AstListNode *tail = (AstListNode *) Sym(6);
  3223.         p -> AllocateArguments(tail -> index + 1);
  3224.         AstListNode *root = tail;
  3225.         do
  3226.         {
  3227.             root = root -> next;
  3228.             p -> AddArgument((AstExpression *) root -> element);
  3229.         } while(root != tail);
  3230.         FreeCircularList(tail);
  3231.     }
  3232.     p -> right_parenthesis_token = Token(7);
  3233.     p -> class_body_opt          = (AstClassBody *) Sym(8);
  3234.     Sym(1) = p;
  3235. }
  3236.  
  3237. //
  3238. // Rule 222:  ClassInstanceCreationExpression ::= Name DOT new SimpleName LPAREN ArgumentListopt RPAREN ClassBodyopt
  3239. //
  3240. // void MakeQualifiedNew(void);
  3241. //
  3242.  
  3243. //
  3244. // Rule 223:  ArgumentList ::= Expression
  3245. //
  3246. #line 3698 "java.g"
  3247. //
  3248. // Note that the list is circular so as to preserve the order of the elements
  3249. //
  3250. void Parser::Act223(void)
  3251. {
  3252.     AstListNode *p = AllocateListNode();
  3253.     p -> next = p;
  3254.     p -> element = Sym(1);
  3255.     p -> index = 0;
  3256.  
  3257.     Sym(1) = p;
  3258. }
  3259.  
  3260. //
  3261. // Rule 224:  ArgumentList ::= ArgumentList COMMA Expression
  3262. //
  3263. #line 3715 "java.g"
  3264. //
  3265. // Note that the list is circular so as to preserve the order of the elements
  3266. //
  3267. void Parser::Act224(void)
  3268. {
  3269.     AstListNode *tail = (AstListNode *) Sym(1);
  3270.  
  3271.     AstListNode *p = AllocateListNode();
  3272.     p -> element = Sym(3);
  3273.     p -> index = tail -> index + 1;
  3274.  
  3275.     p -> next = tail -> next;
  3276.     tail -> next = p;
  3277.  
  3278.     Sym(1) = p;
  3279. }
  3280.  
  3281. //
  3282. // Rule 225:  ArrayCreationExpression ::= new PrimitiveType DimExprs Dimsopt
  3283. //
  3284. #line 3736 "java.g"
  3285. void Parser::MakeArrayCreationExpression(void)
  3286. {
  3287.     AstArrayCreationExpression *p = ast_pool -> NewArrayCreationExpression();
  3288.     p -> new_token             = Token(1);
  3289.     p -> array_type            = Sym(2);
  3290.     //
  3291.     // The list of DimExprs is never null
  3292.     //
  3293.     {
  3294.         AstListNode *tail = (AstListNode *) Sym(3);
  3295.         p -> AllocateDimExprs(tail -> index + 1);
  3296.         AstListNode *root = tail;
  3297.         do
  3298.         {
  3299.             root = root -> next;
  3300.             p -> AddDimExpr((AstDimExpr *) root -> element);
  3301.         } while(root != tail);
  3302.         FreeCircularList(tail);
  3303.     }
  3304.  
  3305.     if (Sym(4) != NULL)
  3306.     {
  3307.         AstListNode *tail = (AstListNode *) Sym(4);
  3308.         p -> AllocateBrackets(tail -> index + 1);
  3309.         AstListNode *root = tail;
  3310.         do
  3311.         {
  3312.             root = root -> next;
  3313.             p -> AddBrackets((AstBrackets *) root -> element);
  3314.         } while(root != tail);
  3315.         FreeCircularList(tail);
  3316.     }
  3317.     p -> array_initializer_opt = NULL;
  3318.     Sym(1) = p;
  3319. }
  3320.  
  3321. //
  3322. // Rule 226:  ArrayCreationExpression ::= new ClassOrInterfaceType DimExprs Dimsopt
  3323. //
  3324. // void MakeArrayCreationExpression(void);
  3325. //
  3326.  
  3327. //
  3328. // Rule 227:  ArrayCreationExpression ::= new ArrayType ArrayInitializer
  3329. //
  3330. #line 3784 "java.g"
  3331. void Parser::Act227(void)
  3332. {
  3333.     AstArrayCreationExpression *p = ast_pool -> NewArrayCreationExpression();
  3334.     p -> new_token             = Token(1);
  3335.     p -> array_type            = Sym(2);
  3336.     p -> array_initializer_opt = (AstArrayInitializer *) Sym(3);
  3337.     Sym(1) = p;
  3338. }
  3339.  
  3340. //
  3341. // Rule 228:  DimExprs ::= DimExpr
  3342. //
  3343. #line 3797 "java.g"
  3344. //
  3345. // Note that the list is circular so as to preserve the order of the elements
  3346. //
  3347. void Parser::Act228(void)
  3348. {
  3349.     AstListNode *p = AllocateListNode();
  3350.     p -> next = p;
  3351.     p -> element = Sym(1);
  3352.     p -> index = 0;
  3353.  
  3354.     Sym(1) = p;
  3355. }
  3356.  
  3357. //
  3358. // Rule 229:  DimExprs ::= DimExprs DimExpr
  3359. //
  3360. #line 3814 "java.g"
  3361. //
  3362. // Note that the list is circular so as to preserve the order of the elements
  3363. //
  3364. void Parser::Act229(void)
  3365. {
  3366.     AstListNode *tail = (AstListNode *) Sym(1);
  3367.  
  3368.     AstListNode *p = AllocateListNode();
  3369.     p -> element = Sym(2);
  3370.     p -> index = tail -> index + 1;
  3371.  
  3372.     p -> next = tail -> next;
  3373.     tail -> next = p;
  3374.  
  3375.     Sym(1) = p;
  3376. }
  3377.  
  3378. //
  3379. // Rule 230:  DimExpr ::= LBRACKET Expression RBRACKET
  3380. //
  3381. #line 3835 "java.g"
  3382. void Parser::Act230(void)
  3383. {
  3384.     AstDimExpr *p = ast_pool -> NewDimExpr();
  3385.     p -> left_bracket_token  = Token(1);
  3386.     p -> expression          = (AstExpression *) Sym(2);
  3387.     p -> right_bracket_token = Token(3);
  3388.     Sym(1) = p;
  3389. }
  3390.  
  3391. //
  3392. // Rule 231:  Dims ::= LBRACKET RBRACKET
  3393. //
  3394. #line 3848 "java.g"
  3395. //
  3396. // Note that the list is circular so as to preserve the order of the elements
  3397. //
  3398. void Parser::Act231(void)
  3399. {
  3400.     AstListNode *p = AllocateListNode();
  3401.     p -> next = p;
  3402.     p -> element = ast_pool -> NewBrackets(Token(1), Token(2));
  3403.     p -> index = 0;
  3404.  
  3405.     Sym(1) = p;
  3406. }
  3407.  
  3408. //
  3409. // Rule 232:  Dims ::= Dims LBRACKET RBRACKET
  3410. //
  3411. #line 3865 "java.g"
  3412. //
  3413. // Note that the list is circular so as to preserve the order of the elements
  3414. //
  3415. void Parser::Act232(void)
  3416. {
  3417.     AstListNode *tail = (AstListNode *) Sym(1);
  3418.  
  3419.     AstListNode *p = AllocateListNode();
  3420.     p -> element = ast_pool -> NewBrackets(Token(2), Token(3));
  3421.     p -> index = tail -> index + 1;
  3422.  
  3423.     p -> next = tail -> next;
  3424.     tail -> next = p;
  3425.  
  3426.     Sym(1) = p;
  3427. }
  3428.  
  3429. //
  3430. // Rule 233:  FieldAccess ::= Primary DOT Identifier
  3431. //
  3432. // void MakeFieldAccess(void);
  3433. //
  3434.  
  3435. //
  3436. // Rule 234:  FieldAccess ::= super DOT Identifier
  3437. //
  3438. #line 3893 "java.g"
  3439. void Parser::MakeSuperFieldAccess(void)
  3440. {
  3441.     Sym(1) = ast_pool -> NewSuperExpression(Token(1));
  3442.  
  3443.     MakeFieldAccess();
  3444. }
  3445.  
  3446. //
  3447. // Rule 235:  FieldAccess ::= Name DOT super DOT Identifier
  3448. //
  3449. #line 3905 "java.g"
  3450. void Parser::MakeSuperDoubleFieldAccess(void)
  3451. {
  3452.     AstFieldAccess *p = ast_pool -> NewFieldAccess();
  3453.  
  3454.          AstFieldAccess *q = ast_pool -> NewFieldAccess(AstFieldAccess::SUPER_TAG);
  3455.          q -> base = (AstExpression *) Sym(1);
  3456.          q -> dot_token = Token(2);
  3457.          q -> identifier_token = Token(3);
  3458.  
  3459.     p -> base = q;
  3460.     p -> dot_token = Token(4);
  3461.     p -> identifier_token = Token(5);
  3462.  
  3463.     Sym(1) = p;
  3464. }
  3465.  
  3466. //
  3467. // Rule 236:  MethodInvocation ::= Name LPAREN ArgumentListopt RPAREN
  3468. //
  3469. #line 3925 "java.g"
  3470. void Parser::Act236(void)
  3471. {
  3472.     AstMethodInvocation *p = ast_pool -> NewMethodInvocation();
  3473.     p -> method                  = (AstExpression *) Sym(1);
  3474.     p -> left_parenthesis_token  = Token(2);
  3475.     if (Sym(3) != NULL)
  3476.     {
  3477.         AstListNode *tail = (AstListNode *) Sym(3);
  3478.         p -> AllocateArguments(tail -> index + 1);
  3479.         AstListNode *root = tail;
  3480.         do
  3481.         {
  3482.             root = root -> next;
  3483.             p -> AddArgument((AstExpression *) root -> element);
  3484.         } while(root != tail);
  3485.         FreeCircularList(tail);
  3486.     }
  3487.     p -> right_parenthesis_token = Token(4);
  3488.     Sym(1) = p;
  3489. }
  3490.  
  3491. //
  3492. // Rule 237:  MethodInvocation ::= Primary DOT Identifier LPAREN ArgumentListopt RPAREN
  3493. //
  3494. #line 3950 "java.g"
  3495. void Parser::Act237(void)
  3496. {
  3497.     MakeFieldAccess();
  3498.  
  3499.     AstMethodInvocation *p = ast_pool -> NewMethodInvocation();
  3500.     p -> method                  = (AstExpression *) Sym(1);
  3501.     p -> left_parenthesis_token  = Token(4);
  3502.     if (Sym(5) != NULL)
  3503.     {
  3504.         AstListNode *tail = (AstListNode *) Sym(5);
  3505.         p -> AllocateArguments(tail -> index + 1);
  3506.         AstListNode *root = tail;
  3507.         do
  3508.         {
  3509.             root = root -> next;
  3510.             p -> AddArgument((AstExpression *) root -> element);
  3511.         } while(root != tail);
  3512.         FreeCircularList(tail);
  3513.     }
  3514.     p -> right_parenthesis_token = Token(6);
  3515.     Sym(1) = p;
  3516. }
  3517.  
  3518. //
  3519. // Rule 238:  MethodInvocation ::= super DOT Identifier LPAREN ArgumentListopt RPAREN
  3520. //
  3521. #line 3977 "java.g"
  3522. void Parser::Act238(void)
  3523. {
  3524.     MakeSuperFieldAccess();
  3525.  
  3526.     AstMethodInvocation *p = ast_pool -> NewMethodInvocation();
  3527.     p -> method                  = (AstExpression *) Sym(1);
  3528.     p -> left_parenthesis_token  = Token(4);
  3529.     if (Sym(5) != NULL)
  3530.     {
  3531.         AstListNode *tail = (AstListNode *) Sym(5);
  3532.         p -> AllocateArguments(tail -> index + 1);
  3533.         AstListNode *root = tail;
  3534.         do
  3535.         {
  3536.             root = root -> next;
  3537.             p -> AddArgument((AstExpression *) root -> element);
  3538.         } while(root != tail);
  3539.         FreeCircularList(tail);
  3540.     }
  3541.     p -> right_parenthesis_token = Token(6);
  3542.     Sym(1) = p;
  3543. }
  3544.  
  3545. //
  3546. // Rule 239:  MethodInvocation ::= Name DOT super DOT Identifier LPAREN ArgumentListopt RPAREN
  3547. //
  3548. #line 4005 "java.g"
  3549. void Parser::Act239(void)
  3550. {
  3551.     MakeSuperDoubleFieldAccess();
  3552.  
  3553.     AstMethodInvocation *p = ast_pool -> NewMethodInvocation();
  3554.     p -> method                  = (AstExpression *) Sym(1);
  3555.     p -> left_parenthesis_token  = Token(6);
  3556.     if (Sym(7) != NULL)
  3557.     {
  3558.         AstListNode *tail = (AstListNode *) Sym(7);
  3559.         p -> AllocateArguments(tail -> index + 1);
  3560.         AstListNode *root = tail;
  3561.         do
  3562.         {
  3563.             root = root -> next;
  3564.             p -> AddArgument((AstExpression *) root -> element);
  3565.         } while(root != tail);
  3566.         FreeCircularList(tail);
  3567.     }
  3568.     p -> right_parenthesis_token = Token(8);
  3569.     Sym(1) = p;
  3570. }
  3571.  
  3572. //
  3573. // Rule 240:  ArrayAccess ::= Name LBRACKET Expression RBRACKET
  3574. //
  3575. #line 4032 "java.g"
  3576. void Parser::MakeArrayAccess(void)
  3577. {
  3578.     AstArrayAccess *p = ast_pool -> NewArrayAccess();
  3579.     p -> base                = (AstExpression *) Sym(1);
  3580.     p -> left_bracket_token  = Token(2);
  3581.     p -> expression          = (AstExpression *) Sym(3);
  3582.     p -> right_bracket_token = Token(4);
  3583.     Sym(1) = p;
  3584. }
  3585.  
  3586. //
  3587. // Rule 241:  ArrayAccess ::= PrimaryNoNewArray LBRACKET Expression RBRACKET
  3588. //
  3589. // void MakeArrayAccess(void);
  3590. //
  3591.  
  3592. //
  3593. // Rule 242:  PostfixExpression -> Primary
  3594. //
  3595. // void NoAction(void);
  3596. //
  3597.  
  3598. //
  3599. // Rule 243:  PostfixExpression -> Name
  3600. //
  3601. // void NoAction(void);
  3602. //
  3603.  
  3604. //
  3605. // Rule 244:  PostfixExpression -> PostIncrementExpression
  3606. //
  3607. // void NoAction(void);
  3608. //
  3609.  
  3610. //
  3611. // Rule 245:  PostfixExpression -> PostDecrementExpression
  3612. //
  3613. // void NoAction(void);
  3614. //
  3615.  
  3616. //
  3617. // Rule 246:  PostIncrementExpression ::= PostfixExpression PLUS_PLUS
  3618. //
  3619. #line 4069 "java.g"
  3620. void Parser::Act246(void)
  3621. {
  3622.     AstPostUnaryExpression *p = ast_pool -> NewPostUnaryExpression(AstPostUnaryExpression::PLUSPLUS);
  3623.     p -> expression          = (AstExpression *) Sym(1);
  3624.     p -> post_operator_token = Token(2);
  3625.     Sym(1) = p;
  3626. }
  3627.  
  3628. //
  3629. // Rule 247:  PostDecrementExpression ::= PostfixExpression MINUS_MINUS
  3630. //
  3631. #line 4081 "java.g"
  3632. void Parser::Act247(void)
  3633. {
  3634.     AstPostUnaryExpression *p = ast_pool -> NewPostUnaryExpression(AstPostUnaryExpression::MINUSMINUS);
  3635.     p -> expression          = (AstExpression *) Sym(1);
  3636.     p -> post_operator_token = Token(2);
  3637.     Sym(1) = p;
  3638. }
  3639.  
  3640. //
  3641. // Rule 248:  UnaryExpression -> PreIncrementExpression
  3642. //
  3643. // void NoAction(void);
  3644. //
  3645.  
  3646. //
  3647. // Rule 249:  UnaryExpression -> PreDecrementExpression
  3648. //
  3649. // void NoAction(void);
  3650. //
  3651.  
  3652. //
  3653. // Rule 250:  UnaryExpression ::= PLUS UnaryExpression
  3654. //
  3655. #line 4101 "java.g"
  3656. void Parser::Act250(void)
  3657. {
  3658.     AstPreUnaryExpression *p = ast_pool -> NewPreUnaryExpression(AstPreUnaryExpression::PLUS);
  3659.     p -> pre_operator_token = Token(1);
  3660.     p -> expression         = (AstExpression *) Sym(2);
  3661.     Sym(1) = p;
  3662. }
  3663.  
  3664. //
  3665. // Rule 251:  UnaryExpression ::= MINUS UnaryExpression
  3666. //
  3667. #line 4113 "java.g"
  3668. void Parser::Act251(void)
  3669. {
  3670.     AstPreUnaryExpression *p = ast_pool -> NewPreUnaryExpression(AstPreUnaryExpression::MINUS);
  3671.     p -> pre_operator_token = Token(1);
  3672.     p -> expression         = (AstExpression *) Sym(2);
  3673.     Sym(1) = p;
  3674. }
  3675.  
  3676. //
  3677. // Rule 252:  UnaryExpression -> UnaryExpressionNotPlusMinus
  3678. //
  3679. // void NoAction(void);
  3680. //
  3681.  
  3682. //
  3683. // Rule 253:  PreIncrementExpression ::= PLUS_PLUS UnaryExpression
  3684. //
  3685. #line 4129 "java.g"
  3686. void Parser::Act253(void)
  3687. {
  3688.     AstPreUnaryExpression *p = ast_pool -> NewPreUnaryExpression(AstPreUnaryExpression::PLUSPLUS);
  3689.     p -> pre_operator_token = Token(1);
  3690.     p -> expression         = (AstExpression *) Sym(2);
  3691.     Sym(1) = p;
  3692. }
  3693.  
  3694. //
  3695. // Rule 254:  PreDecrementExpression ::= MINUS_MINUS UnaryExpression
  3696. //
  3697. #line 4141 "java.g"
  3698. void Parser::Act254(void)
  3699. {
  3700.     AstPreUnaryExpression *p = ast_pool -> NewPreUnaryExpression(AstPreUnaryExpression::MINUSMINUS);
  3701.     p -> pre_operator_token = Token(1);
  3702.     p -> expression         = (AstExpression *) Sym(2);
  3703.     Sym(1) = p;
  3704. }
  3705.  
  3706. //
  3707. // Rule 255:  UnaryExpressionNotPlusMinus -> PostfixExpression
  3708. //
  3709. // void NoAction(void);
  3710. //
  3711.  
  3712. //
  3713. // Rule 256:  UnaryExpressionNotPlusMinus ::= TWIDDLE UnaryExpression
  3714. //
  3715. #line 4157 "java.g"
  3716. void Parser::Act256(void)
  3717. {
  3718.     AstPreUnaryExpression *p = ast_pool -> NewPreUnaryExpression(AstPreUnaryExpression::TWIDDLE);
  3719.     p -> pre_operator_token = Token(1);
  3720.     p -> expression         = (AstExpression *) Sym(2);
  3721.     Sym(1) = p;
  3722. }
  3723.  
  3724. //
  3725. // Rule 257:  UnaryExpressionNotPlusMinus ::= NOT UnaryExpression
  3726. //
  3727. #line 4169 "java.g"
  3728. void Parser::Act257(void)
  3729. {
  3730.     AstPreUnaryExpression *p = ast_pool -> NewPreUnaryExpression(AstPreUnaryExpression::NOT);
  3731.     p -> pre_operator_token = Token(1);
  3732.     p -> expression         = (AstExpression *) Sym(2);
  3733.     Sym(1) = p;
  3734. }
  3735.  
  3736. //
  3737. // Rule 258:  UnaryExpressionNotPlusMinus -> CastExpression
  3738. //
  3739. // void NoAction(void);
  3740. //
  3741.  
  3742. //
  3743. // Rule 259:  CastExpression ::= LPAREN PrimitiveType Dimsopt RPAREN UnaryExpression
  3744. //
  3745. #line 4185 "java.g"
  3746. void Parser::MakeCastExpression(void)
  3747. {
  3748.     AstCastExpression *p = ast_pool -> NewCastExpression();
  3749.     p -> left_parenthesis_token_opt  = Token(1);
  3750.     p -> type_opt                    = Sym(2);
  3751.     if (Sym(3) != NULL)
  3752.     {
  3753.         AstListNode *tail = (AstListNode *) Sym(3);
  3754.         p -> AllocateBrackets(tail -> index + 1);
  3755.         AstListNode *root = tail;
  3756.         do
  3757.         {
  3758.             root = root -> next;
  3759.             p -> AddBrackets((AstBrackets *) root -> element);
  3760.         } while(root != tail);
  3761.         FreeCircularList(tail);
  3762.     }
  3763.     p -> right_parenthesis_token_opt = Token(4);
  3764.     p -> expression                  = (AstExpression *) Sym(5);
  3765.     Sym(1) = p;
  3766. }
  3767.  
  3768. //
  3769. // Rule 260:  CastExpression ::= LPAREN Expression RPAREN UnaryExpressionNotPlusMinus
  3770. //
  3771. #line 4211 "java.g"
  3772. void Parser::Act260(void)
  3773. {
  3774.     //
  3775.     // Note that Expression must be a name - i.e., Sym(2) -> isName() == true
  3776.     // This check is not performed here and should be performed during
  3777.     // semantic processing.
  3778.     //
  3779.     AstCastExpression *p = ast_pool -> NewCastExpression();
  3780.     p -> left_parenthesis_token_opt  = Token(1);
  3781.     p -> type_opt                    = Sym(2);
  3782.     p -> right_parenthesis_token_opt = Token(3);
  3783.     p -> expression                  = (AstExpression *) Sym(4);
  3784.     Sym(1) = p;
  3785. }
  3786.  
  3787. //
  3788. // Rule 261:  CastExpression ::= LPAREN Name Dims RPAREN UnaryExpressionNotPlusMinus
  3789. //
  3790. // void MakeCastExpression(void);
  3791. //
  3792.  
  3793. //
  3794. // Rule 262:  MultiplicativeExpression -> UnaryExpression
  3795. //
  3796. // void NoAction(void);
  3797. //
  3798.  
  3799. //
  3800. // Rule 263:  MultiplicativeExpression ::= MultiplicativeExpression MULTIPLY UnaryExpression
  3801. //
  3802. #line 4241 "java.g"
  3803. void Parser::Act263(void)
  3804. {
  3805.     AstBinaryExpression *p = ast_pool -> NewBinaryExpression(AstBinaryExpression::STAR);
  3806.     p -> left_expression       = (AstExpression *) Sym(1);
  3807.     p -> binary_operator_token = Token(2);
  3808.     p -> right_expression      = (AstExpression *) Sym(3);
  3809.     Sym(1) = p;
  3810. }
  3811.  
  3812. //
  3813. // Rule 264:  MultiplicativeExpression ::= MultiplicativeExpression DIVIDE UnaryExpression
  3814. //
  3815. #line 4254 "java.g"
  3816. void Parser::Act264(void)
  3817. {
  3818.     AstBinaryExpression *p = ast_pool -> NewBinaryExpression(AstBinaryExpression::SLASH);
  3819.     p -> left_expression       = (AstExpression *) Sym(1);
  3820.     p -> binary_operator_token = Token(2);
  3821.     p -> right_expression      = (AstExpression *) Sym(3);
  3822.     Sym(1) = p;
  3823. }
  3824.  
  3825. //
  3826. // Rule 265:  MultiplicativeExpression ::= MultiplicativeExpression REMAINDER UnaryExpression
  3827. //
  3828. #line 4267 "java.g"
  3829. void Parser::Act265(void)
  3830. {
  3831.     AstBinaryExpression *p = ast_pool -> NewBinaryExpression(AstBinaryExpression::MOD);
  3832.     p -> left_expression       = (AstExpression *) Sym(1);
  3833.     p -> binary_operator_token = Token(2);
  3834.     p -> right_expression      = (AstExpression *) Sym(3);
  3835.     Sym(1) = p;
  3836. }
  3837.  
  3838. //
  3839. // Rule 266:  AdditiveExpression -> MultiplicativeExpression
  3840. //
  3841. // void NoAction(void);
  3842. //
  3843.  
  3844. //
  3845. // Rule 267:  AdditiveExpression ::= AdditiveExpression PLUS MultiplicativeExpression
  3846. //
  3847. #line 4284 "java.g"
  3848. void Parser::Act267(void)
  3849. {
  3850.     AstBinaryExpression *p = ast_pool -> NewBinaryExpression(AstBinaryExpression::PLUS);
  3851.     p -> left_expression       = (AstExpression *) Sym(1);
  3852.     p -> binary_operator_token = Token(2);
  3853.     p -> right_expression      = (AstExpression *) Sym(3);
  3854.     Sym(1) = p;
  3855. }
  3856.  
  3857. //
  3858. // Rule 268:  AdditiveExpression ::= AdditiveExpression MINUS MultiplicativeExpression
  3859. //
  3860. #line 4297 "java.g"
  3861. void Parser::Act268(void)
  3862. {
  3863.     AstBinaryExpression *p = ast_pool -> NewBinaryExpression(AstBinaryExpression::MINUS);
  3864.     p -> left_expression       = (AstExpression *) Sym(1);
  3865.     p -> binary_operator_token = Token(2);
  3866.     p -> right_expression      = (AstExpression *) Sym(3);
  3867.     Sym(1) = p;
  3868. }
  3869.  
  3870. //
  3871. // Rule 269:  ShiftExpression -> AdditiveExpression
  3872. //
  3873. // void NoAction(void);
  3874. //
  3875.  
  3876. //
  3877. // Rule 270:  ShiftExpression ::= ShiftExpression LEFT_SHIFT AdditiveExpression
  3878. //
  3879. #line 4314 "java.g"
  3880. void Parser::Act270(void)
  3881. {
  3882.     AstBinaryExpression *p = ast_pool -> NewBinaryExpression(AstBinaryExpression::LEFT_SHIFT);
  3883.     p -> left_expression       = (AstExpression *) Sym(1);
  3884.     p -> binary_operator_token = Token(2);
  3885.     p -> right_expression      = (AstExpression *) Sym(3);
  3886.     Sym(1) = p;
  3887. }
  3888.  
  3889. //
  3890. // Rule 271:  ShiftExpression ::= ShiftExpression RIGHT_SHIFT AdditiveExpression
  3891. //
  3892. #line 4327 "java.g"
  3893. void Parser::Act271(void)
  3894. {
  3895.     AstBinaryExpression *p = ast_pool -> NewBinaryExpression(AstBinaryExpression::RIGHT_SHIFT);
  3896.     p -> left_expression       = (AstExpression *) Sym(1);
  3897.     p -> binary_operator_token = Token(2);
  3898.     p -> right_expression      = (AstExpression *) Sym(3);
  3899.     Sym(1) = p;
  3900. }
  3901.  
  3902. //
  3903. // Rule 272:  ShiftExpression ::= ShiftExpression UNSIGNED_RIGHT_SHIFT AdditiveExpression
  3904. //
  3905. #line 4340 "java.g"
  3906. void Parser::Act272(void)
  3907. {
  3908.     AstBinaryExpression *p = ast_pool -> NewBinaryExpression(AstBinaryExpression::UNSIGNED_RIGHT_SHIFT);
  3909.     p -> left_expression       = (AstExpression *) Sym(1);
  3910.     p -> binary_operator_token = Token(2);
  3911.     p -> right_expression      = (AstExpression *) Sym(3);
  3912.     Sym(1) = p;
  3913. }
  3914.  
  3915. //
  3916. // Rule 273:  RelationalExpression -> ShiftExpression
  3917. //
  3918. // void NoAction(void);
  3919. //
  3920.  
  3921. //
  3922. // Rule 274:  RelationalExpression ::= RelationalExpression LESS ShiftExpression
  3923. //
  3924. #line 4357 "java.g"
  3925. void Parser::Act274(void)
  3926. {
  3927.     AstBinaryExpression *p = ast_pool -> NewBinaryExpression(AstBinaryExpression::LESS);
  3928.     p -> left_expression       = (AstExpression *) Sym(1);
  3929.     p -> binary_operator_token = Token(2);
  3930.     p -> right_expression      = (AstExpression *) Sym(3);
  3931.     Sym(1) = p;
  3932. }
  3933.  
  3934. //
  3935. // Rule 275:  RelationalExpression ::= RelationalExpression GREATER ShiftExpression
  3936. //
  3937. #line 4370 "java.g"
  3938. void Parser::Act275(void)
  3939. {
  3940.     AstBinaryExpression *p = ast_pool -> NewBinaryExpression(AstBinaryExpression::GREATER);
  3941.     p -> left_expression       = (AstExpression *) Sym(1);
  3942.     p -> binary_operator_token = Token(2);
  3943.     p -> right_expression      = (AstExpression *) Sym(3);
  3944.     Sym(1) = p;
  3945. }
  3946.  
  3947. //
  3948. // Rule 276:  RelationalExpression ::= RelationalExpression LESS_EQUAL ShiftExpression
  3949. //
  3950. #line 4383 "java.g"
  3951. void Parser::Act276(void)
  3952. {
  3953.     AstBinaryExpression *p = ast_pool -> NewBinaryExpression(AstBinaryExpression::LESS_EQUAL);
  3954.     p -> left_expression       = (AstExpression *) Sym(1);
  3955.     p -> binary_operator_token = Token(2);
  3956.     p -> right_expression      = (AstExpression *) Sym(3);
  3957.     Sym(1) = p;
  3958. }
  3959.  
  3960. //
  3961. // Rule 277:  RelationalExpression ::= RelationalExpression GREATER_EQUAL ShiftExpression
  3962. //
  3963. #line 4396 "java.g"
  3964. void Parser::Act277(void)
  3965. {
  3966.     AstBinaryExpression *p = ast_pool -> NewBinaryExpression(AstBinaryExpression::GREATER_EQUAL);
  3967.     p -> left_expression       = (AstExpression *) Sym(1);
  3968.     p -> binary_operator_token = Token(2);
  3969.     p -> right_expression      = (AstExpression *) Sym(3);
  3970.     Sym(1) = p;
  3971. }
  3972.  
  3973. //
  3974. // Rule 278:  RelationalExpression ::= RelationalExpression instanceof ReferenceType
  3975. //
  3976. #line 4409 "java.g"
  3977. void Parser::Act278(void)
  3978. {
  3979.     AstBinaryExpression *p = ast_pool -> NewBinaryExpression(AstBinaryExpression::INSTANCEOF);
  3980.     p -> left_expression       = (AstExpression *) Sym(1);
  3981.     p -> binary_operator_token = Token(2);
  3982.     p -> right_expression      = ast_pool -> NewTypeExpression(Sym(3));
  3983.     Sym(1) = p;
  3984. }
  3985.  
  3986. //
  3987. // Rule 279:  EqualityExpression -> RelationalExpression
  3988. //
  3989. // void NoAction(void);
  3990. //
  3991.  
  3992. //
  3993. // Rule 280:  EqualityExpression ::= EqualityExpression EQUAL_EQUAL RelationalExpression
  3994. //
  3995. #line 4426 "java.g"
  3996. void Parser::Act280(void)
  3997. {
  3998.     AstBinaryExpression *p = ast_pool -> NewBinaryExpression(AstBinaryExpression::EQUAL_EQUAL);
  3999.     p -> left_expression       = (AstExpression *) Sym(1);
  4000.     p -> binary_operator_token = Token(2);
  4001.     p -> right_expression      = (AstExpression *) Sym(3);
  4002.     Sym(1) = p;
  4003. }
  4004.  
  4005. //
  4006. // Rule 281:  EqualityExpression ::= EqualityExpression NOT_EQUAL RelationalExpression
  4007. //
  4008. #line 4439 "java.g"
  4009. void Parser::Act281(void)
  4010. {
  4011.     AstBinaryExpression *p = ast_pool -> NewBinaryExpression(AstBinaryExpression::NOT_EQUAL);
  4012.     p -> left_expression       = (AstExpression *) Sym(1);
  4013.     p -> binary_operator_token = Token(2);
  4014.     p -> right_expression      = (AstExpression *) Sym(3);
  4015.     Sym(1) = p;
  4016. }
  4017.  
  4018. //
  4019. // Rule 282:  AndExpression -> EqualityExpression
  4020. //
  4021. // void NoAction(void);
  4022. //
  4023.  
  4024. //
  4025. // Rule 283:  AndExpression ::= AndExpression AND EqualityExpression
  4026. //
  4027. #line 4457 "java.g"
  4028. void Parser::Act283(void)
  4029. {
  4030.     AstBinaryExpression *p = ast_pool -> NewBinaryExpression(AstBinaryExpression::AND);
  4031.     p -> left_expression       = (AstExpression *) Sym(1);
  4032.     p -> binary_operator_token = Token(2);
  4033.     p -> right_expression      = (AstExpression *) Sym(3);
  4034.     Sym(1) = p;
  4035. }
  4036.  
  4037. //
  4038. // Rule 284:  ExclusiveOrExpression -> AndExpression
  4039. //
  4040. // void NoAction(void);
  4041. //
  4042.  
  4043. //
  4044. // Rule 285:  ExclusiveOrExpression ::= ExclusiveOrExpression XOR AndExpression
  4045. //
  4046. #line 4474 "java.g"
  4047. void Parser::Act285(void)
  4048. {
  4049.     AstBinaryExpression *p = ast_pool -> NewBinaryExpression(AstBinaryExpression::XOR);
  4050.     p -> left_expression       = (AstExpression *) Sym(1);
  4051.     p -> binary_operator_token = Token(2);
  4052.     p -> right_expression      = (AstExpression *) Sym(3);
  4053.     Sym(1) = p;
  4054. }
  4055.  
  4056. //
  4057. // Rule 286:  InclusiveOrExpression -> ExclusiveOrExpression
  4058. //
  4059. // void NoAction(void);
  4060. //
  4061.  
  4062. //
  4063. // Rule 287:  InclusiveOrExpression ::= InclusiveOrExpression OR ExclusiveOrExpression
  4064. //
  4065. #line 4491 "java.g"
  4066. void Parser::Act287(void)
  4067. {
  4068.     AstBinaryExpression *p = ast_pool -> NewBinaryExpression(AstBinaryExpression::IOR);
  4069.     p -> left_expression       = (AstExpression *) Sym(1);
  4070.     p -> binary_operator_token = Token(2);
  4071.     p -> right_expression      = (AstExpression *) Sym(3);
  4072.     Sym(1) = p;
  4073. }
  4074.  
  4075. //
  4076. // Rule 288:  ConditionalAndExpression -> InclusiveOrExpression
  4077. //
  4078. // void NoAction(void);
  4079. //
  4080.  
  4081. //
  4082. // Rule 289:  ConditionalAndExpression ::= ConditionalAndExpression AND_AND InclusiveOrExpression
  4083. //
  4084. #line 4508 "java.g"
  4085. void Parser::Act289(void)
  4086. {
  4087.     AstBinaryExpression *p = ast_pool -> NewBinaryExpression(AstBinaryExpression::AND_AND);
  4088.     p -> left_expression       = (AstExpression *) Sym(1);
  4089.     p -> binary_operator_token = Token(2);
  4090.     p -> right_expression      = (AstExpression *) Sym(3);
  4091.     Sym(1) = p;
  4092. }
  4093.  
  4094. //
  4095. // Rule 290:  ConditionalOrExpression -> ConditionalAndExpression
  4096. //
  4097. // void NoAction(void);
  4098. //
  4099.  
  4100. //
  4101. // Rule 291:  ConditionalOrExpression ::= ConditionalOrExpression OR_OR ConditionalAndExpression
  4102. //
  4103. #line 4525 "java.g"
  4104. void Parser::Act291(void)
  4105. {
  4106.     AstBinaryExpression *p = ast_pool -> NewBinaryExpression(AstBinaryExpression::OR_OR);
  4107.     p -> left_expression       = (AstExpression *) Sym(1);
  4108.     p -> binary_operator_token = Token(2);
  4109.     p -> right_expression      = (AstExpression *) Sym(3);
  4110.     Sym(1) = p;
  4111. }
  4112.  
  4113. //
  4114. // Rule 292:  ConditionalExpression -> ConditionalOrExpression
  4115. //
  4116. // void NoAction(void);
  4117. //
  4118.  
  4119. //
  4120. // Rule 293:  ConditionalExpression ::= ConditionalOrExpression QUESTION Expression COLON ConditionalExpression
  4121. //
  4122. #line 4542 "java.g"
  4123. void Parser::Act293(void)
  4124. {
  4125.     AstConditionalExpression *p = ast_pool -> NewConditionalExpression();
  4126.     p -> test_expression  = (AstExpression *) Sym(1);
  4127.     p -> question_token   = Token(2);
  4128.     p -> true_expression  = (AstExpression *) Sym(3);
  4129.     p -> colon_token      = Token(4);
  4130.     p -> false_expression = (AstExpression *) Sym(5);
  4131.     Sym(1) = p;
  4132. }
  4133.  
  4134. //
  4135. // Rule 294:  AssignmentExpression -> ConditionalExpression
  4136. //
  4137. // void NoAction(void);
  4138. //
  4139.  
  4140. //
  4141. // Rule 295:  AssignmentExpression -> Assignment
  4142. //
  4143. // void NoAction(void);
  4144. //
  4145.  
  4146. //
  4147. // Rule 296:  Assignment ::= LeftHandSide AssignmentOperator AssignmentExpression
  4148. //
  4149. #line 4565 "java.g"
  4150. void Parser::Act296(void)
  4151. {
  4152.     AstAssignmentExpression *p = (AstAssignmentExpression *) Sym(2);
  4153.     p -> left_hand_side = (AstExpression *) Sym(1);
  4154.     p -> expression     = (AstExpression *) Sym(3);
  4155.     Sym(1) = p;
  4156. }
  4157.  
  4158. //
  4159. // Rule 297:  LeftHandSide -> Name
  4160. //
  4161. // void NoAction(void);
  4162. //
  4163.  
  4164. //
  4165. // Rule 298:  LeftHandSide -> FieldAccess
  4166. //
  4167. // void NoAction(void);
  4168. //
  4169.  
  4170. //
  4171. // Rule 299:  LeftHandSide -> ArrayAccess
  4172. //
  4173. // void NoAction(void);
  4174. //
  4175.  
  4176. //
  4177. // Rule 300:  AssignmentOperator ::= EQUAL
  4178. //
  4179. #line 4589 "java.g"
  4180. void Parser::Act300(void)
  4181. {
  4182.     Sym(1) = ast_pool -> NewAssignmentExpression(AstAssignmentExpression::SIMPLE_EQUAL, Token(1));
  4183. }
  4184.  
  4185. //
  4186. // Rule 301:  AssignmentOperator ::= MULTIPLY_EQUAL
  4187. //
  4188. #line 4598 "java.g"
  4189. void Parser::Act301(void)
  4190. {
  4191.     Sym(1) = ast_pool -> NewAssignmentExpression(AstAssignmentExpression::STAR_EQUAL, Token(1));
  4192. }
  4193.  
  4194. //
  4195. // Rule 302:  AssignmentOperator ::= DIVIDE_EQUAL
  4196. //
  4197. #line 4607 "java.g"
  4198. void Parser::Act302(void)
  4199. {
  4200.     Sym(1) = ast_pool -> NewAssignmentExpression(AstAssignmentExpression::SLASH_EQUAL, Token(1));
  4201. }
  4202.  
  4203. //
  4204. // Rule 303:  AssignmentOperator ::= REMAINDER_EQUAL
  4205. //
  4206. #line 4616 "java.g"
  4207. void Parser::Act303(void)
  4208. {
  4209.     Sym(1) = ast_pool -> NewAssignmentExpression(AstAssignmentExpression::MOD_EQUAL, Token(1));
  4210. }
  4211.  
  4212. //
  4213. // Rule 304:  AssignmentOperator ::= PLUS_EQUAL
  4214. //
  4215. #line 4625 "java.g"
  4216. void Parser::Act304(void)
  4217. {
  4218.     Sym(1) = ast_pool -> NewAssignmentExpression(AstAssignmentExpression::PLUS_EQUAL, Token(1));
  4219. }
  4220.  
  4221. //
  4222. // Rule 305:  AssignmentOperator ::= MINUS_EQUAL
  4223. //
  4224. #line 4634 "java.g"
  4225. void Parser::Act305(void)
  4226. {
  4227.     Sym(1) = ast_pool -> NewAssignmentExpression(AstAssignmentExpression::MINUS_EQUAL, Token(1));
  4228. }
  4229.  
  4230. //
  4231. // Rule 306:  AssignmentOperator ::= LEFT_SHIFT_EQUAL
  4232. //
  4233. #line 4643 "java.g"
  4234. void Parser::Act306(void)
  4235. {
  4236.     Sym(1) = ast_pool -> NewAssignmentExpression(AstAssignmentExpression::LEFT_SHIFT_EQUAL, Token(1));
  4237. }
  4238.  
  4239. //
  4240. // Rule 307:  AssignmentOperator ::= RIGHT_SHIFT_EQUAL
  4241. //
  4242. #line 4652 "java.g"
  4243. void Parser::Act307(void)
  4244. {
  4245.     Sym(1) = ast_pool -> NewAssignmentExpression(AstAssignmentExpression::RIGHT_SHIFT_EQUAL, Token(1));
  4246. }
  4247.  
  4248. //
  4249. // Rule 308:  AssignmentOperator ::= UNSIGNED_RIGHT_SHIFT_EQUAL
  4250. //
  4251. #line 4661 "java.g"
  4252. void Parser::Act308(void)
  4253. {
  4254.     Sym(1) = ast_pool -> NewAssignmentExpression(AstAssignmentExpression::UNSIGNED_RIGHT_SHIFT_EQUAL, Token(1));
  4255. }
  4256.  
  4257. //
  4258. // Rule 309:  AssignmentOperator ::= AND_EQUAL
  4259. //
  4260. #line 4670 "java.g"
  4261. void Parser::Act309(void)
  4262. {
  4263.     Sym(1) = ast_pool -> NewAssignmentExpression(AstAssignmentExpression::AND_EQUAL, Token(1));
  4264. }
  4265.  
  4266. //
  4267. // Rule 310:  AssignmentOperator ::= XOR_EQUAL
  4268. //
  4269. #line 4679 "java.g"
  4270. void Parser::Act310(void)
  4271. {
  4272.     Sym(1) = ast_pool -> NewAssignmentExpression(AstAssignmentExpression::XOR_EQUAL, Token(1));
  4273. }
  4274.  
  4275. //
  4276. // Rule 311:  AssignmentOperator ::= OR_EQUAL
  4277. //
  4278. #line 4688 "java.g"
  4279. void Parser::Act311(void)
  4280. {
  4281.     Sym(1) = ast_pool -> NewAssignmentExpression(AstAssignmentExpression::IOR_EQUAL, Token(1));
  4282. }
  4283.  
  4284. //
  4285. // Rule 312:  Expression -> AssignmentExpression
  4286. //
  4287. // void NoAction(void);
  4288. //
  4289.  
  4290. //
  4291. // Rule 313:  ConstantExpression -> Expression
  4292. //
  4293. // void NoAction(void);
  4294. //
  4295.  
  4296. //
  4297. // Rule 314:  PackageDeclarationopt ::=
  4298. //
  4299. #line 4711 "java.g"
  4300. //
  4301. // Given a rule of the form A ::= x1 x2 ... xn
  4302. //
  4303. // Construct a NULL Ast for A.
  4304. //
  4305. void Parser::NullAction(void) { Sym(1) = NULL; }
  4306.  
  4307. //
  4308. // Rule 315:  PackageDeclarationopt -> PackageDeclaration
  4309. //
  4310. // void NoAction(void);
  4311. //
  4312.  
  4313. //
  4314. // Rule 316:  Superopt ::=
  4315. //
  4316. // void NullAction(void);
  4317. //
  4318.  
  4319. //
  4320. // Rule 317:  Superopt -> Super
  4321. //
  4322. // void NoAction(void);
  4323. //
  4324.  
  4325. //
  4326. // Rule 318:  Expressionopt ::=
  4327. //
  4328. // void NullAction(void);
  4329. //
  4330.  
  4331. //
  4332. // Rule 319:  Expressionopt -> Expression
  4333. //
  4334. // void NoAction(void);
  4335. //
  4336.  
  4337. //
  4338. // Rule 320:  ClassBodyopt ::=
  4339. //
  4340. // void NullAction(void);
  4341. //
  4342.  
  4343. //
  4344. // Rule 321:  ClassBodyopt -> ClassBody
  4345. //
  4346. // void NoAction(void);
  4347. //
  4348.  
  4349. //
  4350. // Rule 322:  ,opt ::=
  4351. //
  4352. // void NullAction(void);
  4353. //
  4354.  
  4355. //
  4356. // Rule 323:  ,opt -> COMMA
  4357. //
  4358. // void NoAction(void);
  4359. //
  4360.  
  4361. //
  4362. // Rule 324:  ImportDeclarationsopt ::=
  4363. //
  4364. // void NullAction(void);
  4365. //
  4366.  
  4367. //
  4368. // Rule 325:  ImportDeclarationsopt -> ImportDeclarations
  4369. //
  4370. // void NoAction(void);
  4371. //
  4372.  
  4373. //
  4374. // Rule 326:  TypeDeclarationsopt ::=
  4375. //
  4376. // void NullAction(void);
  4377. //
  4378.  
  4379. //
  4380. // Rule 327:  TypeDeclarationsopt -> TypeDeclarations
  4381. //
  4382. // void NoAction(void);
  4383. //
  4384.  
  4385. //
  4386. // Rule 328:  ClassBodyDeclarationsopt ::=
  4387. //
  4388. // void NullAction(void);
  4389. //
  4390.  
  4391. //
  4392. // Rule 329:  ClassBodyDeclarationsopt -> ClassBodyDeclarations
  4393. //
  4394. // void NoAction(void);
  4395. //
  4396.  
  4397. //
  4398. // Rule 330:  Modifiersopt ::=
  4399. //
  4400. // void NullAction(void);
  4401. //
  4402.  
  4403. //
  4404. // Rule 331:  Modifiersopt -> Modifiers
  4405. //
  4406. // void NoAction(void);
  4407. //
  4408.  
  4409. //
  4410. // Rule 332:  BlockStatementsopt ::=
  4411. //
  4412. // void NullAction(void);
  4413. //
  4414.  
  4415. //
  4416. // Rule 333:  BlockStatementsopt -> BlockStatements
  4417. //
  4418. // void NoAction(void);
  4419. //
  4420.  
  4421. //
  4422. // Rule 334:  Dimsopt ::=
  4423. //
  4424. // void NullAction(void);
  4425. //
  4426.  
  4427. //
  4428. // Rule 335:  Dimsopt -> Dims
  4429. //
  4430. // void NoAction(void);
  4431. //
  4432.  
  4433. //
  4434. // Rule 336:  ArgumentListopt ::=
  4435. //
  4436. // void NullAction(void);
  4437. //
  4438.  
  4439. //
  4440. // Rule 337:  ArgumentListopt -> ArgumentList
  4441. //
  4442. // void NoAction(void);
  4443. //
  4444.  
  4445. //
  4446. // Rule 338:  Throwsopt ::=
  4447. //
  4448. // void NullAction(void);
  4449. //
  4450.  
  4451. //
  4452. // Rule 339:  Throwsopt -> Throws
  4453. //
  4454. // void NoAction(void);
  4455. //
  4456.  
  4457. //
  4458. // Rule 340:  FormalParameterListopt ::=
  4459. //
  4460. // void NullAction(void);
  4461. //
  4462.  
  4463. //
  4464. // Rule 341:  FormalParameterListopt -> FormalParameterList
  4465. //
  4466. // void NoAction(void);
  4467. //
  4468.  
  4469. //
  4470. // Rule 342:  Interfacesopt ::=
  4471. //
  4472. // void NullAction(void);
  4473. //
  4474.  
  4475. //
  4476. // Rule 343:  Interfacesopt -> Interfaces
  4477. //
  4478. // void NoAction(void);
  4479. //
  4480.  
  4481. //
  4482. // Rule 344:  InterfaceMemberDeclarationsopt ::=
  4483. //
  4484. // void NullAction(void);
  4485. //
  4486.  
  4487. //
  4488. // Rule 345:  InterfaceMemberDeclarationsopt -> InterfaceMemberDeclarations
  4489. //
  4490. // void NoAction(void);
  4491. //
  4492.  
  4493. //
  4494. // Rule 346:  ForInitopt ::=
  4495. //
  4496. // void NullAction(void);
  4497. //
  4498.  
  4499. //
  4500. // Rule 347:  ForInitopt -> ForInit
  4501. //
  4502. // void NoAction(void);
  4503. //
  4504.  
  4505. //
  4506. // Rule 348:  ForUpdateopt ::=
  4507. //
  4508. // void NullAction(void);
  4509. //
  4510.  
  4511. //
  4512. // Rule 349:  ForUpdateopt -> ForUpdate
  4513. //
  4514. // void NoAction(void);
  4515. //
  4516.  
  4517. //
  4518. // Rule 350:  ExtendsInterfacesopt ::=
  4519. //
  4520. // void NullAction(void);
  4521. //
  4522.  
  4523. //
  4524. // Rule 351:  ExtendsInterfacesopt -> ExtendsInterfaces
  4525. //
  4526. // void NoAction(void);
  4527. //
  4528.  
  4529. //
  4530. // Rule 352:  Catchesopt ::=
  4531. //
  4532. // void NullAction(void);
  4533. //
  4534.  
  4535. //
  4536. // Rule 353:  Catchesopt -> Catches
  4537. //
  4538. // void NoAction(void);
  4539. //
  4540.  
  4541. //
  4542. // Rule 354:  PackageHeaderMarker ::=
  4543. //
  4544. #line 4892 "java.g"
  4545. //
  4546. // When this function is invoked, if the "parse_package_header_only" flag
  4547. // is turned on, we skip to the end-of-file token.
  4548. //
  4549. void Parser::Act354(void)
  4550. {
  4551.     if (parse_package_header_only)
  4552.         lex_stream -> Reset(lex_stream -> NumTokens() - 1); // point to the EOF token
  4553.     Sym(1) = NULL;
  4554. }
  4555.  
  4556. //
  4557. // Rule 355:  MethodHeaderMarker ::=
  4558. //
  4559. #line 4907 "java.g"
  4560. //
  4561. // When this function is invoked, if the "parse_header_only" flag
  4562. // is turned on, the body of the method being parsed is skipped.
  4563. //
  4564. void Parser::Act355(void)
  4565. {
  4566.     if (parse_header_only)
  4567.     {
  4568.         TokenObject token = Token(1);
  4569.  
  4570.         //
  4571.         // If the first token immediately following the method header
  4572.         // is not an open brace, then we have a syntactic error. Do
  4573.         // nothing and let the error recovery take care of it.
  4574.         //
  4575.         if (lex_stream -> Kind(token) == TK_LBRACE)
  4576.             lex_stream -> Reset(lex_stream -> MatchingBrace(token));
  4577.     }
  4578.  
  4579.     Sym(1) = NULL;
  4580. }
  4581.  
  4582. #ifdef    HAVE_JIKES_NAMESPACE
  4583. }            // Close namespace Jikes block
  4584. #endif
  4585.  
  4586.