PageRenderTime 54ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 1ms

/jEdit/tags/jedit-4-1-pre5/bsh/Parser.java

#
Java | 2351 lines | 2195 code | 55 blank | 101 comment | 231 complexity | 70b64765b4b240a21d038e25c633aff6 MD5 | raw file
Possible License(s): BSD-3-Clause, AGPL-1.0, Apache-2.0, LGPL-2.0, LGPL-3.0, GPL-2.0, CC-BY-SA-3.0, LGPL-2.1, GPL-3.0, MPL-2.0-no-copyleft-exception, IPL-1.0
  1. /* Generated By:JJTree&JavaCC: Do not edit this line. Parser.java */
  2. package bsh;
  3. import java.io.*;
  4. /**
  5. This is the BeanShell parser. It is used internally by the Interpreter
  6. class (which is probably what you are looking for). The parser knows
  7. only how to parse the structure of the language, it does not understand
  8. names, commands, etc.
  9. <p>
  10. You can use the Parser from the command line to do basic structural
  11. validation of BeanShell files without actually executing them. e.g.
  12. <code><pre>
  13. java bsh.Parser [ -p ] file [ file ] [ ... ]
  14. </pre></code>
  15. <p>
  16. The -p option causes the abstract syntax to be printed.
  17. <p>
  18. From code you'd use the Parser like this:
  19. <p
  20. <code><pre>
  21. Parser parser = new Parser(in);
  22. while( !(eof=parser.Line()) ) {
  23. SimpleNode node = parser.popNode();
  24. // use the node, etc. (See bsh.BSH* classes)
  25. }
  26. </pre></code>
  27. */
  28. public class Parser/*@bgen(jjtree)*/implements ParserTreeConstants, ParserConstants {/*@bgen(jjtree)*/
  29. protected JJTParserState jjtree = new JJTParserState();boolean retainComments = false;
  30. public void setRetainComments( boolean b ) {
  31. retainComments = b;
  32. }
  33. void jjtreeOpenNodeScope(Node n) {
  34. ((SimpleNode)n).firstToken = getToken(1);
  35. }
  36. void jjtreeCloseNodeScope(Node n) {
  37. ((SimpleNode)n).lastToken = getToken(0);
  38. }
  39. /**
  40. Re-initialize the input stream and token source.
  41. */
  42. void reInitInput( Reader in ) {
  43. ReInit(in);
  44. }
  45. public SimpleNode popNode()
  46. {
  47. if ( jjtree.nodeArity() > 0) // number of child nodes
  48. return (SimpleNode)jjtree.popNode();
  49. else
  50. return null;
  51. }
  52. /**
  53. Explicitly re-initialize just the token reader.
  54. This seems to be necessary to avoid certain looping errors when
  55. reading bogus input. See Interpreter.
  56. */
  57. void reInitTokenInput( Reader in ) {
  58. jj_input_stream.ReInit( in,
  59. jj_input_stream.getEndLine(),
  60. jj_input_stream.getEndColumn() );
  61. }
  62. public static void main( String [] args )
  63. throws IOException, ParseException
  64. {
  65. boolean print = false;
  66. int i=0;
  67. if ( args[0].equals("-p") ) {
  68. i++;
  69. print=true;
  70. }
  71. for(; i< args.length; i++) {
  72. Reader in = new FileReader(args[i]);
  73. Parser parser = new Parser(in);
  74. parser.setRetainComments(true);
  75. while( !parser.Line()/*eof*/ )
  76. if ( print )
  77. System.out.println( parser.popNode() );
  78. }
  79. }
  80. final public boolean Line() throws ParseException {
  81. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  82. case 0:
  83. jj_consume_token(0);
  84. Interpreter.debug("End of File!");
  85. {if (true) return true;}
  86. break;
  87. case BOOLEAN:
  88. case BREAK:
  89. case BYTE:
  90. case CHAR:
  91. case CONTINUE:
  92. case DO:
  93. case DOUBLE:
  94. case FALSE:
  95. case FINAL:
  96. case FLOAT:
  97. case FOR:
  98. case IF:
  99. case IMPORT:
  100. case INT:
  101. case LONG:
  102. case NEW:
  103. case NULL:
  104. case RETURN:
  105. case SHORT:
  106. case SWITCH:
  107. case THROW:
  108. case TRUE:
  109. case TRY:
  110. case VOID:
  111. case WHILE:
  112. case INTEGER_LITERAL:
  113. case FLOATING_POINT_LITERAL:
  114. case CHARACTER_LITERAL:
  115. case STRING_LITERAL:
  116. case FORMAL_COMMENT:
  117. case IDENTIFIER:
  118. case LPAREN:
  119. case LBRACE:
  120. case SEMICOLON:
  121. case BANG:
  122. case TILDE:
  123. case INCR:
  124. case DECR:
  125. case PLUS:
  126. case MINUS:
  127. if (jj_2_1(2147483647)) {
  128. Expression();
  129. jj_consume_token(SEMICOLON);
  130. } else {
  131. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  132. case BOOLEAN:
  133. case BREAK:
  134. case BYTE:
  135. case CHAR:
  136. case CONTINUE:
  137. case DO:
  138. case DOUBLE:
  139. case FALSE:
  140. case FINAL:
  141. case FLOAT:
  142. case FOR:
  143. case IF:
  144. case IMPORT:
  145. case INT:
  146. case LONG:
  147. case NEW:
  148. case NULL:
  149. case RETURN:
  150. case SHORT:
  151. case SWITCH:
  152. case THROW:
  153. case TRUE:
  154. case TRY:
  155. case VOID:
  156. case WHILE:
  157. case INTEGER_LITERAL:
  158. case FLOATING_POINT_LITERAL:
  159. case CHARACTER_LITERAL:
  160. case STRING_LITERAL:
  161. case FORMAL_COMMENT:
  162. case IDENTIFIER:
  163. case LPAREN:
  164. case LBRACE:
  165. case SEMICOLON:
  166. case INCR:
  167. case DECR:
  168. BlockStatement();
  169. break;
  170. default:
  171. jj_la1[0] = jj_gen;
  172. jj_consume_token(-1);
  173. throw new ParseException();
  174. }
  175. }
  176. {if (true) return false;}
  177. break;
  178. default:
  179. jj_la1[1] = jj_gen;
  180. jj_consume_token(-1);
  181. throw new ParseException();
  182. }
  183. throw new Error("Missing return statement in function");
  184. }
  185. /*****************************************
  186. * THE JAVA LANGUAGE GRAMMAR STARTS HERE *
  187. *****************************************/
  188. final public void MethodDeclaration() throws ParseException {
  189. /*@bgen(jjtree) MethodDeclaration */
  190. BSHMethodDeclaration jjtn000 = new BSHMethodDeclaration(JJTMETHODDECLARATION);
  191. boolean jjtc000 = true;
  192. jjtree.openNodeScope(jjtn000);
  193. jjtreeOpenNodeScope(jjtn000);Token t = null;
  194. try {
  195. if (jj_2_2(2147483647)) {
  196. ReturnType();
  197. t = jj_consume_token(IDENTIFIER);
  198. jjtn000.name = t.image;
  199. FormalParameters();
  200. Block();
  201. } else {
  202. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  203. case IDENTIFIER:
  204. t = jj_consume_token(IDENTIFIER);
  205. jjtn000.name = t.image;
  206. FormalParameters();
  207. Block();
  208. break;
  209. default:
  210. jj_la1[2] = jj_gen;
  211. jj_consume_token(-1);
  212. throw new ParseException();
  213. }
  214. }
  215. } catch (Throwable jjte000) {
  216. if (jjtc000) {
  217. jjtree.clearNodeScope(jjtn000);
  218. jjtc000 = false;
  219. } else {
  220. jjtree.popNode();
  221. }
  222. if (jjte000 instanceof RuntimeException) {
  223. {if (true) throw (RuntimeException)jjte000;}
  224. }
  225. if (jjte000 instanceof ParseException) {
  226. {if (true) throw (ParseException)jjte000;}
  227. }
  228. {if (true) throw (Error)jjte000;}
  229. } finally {
  230. if (jjtc000) {
  231. jjtree.closeNodeScope(jjtn000, true);
  232. jjtreeCloseNodeScope(jjtn000);
  233. }
  234. }
  235. }
  236. final public void MethodDeclarationLookahead() throws ParseException {
  237. if (jj_2_3(2147483647)) {
  238. ReturnType();
  239. jj_consume_token(IDENTIFIER);
  240. FormalParameters();
  241. jj_consume_token(LBRACE);
  242. } else {
  243. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  244. case IDENTIFIER:
  245. jj_consume_token(IDENTIFIER);
  246. FormalParameters();
  247. jj_consume_token(LBRACE);
  248. break;
  249. default:
  250. jj_la1[3] = jj_gen;
  251. jj_consume_token(-1);
  252. throw new ParseException();
  253. }
  254. }
  255. }
  256. final public void MethodDeclarationTypeLookahead() throws ParseException {
  257. ReturnType();
  258. jj_consume_token(IDENTIFIER);
  259. jj_consume_token(LPAREN);
  260. }
  261. final public void ImportDeclaration() throws ParseException {
  262. /*@bgen(jjtree) ImportDeclaration */
  263. BSHImportDeclaration jjtn000 = new BSHImportDeclaration(JJTIMPORTDECLARATION);
  264. boolean jjtc000 = true;
  265. jjtree.openNodeScope(jjtn000);
  266. jjtreeOpenNodeScope(jjtn000);Token t = null;
  267. try {
  268. if (jj_2_4(2)) {
  269. jj_consume_token(IMPORT);
  270. AmbiguousName();
  271. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  272. case DOT:
  273. t = jj_consume_token(DOT);
  274. jj_consume_token(STAR);
  275. break;
  276. default:
  277. jj_la1[4] = jj_gen;
  278. ;
  279. }
  280. jj_consume_token(SEMICOLON);
  281. jjtree.closeNodeScope(jjtn000, true);
  282. jjtc000 = false;
  283. jjtreeCloseNodeScope(jjtn000);
  284. if ( t != null )
  285. jjtn000.importPackage = true;
  286. } else {
  287. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  288. case IMPORT:
  289. jj_consume_token(IMPORT);
  290. jj_consume_token(STAR);
  291. jj_consume_token(SEMICOLON);
  292. jjtree.closeNodeScope(jjtn000, true);
  293. jjtc000 = false;
  294. jjtreeCloseNodeScope(jjtn000);
  295. jjtn000.superImport = true;
  296. break;
  297. default:
  298. jj_la1[5] = jj_gen;
  299. jj_consume_token(-1);
  300. throw new ParseException();
  301. }
  302. }
  303. } catch (Throwable jjte000) {
  304. if (jjtc000) {
  305. jjtree.clearNodeScope(jjtn000);
  306. jjtc000 = false;
  307. } else {
  308. jjtree.popNode();
  309. }
  310. if (jjte000 instanceof RuntimeException) {
  311. {if (true) throw (RuntimeException)jjte000;}
  312. }
  313. if (jjte000 instanceof ParseException) {
  314. {if (true) throw (ParseException)jjte000;}
  315. }
  316. {if (true) throw (Error)jjte000;}
  317. } finally {
  318. if (jjtc000) {
  319. jjtree.closeNodeScope(jjtn000, true);
  320. jjtreeCloseNodeScope(jjtn000);
  321. }
  322. }
  323. }
  324. final public void VariableDeclarator() throws ParseException {
  325. /*@bgen(jjtree) VariableDeclarator */
  326. BSHVariableDeclarator jjtn000 = new BSHVariableDeclarator(JJTVARIABLEDECLARATOR);
  327. boolean jjtc000 = true;
  328. jjtree.openNodeScope(jjtn000);
  329. jjtreeOpenNodeScope(jjtn000);Token t;
  330. try {
  331. t = jj_consume_token(IDENTIFIER);
  332. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  333. case ASSIGN:
  334. jj_consume_token(ASSIGN);
  335. VariableInitializer();
  336. break;
  337. default:
  338. jj_la1[6] = jj_gen;
  339. ;
  340. }
  341. jjtree.closeNodeScope(jjtn000, true);
  342. jjtc000 = false;
  343. jjtreeCloseNodeScope(jjtn000);
  344. jjtn000.name = t.image;
  345. } catch (Throwable jjte000) {
  346. if (jjtc000) {
  347. jjtree.clearNodeScope(jjtn000);
  348. jjtc000 = false;
  349. } else {
  350. jjtree.popNode();
  351. }
  352. if (jjte000 instanceof RuntimeException) {
  353. {if (true) throw (RuntimeException)jjte000;}
  354. }
  355. if (jjte000 instanceof ParseException) {
  356. {if (true) throw (ParseException)jjte000;}
  357. }
  358. {if (true) throw (Error)jjte000;}
  359. } finally {
  360. if (jjtc000) {
  361. jjtree.closeNodeScope(jjtn000, true);
  362. jjtreeCloseNodeScope(jjtn000);
  363. }
  364. }
  365. }
  366. /*
  367. Can get rid of this if we ignore postfix array dimensions in declarations.
  368. I don't like them and I don't want to deal with them right now.
  369. void VariableDeclaratorId() #VariableDeclaratorId :
  370. { Token t; }
  371. {
  372. t=<IDENTIFIER> { jjtThis.name = t.image; }
  373. ( "[" "]" { jjtThis.addArrayDimension(); } )*
  374. }
  375. */
  376. final public void VariableInitializer() throws ParseException {
  377. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  378. case LBRACE:
  379. ArrayInitializer();
  380. break;
  381. case BOOLEAN:
  382. case BYTE:
  383. case CHAR:
  384. case DOUBLE:
  385. case FALSE:
  386. case FLOAT:
  387. case INT:
  388. case LONG:
  389. case NEW:
  390. case NULL:
  391. case SHORT:
  392. case TRUE:
  393. case VOID:
  394. case INTEGER_LITERAL:
  395. case FLOATING_POINT_LITERAL:
  396. case CHARACTER_LITERAL:
  397. case STRING_LITERAL:
  398. case IDENTIFIER:
  399. case LPAREN:
  400. case BANG:
  401. case TILDE:
  402. case INCR:
  403. case DECR:
  404. case PLUS:
  405. case MINUS:
  406. Expression();
  407. break;
  408. default:
  409. jj_la1[7] = jj_gen;
  410. jj_consume_token(-1);
  411. throw new ParseException();
  412. }
  413. }
  414. final public void ArrayInitializer() throws ParseException {
  415. /*@bgen(jjtree) ArrayInitializer */
  416. BSHArrayInitializer jjtn000 = new BSHArrayInitializer(JJTARRAYINITIALIZER);
  417. boolean jjtc000 = true;
  418. jjtree.openNodeScope(jjtn000);
  419. jjtreeOpenNodeScope(jjtn000);
  420. try {
  421. jj_consume_token(LBRACE);
  422. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  423. case BOOLEAN:
  424. case BYTE:
  425. case CHAR:
  426. case DOUBLE:
  427. case FALSE:
  428. case FLOAT:
  429. case INT:
  430. case LONG:
  431. case NEW:
  432. case NULL:
  433. case SHORT:
  434. case TRUE:
  435. case VOID:
  436. case INTEGER_LITERAL:
  437. case FLOATING_POINT_LITERAL:
  438. case CHARACTER_LITERAL:
  439. case STRING_LITERAL:
  440. case IDENTIFIER:
  441. case LPAREN:
  442. case LBRACE:
  443. case BANG:
  444. case TILDE:
  445. case INCR:
  446. case DECR:
  447. case PLUS:
  448. case MINUS:
  449. VariableInitializer();
  450. label_1:
  451. while (true) {
  452. if (jj_2_5(2)) {
  453. ;
  454. } else {
  455. break label_1;
  456. }
  457. jj_consume_token(COMMA);
  458. VariableInitializer();
  459. }
  460. break;
  461. default:
  462. jj_la1[8] = jj_gen;
  463. ;
  464. }
  465. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  466. case COMMA:
  467. jj_consume_token(COMMA);
  468. break;
  469. default:
  470. jj_la1[9] = jj_gen;
  471. ;
  472. }
  473. jj_consume_token(RBRACE);
  474. } catch (Throwable jjte000) {
  475. if (jjtc000) {
  476. jjtree.clearNodeScope(jjtn000);
  477. jjtc000 = false;
  478. } else {
  479. jjtree.popNode();
  480. }
  481. if (jjte000 instanceof RuntimeException) {
  482. {if (true) throw (RuntimeException)jjte000;}
  483. }
  484. if (jjte000 instanceof ParseException) {
  485. {if (true) throw (ParseException)jjte000;}
  486. }
  487. {if (true) throw (Error)jjte000;}
  488. } finally {
  489. if (jjtc000) {
  490. jjtree.closeNodeScope(jjtn000, true);
  491. jjtreeCloseNodeScope(jjtn000);
  492. }
  493. }
  494. }
  495. final public void FormalParameters() throws ParseException {
  496. /*@bgen(jjtree) FormalParameters */
  497. BSHFormalParameters jjtn000 = new BSHFormalParameters(JJTFORMALPARAMETERS);
  498. boolean jjtc000 = true;
  499. jjtree.openNodeScope(jjtn000);
  500. jjtreeOpenNodeScope(jjtn000);
  501. try {
  502. jj_consume_token(LPAREN);
  503. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  504. case BOOLEAN:
  505. case BYTE:
  506. case CHAR:
  507. case DOUBLE:
  508. case FLOAT:
  509. case INT:
  510. case LONG:
  511. case SHORT:
  512. case IDENTIFIER:
  513. FormalParameter();
  514. label_2:
  515. while (true) {
  516. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  517. case COMMA:
  518. ;
  519. break;
  520. default:
  521. jj_la1[10] = jj_gen;
  522. break label_2;
  523. }
  524. jj_consume_token(COMMA);
  525. FormalParameter();
  526. }
  527. break;
  528. default:
  529. jj_la1[11] = jj_gen;
  530. ;
  531. }
  532. jj_consume_token(RPAREN);
  533. } catch (Throwable jjte000) {
  534. if (jjtc000) {
  535. jjtree.clearNodeScope(jjtn000);
  536. jjtc000 = false;
  537. } else {
  538. jjtree.popNode();
  539. }
  540. if (jjte000 instanceof RuntimeException) {
  541. {if (true) throw (RuntimeException)jjte000;}
  542. }
  543. if (jjte000 instanceof ParseException) {
  544. {if (true) throw (ParseException)jjte000;}
  545. }
  546. {if (true) throw (Error)jjte000;}
  547. } finally {
  548. if (jjtc000) {
  549. jjtree.closeNodeScope(jjtn000, true);
  550. jjtreeCloseNodeScope(jjtn000);
  551. }
  552. }
  553. }
  554. /*
  555. void FormalParameter() #FormalParameter :
  556. { Token t; }
  557. {
  558. // added [] to Type for bsh. Removed [ final ] - is that legal?
  559. [ LOOKAHEAD(2) Type() ] t=<IDENTIFIER> { jjtThis.name = t.image; }
  560. }
  561. */
  562. final public void FormalParameter() throws ParseException {
  563. /*@bgen(jjtree) FormalParameter */
  564. BSHFormalParameter jjtn000 = new BSHFormalParameter(JJTFORMALPARAMETER);
  565. boolean jjtc000 = true;
  566. jjtree.openNodeScope(jjtn000);
  567. jjtreeOpenNodeScope(jjtn000);Token t;
  568. try {
  569. if (jj_2_6(2)) {
  570. Type();
  571. t = jj_consume_token(IDENTIFIER);
  572. jjtree.closeNodeScope(jjtn000, true);
  573. jjtc000 = false;
  574. jjtreeCloseNodeScope(jjtn000);
  575. jjtn000.name = t.image;
  576. } else {
  577. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  578. case IDENTIFIER:
  579. t = jj_consume_token(IDENTIFIER);
  580. jjtree.closeNodeScope(jjtn000, true);
  581. jjtc000 = false;
  582. jjtreeCloseNodeScope(jjtn000);
  583. jjtn000.name = t.image;
  584. break;
  585. default:
  586. jj_la1[12] = jj_gen;
  587. jj_consume_token(-1);
  588. throw new ParseException();
  589. }
  590. }
  591. } catch (Throwable jjte000) {
  592. if (jjtc000) {
  593. jjtree.clearNodeScope(jjtn000);
  594. jjtc000 = false;
  595. } else {
  596. jjtree.popNode();
  597. }
  598. if (jjte000 instanceof RuntimeException) {
  599. {if (true) throw (RuntimeException)jjte000;}
  600. }
  601. if (jjte000 instanceof ParseException) {
  602. {if (true) throw (ParseException)jjte000;}
  603. }
  604. {if (true) throw (Error)jjte000;}
  605. } finally {
  606. if (jjtc000) {
  607. jjtree.closeNodeScope(jjtn000, true);
  608. jjtreeCloseNodeScope(jjtn000);
  609. }
  610. }
  611. }
  612. /*
  613. Type, name and expression syntax follows.
  614. */
  615. final public void Type() throws ParseException {
  616. /*@bgen(jjtree) Type */
  617. BSHType jjtn000 = new BSHType(JJTTYPE);
  618. boolean jjtc000 = true;
  619. jjtree.openNodeScope(jjtn000);
  620. jjtreeOpenNodeScope(jjtn000);
  621. try {
  622. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  623. case BOOLEAN:
  624. case BYTE:
  625. case CHAR:
  626. case DOUBLE:
  627. case FLOAT:
  628. case INT:
  629. case LONG:
  630. case SHORT:
  631. PrimitiveType();
  632. break;
  633. case IDENTIFIER:
  634. AmbiguousName();
  635. break;
  636. default:
  637. jj_la1[13] = jj_gen;
  638. jj_consume_token(-1);
  639. throw new ParseException();
  640. }
  641. label_3:
  642. while (true) {
  643. if (jj_2_7(2)) {
  644. ;
  645. } else {
  646. break label_3;
  647. }
  648. jj_consume_token(LBRACKET);
  649. jj_consume_token(RBRACKET);
  650. jjtn000.addArrayDimension();
  651. }
  652. } catch (Throwable jjte000) {
  653. if (jjtc000) {
  654. jjtree.clearNodeScope(jjtn000);
  655. jjtc000 = false;
  656. } else {
  657. jjtree.popNode();
  658. }
  659. if (jjte000 instanceof RuntimeException) {
  660. {if (true) throw (RuntimeException)jjte000;}
  661. }
  662. if (jjte000 instanceof ParseException) {
  663. {if (true) throw (ParseException)jjte000;}
  664. }
  665. {if (true) throw (Error)jjte000;}
  666. } finally {
  667. if (jjtc000) {
  668. jjtree.closeNodeScope(jjtn000, true);
  669. jjtreeCloseNodeScope(jjtn000);
  670. }
  671. }
  672. }
  673. /*
  674. Originally called ResultType in the grammar
  675. */
  676. final public void ReturnType() throws ParseException {
  677. /*@bgen(jjtree) ReturnType */
  678. BSHReturnType jjtn000 = new BSHReturnType(JJTRETURNTYPE);
  679. boolean jjtc000 = true;
  680. jjtree.openNodeScope(jjtn000);
  681. jjtreeOpenNodeScope(jjtn000);
  682. try {
  683. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  684. case VOID:
  685. jj_consume_token(VOID);
  686. jjtree.closeNodeScope(jjtn000, true);
  687. jjtc000 = false;
  688. jjtreeCloseNodeScope(jjtn000);
  689. jjtn000.isVoid = true;
  690. break;
  691. case BOOLEAN:
  692. case BYTE:
  693. case CHAR:
  694. case DOUBLE:
  695. case FLOAT:
  696. case INT:
  697. case LONG:
  698. case SHORT:
  699. case IDENTIFIER:
  700. Type();
  701. break;
  702. default:
  703. jj_la1[14] = jj_gen;
  704. jj_consume_token(-1);
  705. throw new ParseException();
  706. }
  707. } catch (Throwable jjte000) {
  708. if (jjtc000) {
  709. jjtree.clearNodeScope(jjtn000);
  710. jjtc000 = false;
  711. } else {
  712. jjtree.popNode();
  713. }
  714. if (jjte000 instanceof RuntimeException) {
  715. {if (true) throw (RuntimeException)jjte000;}
  716. }
  717. if (jjte000 instanceof ParseException) {
  718. {if (true) throw (ParseException)jjte000;}
  719. }
  720. {if (true) throw (Error)jjte000;}
  721. } finally {
  722. if (jjtc000) {
  723. jjtree.closeNodeScope(jjtn000, true);
  724. jjtreeCloseNodeScope(jjtn000);
  725. }
  726. }
  727. }
  728. final public void PrimitiveType() throws ParseException {
  729. /*@bgen(jjtree) PrimitiveType */
  730. BSHPrimitiveType jjtn000 = new BSHPrimitiveType(JJTPRIMITIVETYPE);
  731. boolean jjtc000 = true;
  732. jjtree.openNodeScope(jjtn000);
  733. jjtreeOpenNodeScope(jjtn000);
  734. try {
  735. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  736. case BOOLEAN:
  737. jj_consume_token(BOOLEAN);
  738. jjtree.closeNodeScope(jjtn000, true);
  739. jjtc000 = false;
  740. jjtreeCloseNodeScope(jjtn000);
  741. jjtn000.type = Boolean.TYPE;
  742. break;
  743. case CHAR:
  744. jj_consume_token(CHAR);
  745. jjtree.closeNodeScope(jjtn000, true);
  746. jjtc000 = false;
  747. jjtreeCloseNodeScope(jjtn000);
  748. jjtn000.type = Character.TYPE;
  749. break;
  750. case BYTE:
  751. jj_consume_token(BYTE);
  752. jjtree.closeNodeScope(jjtn000, true);
  753. jjtc000 = false;
  754. jjtreeCloseNodeScope(jjtn000);
  755. jjtn000.type = Byte.TYPE;
  756. break;
  757. case SHORT:
  758. jj_consume_token(SHORT);
  759. jjtree.closeNodeScope(jjtn000, true);
  760. jjtc000 = false;
  761. jjtreeCloseNodeScope(jjtn000);
  762. jjtn000.type = Short.TYPE;
  763. break;
  764. case INT:
  765. jj_consume_token(INT);
  766. jjtree.closeNodeScope(jjtn000, true);
  767. jjtc000 = false;
  768. jjtreeCloseNodeScope(jjtn000);
  769. jjtn000.type = Integer.TYPE;
  770. break;
  771. case LONG:
  772. jj_consume_token(LONG);
  773. jjtree.closeNodeScope(jjtn000, true);
  774. jjtc000 = false;
  775. jjtreeCloseNodeScope(jjtn000);
  776. jjtn000.type = Long.TYPE;
  777. break;
  778. case FLOAT:
  779. jj_consume_token(FLOAT);
  780. jjtree.closeNodeScope(jjtn000, true);
  781. jjtc000 = false;
  782. jjtreeCloseNodeScope(jjtn000);
  783. jjtn000.type = Float.TYPE;
  784. break;
  785. case DOUBLE:
  786. jj_consume_token(DOUBLE);
  787. jjtree.closeNodeScope(jjtn000, true);
  788. jjtc000 = false;
  789. jjtreeCloseNodeScope(jjtn000);
  790. jjtn000.type = Double.TYPE;
  791. break;
  792. default:
  793. jj_la1[15] = jj_gen;
  794. jj_consume_token(-1);
  795. throw new ParseException();
  796. }
  797. } finally {
  798. if (jjtc000) {
  799. jjtree.closeNodeScope(jjtn000, true);
  800. jjtreeCloseNodeScope(jjtn000);
  801. }
  802. }
  803. }
  804. final public void AmbiguousName() throws ParseException {
  805. /*@bgen(jjtree) AmbiguousName */
  806. BSHAmbiguousName jjtn000 = new BSHAmbiguousName(JJTAMBIGUOUSNAME);
  807. boolean jjtc000 = true;
  808. jjtree.openNodeScope(jjtn000);
  809. jjtreeOpenNodeScope(jjtn000);Token t;
  810. StringBuffer s;
  811. try {
  812. t = jj_consume_token(IDENTIFIER);
  813. s = new StringBuffer(t.image);
  814. label_4:
  815. while (true) {
  816. if (jj_2_8(2)) {
  817. ;
  818. } else {
  819. break label_4;
  820. }
  821. jj_consume_token(DOT);
  822. t = jj_consume_token(IDENTIFIER);
  823. s.append("."+t.image);
  824. }
  825. jjtree.closeNodeScope(jjtn000, true);
  826. jjtc000 = false;
  827. jjtreeCloseNodeScope(jjtn000);
  828. jjtn000.text = s.toString();
  829. } finally {
  830. if (jjtc000) {
  831. jjtree.closeNodeScope(jjtn000, true);
  832. jjtreeCloseNodeScope(jjtn000);
  833. }
  834. }
  835. }
  836. /*
  837. * Expression syntax follows.
  838. */
  839. final public void Expression() throws ParseException {
  840. if (jj_2_9(2147483647)) {
  841. Assignment();
  842. } else {
  843. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  844. case BOOLEAN:
  845. case BYTE:
  846. case CHAR:
  847. case DOUBLE:
  848. case FALSE:
  849. case FLOAT:
  850. case INT:
  851. case LONG:
  852. case NEW:
  853. case NULL:
  854. case SHORT:
  855. case TRUE:
  856. case VOID:
  857. case INTEGER_LITERAL:
  858. case FLOATING_POINT_LITERAL:
  859. case CHARACTER_LITERAL:
  860. case STRING_LITERAL:
  861. case IDENTIFIER:
  862. case LPAREN:
  863. case BANG:
  864. case TILDE:
  865. case INCR:
  866. case DECR:
  867. case PLUS:
  868. case MINUS:
  869. ConditionalExpression();
  870. break;
  871. default:
  872. jj_la1[16] = jj_gen;
  873. jj_consume_token(-1);
  874. throw new ParseException();
  875. }
  876. }
  877. }
  878. final public void Assignment() throws ParseException {
  879. /*@bgen(jjtree) Assignment */
  880. BSHAssignment jjtn000 = new BSHAssignment(JJTASSIGNMENT);
  881. boolean jjtc000 = true;
  882. jjtree.openNodeScope(jjtn000);
  883. jjtreeOpenNodeScope(jjtn000);int op ;
  884. try {
  885. LHSPrimaryExpression();
  886. op = AssignmentOperator();
  887. jjtn000.operator = op;
  888. Expression();
  889. } catch (Throwable jjte000) {
  890. if (jjtc000) {
  891. jjtree.clearNodeScope(jjtn000);
  892. jjtc000 = false;
  893. } else {
  894. jjtree.popNode();
  895. }
  896. if (jjte000 instanceof RuntimeException) {
  897. {if (true) throw (RuntimeException)jjte000;}
  898. }
  899. if (jjte000 instanceof ParseException) {
  900. {if (true) throw (ParseException)jjte000;}
  901. }
  902. {if (true) throw (Error)jjte000;}
  903. } finally {
  904. if (jjtc000) {
  905. jjtree.closeNodeScope(jjtn000, true);
  906. jjtreeCloseNodeScope(jjtn000);
  907. }
  908. }
  909. }
  910. final public int AssignmentOperator() throws ParseException {
  911. Token t;
  912. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  913. case ASSIGN:
  914. jj_consume_token(ASSIGN);
  915. break;
  916. case STARASSIGN:
  917. jj_consume_token(STARASSIGN);
  918. break;
  919. case SLASHASSIGN:
  920. jj_consume_token(SLASHASSIGN);
  921. break;
  922. case MODASSIGN:
  923. jj_consume_token(MODASSIGN);
  924. break;
  925. case PLUSASSIGN:
  926. jj_consume_token(PLUSASSIGN);
  927. break;
  928. case MINUSASSIGN:
  929. jj_consume_token(MINUSASSIGN);
  930. break;
  931. case ANDASSIGN:
  932. jj_consume_token(ANDASSIGN);
  933. break;
  934. case XORASSIGN:
  935. jj_consume_token(XORASSIGN);
  936. break;
  937. case ORASSIGN:
  938. jj_consume_token(ORASSIGN);
  939. break;
  940. case LSHIFTASSIGN:
  941. jj_consume_token(LSHIFTASSIGN);
  942. break;
  943. case LSHIFTASSIGNX:
  944. jj_consume_token(LSHIFTASSIGNX);
  945. break;
  946. case RSIGNEDSHIFTASSIGN:
  947. jj_consume_token(RSIGNEDSHIFTASSIGN);
  948. break;
  949. case RSIGNEDSHIFTASSIGNX:
  950. jj_consume_token(RSIGNEDSHIFTASSIGNX);
  951. break;
  952. case RUNSIGNEDSHIFTASSIGN:
  953. jj_consume_token(RUNSIGNEDSHIFTASSIGN);
  954. break;
  955. case RUNSIGNEDSHIFTASSIGNX:
  956. jj_consume_token(RUNSIGNEDSHIFTASSIGNX);
  957. break;
  958. default:
  959. jj_la1[17] = jj_gen;
  960. jj_consume_token(-1);
  961. throw new ParseException();
  962. }
  963. t = getToken(0);
  964. {if (true) return t.kind;}
  965. throw new Error("Missing return statement in function");
  966. }
  967. final public void ConditionalExpression() throws ParseException {
  968. ConditionalOrExpression();
  969. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  970. case HOOK:
  971. jj_consume_token(HOOK);
  972. Expression();
  973. jj_consume_token(COLON);
  974. BSHTernaryExpression jjtn001 = new BSHTernaryExpression(JJTTERNARYEXPRESSION);
  975. boolean jjtc001 = true;
  976. jjtree.openNodeScope(jjtn001);
  977. jjtreeOpenNodeScope(jjtn001);
  978. try {
  979. ConditionalExpression();
  980. } catch (Throwable jjte001) {
  981. if (jjtc001) {
  982. jjtree.clearNodeScope(jjtn001);
  983. jjtc001 = false;
  984. } else {
  985. jjtree.popNode();
  986. }
  987. if (jjte001 instanceof RuntimeException) {
  988. {if (true) throw (RuntimeException)jjte001;}
  989. }
  990. if (jjte001 instanceof ParseException) {
  991. {if (true) throw (ParseException)jjte001;}
  992. }
  993. {if (true) throw (Error)jjte001;}
  994. } finally {
  995. if (jjtc001) {
  996. jjtree.closeNodeScope(jjtn001, 3);
  997. jjtreeCloseNodeScope(jjtn001);
  998. }
  999. }
  1000. break;
  1001. default:
  1002. jj_la1[18] = jj_gen;
  1003. ;
  1004. }
  1005. }
  1006. final public void ConditionalOrExpression() throws ParseException {
  1007. Token t=null;
  1008. ConditionalAndExpression();
  1009. label_5:
  1010. while (true) {
  1011. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  1012. case BOOL_OR:
  1013. case BOOL_ORX:
  1014. ;
  1015. break;
  1016. default:
  1017. jj_la1[19] = jj_gen;
  1018. break label_5;
  1019. }
  1020. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  1021. case BOOL_OR:
  1022. t = jj_consume_token(BOOL_OR);
  1023. break;
  1024. case BOOL_ORX:
  1025. t = jj_consume_token(BOOL_ORX);
  1026. break;
  1027. default:
  1028. jj_la1[20] = jj_gen;
  1029. jj_consume_token(-1);
  1030. throw new ParseException();
  1031. }
  1032. ConditionalAndExpression();
  1033. BSHBinaryExpression jjtn001 = new BSHBinaryExpression(JJTBINARYEXPRESSION);
  1034. boolean jjtc001 = true;
  1035. jjtree.openNodeScope(jjtn001);
  1036. jjtreeOpenNodeScope(jjtn001);
  1037. try {
  1038. jjtree.closeNodeScope(jjtn001, 2);
  1039. jjtc001 = false;
  1040. jjtreeCloseNodeScope(jjtn001);
  1041. jjtn001.kind = t.kind;
  1042. } finally {
  1043. if (jjtc001) {
  1044. jjtree.closeNodeScope(jjtn001, 2);
  1045. jjtreeCloseNodeScope(jjtn001);
  1046. }
  1047. }
  1048. }
  1049. }
  1050. final public void ConditionalAndExpression() throws ParseException {
  1051. Token t=null;
  1052. InclusiveOrExpression();
  1053. label_6:
  1054. while (true) {
  1055. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  1056. case BOOL_AND:
  1057. case BOOL_ANDX:
  1058. ;
  1059. break;
  1060. default:
  1061. jj_la1[21] = jj_gen;
  1062. break label_6;
  1063. }
  1064. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  1065. case BOOL_AND:
  1066. t = jj_consume_token(BOOL_AND);
  1067. break;
  1068. case BOOL_ANDX:
  1069. t = jj_consume_token(BOOL_ANDX);
  1070. break;
  1071. default:
  1072. jj_la1[22] = jj_gen;
  1073. jj_consume_token(-1);
  1074. throw new ParseException();
  1075. }
  1076. InclusiveOrExpression();
  1077. BSHBinaryExpression jjtn001 = new BSHBinaryExpression(JJTBINARYEXPRESSION);
  1078. boolean jjtc001 = true;
  1079. jjtree.openNodeScope(jjtn001);
  1080. jjtreeOpenNodeScope(jjtn001);
  1081. try {
  1082. jjtree.closeNodeScope(jjtn001, 2);
  1083. jjtc001 = false;
  1084. jjtreeCloseNodeScope(jjtn001);
  1085. jjtn001.kind = t.kind;
  1086. } finally {
  1087. if (jjtc001) {
  1088. jjtree.closeNodeScope(jjtn001, 2);
  1089. jjtreeCloseNodeScope(jjtn001);
  1090. }
  1091. }
  1092. }
  1093. }
  1094. final public void InclusiveOrExpression() throws ParseException {
  1095. Token t=null;
  1096. ExclusiveOrExpression();
  1097. label_7:
  1098. while (true) {
  1099. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  1100. case BIT_OR:
  1101. case BIT_ORX:
  1102. ;
  1103. break;
  1104. default:
  1105. jj_la1[23] = jj_gen;
  1106. break label_7;
  1107. }
  1108. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  1109. case BIT_OR:
  1110. t = jj_consume_token(BIT_OR);
  1111. break;
  1112. case BIT_ORX:
  1113. t = jj_consume_token(BIT_ORX);
  1114. break;
  1115. default:
  1116. jj_la1[24] = jj_gen;
  1117. jj_consume_token(-1);
  1118. throw new ParseException();
  1119. }
  1120. ExclusiveOrExpression();
  1121. BSHBinaryExpression jjtn001 = new BSHBinaryExpression(JJTBINARYEXPRESSION);
  1122. boolean jjtc001 = true;
  1123. jjtree.openNodeScope(jjtn001);
  1124. jjtreeOpenNodeScope(jjtn001);
  1125. try {
  1126. jjtree.closeNodeScope(jjtn001, 2);
  1127. jjtc001 = false;
  1128. jjtreeCloseNodeScope(jjtn001);
  1129. jjtn001.kind = t.kind;
  1130. } finally {
  1131. if (jjtc001) {
  1132. jjtree.closeNodeScope(jjtn001, 2);
  1133. jjtreeCloseNodeScope(jjtn001);
  1134. }
  1135. }
  1136. }
  1137. }
  1138. final public void ExclusiveOrExpression() throws ParseException {
  1139. Token t=null;
  1140. AndExpression();
  1141. label_8:
  1142. while (true) {
  1143. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  1144. case XOR:
  1145. ;
  1146. break;
  1147. default:
  1148. jj_la1[25] = jj_gen;
  1149. break label_8;
  1150. }
  1151. t = jj_consume_token(XOR);
  1152. AndExpression();
  1153. BSHBinaryExpression jjtn001 = new BSHBinaryExpression(JJTBINARYEXPRESSION);
  1154. boolean jjtc001 = true;
  1155. jjtree.openNodeScope(jjtn001);
  1156. jjtreeOpenNodeScope(jjtn001);
  1157. try {
  1158. jjtree.closeNodeScope(jjtn001, 2);
  1159. jjtc001 = false;
  1160. jjtreeCloseNodeScope(jjtn001);
  1161. jjtn001.kind = t.kind;
  1162. } finally {
  1163. if (jjtc001) {
  1164. jjtree.closeNodeScope(jjtn001, 2);
  1165. jjtreeCloseNodeScope(jjtn001);
  1166. }
  1167. }
  1168. }
  1169. }
  1170. final public void AndExpression() throws ParseException {
  1171. Token t=null;
  1172. EqualityExpression();
  1173. label_9:
  1174. while (true) {
  1175. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  1176. case BIT_AND:
  1177. case BIT_ANDX:
  1178. ;
  1179. break;
  1180. default:
  1181. jj_la1[26] = jj_gen;
  1182. break label_9;
  1183. }
  1184. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  1185. case BIT_AND:
  1186. t = jj_consume_token(BIT_AND);
  1187. break;
  1188. case BIT_ANDX:
  1189. t = jj_consume_token(BIT_ANDX);
  1190. break;
  1191. default:
  1192. jj_la1[27] = jj_gen;
  1193. jj_consume_token(-1);
  1194. throw new ParseException();
  1195. }
  1196. EqualityExpression();
  1197. BSHBinaryExpression jjtn001 = new BSHBinaryExpression(JJTBINARYEXPRESSION);
  1198. boolean jjtc001 = true;
  1199. jjtree.openNodeScope(jjtn001);
  1200. jjtreeOpenNodeScope(jjtn001);
  1201. try {
  1202. jjtree.closeNodeScope(jjtn001, 2);
  1203. jjtc001 = false;
  1204. jjtreeCloseNodeScope(jjtn001);
  1205. jjtn001.kind = t.kind;
  1206. } finally {
  1207. if (jjtc001) {
  1208. jjtree.closeNodeScope(jjtn001, 2);
  1209. jjtreeCloseNodeScope(jjtn001);
  1210. }
  1211. }
  1212. }
  1213. }
  1214. final public void EqualityExpression() throws ParseException {
  1215. Token t = null;
  1216. InstanceOfExpression();
  1217. label_10:
  1218. while (true) {
  1219. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  1220. case EQ:
  1221. case NE:
  1222. ;
  1223. break;
  1224. default:
  1225. jj_la1[28] = jj_gen;
  1226. break label_10;
  1227. }
  1228. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  1229. case EQ:
  1230. t = jj_consume_token(EQ);
  1231. break;
  1232. case NE:
  1233. t = jj_consume_token(NE);
  1234. break;
  1235. default:
  1236. jj_la1[29] = jj_gen;
  1237. jj_consume_token(-1);
  1238. throw new ParseException();
  1239. }
  1240. InstanceOfExpression();
  1241. BSHBinaryExpression jjtn001 = new BSHBinaryExpression(JJTBINARYEXPRESSION);
  1242. boolean jjtc001 = true;
  1243. jjtree.openNodeScope(jjtn001);
  1244. jjtreeOpenNodeScope(jjtn001);
  1245. try {
  1246. jjtree.closeNodeScope(jjtn001, 2);
  1247. jjtc001 = false;
  1248. jjtreeCloseNodeScope(jjtn001);
  1249. jjtn001.kind = t.kind;
  1250. } finally {
  1251. if (jjtc001) {
  1252. jjtree.closeNodeScope(jjtn001, 2);
  1253. jjtreeCloseNodeScope(jjtn001);
  1254. }
  1255. }
  1256. }
  1257. }
  1258. final public void InstanceOfExpression() throws ParseException {
  1259. Token t = null;
  1260. RelationalExpression();
  1261. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  1262. case INSTANCEOF:
  1263. t = jj_consume_token(INSTANCEOF);
  1264. Type();
  1265. BSHBinaryExpression jjtn001 = new BSHBinaryExpression(JJTBINARYEXPRESSION);
  1266. boolean jjtc001 = true;
  1267. jjtree.openNodeScope(jjtn001);
  1268. jjtreeOpenNodeScope(jjtn001);
  1269. try {
  1270. jjtree.closeNodeScope(jjtn001, 2);
  1271. jjtc001 = false;
  1272. jjtreeCloseNodeScope(jjtn001);
  1273. jjtn001.kind = t.kind;
  1274. } finally {
  1275. if (jjtc001) {
  1276. jjtree.closeNodeScope(jjtn001, 2);
  1277. jjtreeCloseNodeScope(jjtn001);
  1278. }
  1279. }
  1280. break;
  1281. default:
  1282. jj_la1[30] = jj_gen;
  1283. ;
  1284. }
  1285. }
  1286. final public void RelationalExpression() throws ParseException {
  1287. Token t = null;
  1288. ShiftExpression();
  1289. label_11:
  1290. while (true) {
  1291. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  1292. case GT:
  1293. case GTX:
  1294. case LT:
  1295. case LTX:
  1296. case LE:
  1297. case LEX:
  1298. case GE:
  1299. case GEX:
  1300. ;
  1301. break;
  1302. default:
  1303. jj_la1[31] = jj_gen;
  1304. break label_11;
  1305. }
  1306. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  1307. case LT:
  1308. t = jj_consume_token(LT);
  1309. break;
  1310. case LTX:
  1311. t = jj_consume_token(LTX);
  1312. break;
  1313. case GT:
  1314. t = jj_consume_token(GT);
  1315. break;
  1316. case GTX:
  1317. t = jj_consume_token(GTX);
  1318. break;
  1319. case LE:
  1320. t = jj_consume_token(LE);
  1321. break;
  1322. case LEX:
  1323. t = jj_consume_token(LEX);
  1324. break;
  1325. case GE:
  1326. t = jj_consume_token(GE);
  1327. break;
  1328. case GEX:
  1329. t = jj_consume_token(GEX);
  1330. break;
  1331. default:
  1332. jj_la1[32] = jj_gen;
  1333. jj_consume_token(-1);
  1334. throw new ParseException();
  1335. }
  1336. ShiftExpression();
  1337. BSHBinaryExpression jjtn001 = new BSHBinaryExpression(JJTBINARYEXPRESSION);
  1338. boolean jjtc001 = true;
  1339. jjtree.openNodeScope(jjtn001);
  1340. jjtreeOpenNodeScope(jjtn001);
  1341. try {
  1342. jjtree.closeNodeScope(jjtn001, 2);
  1343. jjtc001 = false;
  1344. jjtreeCloseNodeScope(jjtn001);
  1345. jjtn001.kind = t.kind;
  1346. } finally {
  1347. if (jjtc001) {
  1348. jjtree.closeNodeScope(jjtn001, 2);
  1349. jjtreeCloseNodeScope(jjtn001);
  1350. }
  1351. }
  1352. }
  1353. }
  1354. final public void ShiftExpression() throws ParseException {
  1355. Token t = null;
  1356. AdditiveExpression();
  1357. label_12:
  1358. while (true) {
  1359. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  1360. case LSHIFT:
  1361. case LSHIFTX:
  1362. case RSIGNEDSHIFT:
  1363. case RSIGNEDSHIFTX:
  1364. case RUNSIGNEDSHIFT:
  1365. case RUNSIGNEDSHIFTX:
  1366. ;
  1367. break;
  1368. default:
  1369. jj_la1[33] = jj_gen;
  1370. break label_12;
  1371. }
  1372. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  1373. case LSHIFT:
  1374. t = jj_consume_token(LSHIFT);
  1375. break;
  1376. case LSHIFTX:
  1377. t = jj_consume_token(LSHIFTX);
  1378. break;
  1379. case RSIGNEDSHIFT:
  1380. t = jj_consume_token(RSIGNEDSHIFT);
  1381. break;
  1382. case RSIGNEDSHIFTX:
  1383. t = jj_consume_token(RSIGNEDSHIFTX);
  1384. break;
  1385. case RUNSIGNEDSHIFT:
  1386. t = jj_consume_token(RUNSIGNEDSHIFT);
  1387. break;
  1388. case RUNSIGNEDSHIFTX:
  1389. t = jj_consume_token(RUNSIGNEDSHIFTX);
  1390. break;
  1391. default:
  1392. jj_la1[34] = jj_gen;
  1393. jj_consume_token(-1);
  1394. throw new ParseException();
  1395. }
  1396. AdditiveExpression();
  1397. BSHBinaryExpression jjtn001 = new BSHBinaryExpression(JJTBINARYEXPRESSION);
  1398. boolean jjtc001 = true;
  1399. jjtree.openNodeScope(jjtn001);
  1400. jjtreeOpenNodeScope(jjtn001);
  1401. try {
  1402. jjtree.closeNodeScope(jjtn001, 2);
  1403. jjtc001 = false;
  1404. jjtreeCloseNodeScope(jjtn001);
  1405. jjtn001.kind = t.kind;
  1406. } finally {
  1407. if (jjtc001) {
  1408. jjtree.closeNodeScope(jjtn001, 2);
  1409. jjtreeCloseNodeScope(jjtn001);
  1410. }
  1411. }
  1412. }
  1413. }
  1414. final public void AdditiveExpression() throws ParseException {
  1415. Token t = null;
  1416. MultiplicativeExpression();
  1417. label_13:
  1418. while (true) {
  1419. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  1420. case PLUS:
  1421. case MINUS:
  1422. ;
  1423. break;
  1424. default:
  1425. jj_la1[35] = jj_gen;
  1426. break label_13;
  1427. }
  1428. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  1429. case PLUS:
  1430. t = jj_consume_token(PLUS);
  1431. break;
  1432. case MINUS:
  1433. t = jj_consume_token(MINUS);
  1434. break;
  1435. default:
  1436. jj_la1[36] = jj_gen;
  1437. jj_consume_token(-1);
  1438. throw new ParseException();
  1439. }
  1440. MultiplicativeExpression();
  1441. BSHBinaryExpression jjtn001 = new BSHBinaryExpression(JJTBINARYEXPRESSION);
  1442. boolean jjtc001 = true;
  1443. jjtree.openNodeScope(jjtn001);
  1444. jjtreeOpenNodeScope(jjtn001);
  1445. try {
  1446. jjtree.closeNodeScope(jjtn001, 2);
  1447. jjtc001 = false;
  1448. jjtreeCloseNodeScope(jjtn001);
  1449. jjtn001.kind = t.kind;
  1450. } finally {
  1451. if (jjtc001) {
  1452. jjtree.closeNodeScope(jjtn001, 2);
  1453. jjtreeCloseNodeScope(jjtn001);
  1454. }
  1455. }
  1456. }
  1457. }
  1458. final public void MultiplicativeExpression() throws ParseException {
  1459. Token t = null;
  1460. UnaryExpression();
  1461. label_14:
  1462. while (true) {
  1463. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  1464. case STAR:
  1465. case SLASH:
  1466. case MOD:
  1467. ;
  1468. break;
  1469. default:
  1470. jj_la1[37] = jj_gen;
  1471. break label_14;
  1472. }
  1473. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  1474. case STAR:
  1475. t = jj_consume_token(STAR);
  1476. break;
  1477. case SLASH:
  1478. t = jj_consume_token(SLASH);
  1479. break;
  1480. case MOD:
  1481. t = jj_consume_token(MOD);
  1482. break;
  1483. default:
  1484. jj_la1[38] = jj_gen;
  1485. jj_consume_token(-1);
  1486. throw new ParseException();
  1487. }
  1488. UnaryExpression();
  1489. BSHBinaryExpression jjtn001 = new BSHBinaryExpression(JJTBINARYEXPRESSION);
  1490. boolean jjtc001 = true;
  1491. jjtree.openNodeScope(jjtn001);
  1492. jjtreeOpenNodeScope(jjtn001);
  1493. try {
  1494. jjtree.closeNodeScope(jjtn001, 2);
  1495. jjtc001 = false;
  1496. jjtreeCloseNodeScope(jjtn001);
  1497. jjtn001.kind = t.kind;
  1498. } finally {
  1499. if (jjtc001) {
  1500. jjtree.closeNodeScope(jjtn001, 2);
  1501. jjtreeCloseNodeScope(jjtn001);
  1502. }
  1503. }
  1504. }
  1505. }
  1506. final public void UnaryExpression() throws ParseException {
  1507. Token t = null;
  1508. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  1509. case PLUS:
  1510. case MINUS:
  1511. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  1512. case PLUS:
  1513. t = jj_consume_token(PLUS);
  1514. break;
  1515. case MINUS:
  1516. t = jj_consume_token(MINUS);
  1517. break;
  1518. default:
  1519. jj_la1[39] = jj_gen;
  1520. jj_consume_token(-1);
  1521. throw new ParseException();
  1522. }
  1523. UnaryExpression();
  1524. BSHUnaryExpression jjtn001 = new BSHUnaryExpression(JJTUNARYEXPRESSION);
  1525. boolean jjtc001 = true;
  1526. jjtree.openNodeScope(jjtn001);
  1527. jjtreeOpenNodeScope(jjtn001);
  1528. try {
  1529. jjtree.closeNodeScope(jjtn001, 1);
  1530. jjtc001 = false;
  1531. jjtreeCloseNodeScope(jjtn001);
  1532. jjtn001.kind = t.kind;
  1533. } finally {
  1534. if (jjtc001) {
  1535. jjtree.closeNodeScope(jjtn001, 1);
  1536. jjtreeCloseNodeScope(jjtn001);
  1537. }
  1538. }
  1539. break;
  1540. case INCR:
  1541. PreIncrementExpression();
  1542. break;
  1543. case DECR:
  1544. PreDecrementExpression();
  1545. break;
  1546. case BOOLEAN:
  1547. case BYTE:
  1548. case CHAR:
  1549. case DOUBLE:
  1550. case FALSE:
  1551. case FLOAT:
  1552. case INT:
  1553. case LONG:
  1554. case NEW:
  1555. case NULL:
  1556. case SHORT:
  1557. case TRUE:
  1558. case VOID:
  1559. case INTEGER_LITERAL:
  1560. case FLOATING_POINT_LITERAL:
  1561. case CHARACTER_LITERAL:
  1562. case STRING_LITERAL:
  1563. case IDENTIFIER:
  1564. case LPAREN:
  1565. case BANG:
  1566. case TILDE:
  1567. UnaryExpressionNotPlusMinus();
  1568. break;
  1569. default:
  1570. jj_la1[40] = jj_gen;
  1571. jj_consume_token(-1);
  1572. throw new ParseException();
  1573. }
  1574. }
  1575. final public void PreIncrementExpression() throws ParseException {
  1576. Token t = null;
  1577. t = jj_consume_token(INCR);
  1578. LHSPrimaryExpression();
  1579. BSHUnaryExpression jjtn001 = new BSHUnaryExpression(JJTUNARYEXPRESSION);
  1580. boolean jjtc001 = true;
  1581. jjtree.openNodeScope(jjtn001);
  1582. jjtreeOpenNodeScope(jjtn001);
  1583. try {
  1584. jjtree.closeNodeScope(jjtn001, 1);
  1585. jjtc001 = false;
  1586. jjtreeCloseNodeScope(jjtn001);
  1587. jjtn001.kind = t.kind;
  1588. } finally {
  1589. if (jjtc001) {
  1590. jjtree.closeNodeScope(jjtn001, 1);
  1591. jjtreeCloseNodeScope(jjtn001);
  1592. }
  1593. }
  1594. }
  1595. final public void PreDecrementExpression() throws ParseException {
  1596. Token t = null;
  1597. t = jj_consume_token(DECR);
  1598. LHSPrimaryExpression();
  1599. BSHUnaryExpression jjtn001 = new BSHUnaryExpression(JJTUNARYEXPRESSION);
  1600. boolean jjtc001 = true;
  1601. jjtree.openNodeScope(jjtn001);
  1602. jjtreeOpenNodeScope(jjtn001);
  1603. try {
  1604. jjtree.closeNodeScope(jjtn001, 1);
  1605. jjtc001 = false;
  1606. jjtreeCloseNodeScope(jjtn001);
  1607. jjtn001.kind = t.kind;
  1608. } finally {
  1609. if (jjtc001) {
  1610. jjtree.closeNodeScope(jjtn001, 1);
  1611. jjtreeCloseNodeScope(jjtn001);
  1612. }
  1613. }
  1614. }
  1615. final public void UnaryExpressionNotPlusMinus() throws ParseException {
  1616. Token t = null;
  1617. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  1618. case BANG:
  1619. case TILDE:
  1620. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  1621. case TILDE:
  1622. t = jj_consume_token(TILDE);
  1623. break;
  1624. case BANG:
  1625. t = jj_consume_token(BANG);
  1626. break;
  1627. default:
  1628. jj_la1[41] = jj_gen;
  1629. jj_consume_token(-1);
  1630. throw new ParseException();
  1631. }
  1632. UnaryExpression();
  1633. BSHUnaryExpression jjtn001 = new BSHUnaryExpression(JJTUNARYEXPRESSION);
  1634. boolean jjtc001 = true;
  1635. jjtree.openNodeScope(jjtn001);
  1636. jjtreeOpenNodeScope(jjtn001);
  1637. try {
  1638. jjtree.closeNodeScope(jjtn001, 1);
  1639. jjtc001 = false;
  1640. jjtreeCloseNodeScope(jjtn001);
  1641. jjtn001.kind = t.kind;
  1642. } finally {
  1643. if (jjtc001) {
  1644. jjtree.closeNodeScope(jjtn001, 1);
  1645. jjtreeCloseNodeScope(jjtn001);
  1646. }
  1647. }
  1648. break;
  1649. default:
  1650. jj_la1[42] = jj_gen;
  1651. if (jj_2_10(2147483647)) {
  1652. CastExpression();
  1653. } else {
  1654. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  1655. case BOOLEAN:
  1656. case BYTE:
  1657. case CHAR:
  1658. case DOUBLE:
  1659. case FALSE:
  1660. case FLOAT:
  1661. case INT:
  1662. case LONG:
  1663. case NEW:
  1664. case NULL:
  1665. case SHORT:
  1666. case TRUE:
  1667. case VOID:
  1668. case INTEGER_LITERAL:
  1669. case FLOATING_POINT_LITERAL:
  1670. case CHARACTER_LITERAL:
  1671. case STRING_LITERAL:
  1672. case IDENTIFIER:
  1673. case LPAREN:
  1674. PostfixExpression();
  1675. break;
  1676. default:
  1677. jj_la1[43] = jj_gen;
  1678. jj_consume_token(-1);
  1679. throw new ParseException();
  1680. }
  1681. }
  1682. }
  1683. }
  1684. // This production is to determine lookahead only.
  1685. final public void CastLookahead() throws ParseException {
  1686. if (jj_2_11(2)) {
  1687. jj_consume_token(LPAREN);
  1688. PrimitiveType();
  1689. } else if (jj_2_12(2147483647)) {
  1690. jj_consume_token(LPAREN);
  1691. AmbiguousName();
  1692. jj_consume_token(LBRACKET);
  1693. jj_consume_token(RBRACKET);
  1694. } else {
  1695. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  1696. case LPAREN:
  1697. jj_consume_token(LPAREN);
  1698. AmbiguousName();
  1699. jj_consume_token(RPAREN);
  1700. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  1701. case TILDE:
  1702. jj_consume_token(TILDE);
  1703. break;
  1704. case BANG:
  1705. jj_consume_token(BANG);
  1706. break;
  1707. case LPAREN:
  1708. jj_consume_token(LPAREN);
  1709. break;
  1710. case IDENTIFIER:
  1711. jj_consume_token(IDENTIFIER);
  1712. break;
  1713. case NEW:
  1714. jj_consume_token(NEW);
  1715. break;
  1716. case FALSE:
  1717. case NULL:
  1718. case TRUE:
  1719. case VOID:
  1720. case INTEGER_LITERAL:
  1721. case FLOATING_POINT_LITERAL:
  1722. case CHARACTER_LITERAL:
  1723. case STRING_LITERAL:
  1724. Literal();
  1725. break;
  1726. default:
  1727. jj_la1[44] = jj_gen;
  1728. jj_consume_token(-1);
  1729. throw new ParseException();
  1730. }
  1731. break;
  1732. default:
  1733. jj_la1[45] = jj_gen;
  1734. jj_consume_token(-1);
  1735. throw new ParseException();
  1736. }
  1737. }
  1738. }
  1739. final public void PostfixExpression() throws ParseException {
  1740. Token t = null;
  1741. if (jj_2_13(2147483647)) {
  1742. LHSPrimaryExpression();
  1743. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  1744. case INCR:
  1745. t = jj_consume_token(INCR);
  1746. break;
  1747. case DECR:
  1748. t = jj_consume_token(DECR);
  1749. break;
  1750. default:
  1751. jj_la1[46] = jj_gen;
  1752. jj_consume_token(-1);
  1753. throw new ParseException();
  1754. }
  1755. BSHUnaryExpression jjtn001 = new BSHUnaryExpression(JJTUNARYEXPRESSION);
  1756. boolean jjtc001 = true;
  1757. jjtree.openNodeScope(jjtn001);
  1758. jjtreeOpenNodeScope(jjtn001);
  1759. try {
  1760. jjtree.closeNodeScope(jjtn001, 1);
  1761. jjtc001 = false;
  1762. jjtreeCloseNodeScope(jjtn001);
  1763. jjtn001.kind = t.kind; jjtn001.postfix = true;
  1764. } finally {
  1765. if (jjtc001) {
  1766. jjtree.closeNodeScope(jjtn001, 1);
  1767. jjtreeCloseNodeScope(jjtn001);
  1768. }
  1769. }
  1770. } else {
  1771. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  1772. case BOOLEAN:
  1773. case BYTE:
  1774. case CHAR:
  1775. case DOUBLE:
  1776. case FALSE:
  1777. case FLOAT:
  1778. case INT:
  1779. case LONG:
  1780. case NEW:
  1781. case NULL:
  1782. case SHORT:
  1783. case TRUE:
  1784. case VOID:
  1785. case INTEGER_LITERAL:
  1786. case FLOATING_POINT_LITERAL:
  1787. case CHARACTER_LITERAL:
  1788. case STRING_LITERAL:
  1789. case IDENTIFIER:
  1790. case LPAREN:
  1791. PrimaryExpression();
  1792. break;
  1793. default:
  1794. jj_la1[47] = jj_gen;
  1795. jj_consume_token(-1);
  1796. throw new ParseException();
  1797. }
  1798. }
  1799. }
  1800. final public void CastExpression() throws ParseException {
  1801. /*@bgen(jjtree) CastExpression */
  1802. BSHCastExpression jjtn000 = new BSHCastExpression(JJTCASTEXPRESSION);
  1803. boolean jjtc000 = true;
  1804. jjtree.openNodeScope(jjtn000);
  1805. jjtreeOpenNodeScope(jjtn000);
  1806. try {
  1807. if (jj_2_14(2147483647)) {
  1808. jj_consume_token(LPAREN);
  1809. Type();
  1810. jj_consume_token(RPAREN);
  1811. UnaryExpression();
  1812. } else {
  1813. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  1814. case LPAREN:
  1815. jj_consume_token(LPAREN);
  1816. Type();
  1817. jj_consume_token(RPAREN);
  1818. UnaryExpressionNotPlusMinus();
  1819. break;
  1820. default:
  1821. jj_la1[48] = jj_gen;
  1822. jj_consume_token(-1);
  1823. throw new ParseException();
  1824. }
  1825. }
  1826. } catch (Throwable jjte000) {
  1827. if (jjtc000) {
  1828. jjtree.clearNodeScope(jjtn000);
  1829. jjtc000 = false;
  1830. } else {
  1831. jjtree.popNode();
  1832. }
  1833. if (jjte000 instanceof RuntimeException) {
  1834. {if (true) throw (RuntimeException)jjte000;}
  1835. }
  1836. if (jjte000 instanceof ParseException) {
  1837. {if (true) throw (ParseException)jjte000;}
  1838. }
  1839. {if (true) throw (Error)jjte000;}
  1840. } finally {
  1841. if (jjtc000) {
  1842. jjtree.closeNodeScope(jjtn000, true);
  1843. jjtreeCloseNodeScope(jjtn000);
  1844. }
  1845. }
  1846. }
  1847. final public void PrimaryExpression() throws ParseException {
  1848. /*@bgen(jjtree) PrimaryExpression */
  1849. BSHPrimaryExpression jjtn000 = new BSHPrimaryExpression(JJTPRIMARYEXPRESSION);
  1850. boolean jjtc000 = true;
  1851. jjtree.openNodeScope(jjtn000);
  1852. jjtreeOpenNodeScope(jjtn000);
  1853. try {
  1854. PrimaryPrefix();
  1855. label_15:
  1856. while (true) {
  1857. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  1858. case LBRACE:
  1859. case LBRACKET:
  1860. case DOT:
  1861. ;
  1862. break;
  1863. default:
  1864. jj_la1[49] = jj_gen;
  1865. break label_15;
  1866. }
  1867. PrimarySuffix();
  1868. }
  1869. } catch (Throwable jjte000) {
  1870. if (jjtc000) {
  1871. jjtree.clearNodeScope(jjtn000);
  1872. jjtc000 = false;
  1873. } else {
  1874. jjtree.popNode();
  1875. }
  1876. if (jjte000 instanceof RuntimeException) {
  1877. {if (true) throw (RuntimeException)jjte000;}
  1878. }
  1879. if (jjte000 instanceof ParseException) {
  1880. {if (true) throw (ParseException)jjte000;}
  1881. }
  1882. {if (true) throw (Error)jjte000;}
  1883. } finally {
  1884. if (jjtc000) {
  1885. jjtree.closeNodeScope(jjtn000, true);
  1886. jjtreeCloseNodeScope(jjtn000);
  1887. }
  1888. }
  1889. }
  1890. final public void MethodInvocation() throws ParseException {
  1891. /*@bgen(jjtree) MethodInvocation */
  1892. BSHMethodInvocation jjtn000 = new BSHMethodInvocation(JJTMETHODINVOCATION);
  1893. boolean jjtc000 = true;
  1894. jjtree.openNodeScope(jjtn000);
  1895. jjtreeOpenNodeScope(jjtn000);
  1896. try {
  1897. AmbiguousName();
  1898. Arguments();
  1899. } catch (Throwable jjte000) {
  1900. if (jjtc000) {
  1901. jjtree.clearNodeScope(jjtn000);
  1902. jjtc000 = false;
  1903. } else {
  1904. jjtree.popNode();
  1905. }
  1906. if (jjte000 instanceof RuntimeException) {
  1907. {if (true) throw (RuntimeException)jjte000;}
  1908. }
  1909. if (jjte000 instanceof ParseException) {
  1910. {if (true) throw (ParseException)jjte000;}
  1911. }
  1912. {if (true) throw (Error)jjte000;}
  1913. } finally {
  1914. if (jjtc000) {
  1915. jjtree.closeNodeScope(jjtn000, true);
  1916. jjtreeCloseNodeScope(jjtn000);
  1917. }
  1918. }
  1919. }
  1920. final public void PrimaryPrefix() throws ParseException {
  1921. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  1922. case FALSE:
  1923. case NULL:
  1924. case TRUE:
  1925. case VOID:
  1926. case INTEGER_LITERAL:
  1927. case FLOATING_POINT_LITERAL:
  1928. case CHARACTER_LITERAL:
  1929. case STRING_LITERAL:
  1930. Literal();
  1931. break;
  1932. case LPAREN:
  1933. jj_consume_token(LPAREN);
  1934. Expression();
  1935. jj_consume_token(RPAREN);
  1936. break;
  1937. case NEW:
  1938. AllocationExpression();
  1939. break;
  1940. case BOOLEAN:
  1941. case BYTE:
  1942. case CHAR:
  1943. case DOUBLE:
  1944. case FLOAT:
  1945. case INT:
  1946. case LONG:
  1947. case SHORT:
  1948. case IDENTIFIER:
  1949. if (jj_2_16(2147483647)) {
  1950. MethodInvocation();
  1951. } else {
  1952. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  1953. case BOOLEAN:
  1954. case BYTE:
  1955. case CHAR:
  1956. case DOUBLE:
  1957. case FLOAT:
  1958. case INT:
  1959. case LONG:
  1960. case SHORT:
  1961. case IDENTIFIER:
  1962. if (jj_2_15(2147483647)) {
  1963. Type();
  1964. } else {
  1965. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  1966. case IDENTIFIER:
  1967. AmbiguousName();
  1968. break;
  1969. default:
  1970. jj_la1[50] = jj_gen;
  1971. jj_consume_token(-1);
  1972. throw new ParseException();
  1973. }
  1974. }
  1975. break;
  1976. default:
  1977. jj_la1[51] = jj_gen;
  1978. jj_consume_token(-1);
  1979. throw new ParseException();
  1980. }
  1981. }
  1982. break;
  1983. default:
  1984. jj_la1[52] = jj_gen;
  1985. jj_consume_token(-1);
  1986. throw new ParseException();
  1987. }
  1988. }
  1989. final public void PrimarySuffix() throws ParseException {
  1990. /*@bgen(jjtree) PrimarySuffix */
  1991. BSHPrimarySuffix jjtn000 = new BSHPrimarySuffix(JJTPRIMARYSUFFIX);
  1992. boolean jjtc000 = true;
  1993. jjtree.openNodeScope(jjtn000);
  1994. jjtreeOpenNodeScope(jjtn000);Token t = null;
  1995. try {
  1996. if (jj_2_17(2)) {
  1997. jj_consume_token(DOT);
  1998. jj_consume_token(CLASS);
  1999. jjtree.closeNodeScope(jjtn000, true);
  2000. jjtc000 = false;
  2001. jjtreeCloseNodeScope(jjtn000);
  2002. jjtn000.operation = BSHPrimarySuffix.CLASS;
  2003. } else {
  2004. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  2005. case LBRACKET:
  2006. jj_consume_token(LBRACKET);
  2007. Expression();
  2008. jj_consume_token(RBRACKET);
  2009. jjtree.closeNodeScope(jjtn000, true);
  2010. jjtc000 = false;
  2011. jjtreeCloseNodeScope(jjtn000);
  2012. jjtn000.operation = BSHPrimarySuffix.INDEX;
  2013. break;
  2014. case DOT:
  2015. jj_consume_token(DOT);
  2016. t = jj_consume_token(IDENTIFIER);
  2017. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  2018. case LPAREN:
  2019. Arguments();
  2020. break;
  2021. default:
  2022. jj_la1[53] = jj_gen;
  2023. ;
  2024. }
  2025. jjtree.closeNodeScope(jjtn000, true);
  2026. jjtc000 = false;
  2027. jjtreeCloseNodeScope(jjtn000);
  2028. jjtn000.operation = BSHPrimarySuffix.NAME;
  2029. jjtn000.field = t.image;
  2030. break;
  2031. case LBRACE:
  2032. jj_consume_token(LBRACE);
  2033. Expression();
  2034. jj_consume_token(RBRACE);
  2035. jjtree.closeNodeScope(jjtn000, true);
  2036. jjtc000 = false;
  2037. jjtreeCloseNodeScope(jjtn000);
  2038. jjtn000.operation = BSHPrimarySuffix.PROPERTY;
  2039. break;
  2040. default:
  2041. jj_la1[54] = jj_gen;
  2042. jj_consume_token(-1);
  2043. throw new ParseException();
  2044. }
  2045. }
  2046. } catch (Throwable jjte000) {
  2047. if (jjtc000) {
  2048. jjtree.clearNodeScope(jjtn000);
  2049. jjtc000 = false;
  2050. } else {
  2051. jjtree.popNode();
  2052. }
  2053. if (jjte000 instanceof RuntimeException) {
  2054. {if (true) throw (RuntimeException)jjte000;}
  2055. }
  2056. if (jjte000 instanceof ParseException) {
  2057. {if (true) throw (ParseException)jjte000;}
  2058. }
  2059. {if (true) throw (Error)jjte000;}
  2060. } finally {
  2061. if (jjtc000) {
  2062. jjtree.closeNodeScope(jjtn000, true);
  2063. jjtreeCloseNodeScope(jjtn000);
  2064. }
  2065. }
  2066. }
  2067. /*
  2068. Begin LHS part of the grammar --
  2069. The reason this stuff is duplicated (e.g. LHSPrimaryPrefix and
  2070. PrimaryPrefix) is that the whole grammar splits based on whether we
  2071. are preparig to do an assignment or not. This is an important issue
  2072. to revisit in the future.
  2073. */
  2074. /**
  2075. The method invocation is here to force this to an object type in order
  2076. to simplify the suffix processing.
  2077. */
  2078. final public void LHSPrimaryPrefix() throws ParseException {
  2079. if (jj_2_18(2147483647)) {
  2080. MethodInvocation();
  2081. } else {
  2082. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  2083. case IDENTIFIER:
  2084. AmbiguousName();
  2085. break;
  2086. default:
  2087. jj_la1[55] = jj_gen;
  2088. jj_consume_token(-1);
  2089. throw new ParseException();
  2090. }
  2091. }
  2092. }
  2093. final public void LHSPrimaryExpression() throws ParseException {
  2094. /*@bgen(jjtree) LHSPrimaryExpression */
  2095. BSHLHSPrimaryExpression jjtn000 = new BSHLHSPrimaryExpression(JJTLHSPRIMARYEXPRESSION);
  2096. boolean jjtc000 = true;
  2097. jjtree.openNodeScope(jjtn000);
  2098. jjtreeOpenNodeScope(jjtn000);
  2099. try {
  2100. LHSPrimaryPrefix();
  2101. label_16:
  2102. while (true) {
  2103. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  2104. case LBRACE:
  2105. case LBRACKET:
  2106. case DOT:
  2107. ;
  2108. break;
  2109. default:
  2110. jj_la1[56] = jj_gen;
  2111. break label_16;
  2112. }
  2113. LHSPrimarySuffix();
  2114. }
  2115. } catch (Throwable jjte000) {
  2116. if (jjtc000) {
  2117. jjtree.clearNodeScope(jjtn000);
  2118. jjtc000 = false;
  2119. } else {
  2120. jjtree.popNode();
  2121. }
  2122. if (jjte000 instanceof RuntimeException) {
  2123. {if (true) throw (RuntimeException)jjte000;}
  2124. }
  2125. if (jjte000 instanceof ParseException) {
  2126. {if (true) throw (ParseException)jjte000;}
  2127. }
  2128. {if (true) throw (Error)jjte000;}
  2129. } finally {
  2130. if (jjtc000) {
  2131. jjtree.closeNodeScope(jjtn000, true);
  2132. jjtreeCloseNodeScope(jjtn000);
  2133. }
  2134. }
  2135. }
  2136. final public void LHSPrimarySuffix() throws ParseException {
  2137. /*@bgen(jjtree) LHSPrimarySuffix */
  2138. BSHLHSPrimarySuffix jjtn000 = new BSHLHSPrimarySuffix(JJTLHSPRIMARYSUFFIX);
  2139. boolean jjtc000 = true;
  2140. jjtree.openNodeScope(jjtn000);
  2141. jjtreeOpenNodeScope(jjtn000);Token t=null, t1, t2 = null;
  2142. try {
  2143. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  2144. case LBRACKET:
  2145. jj_consume_token(LBRACKET);
  2146. Expression();
  2147. jj_consume_token(RBRACKET);
  2148. jjtree.closeNodeScope(jjtn000, true);
  2149. jjtc000 = false;
  2150. jjtreeCloseNodeScope(jjtn000);
  2151. jjtn000.operation = BSHLHSPrimarySuffix.INDEX;
  2152. break;
  2153. case DOT:
  2154. jj_consume_token(DOT);
  2155. t1 = jj_consume_token(IDENTIFIER);
  2156. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  2157. case LPAREN:
  2158. Arguments();
  2159. jj_consume_token(DOT);
  2160. t2 = jj_consume_token(IDENTIFIER);
  2161. break;
  2162. default:
  2163. jj_la1[57] = jj_gen;
  2164. ;
  2165. }
  2166. jjtree.closeNodeScope(jjtn000, true);
  2167. jjtc000 = false;
  2168. jjtreeCloseNodeScope(jjtn000);
  2169. jjtn000.operation = BSHLHSPrimarySuffix.NAME;
  2170. if ( t2 == null )
  2171. jjtn000.field = t1.image;
  2172. else {
  2173. jjtn000.method = t1.image;
  2174. jjtn000.field = t2.image;
  2175. }
  2176. break;
  2177. case LBRACE:
  2178. jj_consume_token(LBRACE);
  2179. Expression();
  2180. jj_consume_token(RBRACE);
  2181. jjtree.closeNodeScope(jjtn000, true);
  2182. jjtc000 = false;
  2183. jjtreeCloseNodeScope(jjtn000);
  2184. jjtn000.operation = BSHLHSPrimarySuffix.PROPERTY;
  2185. break;
  2186. default:
  2187. jj_la1[58] = jj_gen;
  2188. jj_consume_token(-1);
  2189. throw new ParseException();
  2190. }
  2191. } catch (Throwable jjte000) {
  2192. if (jjtc000) {
  2193. jjtree.clearNodeScope(jjtn000);
  2194. jjtc000 = false;
  2195. } else {
  2196. jjtree.popNode();
  2197. }
  2198. if (jjte000 instanceof RuntimeException) {
  2199. {if (true) throw (RuntimeException)jjte000;}
  2200. }
  2201. if (jjte000 instanceof ParseException) {
  2202. {if (true) throw (ParseException)jjte000;}
  2203. }
  2204. {if (true) throw (Error)jjte000;}
  2205. } finally {
  2206. if (jjtc000) {
  2207. jjtree.closeNodeScope(jjtn000, true);
  2208. jjtreeCloseNodeScope(jjtn000);
  2209. }
  2210. }
  2211. }
  2212. /*
  2213. -- End LHS part of the grammar
  2214. */
  2215. final public void Literal() throws ParseException {
  2216. /*@bgen(jjtree) Literal */
  2217. BSHLiteral jjtn000 = new BSHLiteral(JJTLITERAL);
  2218. boolean jjtc000 = true;
  2219. jjtree.openNodeScope(jjtn000);
  2220. jjtreeOpenNodeScope(jjtn000);Token x;
  2221. boolean b;
  2222. String literal;
  2223. char ch;
  2224. try {
  2225. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  2226. case INTEGER_LITERAL:
  2227. x = jj_consume_token(INTEGER_LITERAL);
  2228. jjtree.closeNodeScope(jjtn000, true);
  2229. jjtc000 = false;
  2230. jjtreeCloseNodeScope(jjtn000);
  2231. literal = x.image;
  2232. ch = literal.charAt(literal.length()-1);
  2233. if(ch == 'l' || ch == 'L')
  2234. {
  2235. literal = literal.substring(0,literal.length()-1);
  2236. // This really should be Long.decode, but there isn't one. As a result,
  2237. // hex and octal literals ending in 'l' or 'L' don't work.
  2238. jjtn000.value = new Primitive( new Long( literal ) );
  2239. }
  2240. else
  2241. jjtn000.value = new Primitive( Integer.decode( literal ) );
  2242. break;
  2243. case FLOATING_POINT_LITERAL:
  2244. x = jj_consume_token(FLOATING_POINT_LITERAL);
  2245. jjtree.closeNodeScope(jjtn000, true);
  2246. jjtc000 = false;
  2247. jjtreeCloseNodeScope(jjtn000);
  2248. literal = x.image;
  2249. ch = literal.charAt(literal.length()-1);
  2250. if(ch == 'f' || ch == 'F')
  2251. {
  2252. literal = literal.substring(0,literal.length()-1);
  2253. jjtn000.value = new Primitive( new Float( literal ) );
  2254. }
  2255. else
  2256. {
  2257. if(ch == 'd' || ch == 'D')
  2258. literal = literal.substring(0,literal.length()-1);
  2259. jjtn000.value = new Primitive( new Double( literal ) );
  2260. }
  2261. break;
  2262. case CHARACTER_LITERAL:
  2263. x = jj_consume_token(CHARACTER_LITERAL);
  2264. jjtree.closeNodeScope(jjtn000, true);
  2265. jjtc000 = false;
  2266. jjtreeCloseNodeScope(jjtn000);
  2267. try {
  2268. jjtn000.charSetup( x.image.substring(1, x.image.length() - 1) );
  2269. } catch ( Exception e ) {
  2270. {if (true) throw new ParseException("Error parsing character: "+x.image);}
  2271. }
  2272. break;
  2273. case STRING_LITERAL:
  2274. x = jj_consume_token(STRING_LITERAL);
  2275. jjtree.closeNodeScope(jjtn000, true);
  2276. jjtc000 = false;
  2277. jjtreeCloseNodeScope(jjtn000);
  2278. try {
  2279. jjtn000.stringSetup( x.image.substring(1, x.image.length() - 1) );
  2280. } catch ( Exception e ) {
  2281. {if (true) throw new ParseException("Error parsing string: "+x.image);}
  2282. }
  2283. break;
  2284. case FALSE:
  2285. case TRUE:
  2286. b = BooleanLiteral();
  2287. jjtree.closeNodeScope(jjtn000, true);
  2288. jjtc000 = false;
  2289. jjtreeCloseNodeScope(jjtn000);
  2290. jjtn000.value = new Primitive( new Boolean(b) );
  2291. break;
  2292. case NULL:
  2293. NullLit