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

/bundles/plugins-trunk/XML/sidekick/css/parser/CSS3Parser.java

#
Java | 2410 lines | 2249 code | 69 blank | 92 comment | 327 complexity | 8c8ca35dbd5612f39d14638901fadf4b 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:JavaCC: Do not edit this line. CSS3Parser.java */
  2. package sidekick.css.parser;
  3. import java.io.*;
  4. import java.net.*;
  5. import java.text.MessageFormat;
  6. import java.util.*;
  7. import java.util.regex.*;
  8. import sidekick.util.*;
  9. import org.gjt.sp.jedit.jEdit;
  10. /**
  11. * A CSS3 parser
  12. *
  13. * @author Philippe Le Hegaret and Sijtsche Smeman
  14. * @author Dale Anson, major modifications for jEdit Sidekick
  15. * @version Revision: 1.71 (W3C version)
  16. */
  17. public class CSS3Parser implements CSS3ParserConstants {
  18. private List<ParseError> parseErrors = new ArrayList<ParseError>();
  19. private List<ParseError> parseWarnings = new ArrayList<ParseError>();
  20. private boolean proprietaryAsError = true;
  21. private static char hexdigits[] = { '0' ,'1' ,'2' ,'3' ,'4' ,'5' ,'6' ,'7' ,'8' ,'9' ,'a' ,'b' ,'c' ,'d' ,'e' ,'f' } ;
  22. /**
  23. * The line offset is used when the css to be parsed is only part of a file,
  24. * for example when the css is the contents of a style block contained within
  25. * an html document.
  26. * @param lineOffset The line number of the first line of the css.
  27. * @param columnOffset The column number of the first character of the css.
  28. */
  29. public CSS3Parser(Reader in, int lineOffset, int columnOffset){
  30. this(in);
  31. jj_input_stream.ReInit(in,lineOffset,columnOffset);
  32. }
  33. /**
  34. * Set the tab size on the input stream. This should be set to the same
  35. * tab size as used in the buffer being parsed, otherwise, locations will
  36. * be off.
  37. */
  38. public void setTabSize(int size) {
  39. jj_input_stream.setTabSize(size);
  40. }
  41. /**
  42. * @return the current tab size used by the input stream.
  43. */
  44. public int getTabSize() {
  45. return jj_input_stream.getTabSize(0);
  46. }
  47. /**
  48. * If set to true, then a warning will be generated when proprietary
  49. * CSS markup is used.
  50. * @param b If set to true, then a warning will be generated when proprietary
  51. * CSS markup is used.
  52. */
  53. public void setProprietaryAsError(boolean b) {
  54. proprietaryAsError = b;
  55. }
  56. /**
  57. * Adds a parse exception to the list of parse exceptions. It is intended
  58. * that a complete file will be parsed and accumulate the exceptions rather
  59. * than quitting on the first exception.
  60. * @param pe A parse exception to add to the list.
  61. */
  62. private void addException(ParseException pe) {
  63. Range range = getExceptionLocation( pe );
  64. parseErrors.add(new ParseError(pe.getMessage(), range));
  65. //pe.printStackTrace();
  66. }
  67. private void addWarning(ParseError pe) {
  68. parseWarnings.add(pe);
  69. }
  70. /**
  71. * @return The list of parse exceptions found during parsing of a file.
  72. */
  73. public List<ParseError> getParseErrors() {
  74. //System.out.println("getParserErrors, there are " + parseErrors.size() + " errors");
  75. return parseErrors;
  76. }
  77. public List<ParseError> getParseWarnings() {
  78. return parseWarnings;
  79. }
  80. // regex to extract line and colun from a ParseException message
  81. // ParseException message look like: "Parse error at line 116, column 5. Encountered: }"
  82. private Pattern pePattern = Pattern.compile( "(.*?)(\u005c\u005cd+)(.*?)(\u005c\u005cd+)(.*?)" );
  83. /**
  84. * @return attempts to return a Location indicating the location of a parser
  85. * exception. If the ParseException contains a Token reference, all is well,
  86. * otherwise, this method attempts to parse the message string for the
  87. * exception.
  88. */
  89. private Range getExceptionLocation( ParseException pe ) {
  90. Token t = pe.currentToken;
  91. if ( t != null ) {
  92. return new Range( new Location( t.next.beginLine, t.next.beginColumn-1 ), new Location( t.next.endLine, t.next.endColumn ) );
  93. }
  94. // ParseException message look like: "Parse error at line 116, column 5. Encountered: }"
  95. try {
  96. Matcher m = pePattern.matcher( pe.getMessage() );
  97. if ( m.matches() ) {
  98. String ln = m.group( 2 );
  99. String cn = m.group( 4 );
  100. int line_number = -1;
  101. int column_number = 0;
  102. if ( ln != null )
  103. line_number = Integer.parseInt( ln );
  104. if ( cn != null )
  105. column_number = Integer.parseInt( cn );
  106. return line_number > -1 ? new Range( new Location( line_number - 1, column_number - 1 ), new Location( line_number - 1, column_number ) ) : null;
  107. }
  108. return new Range();
  109. } catch ( Exception e ) {
  110. //e.printStackTrace();
  111. return new Range();
  112. }
  113. }
  114. public void error_skipto(int kind) {
  115. Token t = null;
  116. int i = 0;
  117. do {
  118. i++;
  119. if (i > 100) {
  120. break;
  121. }
  122. t = getNextToken();
  123. } while (t != null && t.kind != kind);
  124. }
  125. /**
  126. * @param t A token to create a location from.
  127. * @return A location representing the start of the token.
  128. */
  129. public Location getStartLocation(Token t) {
  130. if (t == null)
  131. return new Location(0, 0);
  132. return new Location(t.beginLine + 1, t.beginColumn);
  133. }
  134. /**
  135. * @param t A token to create a location from.
  136. * @return A location representing the end of the token.
  137. */
  138. public Location getEndLocation(Token t) {
  139. if (t == null)
  140. return new Location(0, 0);
  141. return new Location(t.endLine + 1, t.endColumn + 1);
  142. }
  143. /**
  144. * Creates a CSSNode from a token using the token image as the node name
  145. * and the token start and end for node start and end locations.
  146. */
  147. public CSSNode createNode(Token t) {
  148. if (t == null) {
  149. return new CSSNode();
  150. }
  151. CSSNode node = new CSSNode(t.image);
  152. node.setStartLocation(getStartLocation(t));
  153. node.setEndLocation(getEndLocation(t));
  154. return node;
  155. }
  156. /**
  157. * Simple check to verify that all arguments are not null.
  158. */
  159. public boolean notNull(Object... args) {
  160. for (Object o : args) {
  161. if (o == null) {
  162. return false;
  163. }
  164. }
  165. return true;
  166. }
  167. // these property names are defined in CSS3, but are supported by at most
  168. // one browser.
  169. static final String[] invalidProperties = new String[]{
  170. "alignment-adjust",
  171. "alignment-baseline",
  172. "backface-visibility",
  173. "baseline-shift",
  174. "bookmark-label",
  175. "bookmark-level",
  176. "bookmark-target",
  177. "border-image-outset",
  178. "border-image-repeat",
  179. "border-image-slice",
  180. "border-image-source",
  181. "border-image-width",
  182. "box-decoration-break",
  183. "box-flex-group",
  184. "box-lines",
  185. "color-profile",
  186. "column-fill",
  187. "crop",
  188. "dominant-baseline",
  189. "drop-initial-after-adjust",
  190. "drop-initial-after-align",
  191. "drop-initial-before-adjust",
  192. "drop-initial-before-align",
  193. "drop-initial-size",
  194. "drop-initial-value",
  195. "fit",
  196. "fit-position",
  197. "float-offset",
  198. "font-stretch",
  199. "font-size-adjust",
  200. "grid-columns",
  201. "grid-rows",
  202. "hanging-punctuation",
  203. "hyphenate-after",
  204. "hyphenate-before",
  205. "hyphenate-characters",
  206. "hyphenate-lines",
  207. "hyphenate-resource",
  208. "hyphens",
  209. "icon",
  210. "image-orientation",
  211. "image-resolution",
  212. "inline-box-align",
  213. "line-stacking",
  214. "line-stacking-ruby",
  215. "line-stacking-shift",
  216. "line-stacking-strategy",
  217. "mark",
  218. "mark-after",
  219. "mark-before",
  220. "marks",
  221. "marquee-direction",
  222. "marquee-play-count",
  223. "marquee-speed",
  224. "marquee-style",
  225. "move-to",
  226. "nav-down",
  227. "nav-index",
  228. "nav-left",
  229. "nav-right",
  230. "nav-up",
  231. "overflow-style",
  232. "page",
  233. "page-policy",
  234. "phonemes",
  235. "punctuation-trim",
  236. "rest",
  237. "rest-after",
  238. "rest-before",
  239. "rotation",
  240. "rotation-point",
  241. "ruby-align",
  242. "ruby-overhang",
  243. "ruby-position",
  244. "ruby-span",
  245. "size",
  246. "string-set",
  247. "target",
  248. "target-name",
  249. "target-new",
  250. "target-position",
  251. "text-align-last",
  252. "text-emphasis",
  253. "text-height",
  254. "text-outline",
  255. "text-wrap",
  256. "voice-balance",
  257. "voice-duration",
  258. "voice-pitch",
  259. "voice-pitch-range",
  260. "voice-rate",
  261. "voice-stress",
  262. "voice-volume"};
  263. public boolean isUnsupported(String propertyName) {
  264. return unsupportedPropertyNames.contains(propertyName);
  265. }
  266. public final static HashSet<String> unsupportedPropertyNames;
  267. static {
  268. unsupportedPropertyNames = new HashSet<String>();
  269. for (String name : invalidProperties) {
  270. unsupportedPropertyNames.add(name);
  271. }
  272. }
  273. // For testing. Usage: java CSS3Parser < inputfile
  274. public static void main(String[] args) {
  275. try {
  276. CSS3Parser parser = new CSS3Parser(System.in);
  277. parser.styleSheet();
  278. }
  279. catch(Exception e) {
  280. e.printStackTrace();
  281. }
  282. }
  283. //<DEFAULT, IN_COMMENT>
  284. //TOKEN :
  285. //{ /* avoid token manager error */
  286. // < UNKNOWN : ~[] >
  287. //}
  288. /*
  289. * The grammar for CSS2 and CSS3 starts here.
  290. */
  291. /**
  292. * The main entry for the parser. The W3C version called this method "parserUnit".
  293. * I changed the name so it matches up with the older CSS2 parser.
  294. *
  295. * @exception ParseException exception during the parse
  296. */
  297. final public CSSNode styleSheet() throws ParseException {
  298. CSSNode rootNode = new CSSNode("style");
  299. CSSNode firstNode = null;
  300. CSSNode childNode = null;
  301. List<CSSNode> children = null;
  302. try {
  303. label_1:
  304. while (true) {
  305. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  306. case HTMLSTARTTAG:
  307. case HTMLENDTAG:
  308. ;
  309. break;
  310. default:
  311. jj_la1[0] = jj_gen;
  312. break label_1;
  313. }
  314. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  315. case HTMLSTARTTAG:
  316. jj_consume_token(HTMLSTARTTAG);
  317. break;
  318. case HTMLENDTAG:
  319. jj_consume_token(HTMLENDTAG);
  320. break;
  321. default:
  322. jj_la1[1] = jj_gen;
  323. jj_consume_token(-1);
  324. throw new ParseException();
  325. }
  326. addException ( new ParseException (jEdit.getProperty("sidekick.css.parser.CSS3Parser.dont-html")));
  327. }
  328. label_2:
  329. while (true) {
  330. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  331. case CHARSET_SYM:
  332. ;
  333. break;
  334. default:
  335. jj_la1[2] = jj_gen;
  336. break label_2;
  337. }
  338. childNode = charset();
  339. if (childNode != null) {
  340. rootNode.addChild(childNode);
  341. if (firstNode == null) {
  342. firstNode = childNode;
  343. rootNode.setStartLocation(firstNode.getStartLocation());
  344. }
  345. }
  346. }
  347. label_3:
  348. while (true) {
  349. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  350. case S:
  351. case CDO:
  352. case CDC:
  353. ;
  354. break;
  355. default:
  356. jj_la1[3] = jj_gen;
  357. break label_3;
  358. }
  359. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  360. case S:
  361. jj_consume_token(S);
  362. break;
  363. case CDO:
  364. jj_consume_token(CDO);
  365. break;
  366. case CDC:
  367. jj_consume_token(CDC);
  368. break;
  369. default:
  370. jj_la1[4] = jj_gen;
  371. jj_consume_token(-1);
  372. throw new ParseException();
  373. }
  374. }
  375. label_4:
  376. while (true) {
  377. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  378. case IMPORT_SYM:
  379. ;
  380. break;
  381. default:
  382. jj_la1[5] = jj_gen;
  383. break label_4;
  384. }
  385. childNode = importDeclaration();
  386. if (childNode != null) {
  387. rootNode.addChild(childNode);
  388. if (firstNode == null) {
  389. firstNode = childNode;
  390. rootNode.setStartLocation(firstNode.getStartLocation());
  391. }
  392. }
  393. ignoreStatement();
  394. }
  395. label_5:
  396. while (true) {
  397. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  398. case NAMESPACE_SYM:
  399. ;
  400. break;
  401. default:
  402. jj_la1[6] = jj_gen;
  403. break label_5;
  404. }
  405. childNode = namespaceDeclaration();
  406. if (childNode != null) {
  407. rootNode.addChild(childNode);
  408. if (firstNode == null) {
  409. firstNode = childNode;
  410. rootNode.setStartLocation(firstNode.getStartLocation());
  411. }
  412. }
  413. ignoreStatement();
  414. }
  415. children = afterImportDeclaration();
  416. if (children != null && children.size() > 0) {
  417. rootNode.setEndLocation(children.get(children.size() - 1).getEndLocation());
  418. rootNode.addChildren(children);
  419. }
  420. jj_consume_token(0);
  421. } catch (TokenMgrError err) {
  422. addException ( new ParseException ("Unrecognized token, " + err.getMessage()));
  423. }
  424. {if (true) return rootNode;}
  425. throw new Error("Missing return statement in function");
  426. }
  427. final public CSSNode charset() throws ParseException {
  428. Token start = null;
  429. Token middle = null;
  430. Token end = null;
  431. CSSNode node = null;
  432. try {
  433. start = jj_consume_token(CHARSET_SYM);
  434. label_6:
  435. while (true) {
  436. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  437. case S:
  438. ;
  439. break;
  440. default:
  441. jj_la1[7] = jj_gen;
  442. break label_6;
  443. }
  444. jj_consume_token(S);
  445. }
  446. middle = jj_consume_token(STRING);
  447. label_7:
  448. while (true) {
  449. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  450. case S:
  451. ;
  452. break;
  453. default:
  454. jj_la1[8] = jj_gen;
  455. break label_7;
  456. }
  457. jj_consume_token(S);
  458. }
  459. end = jj_consume_token(SEMICOLON);
  460. } catch (ParseException e) {
  461. addException(e);
  462. error_skipto(RBRACE);
  463. {if (true) return null;}
  464. }
  465. if (notNull(start, middle, end)) {
  466. String name = start.image + " " + middle.image;
  467. node = new CSSNode(name);
  468. node.setStartLocation(getStartLocation(start));
  469. node.setEndLocation(getEndLocation(end));
  470. }
  471. {if (true) return node;}
  472. throw new Error("Missing return statement in function");
  473. }
  474. final public List<CSSNode> afterImportDeclaration() throws ParseException {
  475. CSSNode node = null;
  476. List<CSSNode> list = new ArrayList<CSSNode>();
  477. String skip = null;
  478. try {
  479. label_8:
  480. while (true) {
  481. ;
  482. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  483. case IDENT:
  484. case HASHIDENT:
  485. case HASH:
  486. case LBRACKET:
  487. case ANY:
  488. case COLON:
  489. case LENGTH:
  490. case EMS:
  491. case EXS:
  492. case ANGLE:
  493. case TIME:
  494. case FREQ:
  495. case RESOLUTION:
  496. case DIMEN:
  497. case PSEUDOELEMENT_SYM:
  498. case CLASS:
  499. case FUNCTIONNOT:
  500. case 98:
  501. node = ruleSet();
  502. if (node != null) list.add(node);
  503. break;
  504. case MEDIA_SYM:
  505. node = media();
  506. if (node != null) list.add(node);
  507. break;
  508. case PAGE_SYM:
  509. node = page();
  510. if (node != null) list.add(node);
  511. break;
  512. case FONT_FACE_SYM:
  513. node = fontFace();
  514. if (node != null) list.add(node);
  515. break;
  516. case PREF_SYM:
  517. node = preference();
  518. if (node != null) list.add(node);
  519. break;
  520. case COLOR_PROFILE:
  521. node = colorprofile();
  522. if (node != null) list.add(node);
  523. break;
  524. case PHONETIC_ALPHABET_SYM:
  525. node = phoneticAlphabet();
  526. if (node != null) list.add(node);
  527. break;
  528. default:
  529. jj_la1[9] = jj_gen;
  530. skip = skipStatement();
  531. if (skip == null || skip.length() == 0) {
  532. {if (true) return list;}
  533. }
  534. }
  535. ignoreStatement();
  536. }
  537. } catch (ParseException e) {
  538. addException(e);
  539. error_skipto(RBRACE);
  540. {if (true) return null;}
  541. }
  542. {if (true) return list;}
  543. throw new Error("Missing return statement in function");
  544. }
  545. final public void ignoreStatement() throws ParseException {
  546. label_9:
  547. while (true) {
  548. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  549. case CDO:
  550. case CDC:
  551. case ATKEYWORD:
  552. ;
  553. break;
  554. default:
  555. jj_la1[10] = jj_gen;
  556. break label_9;
  557. }
  558. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  559. case CDO:
  560. jj_consume_token(CDO);
  561. break;
  562. case CDC:
  563. jj_consume_token(CDC);
  564. break;
  565. case ATKEYWORD:
  566. atRuleDeclaration();
  567. break;
  568. default:
  569. jj_la1[11] = jj_gen;
  570. jj_consume_token(-1);
  571. throw new ParseException();
  572. }
  573. label_10:
  574. while (true) {
  575. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  576. case S:
  577. ;
  578. break;
  579. default:
  580. jj_la1[12] = jj_gen;
  581. break label_10;
  582. }
  583. jj_consume_token(S);
  584. }
  585. }
  586. }
  587. final public CSSNode namespaceDeclaration() throws ParseException {
  588. CSSNode node = null;
  589. Token start = null;
  590. Token ident = null;
  591. Token uri = null;
  592. Token end = null;
  593. try {
  594. start = jj_consume_token(NAMESPACE_SYM);
  595. label_11:
  596. while (true) {
  597. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  598. case S:
  599. ;
  600. break;
  601. default:
  602. jj_la1[13] = jj_gen;
  603. break label_11;
  604. }
  605. jj_consume_token(S);
  606. }
  607. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  608. case IDENT:
  609. ident = jj_consume_token(IDENT);
  610. label_12:
  611. while (true) {
  612. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  613. case S:
  614. ;
  615. break;
  616. default:
  617. jj_la1[14] = jj_gen;
  618. break label_12;
  619. }
  620. jj_consume_token(S);
  621. }
  622. break;
  623. default:
  624. jj_la1[15] = jj_gen;
  625. ;
  626. }
  627. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  628. case STRING:
  629. uri = jj_consume_token(STRING);
  630. break;
  631. case URL:
  632. uri = jj_consume_token(URL);
  633. break;
  634. default:
  635. jj_la1[16] = jj_gen;
  636. jj_consume_token(-1);
  637. throw new ParseException();
  638. }
  639. label_13:
  640. while (true) {
  641. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  642. case S:
  643. ;
  644. break;
  645. default:
  646. jj_la1[17] = jj_gen;
  647. break label_13;
  648. }
  649. jj_consume_token(S);
  650. }
  651. end = jj_consume_token(SEMICOLON);
  652. label_14:
  653. while (true) {
  654. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  655. case S:
  656. ;
  657. break;
  658. default:
  659. jj_la1[18] = jj_gen;
  660. break label_14;
  661. }
  662. jj_consume_token(S);
  663. }
  664. } catch (ParseException e) {
  665. addException(e);
  666. error_skipto(SEMICOLON);
  667. {if (true) return null;}
  668. }
  669. if (notNull(start, uri, end)) {
  670. String name = start.image + " " + (ident != null ? ident.image : "") + uri.image;
  671. node = new CSSNode(name);
  672. node.setStartLocation(getStartLocation(start));
  673. node.setEndLocation(getEndLocation(end));
  674. }
  675. {if (true) return node;}
  676. throw new Error("Missing return statement in function");
  677. }
  678. /**
  679. * The import statement
  680. *
  681. * @exception ParseException exception during the parse
  682. */
  683. final public CSSNode importDeclaration() throws ParseException {
  684. Token start = null;
  685. CSSNode medium = null;
  686. List<CSSNode> mediumList = new ArrayList<CSSNode>();
  687. Token uri = null;
  688. Token end = null;
  689. CSSNode node = null;
  690. try {
  691. start = jj_consume_token(IMPORT_SYM);
  692. label_15:
  693. while (true) {
  694. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  695. case S:
  696. ;
  697. break;
  698. default:
  699. jj_la1[19] = jj_gen;
  700. break label_15;
  701. }
  702. jj_consume_token(S);
  703. }
  704. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  705. case STRING:
  706. uri = jj_consume_token(STRING);
  707. break;
  708. case URL:
  709. uri = jj_consume_token(URL);
  710. break;
  711. default:
  712. jj_la1[20] = jj_gen;
  713. jj_consume_token(-1);
  714. throw new ParseException();
  715. }
  716. label_16:
  717. while (true) {
  718. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  719. case S:
  720. ;
  721. break;
  722. default:
  723. jj_la1[21] = jj_gen;
  724. break label_16;
  725. }
  726. jj_consume_token(S);
  727. }
  728. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  729. case IDENT:
  730. medium = medium();
  731. if (medium != null) mediumList.add(medium);
  732. label_17:
  733. while (true) {
  734. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  735. case COMMA:
  736. ;
  737. break;
  738. default:
  739. jj_la1[22] = jj_gen;
  740. break label_17;
  741. }
  742. jj_consume_token(COMMA);
  743. label_18:
  744. while (true) {
  745. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  746. case S:
  747. ;
  748. break;
  749. default:
  750. jj_la1[23] = jj_gen;
  751. break label_18;
  752. }
  753. jj_consume_token(S);
  754. }
  755. medium = medium();
  756. if (medium != null) mediumList.add(medium);
  757. }
  758. break;
  759. default:
  760. jj_la1[24] = jj_gen;
  761. ;
  762. }
  763. end = jj_consume_token(SEMICOLON);
  764. label_19:
  765. while (true) {
  766. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  767. case S:
  768. ;
  769. break;
  770. default:
  771. jj_la1[25] = jj_gen;
  772. break label_19;
  773. }
  774. jj_consume_token(S);
  775. }
  776. } catch (ParseException e) {
  777. addException(e);
  778. error_skipto(SEMICOLON);
  779. {if (true) return null;}
  780. }
  781. if (notNull(start, end)) {
  782. StringBuilder sb = new StringBuilder();
  783. for (CSSNode m : mediumList) {
  784. sb.append(m).append(',');
  785. }
  786. String mediumNames = sb.substring(0, Math.max(0, sb.length() - 1)); // trims the trailing comma
  787. String name = start.image + (uri != null ? " " + uri.image : "") + (mediumNames.length() > 0 ? " " + mediumNames : "");
  788. node = new CSSNode(name);
  789. node.setStartLocation(getStartLocation(start));
  790. node.setEndLocation(getEndLocation(end));
  791. }
  792. {if (true) return node;}
  793. throw new Error("Missing return statement in function");
  794. }
  795. final public CSSNode media() throws ParseException {
  796. Token start = null;
  797. Token mr = null;
  798. CSSNode medium = null;
  799. List<CSSNode> mlist = new ArrayList<CSSNode>();
  800. CSSNode mdecl = null;
  801. List<CSSNode> mdeclList = new ArrayList<CSSNode>();
  802. CSSNode ruleset = null;
  803. Token end = null;
  804. try {
  805. start = jj_consume_token(MEDIA_SYM);
  806. label_20:
  807. while (true) {
  808. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  809. case S:
  810. ;
  811. break;
  812. default:
  813. jj_la1[26] = jj_gen;
  814. break label_20;
  815. }
  816. jj_consume_token(S);
  817. }
  818. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  819. case MEDIARESTRICTOR:
  820. mr = jj_consume_token(MEDIARESTRICTOR);
  821. label_21:
  822. while (true) {
  823. jj_consume_token(S);
  824. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  825. case S:
  826. ;
  827. break;
  828. default:
  829. jj_la1[27] = jj_gen;
  830. break label_21;
  831. }
  832. }
  833. break;
  834. default:
  835. jj_la1[28] = jj_gen;
  836. ;
  837. }
  838. // </CSS3>
  839. medium = medium();
  840. if (medium != null) mlist.add(medium);
  841. label_22:
  842. while (true) {
  843. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  844. case COMMA:
  845. ;
  846. break;
  847. default:
  848. jj_la1[29] = jj_gen;
  849. break label_22;
  850. }
  851. jj_consume_token(COMMA);
  852. label_23:
  853. while (true) {
  854. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  855. case S:
  856. ;
  857. break;
  858. default:
  859. jj_la1[30] = jj_gen;
  860. break label_23;
  861. }
  862. jj_consume_token(S);
  863. }
  864. medium = medium();
  865. if (medium != null) mlist.add(medium);
  866. }
  867. label_24:
  868. while (true) {
  869. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  870. case AND:
  871. ;
  872. break;
  873. default:
  874. jj_la1[31] = jj_gen;
  875. break label_24;
  876. }
  877. jj_consume_token(AND);
  878. label_25:
  879. while (true) {
  880. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  881. case S:
  882. ;
  883. break;
  884. default:
  885. jj_la1[32] = jj_gen;
  886. break label_25;
  887. }
  888. jj_consume_token(S);
  889. }
  890. jj_consume_token(LPARAN);
  891. label_26:
  892. while (true) {
  893. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  894. case S:
  895. ;
  896. break;
  897. default:
  898. jj_la1[33] = jj_gen;
  899. break label_26;
  900. }
  901. jj_consume_token(S);
  902. }
  903. mdecl = mediadeclaration();
  904. if(mdecl != null) mdeclList.add(mdecl);
  905. jj_consume_token(RPARAN);
  906. label_27:
  907. while (true) {
  908. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  909. case S:
  910. ;
  911. break;
  912. default:
  913. jj_la1[34] = jj_gen;
  914. break label_27;
  915. }
  916. jj_consume_token(S);
  917. }
  918. }
  919. jj_consume_token(LBRACE);
  920. label_28:
  921. while (true) {
  922. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  923. case S:
  924. ;
  925. break;
  926. default:
  927. jj_la1[35] = jj_gen;
  928. break label_28;
  929. }
  930. jj_consume_token(S);
  931. }
  932. label_29:
  933. while (true) {
  934. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  935. case IDENT:
  936. case HASHIDENT:
  937. case HASH:
  938. case LBRACKET:
  939. case ANY:
  940. case COLON:
  941. case LENGTH:
  942. case EMS:
  943. case EXS:
  944. case ANGLE:
  945. case TIME:
  946. case FREQ:
  947. case RESOLUTION:
  948. case DIMEN:
  949. case PSEUDOELEMENT_SYM:
  950. case CLASS:
  951. case FUNCTIONNOT:
  952. case 98:
  953. ;
  954. break;
  955. default:
  956. jj_la1[36] = jj_gen;
  957. break label_29;
  958. }
  959. ruleset = ruleSet();
  960. }
  961. end = jj_consume_token(RBRACE);
  962. label_30:
  963. while (true) {
  964. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  965. case S:
  966. ;
  967. break;
  968. default:
  969. jj_la1[37] = jj_gen;
  970. break label_30;
  971. }
  972. jj_consume_token(S);
  973. }
  974. } catch (ParseException e) {
  975. addException(e);
  976. error_skipto(RBRACE);
  977. {if (true) return null;}
  978. }
  979. if (notNull(start, end)) {
  980. CSSNode node = new CSSNode(start.image);
  981. if (mr != null) {
  982. node.addChild(createNode(mr));
  983. }
  984. node.addChildren(mlist);
  985. node.addChildren(mdeclList);
  986. node.setStartLocation(getStartLocation(start));
  987. node.setEndLocation(getEndLocation(end));
  988. {if (true) return node;}
  989. }
  990. {if (true) return null;}
  991. throw new Error("Missing return statement in function");
  992. }
  993. final public CSSNode medium() throws ParseException {
  994. Token t = null;
  995. t = jj_consume_token(IDENT);
  996. label_31:
  997. while (true) {
  998. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  999. case S:
  1000. ;
  1001. break;
  1002. default:
  1003. jj_la1[38] = jj_gen;
  1004. break label_31;
  1005. }
  1006. jj_consume_token(S);
  1007. }
  1008. if (notNull(t)) {
  1009. {if (true) return createNode(t);}
  1010. }
  1011. {if (true) return null;}
  1012. throw new Error("Missing return statement in function");
  1013. }
  1014. final public CSSNode unused_production_generic_syntax() throws ParseException {
  1015. Token start = null;
  1016. CSSNode term = null;
  1017. Token end = null;
  1018. try {
  1019. start = jj_consume_token(LPARAN);
  1020. label_32:
  1021. while (true) {
  1022. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  1023. case S:
  1024. ;
  1025. break;
  1026. default:
  1027. jj_la1[39] = jj_gen;
  1028. break label_32;
  1029. }
  1030. jj_consume_token(S);
  1031. }
  1032. term = term();
  1033. end = jj_consume_token(RPARAN);
  1034. } catch (ParseException e) {
  1035. addException(e);
  1036. error_skipto(RPARAN);
  1037. {if (true) return null;}
  1038. }
  1039. if (notNull(start, term, end)) {
  1040. CSSNode node = new CSSNode('[' + term.getName() + ']');
  1041. node.addChildren(term.getChildren());
  1042. node.setStartLocation(getStartLocation(start));
  1043. node.setEndLocation(getEndLocation(end));
  1044. {if (true) return node;}
  1045. }
  1046. {if (true) return null;}
  1047. throw new Error("Missing return statement in function");
  1048. }
  1049. final public CSSNode definition() throws ParseException {
  1050. Token start = null;
  1051. CSSNode term = null;
  1052. Token end = null;
  1053. try {
  1054. start = jj_consume_token(LBRACKET);
  1055. label_33:
  1056. while (true) {
  1057. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  1058. case S:
  1059. ;
  1060. break;
  1061. default:
  1062. jj_la1[40] = jj_gen;
  1063. break label_33;
  1064. }
  1065. jj_consume_token(S);
  1066. }
  1067. term = term();
  1068. end = jj_consume_token(RBRACKET);
  1069. } catch (ParseException e) {
  1070. addException(e);
  1071. error_skipto(RBRACKET);
  1072. {if (true) return null;}
  1073. }
  1074. if (notNull(start, term, end)) {
  1075. CSSNode node = new CSSNode('[' + term.getName() + ']');
  1076. node.addChildren(term.getChildren());
  1077. node.setStartLocation(getStartLocation(start));
  1078. node.setEndLocation(getEndLocation(end));
  1079. }
  1080. throw new Error("Missing return statement in function");
  1081. }
  1082. final public CSSNode page() throws ParseException {
  1083. CSSNode node = new CSSNode();
  1084. CSSNode child = null;
  1085. List<CSSNode> contents = null;
  1086. Token start = null;
  1087. Token i = null;
  1088. Token end = null;
  1089. try {
  1090. start = jj_consume_token(PAGE_SYM);
  1091. if (start != null) node.setName(start.image);
  1092. label_34:
  1093. while (true) {
  1094. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  1095. case S:
  1096. ;
  1097. break;
  1098. default:
  1099. jj_la1[41] = jj_gen;
  1100. break label_34;
  1101. }
  1102. jj_consume_token(S);
  1103. }
  1104. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  1105. case IDENT:
  1106. i = jj_consume_token(IDENT);
  1107. if (i != null) node.setName(node.getName() + ' ' + i.image);
  1108. label_35:
  1109. while (true) {
  1110. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  1111. case S:
  1112. ;
  1113. break;
  1114. default:
  1115. jj_la1[42] = jj_gen;
  1116. break label_35;
  1117. }
  1118. jj_consume_token(S);
  1119. }
  1120. break;
  1121. default:
  1122. jj_la1[43] = jj_gen;
  1123. ;
  1124. }
  1125. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  1126. case COLON:
  1127. child = pseudo_page();
  1128. if (child != null) node.addChild(child);
  1129. break;
  1130. default:
  1131. jj_la1[44] = jj_gen;
  1132. ;
  1133. }
  1134. jj_consume_token(LBRACE);
  1135. label_36:
  1136. while (true) {
  1137. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  1138. case S:
  1139. ;
  1140. break;
  1141. default:
  1142. jj_la1[45] = jj_gen;
  1143. break label_36;
  1144. }
  1145. jj_consume_token(S);
  1146. }
  1147. contents = pageContent();
  1148. if (contents != null) node.addChildren(contents);
  1149. end = jj_consume_token(RBRACE);
  1150. label_37:
  1151. while (true) {
  1152. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  1153. case S:
  1154. ;
  1155. break;
  1156. default:
  1157. jj_la1[46] = jj_gen;
  1158. break label_37;
  1159. }
  1160. jj_consume_token(S);
  1161. }
  1162. } catch (ParseException e) {
  1163. addException(e);
  1164. error_skipto(RBRACE);
  1165. {if (true) return null;}
  1166. }
  1167. if (notNull(start, end)) {
  1168. node.setStartLocation(getStartLocation(start));
  1169. node.setEndLocation(getEndLocation(end));
  1170. {if (true) return node;}
  1171. }
  1172. {if (true) return null;}
  1173. throw new Error("Missing return statement in function");
  1174. }
  1175. final public List<CSSNode> pageContent() throws ParseException {
  1176. CSSNode node = null;
  1177. List<CSSNode> list = null;
  1178. try {
  1179. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  1180. case ATTOP:
  1181. case ATRIGHT:
  1182. case ATBOTTOM:
  1183. case ATLEFT:
  1184. node = prefAtRule();
  1185. break;
  1186. default:
  1187. jj_la1[47] = jj_gen;
  1188. list = declarations();
  1189. }
  1190. } catch (ParseException e) {
  1191. addException(e);
  1192. error_skipto(RBRACE);
  1193. {if (true) return null;}
  1194. }
  1195. if (node != null) {
  1196. list = new ArrayList<CSSNode>();
  1197. list.add(node);
  1198. {if (true) return list;}
  1199. }
  1200. else if (list != null) {
  1201. {if (true) return list;}
  1202. }
  1203. {if (true) return null;}
  1204. throw new Error("Missing return statement in function");
  1205. }
  1206. final public CSSNode prefAtRule() throws ParseException {
  1207. Token start = null;
  1208. List<CSSNode> decls = null;
  1209. Token end = null;
  1210. try {
  1211. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  1212. case ATTOP:
  1213. start = jj_consume_token(ATTOP);
  1214. break;
  1215. case ATBOTTOM:
  1216. start = jj_consume_token(ATBOTTOM);
  1217. break;
  1218. case ATLEFT:
  1219. start = jj_consume_token(ATLEFT);
  1220. break;
  1221. case ATRIGHT:
  1222. start = jj_consume_token(ATRIGHT);
  1223. break;
  1224. default:
  1225. jj_la1[48] = jj_gen;
  1226. jj_consume_token(-1);
  1227. throw new ParseException();
  1228. }
  1229. label_38:
  1230. while (true) {
  1231. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  1232. case S:
  1233. ;
  1234. break;
  1235. default:
  1236. jj_la1[49] = jj_gen;
  1237. break label_38;
  1238. }
  1239. jj_consume_token(S);
  1240. }
  1241. jj_consume_token(LBRACE);
  1242. label_39:
  1243. while (true) {
  1244. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  1245. case S:
  1246. ;
  1247. break;
  1248. default:
  1249. jj_la1[50] = jj_gen;
  1250. break label_39;
  1251. }
  1252. jj_consume_token(S);
  1253. }
  1254. decls = declarations();
  1255. end = jj_consume_token(RBRACE);
  1256. label_40:
  1257. while (true) {
  1258. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  1259. case S:
  1260. ;
  1261. break;
  1262. default:
  1263. jj_la1[51] = jj_gen;
  1264. break label_40;
  1265. }
  1266. jj_consume_token(S);
  1267. }
  1268. } catch (ParseException e) {
  1269. addException(e);
  1270. error_skipto(RBRACE);
  1271. {if (true) return null;}
  1272. }
  1273. if (notNull(start, decls, end)) {
  1274. CSSNode node = new CSSNode(start.image);
  1275. node.addChildren(decls);
  1276. node.setStartLocation(getStartLocation(start));
  1277. node.setEndLocation(getEndLocation(end));
  1278. {if (true) return node;}
  1279. }
  1280. {if (true) return null;}
  1281. throw new Error("Missing return statement in function");
  1282. }
  1283. final public CSSNode pseudo_page() throws ParseException {
  1284. Token start = null;
  1285. Token t = null;
  1286. try {
  1287. start = jj_consume_token(COLON);
  1288. t = jj_consume_token(IDENT);
  1289. label_41:
  1290. while (true) {
  1291. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  1292. case S:
  1293. ;
  1294. break;
  1295. default:
  1296. jj_la1[52] = jj_gen;
  1297. break label_41;
  1298. }
  1299. jj_consume_token(S);
  1300. }
  1301. } catch (ParseException e) {
  1302. addException(e);
  1303. {if (true) return null;}
  1304. }
  1305. if (notNull(t)) {
  1306. CSSNode node = new CSSNode(':' + t.image);
  1307. node.setStartLocation(getStartLocation(start));
  1308. node.setEndLocation(getEndLocation(start));
  1309. {if (true) return node;}
  1310. }
  1311. {if (true) return null;}
  1312. throw new Error("Missing return statement in function");
  1313. }
  1314. final public CSSNode fontFace() throws ParseException {
  1315. Token start = null;
  1316. List<CSSNode> decls = null;
  1317. Token end = null;
  1318. try {
  1319. start = jj_consume_token(FONT_FACE_SYM);
  1320. label_42:
  1321. while (true) {
  1322. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  1323. case S:
  1324. ;
  1325. break;
  1326. default:
  1327. jj_la1[53] = jj_gen;
  1328. break label_42;
  1329. }
  1330. jj_consume_token(S);
  1331. }
  1332. jj_consume_token(LBRACE);
  1333. label_43:
  1334. while (true) {
  1335. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  1336. case S:
  1337. ;
  1338. break;
  1339. default:
  1340. jj_la1[54] = jj_gen;
  1341. break label_43;
  1342. }
  1343. jj_consume_token(S);
  1344. }
  1345. decls = declarations();
  1346. end = jj_consume_token(RBRACE);
  1347. label_44:
  1348. while (true) {
  1349. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  1350. case S:
  1351. ;
  1352. break;
  1353. default:
  1354. jj_la1[55] = jj_gen;
  1355. break label_44;
  1356. }
  1357. jj_consume_token(S);
  1358. }
  1359. } catch (ParseException e) {
  1360. addException(e);
  1361. error_skipto(RBRACE);
  1362. {if (true) return null;}
  1363. }
  1364. if (notNull(start, decls, end)) {
  1365. CSSNode node = new CSSNode(start.image);
  1366. node.addChildren(decls);
  1367. node.setStartLocation(getStartLocation(start));
  1368. node.setEndLocation(getEndLocation(end));
  1369. {if (true) return node;}
  1370. }
  1371. {if (true) return null;}
  1372. throw new Error("Missing return statement in function");
  1373. }
  1374. final public CSSNode colorprofile() throws ParseException {
  1375. Token start = null;
  1376. List<CSSNode> decls = null;
  1377. Token end = null;
  1378. try {
  1379. start = jj_consume_token(COLOR_PROFILE);
  1380. label_45:
  1381. while (true) {
  1382. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  1383. case S:
  1384. ;
  1385. break;
  1386. default:
  1387. jj_la1[56] = jj_gen;
  1388. break label_45;
  1389. }
  1390. jj_consume_token(S);
  1391. }
  1392. jj_consume_token(LBRACE);
  1393. label_46:
  1394. while (true) {
  1395. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  1396. case S:
  1397. ;
  1398. break;
  1399. default:
  1400. jj_la1[57] = jj_gen;
  1401. break label_46;
  1402. }
  1403. jj_consume_token(S);
  1404. }
  1405. decls = declarations();
  1406. end = jj_consume_token(RBRACE);
  1407. label_47:
  1408. while (true) {
  1409. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  1410. case S:
  1411. ;
  1412. break;
  1413. default:
  1414. jj_la1[58] = jj_gen;
  1415. break label_47;
  1416. }
  1417. jj_consume_token(S);
  1418. }
  1419. } catch (ParseException e) {
  1420. addException(e);
  1421. error_skipto(RBRACE);
  1422. {if (true) return null;}
  1423. }
  1424. if (notNull(start, decls, end)) {
  1425. CSSNode node = new CSSNode(start.image);
  1426. node.addChildren(decls);
  1427. node.setStartLocation(getStartLocation(start));
  1428. node.setEndLocation(getEndLocation(end));
  1429. {if (true) return node;}
  1430. }
  1431. {if (true) return null;}
  1432. throw new Error("Missing return statement in function");
  1433. }
  1434. final public CSSNode preference() throws ParseException {
  1435. Token start = null;
  1436. List<CSSNode> decls = null;
  1437. Token end = null;
  1438. try {
  1439. start = jj_consume_token(PREF_SYM);
  1440. label_48:
  1441. while (true) {
  1442. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  1443. case S:
  1444. ;
  1445. break;
  1446. default:
  1447. jj_la1[59] = jj_gen;
  1448. break label_48;
  1449. }
  1450. jj_consume_token(S);
  1451. }
  1452. jj_consume_token(LBRACE);
  1453. label_49:
  1454. while (true) {
  1455. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  1456. case S:
  1457. ;
  1458. break;
  1459. default:
  1460. jj_la1[60] = jj_gen;
  1461. break label_49;
  1462. }
  1463. jj_consume_token(S);
  1464. }
  1465. decls = declarations();
  1466. end = jj_consume_token(RBRACE);
  1467. label_50:
  1468. while (true) {
  1469. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  1470. case S:
  1471. ;
  1472. break;
  1473. default:
  1474. jj_la1[61] = jj_gen;
  1475. break label_50;
  1476. }
  1477. jj_consume_token(S);
  1478. }
  1479. } catch (ParseException e) {
  1480. addException(e);
  1481. error_skipto(RBRACE);
  1482. {if (true) return null;}
  1483. }
  1484. if (notNull(start, decls, end)) {
  1485. CSSNode node = new CSSNode(start.image);
  1486. node.addChildren(decls);
  1487. node.setStartLocation(getStartLocation(start));
  1488. node.setEndLocation(getEndLocation(end));
  1489. {if (true) return node;}
  1490. }
  1491. {if (true) return null;}
  1492. throw new Error("Missing return statement in function");
  1493. }
  1494. final public CSSNode phoneticAlphabet() throws ParseException {
  1495. Token start = null;
  1496. Token middle = null;
  1497. Token end = null;
  1498. try {
  1499. start = jj_consume_token(PHONETIC_ALPHABET_SYM);
  1500. label_51:
  1501. while (true) {
  1502. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  1503. case S:
  1504. ;
  1505. break;
  1506. default:
  1507. jj_la1[62] = jj_gen;
  1508. break label_51;
  1509. }
  1510. jj_consume_token(S);
  1511. }
  1512. middle = jj_consume_token(STRING);
  1513. label_52:
  1514. while (true) {
  1515. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  1516. case S:
  1517. ;
  1518. break;
  1519. default:
  1520. jj_la1[63] = jj_gen;
  1521. break label_52;
  1522. }
  1523. jj_consume_token(S);
  1524. }
  1525. end = jj_consume_token(SEMICOLON);
  1526. } catch (ParseException e) {
  1527. addException(e);
  1528. error_skipto(SEMICOLON);
  1529. {if (true) return null;}
  1530. }
  1531. if (notNull(start, middle, end)) {
  1532. StringBuilder name = new StringBuilder();
  1533. name.append(start.image).append(' ').append(middle.image);
  1534. CSSNode node = new CSSNode(name.toString());
  1535. node.setStartLocation(getStartLocation(start));
  1536. node.setEndLocation(getEndLocation(end));
  1537. {if (true) return node;}
  1538. }
  1539. {if (true) return null;}
  1540. throw new Error("Missing return statement in function");
  1541. }
  1542. final public CSSNode atRuleDeclaration() throws ParseException {
  1543. Token t = null;
  1544. try {
  1545. t = jj_consume_token(ATKEYWORD);
  1546. } catch (ParseException e) {
  1547. addException(e);
  1548. error_skipto(RBRACE);
  1549. {if (true) return null;}
  1550. }
  1551. if (notNull(t)) {
  1552. {if (true) return createNode(t);}
  1553. }
  1554. {if (true) return null;}
  1555. throw new Error("Missing return statement in function");
  1556. }
  1557. final public char operator() throws ParseException {
  1558. char op = ' ';
  1559. try {
  1560. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  1561. case COMMA:
  1562. case DIV:
  1563. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  1564. case DIV:
  1565. jj_consume_token(DIV);
  1566. op = '/';
  1567. break;
  1568. case COMMA:
  1569. jj_consume_token(COMMA);
  1570. op = ',';
  1571. break;
  1572. default:
  1573. jj_la1[64] = jj_gen;
  1574. jj_consume_token(-1);
  1575. throw new ParseException();
  1576. }
  1577. label_53:
  1578. while (true) {
  1579. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  1580. case S:
  1581. ;
  1582. break;
  1583. default:
  1584. jj_la1[65] = jj_gen;
  1585. break label_53;
  1586. }
  1587. jj_consume_token(S);
  1588. }
  1589. break;
  1590. default:
  1591. jj_la1[66] = jj_gen;
  1592. ;
  1593. }
  1594. } catch (ParseException e) {
  1595. addException(e);
  1596. error_skipto(RBRACE);
  1597. {if (true) return op;}
  1598. }
  1599. {if (true) return op;}
  1600. throw new Error("Missing return statement in function");
  1601. }
  1602. final public char combinator() throws ParseException {
  1603. char connector = ' ';
  1604. try {
  1605. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  1606. case PLUS:
  1607. case GREATER:
  1608. case TILDE:
  1609. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  1610. case PLUS:
  1611. jj_consume_token(PLUS);
  1612. connector = '+' ;
  1613. break;
  1614. case GREATER:
  1615. jj_consume_token(GREATER);
  1616. connector = '>' ;
  1617. break;
  1618. case TILDE:
  1619. jj_consume_token(TILDE);
  1620. connector = '~' ;
  1621. break;
  1622. default:
  1623. jj_la1[67] = jj_gen;
  1624. jj_consume_token(-1);
  1625. throw new ParseException();
  1626. }
  1627. label_54:
  1628. while (true) {
  1629. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  1630. case S:
  1631. ;
  1632. break;
  1633. default:
  1634. jj_la1[68] = jj_gen;
  1635. break label_54;
  1636. }
  1637. jj_consume_token(S);
  1638. }
  1639. break;
  1640. case S:
  1641. label_55:
  1642. while (true) {
  1643. jj_consume_token(S);
  1644. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  1645. case S:
  1646. ;
  1647. break;
  1648. default:
  1649. jj_la1[69] = jj_gen;
  1650. break label_55;
  1651. }
  1652. }
  1653. connector = ' ' ;
  1654. break;
  1655. default:
  1656. jj_la1[70] = jj_gen;
  1657. jj_consume_token(-1);
  1658. throw new ParseException();
  1659. }
  1660. } catch (ParseException e) {
  1661. addException(e);
  1662. error_skipto(RBRACE);
  1663. {if (true) return connector;}
  1664. }
  1665. {if (true) return connector;}
  1666. throw new Error("Missing return statement in function");
  1667. }
  1668. final public char unaryOperator() throws ParseException {
  1669. char unary;
  1670. try {
  1671. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  1672. case MINUS:
  1673. jj_consume_token(MINUS);
  1674. unary = '-';
  1675. break;
  1676. case PLUS:
  1677. jj_consume_token(PLUS);
  1678. unary = '+';
  1679. break;
  1680. default:
  1681. jj_la1[71] = jj_gen;
  1682. jj_consume_token(-1);
  1683. throw new ParseException();
  1684. }
  1685. } catch (ParseException e) {
  1686. addException(e);
  1687. error_skipto(RBRACE);
  1688. {if (true) return ' ';}
  1689. }
  1690. {if (true) return unary;}
  1691. throw new Error("Missing return statement in function");
  1692. }
  1693. final public CSSNode property() throws ParseException {
  1694. Token t = null;
  1695. try {
  1696. t = jj_consume_token(IDENT);
  1697. label_56:
  1698. while (true) {
  1699. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  1700. case S:
  1701. ;
  1702. break;
  1703. default:
  1704. jj_la1[72] = jj_gen;
  1705. break label_56;
  1706. }
  1707. jj_consume_token(S);
  1708. }
  1709. } catch (ParseException e) {
  1710. addException(e);
  1711. error_skipto(RBRACE);
  1712. {if (true) return null;}
  1713. }
  1714. if (notNull(t)) {
  1715. if (isUnsupported(t.image)) {
  1716. Range range = new Range( new Location( t.next.beginLine, t.next.beginColumn-1 ), new Location( t.next.endLine, t.next.endColumn ) );
  1717. addWarning(new ParseError(t.image + " is not supported by most browsers.", range));
  1718. }
  1719. {if (true) return createNode(t);}
  1720. }
  1721. {if (true) return null;}
  1722. throw new Error("Missing return statement in function");
  1723. }
  1724. final public CSSNode ruleSet() throws ParseException {
  1725. CSSNode sel = null;
  1726. List<CSSNode> selectors = new ArrayList<CSSNode>();
  1727. List<CSSNode> decls = null;
  1728. Token end = null;
  1729. try {
  1730. sel = selector();
  1731. if (sel != null) selectors.add(sel);
  1732. label_57:
  1733. while (true) {
  1734. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  1735. case COMMA:
  1736. ;
  1737. break;
  1738. default:
  1739. jj_la1[73] = jj_gen;
  1740. break label_57;
  1741. }
  1742. jj_consume_token(COMMA);
  1743. label_58:
  1744. while (true) {
  1745. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  1746. case S:
  1747. ;
  1748. break;
  1749. default:
  1750. jj_la1[74] = jj_gen;
  1751. break label_58;
  1752. }
  1753. jj_consume_token(S);
  1754. }
  1755. sel = selector();
  1756. if (sel != null) selectors.add(sel);
  1757. }
  1758. jj_consume_token(LBRACE);
  1759. label_59:
  1760. while (true) {
  1761. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  1762. case S:
  1763. ;
  1764. break;
  1765. default:
  1766. jj_la1[75] = jj_gen;
  1767. break label_59;
  1768. }
  1769. jj_consume_token(S);
  1770. }
  1771. decls = declarations();
  1772. end = jj_consume_token(RBRACE);
  1773. label_60:
  1774. while (true) {
  1775. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  1776. case S:
  1777. ;
  1778. break;
  1779. default:
  1780. jj_la1[76] = jj_gen;
  1781. break label_60;
  1782. }
  1783. jj_consume_token(S);
  1784. }
  1785. } catch (ParseException e) {
  1786. addException(e);
  1787. error_skipto(RBRACE);
  1788. {if (true) return null;}
  1789. }
  1790. if (selectors.size() > 0 && notNull(decls, end)) {
  1791. StringBuilder sb = new StringBuilder();
  1792. for (CSSNode s : selectors) {
  1793. sb.append(s.getName()).append(',');
  1794. }
  1795. String name = sb.substring(0, Math.max(0, sb.length() - 1));
  1796. CSSNode node = new CSSNode(name);
  1797. node.addChildren(decls);
  1798. node.setStartLocation(selectors.get(0).getStartLocation());
  1799. node.setEndLocation(getEndLocation(end));
  1800. {if (true) return node;}
  1801. }
  1802. {if (true) return null;}
  1803. throw new Error("Missing return statement in function");
  1804. }
  1805. final public List<CSSNode> declarations() throws ParseException {
  1806. CSSNode node = null;
  1807. List<CSSNode> nodes = new ArrayList<CSSNode>();
  1808. Token semi;
  1809. try {
  1810. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  1811. case IDENT:
  1812. node = declaration();
  1813. if (node != null) nodes.add(node);
  1814. break;
  1815. default:
  1816. jj_la1[77] = jj_gen;
  1817. ;
  1818. }
  1819. label_61:
  1820. while (true) {
  1821. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  1822. case SEMICOLON:
  1823. ;
  1824. break;
  1825. default:
  1826. jj_la1[78] = jj_gen;
  1827. break label_61;
  1828. }
  1829. semi = jj_consume_token(SEMICOLON);
  1830. if (node != null) node.setEndLocation(getEndLocation(semi));
  1831. label_62:
  1832. while (true) {
  1833. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  1834. case S:
  1835. ;
  1836. break;
  1837. default:
  1838. jj_la1[79] = jj_gen;
  1839. break label_62;
  1840. }
  1841. jj_consume_token(S);
  1842. }
  1843. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  1844. case IDENT:
  1845. node = declaration();
  1846. if (node != null) nodes.add(node);
  1847. break;
  1848. default:
  1849. jj_la1[80] = jj_gen;
  1850. ;
  1851. }
  1852. }
  1853. } catch (ParseException e) {
  1854. addException(e);
  1855. error_skipto(RBRACE);
  1856. {if (true) return null;}
  1857. }
  1858. {if (true) return nodes;}
  1859. throw new Error("Missing return statement in function");
  1860. }
  1861. final public CSSNode selector() throws ParseException {
  1862. CSSNode node = null;
  1863. List<CSSNode> nodes = new ArrayList<CSSNode>();
  1864. char c;
  1865. List<Character> combs = new ArrayList<Character>();
  1866. try {
  1867. node = simple_selector();
  1868. if(node != null) nodes.add(node);
  1869. label_63:
  1870. while (true) {
  1871. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  1872. case S:
  1873. case PLUS:
  1874. case GREATER:
  1875. case TILDE:
  1876. ;
  1877. break;
  1878. default:
  1879. jj_la1[81] = jj_gen;
  1880. break label_63;
  1881. }
  1882. c = combinator();
  1883. combs.add(c);
  1884. node = simple_selector();
  1885. if(node != null) nodes.add(node);
  1886. }
  1887. } catch (ParseException e) {
  1888. addException(e);
  1889. error_skipto(RBRACE);
  1890. {if (true) return null;}
  1891. }
  1892. if (nodes.size() > 0) {
  1893. StringBuilder sb = new StringBuilder();
  1894. for (int i = 0; i < nodes.size(); i++) {
  1895. sb.append(nodes.get(i).getName());
  1896. if (combs.size() < i) {
  1897. sb.append(combs.get(i));
  1898. }
  1899. }
  1900. node = new CSSNode(sb.toString());
  1901. node.setStartLocation(nodes.get(0).getStartLocation());
  1902. node.setEndLocation(nodes.get(nodes.size() - 1).getEndLocation());
  1903. {if (true) return node;}
  1904. }
  1905. {if (true) return null;}
  1906. throw new Error("Missing return statement in function");
  1907. }
  1908. /**
  1909. * I made this rule to parse a selector from a document. Combinator are avoid.
  1910. * @exception ParseException exception during the parse
  1911. */
  1912. final public CSSNode externalSelector() throws ParseException {
  1913. CSSNode node = null;
  1914. List<CSSNode> nodes = new ArrayList<CSSNode>();
  1915. try {
  1916. node = simple_selector();
  1917. if (node != null) nodes.add(node);
  1918. label_64:
  1919. while (true) {
  1920. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  1921. case S:
  1922. ;
  1923. break;
  1924. default:
  1925. jj_la1[82] = jj_gen;
  1926. break label_64;
  1927. }
  1928. label_65:
  1929. while (true) {
  1930. jj_consume_token(S);
  1931. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  1932. case S:
  1933. ;
  1934. break;
  1935. default:
  1936. jj_la1[83] = jj_gen;
  1937. break label_65;
  1938. }
  1939. }
  1940. node = simple_selector();
  1941. if (node != null) nodes.add(node);
  1942. }
  1943. } catch (ParseException e) {
  1944. addException(e);
  1945. error_skipto(RBRACE);
  1946. {if (true) return null;}
  1947. }
  1948. if (nodes.size() > 0) {
  1949. StringBuilder sb = new StringBuilder();
  1950. for (CSSNode n : nodes) {
  1951. sb.append(n.getName()).append(' ');
  1952. }
  1953. node = new CSSNode();
  1954. node.setName(sb.toString());
  1955. node.setStartLocation(nodes.get(0).getStartLocation());
  1956. node.setEndLocation(nodes.get(nodes.size() - 1).getEndLocation());
  1957. {if (true) return node;}
  1958. }
  1959. {if (true) return null;}
  1960. throw new Error("Missing return statement in function");
  1961. }
  1962. final public CSSNode simple_selector() throws ParseException {
  1963. CSSNode child = null;
  1964. List<CSSNode> children = new ArrayList<CSSNode>();
  1965. try {
  1966. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  1967. case IDENT:
  1968. case ANY:
  1969. case 98:
  1970. child = element_name();
  1971. if (child != null) children.add(child);
  1972. label_66:
  1973. while (true) {
  1974. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  1975. case HASHIDENT:
  1976. case HASH:
  1977. case LBRACKET:
  1978. case COLON:
  1979. case LENGTH:
  1980. case EMS:
  1981. case EXS:
  1982. case ANGLE:
  1983. case TIME:
  1984. case FREQ:
  1985. case RESOLUTION:
  1986. case DIMEN:
  1987. case PSEUDOELEMENT_SYM:
  1988. case CLASS:
  1989. case FUNCTIONNOT:
  1990. ;
  1991. break;
  1992. default:
  1993. jj_la1[84] = jj_gen;
  1994. break label_66;
  1995. }
  1996. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  1997. case HASHIDENT:
  1998. case HASH:
  1999. child = hash();
  2000. if (child != null) children.add(child);
  2001. break;
  2002. case LENGTH:
  2003. case EMS:
  2004. case EXS:
  2005. case ANGLE:
  2006. case TIME:
  2007. case FREQ:
  2008. case RESOLUTION:
  2009. case DIMEN:
  2010. case CLASS:
  2011. child = _class();
  2012. if (child != null) children.add(child);
  2013. break;
  2014. case LBRACKET:
  2015. child = attrib();
  2016. if (child != null) children.add(child);
  2017. break;
  2018. case COLON:
  2019. case PSEUDOELEMENT_SYM:
  2020. child = pseudo();
  2021. if (child != null) children.add(child);
  2022. break;
  2023. case FUNCTIONNOT:
  2024. child = negation();
  2025. if (child != null) children.add(child);
  2026. break;
  2027. default:
  2028. jj_la1[85] = jj_gen;
  2029. jj_consume_token(-1);
  2030. throw new ParseException();
  2031. }
  2032. }
  2033. break;
  2034. case HASHIDENT:
  2035. case HASH:
  2036. case LBRACKET:
  2037. case COLON:
  2038. case LENGTH:
  2039. case EMS:
  2040. case EXS:
  2041. case ANGLE:
  2042. case TIME:
  2043. case FREQ:
  2044. case RESOLUTION:
  2045. case DIMEN:
  2046. case PSEUDOELEMENT_SYM:
  2047. case CLASS:
  2048. case FUNCTIONNOT:
  2049. label_67:
  2050. while (true) {
  2051. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  2052. case HASHIDENT:
  2053. case HASH:
  2054. child = hash();
  2055. if (child != null) children.add(child);
  2056. break;
  2057. case LENGTH:
  2058. case EMS:
  2059. case EXS:
  2060. case ANGLE:
  2061. case TIME:
  2062. case FREQ:
  2063. case RESOLUTION:
  2064. case DIMEN:
  2065. case CLASS:
  2066. child = _class();
  2067. if (child != null) children.add(child);
  2068. break;
  2069. case LBRACKET:
  2070. child = attrib();
  2071. if (child != null) children.add(child);
  2072. break;
  2073. case COLON:
  2074. case PSEUDOELEMENT_SYM:
  2075. child = pseudo();
  2076. if (child != null) children.add(child);
  2077. break;
  2078. case FUNCTIONNOT:
  2079. child = negation();
  2080. if (child != null) children.add(child);
  2081. break;
  2082. default:
  2083. jj_la1[86] = jj_gen;
  2084. jj_consume_token(-1);
  2085. throw new ParseException();
  2086. }
  2087. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  2088. case HASHIDENT:
  2089. case HASH:
  2090. case LBRACKET:
  2091. case COLON:
  2092. case LENGTH:
  2093. case EMS:
  2094. case EXS:
  2095. case ANGLE:
  2096. case TIME:
  2097. case FREQ:
  2098. case RESOLUTION:
  2099. case DIMEN:
  2100. case PSEUDOELEMENT_SYM:
  2101. case CLASS:
  2102. case FUNCTIONNOT:
  2103. ;
  2104. break;
  2105. default:
  2106. jj_la1[87] = jj_gen;
  2107. break label_67;
  2108. }
  2109. }
  2110. break;
  2111. default:
  2112. jj_la1[88] = jj_gen;
  2113. jj_consume_token(-1);
  2114. throw new ParseException();
  2115. }
  2116. } catch (ParseException e) {
  2117. addException(e);
  2118. error_skipto(RBRACE);
  2119. {if (true) return null;}
  2120. }
  2121. if (children.size() > 0) {
  2122. StringBuilder sb = new StringBuilder();
  2123. for (CSSNode c : children) {
  2124. sb.append(c.getName()).append(' ');
  2125. }
  2126. CSSNode node = new CSSNode(sb.toString());
  2127. node.setStartLocation(children.get(0).getStartLocation());
  2128. node.setEndLocation(children.get(children.size() - 1).getEndLocation());
  2129. {if (true) return node;}
  2130. }
  2131. {if (true) return null;}
  2132. throw new Error("Missing return statement in function");
  2133. }
  2134. final public CSSNode _class() throws ParseException {
  2135. Token t = null;
  2136. CSSNode node = null;
  2137. try {
  2138. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  2139. case CLASS:
  2140. t = jj_consume_token(CLASS);
  2141. break;
  2142. case LENGTH:
  2143. case EMS:
  2144. case EXS:
  2145. case ANGLE:
  2146. case TIME:
  2147. case FREQ:
  2148. case RESOLUTION:
  2149. case DIMEN:
  2150. node = deprecated_class();
  2151. break;
  2152. default:
  2153. jj_la1[89] = jj_gen;
  2154. jj_consume_token(-1);
  2155. throw new ParseException();
  2156. }
  2157. } catch (ParseException e) {
  2158. addException(e);
  2159. error_skipto(RBRACE);
  2160. {if (true) return null;}
  2161. }
  2162. if (notNull(t)) {
  2163. {if (true) return createNode(t);}
  2164. }
  2165. else if (notNull(node)) {
  2166. {if (true) return node;}
  2167. }
  2168. {if (true) return null;}
  2169. throw new Error("Missing return statement in function");
  2170. }
  2171. final public CSSNode deprecated_class() throws ParseException {
  2172. Token t = null;
  2173. try {
  2174. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  2175. case LENGTH:
  2176. t = jj_consume_token(LENGTH);
  2177. break;
  2178. case EMS:
  2179. t = jj_consume_token(EMS);
  2180. break;
  2181. case EXS:
  2182. t = jj_consume_token(EXS);
  2183. break;
  2184. case ANGLE:
  2185. t = jj_consume_token(ANGLE);
  2186. break;
  2187. case TIME:
  2188. t = jj_consume_token(TIME);
  2189. break;
  2190. case FREQ:
  2191. t = jj_consume_token(FREQ);
  2192. break;
  2193. case RESOLUTION:
  2194. t = jj_consume_token(RESOLUTION);
  2195. break;
  2196. case DIMEN:
  2197. t = jj_consume_token(DIMEN);
  2198. break;
  2199. default:
  2200. jj_la1[90] = jj_gen;
  2201. jj_consume_token(-1);
  2202. throw new ParseException();
  2203. }
  2204. } catch (ParseException e) {
  2205. addException(e);
  2206. error_skipto(RBRACE);
  2207. {if (true) return null;}
  2208. }
  2209. if (notNull(t)) {
  2210. {if (true) return createNode(t);}
  2211. }
  2212. {if (true) return null;}
  2213. throw new Error("Missing return statement in function");
  2214. }
  2215. final public CSSNode element_name() throws ParseException {
  2216. Token t1 = null;
  2217. Token t2 = null;
  2218. try {
  2219. if (jj_2_1(2)) {
  2220. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  2221. case IDENT:
  2222. case ANY:
  2223. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  2224. case IDENT:
  2225. t1 = jj_consume_token(IDENT);
  2226. break;
  2227. case ANY:
  2228. t1 = jj_consume_token(ANY);
  2229. break;
  2230. default:
  2231. jj_la1[91] = jj_gen;
  2232. jj_consume_token(-1);
  2233. throw new ParseException();
  2234. }
  2235. break;
  2236. default:
  2237. jj_la1[92] = jj_gen;
  2238. ;
  2239. }
  2240. jj_consume_token(98);
  2241. } else {
  2242. ;
  2243. }
  2244. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  2245. case IDENT:
  2246. t2 = jj_consume_token(IDENT);
  2247. break;
  2248. case ANY:
  2249. t2 = jj_consume_token(ANY);
  2250. break;
  2251. default:
  2252. jj_la1[93] = jj_gen;
  2253. jj_consume_token(-1);
  2254. throw new ParseException();
  2255. }
  2256. } catch (ParseException e) {
  2257. addException(e);
  2258. error_skipto(RBRACE);
  2259. {if (true) return null;}
  2260. }
  2261. if (notNull(t2)) {
  2262. StringBuilder sb = new StringBuilder();
  2263. if (notNull(t1)) {
  2264. sb.append(t1.image).append('|');
  2265. }
  2266. sb.append(t2.image);
  2267. CSSNode node = new CSSNode(sb.toString());
  2268. node.setStartLocation(t1 == null ? getStartLocation(t2) : getStartLocation(t1));
  2269. node.setEndLocation(getEndLocation(t2));
  2270. {if (true) return node;}
  2271. }
  2272. {if (true) return null;}
  2273. throw new Error("Missing return statement in function");
  2274. }
  2275. final public CSSNode attrib() throws ParseException {
  2276. Token start = null;
  2277. Token t1 = null;
  2278. Token t2 = null;
  2279. Token t3 = null;
  2280. Token end = null;
  2281. try {
  2282. start = jj_consume_token(LBRACKET);
  2283. label_68:
  2284. while (true) {
  2285. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  2286. case S:
  2287. ;
  2288. break;
  2289. default:
  2290. jj_la1[94] = jj_gen;
  2291. break label_68;
  2292. }
  2293. jj_consume_token(S);
  2294. }
  2295. t1 = jj_consume_token(IDENT);
  2296. label_69:
  2297. while (true) {
  2298. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  2299. case S:
  2300. ;
  2301. break;
  2302. default:
  2303. jj_la1[95] = jj_gen;
  2304. break label_69;
  2305. }
  2306. jj_consume_token(S);
  2307. }
  2308. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  2309. case INCLUDES:
  2310. case DASHMATCH:
  2311. case PREFIXMATCH:
  2312. case SUFFIXMATCH:
  2313. case SUBSTRINGMATCH:
  2314. case EQ:
  2315. switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  2316. case EQ:
  2317. t2 = jj_consume_token(EQ);
  2318. break;
  2319. case INCLUDES:
  2320. t2 = jj_consume_token(INCLUDES);
  2321. break;
  2322. case DASHMATCH:
  2323. t2 = jj_consume_token(DASHMATCH);
  2324. break;
  2325. case PREFIXMATCH:
  2326. t2 = jj_consume_token(PREFIXMATCH);
  2327. break;
  2328. case SUFFIXMATCH:
  2329. t2 = jj_consume_token(SUFFIXMATCH);
  2330. break;
  2331. case SUBSTRINGMATCH:
  2332. t2 = jj_consume_token(SUBSTRINGMATCH);
  2333. break;
  2334. default:
  2335. jj_la1[96] = jj_gen;
  2336. jj_consume_token(-1);
  2337. throw new ParseException();
  2338. }
  2339. label_70:
  2340. while (true) {
  2341. sw