PageRenderTime 56ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 1ms

/jEdit/tags/jedit-4-2-pre4/bsh/Parser.java

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