PageRenderTime 55ms CodeModel.GetById 15ms RepoModel.GetById 1ms app.codeStats 0ms

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

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