001/* MapCSSParser.java */ 002/* Generated By:JavaCC: Do not edit this line. MapCSSParser.java */ 003package org.openstreetmap.josm.gui.mappaint.mapcss.parsergen; 004 005import java.io.InputStream; 006import java.io.Reader; 007import java.util.ArrayList; 008import java.util.Arrays; 009import java.util.Collections; 010import java.util.List; 011 012import org.openstreetmap.josm.data.preferences.NamedColorProperty; 013import org.openstreetmap.josm.gui.mappaint.Keyword; 014import org.openstreetmap.josm.gui.mappaint.Range; 015import org.openstreetmap.josm.gui.mappaint.mapcss.Condition; 016import org.openstreetmap.josm.gui.mappaint.mapcss.Condition.Context; 017import org.openstreetmap.josm.gui.mappaint.mapcss.ConditionFactory; 018import org.openstreetmap.josm.gui.mappaint.mapcss.ConditionFactory.KeyMatchType; 019import org.openstreetmap.josm.gui.mappaint.mapcss.ConditionFactory.Op; 020import org.openstreetmap.josm.gui.mappaint.mapcss.Declaration; 021import org.openstreetmap.josm.gui.mappaint.mapcss.Expression; 022import org.openstreetmap.josm.gui.mappaint.mapcss.ExpressionFactory; 023import org.openstreetmap.josm.gui.mappaint.mapcss.ExpressionFactory.NullExpression; 024import org.openstreetmap.josm.gui.mappaint.mapcss.Instruction; 025import org.openstreetmap.josm.gui.mappaint.mapcss.LiteralExpression; 026import org.openstreetmap.josm.gui.mappaint.mapcss.MapCSSException; 027import org.openstreetmap.josm.gui.mappaint.mapcss.MapCSSRule; 028import org.openstreetmap.josm.gui.mappaint.mapcss.MapCSSStyleSource; 029import org.openstreetmap.josm.gui.mappaint.mapcss.PlaceholderExpression; 030import org.openstreetmap.josm.gui.mappaint.mapcss.Selector; 031import org.openstreetmap.josm.gui.mappaint.mapcss.Selector.ChildOrParentSelector; 032import org.openstreetmap.josm.gui.mappaint.mapcss.Selector.GeneralSelector; 033import org.openstreetmap.josm.gui.mappaint.mapcss.Selector.LinkSelector; 034import org.openstreetmap.josm.gui.mappaint.mapcss.Subpart; 035import org.openstreetmap.josm.tools.ColorHelper; 036import org.openstreetmap.josm.tools.JosmRuntimeException; 037import org.openstreetmap.josm.tools.Logging; 038import org.openstreetmap.josm.tools.Utils; 039 040/** 041 * MapCSS parser. 042 * 043 * Contains two independent grammars: 044 * (a) the preprocessor and (b) the main mapcss parser. 045 * 046 * The preprocessor handles @supports syntax. 047 * Basically this allows to write one style for different versions of JOSM (or different editors). 048 * When the @supports condition is not fulfilled, it should simply skip over 049 * the whole section and not attempt to parse the possibly unknown 050 * grammar. It preserves whitespace and comments, in order to keep the 051 * line and column numbers in the error messages correct for the second pass. 052 * 053 */ 054public class MapCSSParser implements MapCSSParserConstants { 055 MapCSSStyleSource sheet; 056 StringBuilder sb; 057 int declarationCounter; 058 059 /** 060 * Nicer way to refer to a lexical state. 061 */ 062 public enum LexicalState { 063 /** the preprocessor */ 064 PREPROCESSOR(0), 065 /** the main parser */ 066 DEFAULT(2); 067 068 final int idx; // the integer, which javacc assigns to this state 069 070 LexicalState(int idx) { 071 if (!this.name().equals(MapCSSParserTokenManager.lexStateNames[idx])) { 072 throw new JosmRuntimeException("Wrong name for index " + idx); 073 } 074 this.idx = idx; 075 } 076 } 077 078 /** 079 * Constructor which initializes the parser with a certain lexical state. 080 * @param in input 081 * @param encoding contents encoding 082 * @param initState initial state 083 */ 084 @Deprecated 085 public MapCSSParser(InputStream in, String encoding, LexicalState initState) { 086 this(createTokenManager(in, encoding, initState)); 087 declarationCounter = 0; 088 } 089 090 @Deprecated 091 protected static MapCSSParserTokenManager createTokenManager(InputStream in, String encoding, LexicalState initState) { 092 SimpleCharStream scs; 093 try { 094 scs = new SimpleCharStream(in, encoding, 1, 1); 095 } catch (java.io.UnsupportedEncodingException e) { 096 throw new JosmRuntimeException(e); 097 } 098 return new MapCSSParserTokenManager(scs, initState.idx); 099 } 100 101 /** 102 * Constructor which initializes the parser with a certain lexical state. 103 * @param in input 104 * @param initState initial state 105 */ 106 public MapCSSParser(Reader in, LexicalState initState) { 107 this(createTokenManager(in, initState)); 108 declarationCounter = 0; 109 } 110 111 protected static MapCSSParserTokenManager createTokenManager(Reader in, LexicalState initState) { 112 final SimpleCharStream scs = new SimpleCharStream(in, 1, 1); 113 return new MapCSSParserTokenManager(scs, initState.idx); 114 } 115 116/* 117 * Preprocessor parser definitions: 118 * 119 * <pre> 120 * 121 * {@literal @media} { ... } queries are supported, following http://www.w3.org/TR/css3-mediaqueries/#syntax 122 * 123 * media_query 124 * ___________________________|_______________________________ 125 * | | 126 * {@literal @media} all and (min-josm-version: 7789) and (max-josm-version: 7790), all and (user-agent: xyz) { ... } 127 * |______________________| 128 * | 129 * media_expression 130 * </pre> 131 */ 132 133 134/** 135 * root method for the preprocessor. 136 * @param sheet MapCSS style source 137 * @return result string 138 * @throws ParseException in case of parsing error 139 */ 140 final public String pp_root(MapCSSStyleSource sheet) throws ParseException { 141sb = new StringBuilder(); this.sheet = sheet; 142 pp_black_box(true); 143 jj_consume_token(0); 144{if ("" != null) return sb.toString();} 145 throw new Error("Missing return statement in function"); 146} 147 148/** 149 * Parse any unknown grammar (black box). 150 * 151 * Only stop when "@media" is encountered and keep track of correct number of 152 * opening and closing curly brackets. 153 * 154 * @param write false if this content should be skipped (@pp_media condition is not fulfilled), true otherwise 155 * @throws ParseException in case of parsing error 156 */ 157 final public void pp_black_box(boolean write) throws ParseException {Token t; 158 label_1: 159 while (true) { 160 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 161 case PP_AND: 162 case PP_OR: 163 case PP_NOT: 164 case PP_SUPPORTS: 165 case PP_NEWLINECHAR: 166 case PP_WHITESPACE: 167 case PP_COMMENT_START: 168 case IDENT: 169 case UINT: 170 case STRING: 171 case REGEX: 172 case LBRACE: 173 case LPAR: 174 case RPAR: 175 case COMMA: 176 case COLON: 177 case PP_SOMETHING_ELSE:{ 178 ; 179 break; 180 } 181 default: 182 jj_la1[0] = jj_gen; 183 break label_1; 184 } 185 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 186 case PP_AND: 187 case PP_OR: 188 case PP_NOT: 189 case IDENT: 190 case UINT: 191 case STRING: 192 case REGEX: 193 case LPAR: 194 case RPAR: 195 case COMMA: 196 case COLON: 197 case PP_SOMETHING_ELSE:{ 198 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 199 case PP_AND:{ 200 t = jj_consume_token(PP_AND); 201 break; 202 } 203 case PP_OR:{ 204 t = jj_consume_token(PP_OR); 205 break; 206 } 207 case PP_NOT:{ 208 t = jj_consume_token(PP_NOT); 209 break; 210 } 211 case UINT:{ 212 t = jj_consume_token(UINT); 213 break; 214 } 215 case STRING:{ 216 t = jj_consume_token(STRING); 217 break; 218 } 219 case REGEX:{ 220 t = jj_consume_token(REGEX); 221 break; 222 } 223 case LPAR:{ 224 t = jj_consume_token(LPAR); 225 break; 226 } 227 case RPAR:{ 228 t = jj_consume_token(RPAR); 229 break; 230 } 231 case COMMA:{ 232 t = jj_consume_token(COMMA); 233 break; 234 } 235 case COLON:{ 236 t = jj_consume_token(COLON); 237 break; 238 } 239 case IDENT:{ 240 t = jj_consume_token(IDENT); 241 break; 242 } 243 case PP_SOMETHING_ELSE:{ 244 t = jj_consume_token(PP_SOMETHING_ELSE); 245 break; 246 } 247 default: 248 jj_la1[1] = jj_gen; 249 jj_consume_token(-1); 250 throw new ParseException(); 251 } 252if (write) sb.append(t.image); 253 break; 254 } 255 case PP_NEWLINECHAR: 256 case PP_WHITESPACE: 257 case PP_COMMENT_START:{ 258 pp_w1(); 259 break; 260 } 261 case PP_SUPPORTS:{ 262 pp_supports(!write); 263 break; 264 } 265 case LBRACE:{ 266 t = jj_consume_token(LBRACE); 267if (write) sb.append(t.image); 268 pp_black_box(write); 269 t = jj_consume_token(RBRACE); 270if (write) sb.append(t.image); 271 break; 272 } 273 default: 274 jj_la1[2] = jj_gen; 275 jj_consume_token(-1); 276 throw new ParseException(); 277 } 278 } 279} 280 281/** 282 * Parses an @supports rule. 283 * 284 * @param ignore if the content of this rule should be ignored 285 * (because we are already inside a @supports block that didn't pass) 286 * @throws ParseException in case of parsing error 287 */ 288 final public void pp_supports(boolean ignore) throws ParseException {boolean pass; 289 jj_consume_token(PP_SUPPORTS); 290 pp_w(); 291 pass = pp_supports_condition(); 292 jj_consume_token(LBRACE); 293 pp_black_box(pass && !ignore); 294 jj_consume_token(RBRACE); 295} 296 297/** 298 * Parses the condition of the @supports rule. 299 * 300 * Unlike other parsing rules, grabs trailing whitespace. 301 * @return true, if the condition is fulfilled 302 * @throws ParseException in case of parsing error 303 */ 304 final public boolean pp_supports_condition() throws ParseException {boolean pass; 305 boolean q; 306 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 307 case PP_NOT:{ 308 jj_consume_token(PP_NOT); 309 pp_w(); 310 q = pp_supports_condition_in_parens(); 311pass = !q; 312 pp_w(); 313 break; 314 } 315 default: 316 jj_la1[5] = jj_gen; 317 if (jj_2_1(2147483647)) { 318 pass = pp_supports_condition_in_parens(); 319 pp_w(); 320 label_2: 321 while (true) { 322 jj_consume_token(PP_AND); 323 pp_w(); 324 q = pp_supports_condition_in_parens(); 325pass = pass && q; 326 pp_w(); 327 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 328 case PP_AND:{ 329 ; 330 break; 331 } 332 default: 333 jj_la1[3] = jj_gen; 334 break label_2; 335 } 336 } 337 } else if (jj_2_2(2147483647)) { 338 pass = pp_supports_condition_in_parens(); 339 pp_w(); 340 label_3: 341 while (true) { 342 jj_consume_token(PP_OR); 343 pp_w(); 344 q = pp_supports_condition_in_parens(); 345pass = pass || q; 346 pp_w(); 347 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 348 case PP_OR:{ 349 ; 350 break; 351 } 352 default: 353 jj_la1[4] = jj_gen; 354 break label_3; 355 } 356 } 357 } else { 358 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 359 case LPAR:{ 360 pass = pp_supports_condition_in_parens(); 361 pp_w(); 362 break; 363 } 364 default: 365 jj_la1[6] = jj_gen; 366 jj_consume_token(-1); 367 throw new ParseException(); 368 } 369 } 370 } 371{if ("" != null) return pass;} 372 throw new Error("Missing return statement in function"); 373} 374 375/** 376 * Parses something in parenthesis inside the condition of the @supports rule. 377 * 378 * @return true, if the condition is fulfilled 379 * @throws ParseException in case of parsing error 380 */ 381 final public boolean pp_supports_condition_in_parens() throws ParseException {boolean pass; 382 if (jj_2_3(2147483647)) { 383 pass = pp_supports_declaration_condition(); 384 } else { 385 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 386 case LPAR:{ 387 jj_consume_token(LPAR); 388 pp_w(); 389 pass = pp_supports_condition(); 390 jj_consume_token(RPAR); 391 break; 392 } 393 default: 394 jj_la1[7] = jj_gen; 395 jj_consume_token(-1); 396 throw new ParseException(); 397 } 398 } 399{if ("" != null) return pass;} 400 throw new Error("Missing return statement in function"); 401} 402 403/** 404 * Parse an @supports declaration condition, e. g. a single (key:value) or (key) statement. 405 * 406 * The parsing rule {@link #literal()} from the main mapcss parser is reused here. 407 * 408 * @return true if the condition is fulfilled 409 * @throws ParseException in case of parsing error 410 */ 411 final public boolean pp_supports_declaration_condition() throws ParseException {Token t; 412 String feature; 413 Object val = null; 414 jj_consume_token(LPAR); 415 pp_w(); 416 t = jj_consume_token(IDENT); 417feature = t.image; 418 pp_w(); 419 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 420 case COLON:{ 421 jj_consume_token(COLON); 422 pp_w(); 423 val = literal(); 424 break; 425 } 426 default: 427 jj_la1[8] = jj_gen; 428 ; 429 } 430 jj_consume_token(RPAR); 431{if ("" != null) return this.sheet.evalSupportsDeclCondition(feature, val);} 432 throw new Error("Missing return statement in function"); 433} 434 435 final public void pp_w1() throws ParseException {Token t; 436 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 437 case PP_NEWLINECHAR:{ 438 t = jj_consume_token(PP_NEWLINECHAR); 439sb.append(t.image); 440 break; 441 } 442 case PP_WHITESPACE:{ 443 t = jj_consume_token(PP_WHITESPACE); 444sb.append(t.image); 445 break; 446 } 447 case PP_COMMENT_START:{ 448 t = jj_consume_token(PP_COMMENT_START); 449sb.append(t.image); 450 t = jj_consume_token(PP_COMMENT_END); 451sb.append(t.image); 452 break; 453 } 454 default: 455 jj_la1[9] = jj_gen; 456 jj_consume_token(-1); 457 throw new ParseException(); 458 } 459} 460 461 final public void pp_w() throws ParseException { 462 label_4: 463 while (true) { 464 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 465 case PP_NEWLINECHAR: 466 case PP_WHITESPACE: 467 case PP_COMMENT_START:{ 468 ; 469 break; 470 } 471 default: 472 jj_la1[10] = jj_gen; 473 break label_4; 474 } 475 pp_w1(); 476 } 477} 478 479/* 480 * Parser definition for the main MapCSS parser: 481 * 482 * <pre> 483 * 484 * rule 485 * _______________________|______________________________ 486 * | | 487 * selector declaration 488 * _________|___________________ _________|____________ 489 * | | | | 490 * 491 * way|z11-12[highway=residential] { color: red; width: 3 } 492 * 493 * |_____||___________________| |_________| 494 * | | | 495 * zoom condition instruction 496 * 497 * more general: 498 * 499 * way|z13-[a=b][c=d]::subpart, way|z-3[u=v]:closed::subpart2 { p1 : val; p2 : val; } 500 * 501 * 'val' can be a literal, or an expression like "prop(width, default) + 0.8". 502 * 503 * </pre> 504 */ 505 final public 506int uint() throws ParseException {Token i; 507 i = jj_consume_token(UINT); 508{if ("" != null) return Integer.parseInt(i.image);} 509 throw new Error("Missing return statement in function"); 510} 511 512 final public int int_() throws ParseException {int i; 513 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 514 case MINUS:{ 515 jj_consume_token(MINUS); 516 i = uint(); 517{if ("" != null) return -i;} 518 break; 519 } 520 case UINT:{ 521 i = uint(); 522{if ("" != null) return i;} 523 break; 524 } 525 default: 526 jj_la1[11] = jj_gen; 527 jj_consume_token(-1); 528 throw new ParseException(); 529 } 530 throw new Error("Missing return statement in function"); 531} 532 533 final public float ufloat() throws ParseException {Token f; 534 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 535 case UFLOAT:{ 536 f = jj_consume_token(UFLOAT); 537 break; 538 } 539 case UINT:{ 540 f = jj_consume_token(UINT); 541 break; 542 } 543 default: 544 jj_la1[12] = jj_gen; 545 jj_consume_token(-1); 546 throw new ParseException(); 547 } 548{if ("" != null) return Float.parseFloat(f.image);} 549 throw new Error("Missing return statement in function"); 550} 551 552 final public float float_() throws ParseException {float f; 553 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 554 case MINUS:{ 555 jj_consume_token(MINUS); 556 f = ufloat(); 557{if ("" != null) return -f;} 558 break; 559 } 560 case UINT: 561 case UFLOAT:{ 562 f = ufloat(); 563{if ("" != null) return f;} 564 break; 565 } 566 default: 567 jj_la1[13] = jj_gen; 568 jj_consume_token(-1); 569 throw new ParseException(); 570 } 571 throw new Error("Missing return statement in function"); 572} 573 574 final public String string() throws ParseException {Token t; 575 t = jj_consume_token(STRING); 576{if ("" != null) return t.image.substring(1, t.image.length() - 1).replace("\\\"", "\"").replace("\\\\", "\\");} 577 throw new Error("Missing return statement in function"); 578} 579 580 final public String ident() throws ParseException {Token t; 581 String s; 582 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 583 case IDENT:{ 584 t = jj_consume_token(IDENT); 585 break; 586 } 587 case SET:{ 588 t = jj_consume_token(SET); 589 break; 590 } 591 default: 592 jj_la1[14] = jj_gen; 593 jj_consume_token(-1); 594 throw new ParseException(); 595 } 596{if ("" != null) return t.image;} 597 throw new Error("Missing return statement in function"); 598} 599 600 final public String string_or_ident() throws ParseException {Token t; 601 String s; 602 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 603 case SET: 604 case IDENT:{ 605 s = ident(); 606 break; 607 } 608 case STRING:{ 609 s = string(); 610 break; 611 } 612 default: 613 jj_la1[15] = jj_gen; 614 jj_consume_token(-1); 615 throw new ParseException(); 616 } 617{if ("" != null) return s;} 618 throw new Error("Missing return statement in function"); 619} 620 621 final public String regex() throws ParseException {Token t; 622 t = jj_consume_token(REGEX); 623{if ("" != null) return t.image.substring(1, t.image.length() - 1);} 624 throw new Error("Missing return statement in function"); 625} 626 627/** 628 * white-space 629 * @throws ParseException in case of parsing error 630 */ 631 final public void s() throws ParseException { 632 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 633 case S:{ 634 jj_consume_token(S); 635 break; 636 } 637 default: 638 jj_la1[16] = jj_gen; 639 ; 640 } 641} 642 643/** 644 * mix of white-space and comments 645 * @throws ParseException in case of parsing error 646 */ 647 final public void w() throws ParseException { 648 label_5: 649 while (true) { 650 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 651 case S: 652 case COMMENT_START:{ 653 ; 654 break; 655 } 656 default: 657 jj_la1[17] = jj_gen; 658 break label_5; 659 } 660 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 661 case S:{ 662 jj_consume_token(S); 663 break; 664 } 665 case COMMENT_START:{ 666 jj_consume_token(COMMENT_START); 667 jj_consume_token(COMMENT_END); 668 break; 669 } 670 default: 671 jj_la1[18] = jj_gen; 672 jj_consume_token(-1); 673 throw new ParseException(); 674 } 675 } 676} 677 678/** 679 * comma delimited list of floats (at least 2, all >= 0) 680 * @return list of floats 681 * @throws ParseException in case of parsing error 682 */ 683 final public List<Float> float_array() throws ParseException {float f; 684 List<Float> fs = new ArrayList<Float>(); 685 f = ufloat(); 686fs.add(f); 687 label_6: 688 while (true) { 689 jj_consume_token(COMMA); 690 s(); 691 f = ufloat(); 692fs.add(f); 693 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 694 case COMMA:{ 695 ; 696 break; 697 } 698 default: 699 jj_la1[19] = jj_gen; 700 break label_6; 701 } 702 } 703{if ("" != null) return fs;} 704 throw new Error("Missing return statement in function"); 705} 706 707/** 708 * entry point for the main parser 709 * @param sheet MapCSS style source 710 * @throws ParseException in case of parsing error 711 */ 712 final public void sheet(MapCSSStyleSource sheet) throws ParseException { 713this.sheet = sheet; 714 w(); 715 label_7: 716 while (true) { 717 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 718 case IDENT: 719 case STAR:{ 720 ; 721 break; 722 } 723 default: 724 jj_la1[20] = jj_gen; 725 break label_7; 726 } 727 try { 728 rule(); 729 w(); 730 } catch (MapCSSException mex) { 731Logging.error(mex); 732 error_skipto(RBRACE, mex); 733 w(); 734 } catch (ParseException ex) { 735error_skipto(RBRACE, null); 736 w(); 737 } 738 } 739 jj_consume_token(0); 740} 741 742 final public void rule() throws ParseException {List<Selector> selectors; 743 Declaration decl; 744 selectors = selectors(); 745 decl = declaration(); 746sheet.rules.add(new MapCSSRule(selectors, decl)); 747} 748 749/** Read selectors, make sure that we read all tokens See #17746 */ 750 final public List<Selector> selectors_for_search() throws ParseException {List<Selector> selectors; 751 selectors = selectors(); 752 jj_consume_token(0); 753{if ("" != null) return selectors;} 754 throw new Error("Missing return statement in function"); 755} 756 757 final public List<Selector> selectors() throws ParseException {List<Selector> selectors = new ArrayList<Selector>(); 758 Selector sel; 759 sel = child_selector(); 760selectors.add(sel); 761 label_8: 762 while (true) { 763 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 764 case COMMA:{ 765 ; 766 break; 767 } 768 default: 769 jj_la1[21] = jj_gen; 770 break label_8; 771 } 772 jj_consume_token(COMMA); 773 w(); 774 sel = child_selector(); 775selectors.add(sel); 776 } 777{if ("" != null) return selectors;} 778 throw new Error("Missing return statement in function"); 779} 780 781 final public Selector child_selector() throws ParseException {Selector.ChildOrParentSelectorType type = null; 782 Condition c; 783 List<Condition> conditions = new ArrayList<Condition>(); 784 Selector selLeft; 785 LinkSelector selLink = null; 786 Selector selRight = null; 787 selLeft = selector(); 788 w(); 789 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 790 case IDENT: 791 case STAR: 792 case GREATER: 793 case LESS: 794 case PLUS: 795 case SUBSET_OR_EQUAL: 796 case NOT_SUBSET_OR_EQUAL: 797 case SUPERSET_OR_EQUAL: 798 case NOT_SUPERSET_OR_EQUAL: 799 case CROSSING:{ 800 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 801 case GREATER: 802 case LESS: 803 case PLUS: 804 case SUBSET_OR_EQUAL: 805 case NOT_SUBSET_OR_EQUAL: 806 case SUPERSET_OR_EQUAL: 807 case NOT_SUPERSET_OR_EQUAL: 808 case CROSSING:{ 809 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 810 case GREATER: 811 case LESS: 812 case PLUS:{ 813 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 814 case GREATER:{ 815 jj_consume_token(GREATER); 816type = Selector.ChildOrParentSelectorType.CHILD; 817 break; 818 } 819 case LESS:{ 820 jj_consume_token(LESS); 821type = Selector.ChildOrParentSelectorType.PARENT; 822 break; 823 } 824 case PLUS:{ 825 jj_consume_token(PLUS); 826type = Selector.ChildOrParentSelectorType.SIBLING; 827 break; 828 } 829 default: 830 jj_la1[22] = jj_gen; 831 jj_consume_token(-1); 832 throw new ParseException(); 833 } 834 label_9: 835 while (true) { 836 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 837 case COLON: 838 case LSQUARE: 839 case EXCLAMATION: 840 case FULLSTOP:{ 841 ; 842 break; 843 } 844 default: 845 jj_la1[23] = jj_gen; 846 break label_9; 847 } 848 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 849 case LSQUARE:{ 850 c = condition(Context.LINK); 851 break; 852 } 853 case COLON: 854 case EXCLAMATION: 855 case FULLSTOP:{ 856 c = class_or_pseudoclass(Context.LINK); 857 break; 858 } 859 default: 860 jj_la1[24] = jj_gen; 861 jj_consume_token(-1); 862 throw new ParseException(); 863 } 864if (c!= null) conditions.add(c); 865 } 866 break; 867 } 868 case SUBSET_OR_EQUAL:{ 869 jj_consume_token(SUBSET_OR_EQUAL); 870type = Selector.ChildOrParentSelectorType.SUBSET_OR_EQUAL; 871 break; 872 } 873 case NOT_SUBSET_OR_EQUAL:{ 874 jj_consume_token(NOT_SUBSET_OR_EQUAL); 875type = Selector.ChildOrParentSelectorType.NOT_SUBSET_OR_EQUAL; 876 break; 877 } 878 case SUPERSET_OR_EQUAL:{ 879 jj_consume_token(SUPERSET_OR_EQUAL); 880type = Selector.ChildOrParentSelectorType.SUPERSET_OR_EQUAL; 881 break; 882 } 883 case NOT_SUPERSET_OR_EQUAL:{ 884 jj_consume_token(NOT_SUPERSET_OR_EQUAL); 885type = Selector.ChildOrParentSelectorType.NOT_SUPERSET_OR_EQUAL; 886 break; 887 } 888 case CROSSING:{ 889 jj_consume_token(CROSSING); 890type = Selector.ChildOrParentSelectorType.CROSSING; 891 break; 892 } 893 default: 894 jj_la1[25] = jj_gen; 895 jj_consume_token(-1); 896 throw new ParseException(); 897 } 898 w(); 899 break; 900 } 901 default: 902 jj_la1[26] = jj_gen; 903/* <GREATER> is optional for child selector */ type = Selector.ChildOrParentSelectorType.CHILD; 904 } 905selLink = new LinkSelector(conditions); 906 selRight = selector(); 907 w(); 908 break; 909 } 910 default: 911 jj_la1[27] = jj_gen; 912 ; 913 } 914{if ("" != null) return selRight != null ? new ChildOrParentSelector(selLeft, selLink, selRight, type) : selLeft;} 915 throw new Error("Missing return statement in function"); 916} 917 918 final public Selector selector() throws ParseException {Token base; 919 Condition c; 920 Range r = Range.ZERO_TO_INFINITY; 921 List<Condition> conditions = new ArrayList<Condition>(); 922 Subpart sub = null; 923 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 924 case IDENT:{ 925 base = jj_consume_token(IDENT); 926 break; 927 } 928 case STAR:{ 929 base = jj_consume_token(STAR); 930 break; 931 } 932 default: 933 jj_la1[28] = jj_gen; 934 jj_consume_token(-1); 935 throw new ParseException(); 936 } 937 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 938 case PIPE_Z:{ 939 r = zoom(); 940 break; 941 } 942 default: 943 jj_la1[29] = jj_gen; 944 ; 945 } 946 label_10: 947 while (true) { 948 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 949 case COLON: 950 case LSQUARE: 951 case EXCLAMATION: 952 case FULLSTOP:{ 953 ; 954 break; 955 } 956 default: 957 jj_la1[30] = jj_gen; 958 break label_10; 959 } 960 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 961 case LSQUARE:{ 962 c = condition(Context.PRIMITIVE); 963 break; 964 } 965 case COLON: 966 case EXCLAMATION: 967 case FULLSTOP:{ 968 c = class_or_pseudoclass(Context.PRIMITIVE); 969 break; 970 } 971 default: 972 jj_la1[31] = jj_gen; 973 jj_consume_token(-1); 974 throw new ParseException(); 975 } 976if (c!= null) conditions.add(c); 977 } 978 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 979 case DCOLON:{ 980 sub = subpart(); 981 break; 982 } 983 default: 984 jj_la1[32] = jj_gen; 985 ; 986 } 987{if ("" != null) return new GeneralSelector(base.image, r, conditions, sub);} 988 throw new Error("Missing return statement in function"); 989} 990 991 final public Range zoom() throws ParseException {Integer min = 0; 992 Integer max = Integer.MAX_VALUE; 993 jj_consume_token(PIPE_Z); 994 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 995 case MINUS:{ 996 jj_consume_token(MINUS); 997 max = uint(); 998 break; 999 } 1000 default: 1001 jj_la1[34] = jj_gen; 1002 if (jj_2_4(2)) { 1003 min = uint(); 1004 jj_consume_token(MINUS); 1005 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 1006 case UINT:{ 1007 max = uint(); 1008 break; 1009 } 1010 default: 1011 jj_la1[33] = jj_gen; 1012 ; 1013 } 1014 } else { 1015 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 1016 case UINT:{ 1017 min = uint(); 1018max = min; 1019 break; 1020 } 1021 default: 1022 jj_la1[35] = jj_gen; 1023 jj_consume_token(-1); 1024 throw new ParseException(); 1025 } 1026 } 1027 } 1028{if ("" != null) return GeneralSelector.fromLevel(min, max);} 1029 throw new Error("Missing return statement in function"); 1030} 1031 1032 final public Condition condition(Context context) throws ParseException {Condition c; 1033 Expression e; 1034 jj_consume_token(LSQUARE); 1035 s(); 1036 if (jj_2_5(2147483647)) { 1037 c = simple_key_condition(context); 1038 s(); 1039 jj_consume_token(RSQUARE); 1040{if ("" != null) return c;} 1041 } else if (jj_2_6(2147483647)) { 1042 c = simple_key_value_condition(context); 1043 s(); 1044 jj_consume_token(RSQUARE); 1045{if ("" != null) return c;} 1046 } else { 1047 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 1048 case SET: 1049 case IDENT: 1050 case UINT: 1051 case STRING: 1052 case LPAR: 1053 case UFLOAT: 1054 case HEXCOLOR: 1055 case EXCLAMATION: 1056 case PLUS: 1057 case MINUS:{ 1058 e = expression(); 1059 jj_consume_token(RSQUARE); 1060{if ("" != null) return ConditionFactory.createExpressionCondition(e, context);} 1061 break; 1062 } 1063 default: 1064 jj_la1[36] = jj_gen; 1065 jj_consume_token(-1); 1066 throw new ParseException(); 1067 } 1068 } 1069 throw new Error("Missing return statement in function"); 1070} 1071 1072 final public String tag_key() throws ParseException {String s, s2; 1073 Token t; 1074 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 1075 case STRING:{ 1076 s = string(); 1077{if ("" != null) return s;} 1078 break; 1079 } 1080 case SET: 1081 case IDENT:{ 1082 s = ident(); 1083 label_11: 1084 while (true) { 1085 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 1086 case COLON:{ 1087 ; 1088 break; 1089 } 1090 default: 1091 jj_la1[37] = jj_gen; 1092 break label_11; 1093 } 1094 jj_consume_token(COLON); 1095 s2 = ident(); 1096s += ':' + s2; 1097 } 1098{if ("" != null) return s;} 1099 break; 1100 } 1101 default: 1102 jj_la1[38] = jj_gen; 1103 jj_consume_token(-1); 1104 throw new ParseException(); 1105 } 1106 throw new Error("Missing return statement in function"); 1107} 1108 1109 final public Condition simple_key_condition(Context context) throws ParseException {boolean not = false; 1110 KeyMatchType matchType = null; 1111 String key; 1112 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 1113 case EXCLAMATION:{ 1114 jj_consume_token(EXCLAMATION); 1115not = true; 1116 break; 1117 } 1118 default: 1119 jj_la1[39] = jj_gen; 1120 ; 1121 } 1122 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 1123 case REGEX:{ 1124matchType = KeyMatchType.REGEX; 1125 key = regex(); 1126 break; 1127 } 1128 case SET: 1129 case IDENT: 1130 case STRING:{ 1131 key = tag_key(); 1132 break; 1133 } 1134 default: 1135 jj_la1[40] = jj_gen; 1136 jj_consume_token(-1); 1137 throw new ParseException(); 1138 } 1139 if (jj_2_7(2)) { 1140 jj_consume_token(QUESTION); 1141 jj_consume_token(EXCLAMATION); 1142matchType = KeyMatchType.FALSE; 1143 } else { 1144 ; 1145 } 1146 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 1147 case QUESTION:{ 1148 jj_consume_token(QUESTION); 1149matchType = KeyMatchType.TRUE; 1150 break; 1151 } 1152 default: 1153 jj_la1[41] = jj_gen; 1154 ; 1155 } 1156{if ("" != null) return ConditionFactory.createKeyCondition(key, not, matchType, context);} 1157 throw new Error("Missing return statement in function"); 1158} 1159 1160 final public Condition simple_key_value_condition(Context context) throws ParseException {String key; 1161 String val; 1162 float f; 1163 int i; 1164 KeyMatchType matchType = null; 1165 Op op; 1166 boolean considerValAsKey = false; 1167 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 1168 case REGEX:{ 1169 key = regex(); 1170 s(); 1171matchType = KeyMatchType.REGEX; 1172 break; 1173 } 1174 case SET: 1175 case IDENT: 1176 case STRING:{ 1177 key = tag_key(); 1178 s(); 1179 break; 1180 } 1181 default: 1182 jj_la1[42] = jj_gen; 1183 jj_consume_token(-1); 1184 throw new ParseException(); 1185 } 1186 if (jj_2_9(3)) { 1187 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 1188 case EQUAL:{ 1189 jj_consume_token(EQUAL); 1190 jj_consume_token(TILDE); 1191op=Op.REGEX; 1192 break; 1193 } 1194 case EXCLAMATION:{ 1195 jj_consume_token(EXCLAMATION); 1196 jj_consume_token(TILDE); 1197op=Op.NREGEX; 1198 break; 1199 } 1200 default: 1201 jj_la1[43] = jj_gen; 1202 jj_consume_token(-1); 1203 throw new ParseException(); 1204 } 1205 s(); 1206 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 1207 case STAR:{ 1208 jj_consume_token(STAR); 1209considerValAsKey=true; 1210 break; 1211 } 1212 default: 1213 jj_la1[44] = jj_gen; 1214 ; 1215 } 1216 val = regex(); 1217 } else { 1218 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 1219 case STAR: 1220 case EQUAL: 1221 case EXCLAMATION: 1222 case TILDE: 1223 case DOLLAR: 1224 case CARET:{ 1225 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 1226 case EXCLAMATION:{ 1227 jj_consume_token(EXCLAMATION); 1228 jj_consume_token(EQUAL); 1229op=Op.NEQ; 1230 break; 1231 } 1232 case EQUAL:{ 1233 jj_consume_token(EQUAL); 1234op=Op.EQ; 1235 break; 1236 } 1237 case TILDE:{ 1238 jj_consume_token(TILDE); 1239 jj_consume_token(EQUAL); 1240op=Op.ONE_OF; 1241 break; 1242 } 1243 case CARET:{ 1244 jj_consume_token(CARET); 1245 jj_consume_token(EQUAL); 1246op=Op.BEGINS_WITH; 1247 break; 1248 } 1249 case DOLLAR:{ 1250 jj_consume_token(DOLLAR); 1251 jj_consume_token(EQUAL); 1252op=Op.ENDS_WITH; 1253 break; 1254 } 1255 case STAR:{ 1256 jj_consume_token(STAR); 1257 jj_consume_token(EQUAL); 1258op=Op.CONTAINS; 1259 break; 1260 } 1261 default: 1262 jj_la1[45] = jj_gen; 1263 jj_consume_token(-1); 1264 throw new ParseException(); 1265 } 1266 s(); 1267 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 1268 case STAR:{ 1269 jj_consume_token(STAR); 1270considerValAsKey=true; 1271 break; 1272 } 1273 default: 1274 jj_la1[46] = jj_gen; 1275 ; 1276 } 1277 if (jj_2_8(2)) { 1278 i = int_(); 1279val=Integer.toString(i); 1280 } else { 1281 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 1282 case UINT: 1283 case UFLOAT: 1284 case MINUS:{ 1285 f = float_(); 1286val=Float.toString(f); 1287 break; 1288 } 1289 case SET: 1290 case IDENT: 1291 case STRING:{ 1292 val = string_or_ident(); 1293 break; 1294 } 1295 default: 1296 jj_la1[47] = jj_gen; 1297 jj_consume_token(-1); 1298 throw new ParseException(); 1299 } 1300 } 1301 break; 1302 } 1303 case GREATER_EQUAL: 1304 case LESS_EQUAL: 1305 case GREATER: 1306 case LESS:{ 1307 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 1308 case GREATER_EQUAL:{ 1309 jj_consume_token(GREATER_EQUAL); 1310op=Op.GREATER_OR_EQUAL; 1311 break; 1312 } 1313 case GREATER:{ 1314 jj_consume_token(GREATER); 1315op=Op.GREATER; 1316 break; 1317 } 1318 case LESS_EQUAL:{ 1319 jj_consume_token(LESS_EQUAL); 1320op=Op.LESS_OR_EQUAL; 1321 break; 1322 } 1323 case LESS:{ 1324 jj_consume_token(LESS); 1325op=Op.LESS; 1326 break; 1327 } 1328 default: 1329 jj_la1[48] = jj_gen; 1330 jj_consume_token(-1); 1331 throw new ParseException(); 1332 } 1333 s(); 1334 f = float_(); 1335val=Float.toString(f); 1336 break; 1337 } 1338 default: 1339 jj_la1[49] = jj_gen; 1340 jj_consume_token(-1); 1341 throw new ParseException(); 1342 } 1343 } 1344{if ("" != null) return KeyMatchType.REGEX == matchType 1345 ? ConditionFactory.createRegexpKeyRegexpValueCondition(key, val, op) 1346 : ConditionFactory.createKeyValueCondition(key, val, op, context, considerValAsKey);} 1347 throw new Error("Missing return statement in function"); 1348} 1349 1350 final public Condition class_or_pseudoclass(Context context) throws ParseException {String s; 1351 boolean not = false; 1352 boolean pseudo; 1353 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 1354 case EXCLAMATION:{ 1355 jj_consume_token(EXCLAMATION); 1356not = true; 1357 break; 1358 } 1359 default: 1360 jj_la1[50] = jj_gen; 1361 ; 1362 } 1363 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 1364 case FULLSTOP:{ 1365 jj_consume_token(FULLSTOP); 1366pseudo = false; 1367 break; 1368 } 1369 case COLON:{ 1370 jj_consume_token(COLON); 1371pseudo = true; 1372 break; 1373 } 1374 default: 1375 jj_la1[51] = jj_gen; 1376 jj_consume_token(-1); 1377 throw new ParseException(); 1378 } 1379 s = ident(); 1380if (pseudo && sheet != null && sheet.isRemoveAreaStylePseudoClass() && s.matches("areaStyle|area-style|area_style")) { 1381 Logging.warn("Removing 'areaStyle' pseudo-class. This class is only meant for validator"); 1382 {if ("" != null) return null;} 1383 } else if (pseudo) { 1384 {if ("" != null) return ConditionFactory.createPseudoClassCondition(s, not, context);} 1385 } else { 1386 {if ("" != null) return ConditionFactory.createClassCondition(s, not, context);} 1387 } 1388 throw new Error("Missing return statement in function"); 1389} 1390 1391 final public Subpart subpart() throws ParseException {String s; 1392 Expression e; 1393 jj_consume_token(DCOLON); 1394 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 1395 case SET: 1396 case IDENT:{ 1397 s = ident(); 1398{if ("" != null) return new Subpart.StringSubpart(s);} 1399 break; 1400 } 1401 case STAR:{ 1402 jj_consume_token(STAR); 1403{if ("" != null) return new Subpart.StringSubpart("*");} 1404 break; 1405 } 1406 case LPAR:{ 1407 jj_consume_token(LPAR); 1408 e = expression(); 1409 jj_consume_token(RPAR); 1410{if ("" != null) return new Subpart.ExpressionSubpart(e);} 1411 break; 1412 } 1413 default: 1414 jj_la1[52] = jj_gen; 1415 jj_consume_token(-1); 1416 throw new ParseException(); 1417 } 1418 throw new Error("Missing return statement in function"); 1419} 1420 1421 final public Declaration declaration() throws ParseException {List<Instruction> ins = new ArrayList<Instruction>(); 1422 Instruction i; 1423 Token key; 1424 Object val = null; 1425 jj_consume_token(LBRACE); 1426 w(); 1427 label_12: 1428 while (true) { 1429 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 1430 case SET: 1431 case IDENT: 1432 case MINUS:{ 1433 ; 1434 break; 1435 } 1436 default: 1437 jj_la1[53] = jj_gen; 1438 break label_12; 1439 } 1440 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 1441 case SET:{ 1442 jj_consume_token(SET); 1443 w(); 1444 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 1445 case FULLSTOP:{ 1446 jj_consume_token(FULLSTOP); 1447 break; 1448 } 1449 default: 1450 jj_la1[54] = jj_gen; 1451 ; 1452 } 1453 // specification allows "set .class" to set "class". we also support "set class" 1454 key = jj_consume_token(IDENT); 1455 w(); 1456 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 1457 case EQUAL:{ 1458 jj_consume_token(EQUAL); 1459 val = expression(); 1460 break; 1461 } 1462 default: 1463 jj_la1[55] = jj_gen; 1464 ; 1465 } 1466ins.add(new Instruction.AssignmentInstruction(key.image, val == null ? true : val, true)); 1467 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 1468 case RBRACE:{ 1469 jj_consume_token(RBRACE); 1470{if ("" != null) return new Declaration(ins, declarationCounter++);} 1471 break; 1472 } 1473 case SEMICOLON:{ 1474 jj_consume_token(SEMICOLON); 1475 w(); 1476 break; 1477 } 1478 default: 1479 jj_la1[56] = jj_gen; 1480 jj_consume_token(-1); 1481 throw new ParseException(); 1482 } 1483 break; 1484 } 1485 case MINUS:{ 1486 jj_consume_token(MINUS); 1487 jj_consume_token(IDENT); 1488 w(); 1489 jj_consume_token(COLON); 1490 w(); 1491 expression(); 1492 jj_consume_token(SEMICOLON); 1493 w(); 1494 break; 1495 } 1496 case IDENT:{ 1497 key = jj_consume_token(IDENT); 1498 w(); 1499 jj_consume_token(COLON); 1500 w(); 1501 if (jj_2_10(2147483647)) { 1502 val = float_array(); 1503ins.add(new Instruction.AssignmentInstruction(key.image, val, false)); 1504 w(); 1505 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 1506 case RBRACE:{ 1507 jj_consume_token(RBRACE); 1508{if ("" != null) return new Declaration(ins, declarationCounter++);} 1509 break; 1510 } 1511 case SEMICOLON:{ 1512 jj_consume_token(SEMICOLON); 1513 w(); 1514 break; 1515 } 1516 default: 1517 jj_la1[57] = jj_gen; 1518 jj_consume_token(-1); 1519 throw new ParseException(); 1520 } 1521 } else if (jj_2_11(2147483647)) { 1522 val = expression(); 1523ins.add(new Instruction.AssignmentInstruction(key.image, val, false)); 1524 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 1525 case RBRACE:{ 1526 jj_consume_token(RBRACE); 1527{if ("" != null) return new Declaration(ins, declarationCounter++);} 1528 break; 1529 } 1530 case SEMICOLON:{ 1531 jj_consume_token(SEMICOLON); 1532 w(); 1533 break; 1534 } 1535 default: 1536 jj_la1[58] = jj_gen; 1537 jj_consume_token(-1); 1538 throw new ParseException(); 1539 } 1540 } else { 1541 val = readRaw(); 1542 w(); 1543ins.add(new Instruction.AssignmentInstruction(key.image, val, false)); 1544 } 1545 break; 1546 } 1547 default: 1548 jj_la1[59] = jj_gen; 1549 jj_consume_token(-1); 1550 throw new ParseException(); 1551 } 1552 } 1553 jj_consume_token(RBRACE); 1554{if ("" != null) return new Declaration(ins, declarationCounter++);} 1555 throw new Error("Missing return statement in function"); 1556} 1557 1558/** 1559 * General expression. 1560 * Separate production rule for each level of operator precedence (recursive descent). 1561 */ 1562 final public Expression expression() throws ParseException {Expression e; 1563 e = conditional_expression(); 1564{if ("" != null) return e;} 1565 throw new Error("Missing return statement in function"); 1566} 1567 1568 final public Expression conditional_expression() throws ParseException {Expression e, e1, e2; 1569 String op = null; 1570 e = or_expression(); 1571 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 1572 case QUESTION:{ 1573 jj_consume_token(QUESTION); 1574 w(); 1575 e1 = conditional_expression(); 1576 jj_consume_token(COLON); 1577 w(); 1578 e2 = conditional_expression(); 1579e = ExpressionFactory.createFunctionExpression("cond", Arrays.asList(e, e1, e2)); 1580 break; 1581 } 1582 default: 1583 jj_la1[60] = jj_gen; 1584 ; 1585 } 1586{if ("" != null) return e;} 1587 throw new Error("Missing return statement in function"); 1588} 1589 1590 final public Expression or_expression() throws ParseException {Expression e, e2; 1591 String op = null; 1592 e = and_expression(); 1593 label_13: 1594 while (true) { 1595 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 1596 case PIPE:{ 1597 ; 1598 break; 1599 } 1600 default: 1601 jj_la1[61] = jj_gen; 1602 break label_13; 1603 } 1604 jj_consume_token(PIPE); 1605 jj_consume_token(PIPE); 1606 w(); 1607 e2 = and_expression(); 1608e = ExpressionFactory.createFunctionExpression("or", Arrays.asList(e, e2)); 1609 } 1610{if ("" != null) return e;} 1611 throw new Error("Missing return statement in function"); 1612} 1613 1614 final public Expression and_expression() throws ParseException {Expression e, e2; 1615 String op = null; 1616 e = relational_expression(); 1617 label_14: 1618 while (true) { 1619 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 1620 case AMPERSAND:{ 1621 ; 1622 break; 1623 } 1624 default: 1625 jj_la1[62] = jj_gen; 1626 break label_14; 1627 } 1628 jj_consume_token(AMPERSAND); 1629 jj_consume_token(AMPERSAND); 1630 w(); 1631 e2 = relational_expression(); 1632e = ExpressionFactory.createFunctionExpression("and", Arrays.asList(e, e2)); 1633 } 1634{if ("" != null) return e;} 1635 throw new Error("Missing return statement in function"); 1636} 1637 1638 final public Expression relational_expression() throws ParseException {Expression e, e2; 1639 String op = null; 1640 e = additive_expression(); 1641 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 1642 case GREATER_EQUAL: 1643 case LESS_EQUAL: 1644 case GREATER: 1645 case LESS: 1646 case EQUAL: 1647 case EXCLAMATION:{ 1648 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 1649 case GREATER_EQUAL:{ 1650 jj_consume_token(GREATER_EQUAL); 1651op = "greater_equal"; 1652 break; 1653 } 1654 case LESS_EQUAL:{ 1655 jj_consume_token(LESS_EQUAL); 1656op = "less_equal"; 1657 break; 1658 } 1659 case GREATER:{ 1660 jj_consume_token(GREATER); 1661op = "greater"; 1662 break; 1663 } 1664 case LESS:{ 1665 jj_consume_token(LESS); 1666op = "less"; 1667 break; 1668 } 1669 case EQUAL:{ 1670 jj_consume_token(EQUAL); 1671 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 1672 case EQUAL:{ 1673 jj_consume_token(EQUAL); 1674 break; 1675 } 1676 default: 1677 jj_la1[63] = jj_gen; 1678 ; 1679 } 1680op = "equal"; 1681 break; 1682 } 1683 case EXCLAMATION:{ 1684 jj_consume_token(EXCLAMATION); 1685 jj_consume_token(EQUAL); 1686op = "not_equal"; 1687 break; 1688 } 1689 default: 1690 jj_la1[64] = jj_gen; 1691 jj_consume_token(-1); 1692 throw new ParseException(); 1693 } 1694 w(); 1695 e2 = additive_expression(); 1696e = ExpressionFactory.createFunctionExpression(op, Arrays.asList(e, e2)); 1697 break; 1698 } 1699 default: 1700 jj_la1[65] = jj_gen; 1701 ; 1702 } 1703{if ("" != null) return e;} 1704 throw new Error("Missing return statement in function"); 1705} 1706 1707 final public Expression additive_expression() throws ParseException {Expression e, e2; 1708 String op = null; 1709 e = multiplicative_expression(); 1710 label_15: 1711 while (true) { 1712 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 1713 case PLUS: 1714 case MINUS:{ 1715 ; 1716 break; 1717 } 1718 default: 1719 jj_la1[66] = jj_gen; 1720 break label_15; 1721 } 1722 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 1723 case PLUS:{ 1724 jj_consume_token(PLUS); 1725op = "plus"; 1726 break; 1727 } 1728 case MINUS:{ 1729 jj_consume_token(MINUS); 1730op = "minus"; 1731 break; 1732 } 1733 default: 1734 jj_la1[67] = jj_gen; 1735 jj_consume_token(-1); 1736 throw new ParseException(); 1737 } 1738 w(); 1739 e2 = multiplicative_expression(); 1740e = ExpressionFactory.createFunctionExpression(op, Arrays.asList(e, e2)); 1741 } 1742{if ("" != null) return e;} 1743 throw new Error("Missing return statement in function"); 1744} 1745 1746 final public Expression multiplicative_expression() throws ParseException {Expression e, e2; 1747 String op = null; 1748 e = unary_expression(); 1749 label_16: 1750 while (true) { 1751 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 1752 case STAR: 1753 case SLASH:{ 1754 ; 1755 break; 1756 } 1757 default: 1758 jj_la1[68] = jj_gen; 1759 break label_16; 1760 } 1761 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 1762 case STAR:{ 1763 jj_consume_token(STAR); 1764op = "times"; 1765 break; 1766 } 1767 case SLASH:{ 1768 jj_consume_token(SLASH); 1769op = "divided_by"; 1770 break; 1771 } 1772 default: 1773 jj_la1[69] = jj_gen; 1774 jj_consume_token(-1); 1775 throw new ParseException(); 1776 } 1777 w(); 1778 e2 = unary_expression(); 1779e = ExpressionFactory.createFunctionExpression(op, Arrays.asList(e, e2)); 1780 } 1781{if ("" != null) return e;} 1782 throw new Error("Missing return statement in function"); 1783} 1784 1785 final public Expression unary_expression() throws ParseException {Expression e; 1786 String op = null; 1787 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 1788 case EXCLAMATION: 1789 case MINUS:{ 1790 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 1791 case MINUS:{ 1792 jj_consume_token(MINUS); 1793op = "minus"; 1794 w(); 1795 break; 1796 } 1797 case EXCLAMATION:{ 1798 jj_consume_token(EXCLAMATION); 1799op = "not"; 1800 w(); 1801 break; 1802 } 1803 default: 1804 jj_la1[70] = jj_gen; 1805 jj_consume_token(-1); 1806 throw new ParseException(); 1807 } 1808 break; 1809 } 1810 default: 1811 jj_la1[71] = jj_gen; 1812 ; 1813 } 1814 e = primary(); 1815 w(); 1816if (op == null) 1817 {if ("" != null) return e;} 1818 {if ("" != null) return ExpressionFactory.createFunctionExpression(op, Collections.singletonList(e));} 1819 throw new Error("Missing return statement in function"); 1820} 1821 1822 final public Expression primary() throws ParseException {Expression nested; 1823 Expression fn; 1824 Object lit; 1825 if (jj_2_12(3)) { 1826 // both function and identifier start with an identifier (+ optional whitespace) 1827 fn = function(); 1828{if ("" != null) return fn;} 1829 } else { 1830 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 1831 case SET: 1832 case IDENT: 1833 case UINT: 1834 case STRING: 1835 case UFLOAT: 1836 case HEXCOLOR: 1837 case PLUS:{ 1838 lit = literal(); 1839if (lit == null) 1840 {if ("" != null) return NullExpression.INSTANCE;} 1841 else if (lit instanceof String && PlaceholderExpression.PATTERN_PLACEHOLDER.matcher((String) lit).find()) { 1842 {if ("" != null) return new PlaceholderExpression((String) lit);} 1843 } 1844 {if ("" != null) return new LiteralExpression(lit);} 1845 break; 1846 } 1847 case LPAR:{ 1848 jj_consume_token(LPAR); 1849 w(); 1850 nested = expression(); 1851 jj_consume_token(RPAR); 1852{if ("" != null) return nested;} 1853 break; 1854 } 1855 default: 1856 jj_la1[72] = jj_gen; 1857 jj_consume_token(-1); 1858 throw new ParseException(); 1859 } 1860 } 1861 throw new Error("Missing return statement in function"); 1862} 1863 1864 final public Expression function() throws ParseException {Expression arg; 1865 String name; 1866 List<Expression> args = new ArrayList<Expression>(); 1867 name = ident(); 1868 w(); 1869 jj_consume_token(LPAR); 1870 w(); 1871 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 1872 case SET: 1873 case IDENT: 1874 case UINT: 1875 case STRING: 1876 case LPAR: 1877 case UFLOAT: 1878 case HEXCOLOR: 1879 case EXCLAMATION: 1880 case PLUS: 1881 case MINUS:{ 1882 arg = expression(); 1883args.add(arg); 1884 label_17: 1885 while (true) { 1886 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 1887 case COMMA:{ 1888 ; 1889 break; 1890 } 1891 default: 1892 jj_la1[73] = jj_gen; 1893 break label_17; 1894 } 1895 jj_consume_token(COMMA); 1896 w(); 1897 arg = expression(); 1898args.add(arg); 1899 } 1900 break; 1901 } 1902 default: 1903 jj_la1[74] = jj_gen; 1904 ; 1905 } 1906 jj_consume_token(RPAR); 1907{if ("" != null) return ExpressionFactory.createFunctionExpression(name, args);} 1908 throw new Error("Missing return statement in function"); 1909} 1910 1911 final public Object literal() throws ParseException {String val, pref; 1912 Token t; 1913 Float f; 1914 if (jj_2_13(2)) { 1915 pref = ident(); 1916 t = jj_consume_token(HEXCOLOR); 1917{if ("" != null) return new NamedColorProperty( 1918 NamedColorProperty.COLOR_CATEGORY_MAPPAINT, 1919 sheet == null ? "MapCSS" : sheet.title, pref, 1920 ColorHelper.html2color(t.image)).get();} 1921 } else { 1922 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 1923 case IDENT:{ 1924 t = jj_consume_token(IDENT); 1925{if ("" != null) return new Keyword(t.image);} 1926 break; 1927 } 1928 case STRING:{ 1929 val = string(); 1930{if ("" != null) return val;} 1931 break; 1932 } 1933 case PLUS:{ 1934 jj_consume_token(PLUS); 1935 f = ufloat(); 1936{if ("" != null) return new Instruction.RelativeFloat(f);} 1937 break; 1938 } 1939 default: 1940 jj_la1[75] = jj_gen; 1941 if (jj_2_14(2)) { 1942 f = ufloat_unit(); 1943{if ("" != null) return f;} 1944 } else { 1945 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 1946 case UINT: 1947 case UFLOAT:{ 1948 f = ufloat(); 1949{if ("" != null) return f;} 1950 break; 1951 } 1952 case HEXCOLOR:{ 1953 t = jj_consume_token(HEXCOLOR); 1954{if ("" != null) return ColorHelper.html2color(t.image);} 1955 break; 1956 } 1957 default: 1958 jj_la1[76] = jj_gen; 1959 jj_consume_token(-1); 1960 throw new ParseException(); 1961 } 1962 } 1963 } 1964 } 1965 throw new Error("Missing return statement in function"); 1966} 1967 1968/** 1969 * Number followed by a unit. 1970 * 1971 * Returns angles in radians and lengths in pixels. 1972 */ 1973 final public Float ufloat_unit() throws ParseException {float f; 1974 String u; 1975 f = ufloat(); 1976 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 1977 case SET: 1978 case IDENT:{ 1979 u = ident(); 1980 break; 1981 } 1982 case DEG:{ 1983 jj_consume_token(DEG); 1984u = "\u00b0"; 1985 break; 1986 } 1987 case PERCENT:{ 1988 jj_consume_token(PERCENT); 1989u = "%"; 1990 break; 1991 } 1992 default: 1993 jj_la1[77] = jj_gen; 1994 jj_consume_token(-1); 1995 throw new ParseException(); 1996 } 1997Double m = unit_factor(u); 1998 if (m == null) 1999 {if ("" != null) return null;} 2000 {if ("" != null) return (float) (f * m);} 2001 throw new Error("Missing return statement in function"); 2002} 2003 2004 private Double unit_factor(String unit) throws ParseException {switch (unit) { 2005 case "deg": 2006 case "\u00b0": return Math.PI / 180; 2007 case "rad": return 1.; 2008 case "grad": return Math.PI / 200; 2009 case "turn": return 2 * Math.PI; 2010 case "%": return 0.01; 2011 case "px": return 1.; 2012 case "cm": return 96/2.54; 2013 case "mm": return 9.6/2.54; 2014 case "in": return 96.; 2015 case "q": return 2.4/2.54; 2016 case "pc": return 16.; 2017 case "pt": return 96./72; 2018 default: return null; 2019 } 2020 } 2021 2022 void error_skipto(int kind, MapCSSException me) throws ParseException {if (token.kind == EOF) 2023 throw new ParseException("Reached end of file while parsing"); 2024 2025 Exception e = null; 2026 ParseException pe = generateParseException(); 2027 2028 if (me != null) { 2029 final Token token = Utils.firstNonNull(pe.currentToken.next, pe.currentToken); 2030 me.setLine(token.beginLine); 2031 me.setColumn(token.beginColumn); 2032 e = me; 2033 } else { 2034 e = new ParseException(pe.getMessage()); // prevent memory leak 2035 } 2036 2037 Logging.error("Skipping to the next rule, because of an error: " + e); 2038 if (sheet != null) { 2039 sheet.logError(e); 2040 } 2041 Token t; 2042 do { 2043 t = getNextToken(); 2044 } while (t.kind != kind && t.kind != EOF); 2045 if (t.kind == EOF) 2046 throw new ParseException("Reached end of file while parsing"); 2047 } 2048 2049/** 2050 * read everything to the next semicolon 2051 */ 2052 String readRaw() throws ParseException {Token t; 2053 StringBuilder s = new StringBuilder(); 2054 while (true) { 2055 t = getNextToken(); 2056 if ((t.kind == S || t.kind == STRING || t.kind == UNEXPECTED_CHAR) && 2057 t.image.contains("\n")) { 2058 ParseException e = new ParseException(String.format("Warning: end of line while reading an unquoted string at line %s column %s.", t.beginLine, t.beginColumn)); 2059 Logging.error(e); 2060 if (sheet != null) { 2061 sheet.logError(e); 2062 } 2063 } 2064 if (t.kind == SEMICOLON || t.kind == EOF) 2065 break; 2066 s.append(t.image); 2067 } 2068 if (t.kind == EOF) 2069 throw new ParseException("Reached end of file while parsing"); 2070 return s.toString(); 2071 } 2072 2073 private boolean jj_2_1(int xla) 2074 { 2075 jj_la = xla; jj_lastpos = jj_scanpos = token; 2076 try { return (!jj_3_1()); } 2077 catch(LookaheadSuccess ls) { return true; } 2078 finally { jj_save(0, xla); } 2079 } 2080 2081 private boolean jj_2_2(int xla) 2082 { 2083 jj_la = xla; jj_lastpos = jj_scanpos = token; 2084 try { return (!jj_3_2()); } 2085 catch(LookaheadSuccess ls) { return true; } 2086 finally { jj_save(1, xla); } 2087 } 2088 2089 private boolean jj_2_3(int xla) 2090 { 2091 jj_la = xla; jj_lastpos = jj_scanpos = token; 2092 try { return (!jj_3_3()); } 2093 catch(LookaheadSuccess ls) { return true; } 2094 finally { jj_save(2, xla); } 2095 } 2096 2097 private boolean jj_2_4(int xla) 2098 { 2099 jj_la = xla; jj_lastpos = jj_scanpos = token; 2100 try { return (!jj_3_4()); } 2101 catch(LookaheadSuccess ls) { return true; } 2102 finally { jj_save(3, xla); } 2103 } 2104 2105 private boolean jj_2_5(int xla) 2106 { 2107 jj_la = xla; jj_lastpos = jj_scanpos = token; 2108 try { return (!jj_3_5()); } 2109 catch(LookaheadSuccess ls) { return true; } 2110 finally { jj_save(4, xla); } 2111 } 2112 2113 private boolean jj_2_6(int xla) 2114 { 2115 jj_la = xla; jj_lastpos = jj_scanpos = token; 2116 try { return (!jj_3_6()); } 2117 catch(LookaheadSuccess ls) { return true; } 2118 finally { jj_save(5, xla); } 2119 } 2120 2121 private boolean jj_2_7(int xla) 2122 { 2123 jj_la = xla; jj_lastpos = jj_scanpos = token; 2124 try { return (!jj_3_7()); } 2125 catch(LookaheadSuccess ls) { return true; } 2126 finally { jj_save(6, xla); } 2127 } 2128 2129 private boolean jj_2_8(int xla) 2130 { 2131 jj_la = xla; jj_lastpos = jj_scanpos = token; 2132 try { return (!jj_3_8()); } 2133 catch(LookaheadSuccess ls) { return true; } 2134 finally { jj_save(7, xla); } 2135 } 2136 2137 private boolean jj_2_9(int xla) 2138 { 2139 jj_la = xla; jj_lastpos = jj_scanpos = token; 2140 try { return (!jj_3_9()); } 2141 catch(LookaheadSuccess ls) { return true; } 2142 finally { jj_save(8, xla); } 2143 } 2144 2145 private boolean jj_2_10(int xla) 2146 { 2147 jj_la = xla; jj_lastpos = jj_scanpos = token; 2148 try { return (!jj_3_10()); } 2149 catch(LookaheadSuccess ls) { return true; } 2150 finally { jj_save(9, xla); } 2151 } 2152 2153 private boolean jj_2_11(int xla) 2154 { 2155 jj_la = xla; jj_lastpos = jj_scanpos = token; 2156 try { return (!jj_3_11()); } 2157 catch(LookaheadSuccess ls) { return true; } 2158 finally { jj_save(10, xla); } 2159 } 2160 2161 private boolean jj_2_12(int xla) 2162 { 2163 jj_la = xla; jj_lastpos = jj_scanpos = token; 2164 try { return (!jj_3_12()); } 2165 catch(LookaheadSuccess ls) { return true; } 2166 finally { jj_save(11, xla); } 2167 } 2168 2169 private boolean jj_2_13(int xla) 2170 { 2171 jj_la = xla; jj_lastpos = jj_scanpos = token; 2172 try { return (!jj_3_13()); } 2173 catch(LookaheadSuccess ls) { return true; } 2174 finally { jj_save(12, xla); } 2175 } 2176 2177 private boolean jj_2_14(int xla) 2178 { 2179 jj_la = xla; jj_lastpos = jj_scanpos = token; 2180 try { return (!jj_3_14()); } 2181 catch(LookaheadSuccess ls) { return true; } 2182 finally { jj_save(13, xla); } 2183 } 2184 2185 private boolean jj_3R_and_expression_943_9_105() 2186 { 2187 if (jj_scan_token(AMPERSAND)) return true; 2188 if (jj_scan_token(AMPERSAND)) return true; 2189 if (jj_3R_w_518_5_31()) return true; 2190 if (jj_3R_relational_expression_960_5_104()) return true; 2191 return false; 2192 } 2193 2194 private boolean jj_3R_ufloat_unit_1123_18_55() 2195 { 2196 if (jj_3R_ident_478_5_34()) return true; 2197 return false; 2198 } 2199 2200 private boolean jj_3_3() 2201 { 2202 if (jj_3R_pp_supports_declaration_condition_380_5_20()) return true; 2203 return false; 2204 } 2205 2206 private boolean jj_3R_and_expression_941_5_96() 2207 { 2208 if (jj_3R_relational_expression_960_5_104()) return true; 2209 Token xsp; 2210 while (true) { 2211 xsp = jj_scanpos; 2212 if (jj_3R_and_expression_943_9_105()) { jj_scanpos = xsp; break; } 2213 } 2214 return false; 2215 } 2216 2217 private boolean jj_3_9() 2218 { 2219 Token xsp; 2220 xsp = jj_scanpos; 2221 if (jj_3R_simple_key_value_condition_748_21_26()) { 2222 jj_scanpos = xsp; 2223 if (jj_3R_simple_key_value_condition_750_21_27()) return true; 2224 } 2225 if (jj_3R_s_507_5_23()) return true; 2226 xsp = jj_scanpos; 2227 if (jj_3R_simple_key_value_condition_753_15_28()) jj_scanpos = xsp; 2228 if (jj_3R_regex_495_5_29()) return true; 2229 return false; 2230 } 2231 2232 private boolean jj_3R_simple_key_value_condition_743_9_45() 2233 { 2234 if (jj_3R_tag_key_706_9_61()) return true; 2235 if (jj_3R_s_507_5_23()) return true; 2236 return false; 2237 } 2238 2239 private boolean jj_3R_pp_supports_condition_in_parens_360_9_37() 2240 { 2241 if (jj_scan_token(LPAR)) return true; 2242 if (jj_3R_pp_w_400_2_19()) return true; 2243 if (jj_3R_pp_supports_condition_329_5_58()) return true; 2244 if (jj_scan_token(RPAR)) return true; 2245 return false; 2246 } 2247 2248 private boolean jj_3R_simple_key_value_condition_741_9_44() 2249 { 2250 if (jj_3R_regex_495_5_29()) return true; 2251 if (jj_3R_s_507_5_23()) return true; 2252 return false; 2253 } 2254 2255 private boolean jj_3R_pp_supports_condition_in_parens_357_9_36() 2256 { 2257 if (jj_3R_pp_supports_declaration_condition_380_5_20()) return true; 2258 return false; 2259 } 2260 2261 private boolean jj_3R_ufloat_unit_1123_5_35() 2262 { 2263 if (jj_3R_ufloat_451_5_50()) return true; 2264 Token xsp; 2265 xsp = jj_scanpos; 2266 if (jj_3R_ufloat_unit_1123_18_55()) { 2267 jj_scanpos = xsp; 2268 if (jj_3R_ufloat_unit_1123_30_56()) { 2269 jj_scanpos = xsp; 2270 if (jj_3R_ufloat_unit_1123_51_57()) return true; 2271 } 2272 } 2273 return false; 2274 } 2275 2276 private boolean jj_3R_simple_key_value_condition_740_5_24() 2277 { 2278 Token xsp; 2279 xsp = jj_scanpos; 2280 if (jj_3R_simple_key_value_condition_741_9_44()) { 2281 jj_scanpos = xsp; 2282 if (jj_3R_simple_key_value_condition_743_9_45()) return true; 2283 } 2284 xsp = jj_scanpos; 2285 if (jj_3_9()) { 2286 jj_scanpos = xsp; 2287 if (jj_3R_simple_key_value_condition_756_13_46()) { 2288 jj_scanpos = xsp; 2289 if (jj_3R_simple_key_value_condition_780_13_47()) return true; 2290 } 2291 } 2292 return false; 2293 } 2294 2295 private boolean jj_3R_simple_key_condition_725_20_43() 2296 { 2297 if (jj_scan_token(QUESTION)) return true; 2298 return false; 2299 } 2300 2301 private boolean jj_3R_pp_supports_condition_in_parens_356_5_18() 2302 { 2303 Token xsp; 2304 xsp = jj_scanpos; 2305 if (jj_3R_pp_supports_condition_in_parens_357_9_36()) { 2306 jj_scanpos = xsp; 2307 if (jj_3R_pp_supports_condition_in_parens_360_9_37()) return true; 2308 } 2309 return false; 2310 } 2311 2312 private boolean jj_3R_or_expression_924_9_97() 2313 { 2314 if (jj_scan_token(PIPE)) return true; 2315 if (jj_scan_token(PIPE)) return true; 2316 if (jj_3R_w_518_5_31()) return true; 2317 if (jj_3R_and_expression_941_5_96()) return true; 2318 return false; 2319 } 2320 2321 private boolean jj_3_2() 2322 { 2323 if (jj_3R_pp_supports_condition_in_parens_356_5_18()) return true; 2324 if (jj_3R_pp_w_400_2_19()) return true; 2325 if (jj_scan_token(PP_OR)) return true; 2326 return false; 2327 } 2328 2329 private boolean jj_3R_literal_1109_9_90() 2330 { 2331 if (jj_scan_token(HEXCOLOR)) return true; 2332 return false; 2333 } 2334 2335 private boolean jj_3R_or_expression_922_5_77() 2336 { 2337 if (jj_3R_and_expression_941_5_96()) return true; 2338 Token xsp; 2339 while (true) { 2340 xsp = jj_scanpos; 2341 if (jj_3R_or_expression_924_9_97()) { jj_scanpos = xsp; break; } 2342 } 2343 return false; 2344 } 2345 2346 private boolean jj_3R_literal_1107_9_89() 2347 { 2348 if (jj_3R_ufloat_451_5_50()) return true; 2349 return false; 2350 } 2351 2352 private boolean jj_3R_float_array_534_9_51() 2353 { 2354 if (jj_scan_token(COMMA)) return true; 2355 if (jj_3R_s_507_5_23()) return true; 2356 if (jj_3R_ufloat_451_5_50()) return true; 2357 return false; 2358 } 2359 2360 private boolean jj_3_1() 2361 { 2362 if (jj_3R_pp_supports_condition_in_parens_356_5_18()) return true; 2363 if (jj_3R_pp_w_400_2_19()) return true; 2364 if (jj_scan_token(PP_AND)) return true; 2365 return false; 2366 } 2367 2368 private boolean jj_3R_pp_supports_condition_338_11_99() 2369 { 2370 if (jj_scan_token(PP_OR)) return true; 2371 if (jj_3R_pp_w_400_2_19()) return true; 2372 if (jj_3R_pp_supports_condition_in_parens_356_5_18()) return true; 2373 if (jj_3R_pp_w_400_2_19()) return true; 2374 return false; 2375 } 2376 2377 private boolean jj_3R_pp_supports_condition_340_9_82() 2378 { 2379 if (jj_3R_pp_supports_condition_in_parens_356_5_18()) return true; 2380 if (jj_3R_pp_w_400_2_19()) return true; 2381 return false; 2382 } 2383 2384 private boolean jj_3_7() 2385 { 2386 if (jj_scan_token(QUESTION)) return true; 2387 if (jj_scan_token(EXCLAMATION)) return true; 2388 return false; 2389 } 2390 2391 private boolean jj_3R_simple_key_condition_722_9_42() 2392 { 2393 if (jj_3R_tag_key_706_9_61()) return true; 2394 return false; 2395 } 2396 2397 private boolean jj_3_14() 2398 { 2399 if (jj_3R_ufloat_unit_1123_5_35()) return true; 2400 return false; 2401 } 2402 2403 private boolean jj_3R_tag_key_708_21_101() 2404 { 2405 if (jj_scan_token(COLON)) return true; 2406 if (jj_3R_ident_478_5_34()) return true; 2407 return false; 2408 } 2409 2410 private boolean jj_3R_literal_1102_9_88() 2411 { 2412 if (jj_scan_token(PLUS)) return true; 2413 if (jj_3R_ufloat_451_5_50()) return true; 2414 return false; 2415 } 2416 2417 private boolean jj_3R_simple_key_condition_720_9_41() 2418 { 2419 if (jj_3R_regex_495_5_29()) return true; 2420 return false; 2421 } 2422 2423 private boolean jj_3R_float_array_532_5_30() 2424 { 2425 if (jj_3R_ufloat_451_5_50()) return true; 2426 Token xsp; 2427 if (jj_3R_float_array_534_9_51()) return true; 2428 while (true) { 2429 xsp = jj_scanpos; 2430 if (jj_3R_float_array_534_9_51()) { jj_scanpos = xsp; break; } 2431 } 2432 return false; 2433 } 2434 2435 private boolean jj_3R_pp_supports_condition_334_11_98() 2436 { 2437 if (jj_scan_token(PP_AND)) return true; 2438 if (jj_3R_pp_w_400_2_19()) return true; 2439 if (jj_3R_pp_supports_condition_in_parens_356_5_18()) return true; 2440 if (jj_3R_pp_w_400_2_19()) return true; 2441 return false; 2442 } 2443 2444 private boolean jj_3R_literal_1100_9_87() 2445 { 2446 if (jj_3R_string_468_5_100()) return true; 2447 return false; 2448 } 2449 2450 private boolean jj_3R_pp_supports_condition_336_9_81() 2451 { 2452 if (jj_3R_pp_supports_condition_in_parens_356_5_18()) return true; 2453 if (jj_3R_pp_w_400_2_19()) return true; 2454 Token xsp; 2455 if (jj_3R_pp_supports_condition_338_11_99()) return true; 2456 while (true) { 2457 xsp = jj_scanpos; 2458 if (jj_3R_pp_supports_condition_338_11_99()) { jj_scanpos = xsp; break; } 2459 } 2460 return false; 2461 } 2462 2463 private boolean jj_3R_literal_1098_9_86() 2464 { 2465 if (jj_scan_token(IDENT)) return true; 2466 return false; 2467 } 2468 2469 private boolean jj_3R_simple_key_condition_718_7_40() 2470 { 2471 if (jj_scan_token(EXCLAMATION)) return true; 2472 return false; 2473 } 2474 2475 private boolean jj_3R_pp_supports_condition_332_9_80() 2476 { 2477 if (jj_3R_pp_supports_condition_in_parens_356_5_18()) return true; 2478 if (jj_3R_pp_w_400_2_19()) return true; 2479 Token xsp; 2480 if (jj_3R_pp_supports_condition_334_11_98()) return true; 2481 while (true) { 2482 xsp = jj_scanpos; 2483 if (jj_3R_pp_supports_condition_334_11_98()) { jj_scanpos = xsp; break; } 2484 } 2485 return false; 2486 } 2487 2488 private boolean jj_3R_simple_key_condition_718_5_22() 2489 { 2490 Token xsp; 2491 xsp = jj_scanpos; 2492 if (jj_3R_simple_key_condition_718_7_40()) jj_scanpos = xsp; 2493 xsp = jj_scanpos; 2494 if (jj_3R_simple_key_condition_720_9_41()) { 2495 jj_scanpos = xsp; 2496 if (jj_3R_simple_key_condition_722_9_42()) return true; 2497 } 2498 xsp = jj_scanpos; 2499 if (jj_3_7()) jj_scanpos = xsp; 2500 xsp = jj_scanpos; 2501 if (jj_3R_simple_key_condition_725_20_43()) jj_scanpos = xsp; 2502 return false; 2503 } 2504 2505 private boolean jj_3R_w_518_13_76() 2506 { 2507 if (jj_scan_token(COMMENT_START)) return true; 2508 if (jj_scan_token(COMMENT_END)) return true; 2509 return false; 2510 } 2511 2512 private boolean jj_3R_pp_supports_condition_330_9_79() 2513 { 2514 if (jj_scan_token(PP_NOT)) return true; 2515 if (jj_3R_pp_w_400_2_19()) return true; 2516 if (jj_3R_pp_supports_condition_in_parens_356_5_18()) return true; 2517 if (jj_3R_pp_w_400_2_19()) return true; 2518 return false; 2519 } 2520 2521 private boolean jj_3R_conditional_expression_903_9_78() 2522 { 2523 if (jj_scan_token(QUESTION)) return true; 2524 if (jj_3R_w_518_5_31()) return true; 2525 if (jj_3R_conditional_expression_901_5_53()) return true; 2526 if (jj_scan_token(COLON)) return true; 2527 if (jj_3R_w_518_5_31()) return true; 2528 if (jj_3R_conditional_expression_901_5_53()) return true; 2529 return false; 2530 } 2531 2532 private boolean jj_3R_tag_key_708_9_92() 2533 { 2534 if (jj_3R_ident_478_5_34()) return true; 2535 Token xsp; 2536 while (true) { 2537 xsp = jj_scanpos; 2538 if (jj_3R_tag_key_708_21_101()) { jj_scanpos = xsp; break; } 2539 } 2540 return false; 2541 } 2542 2543 private boolean jj_3R_pp_supports_condition_329_5_58() 2544 { 2545 Token xsp; 2546 xsp = jj_scanpos; 2547 if (jj_3R_pp_supports_condition_330_9_79()) { 2548 jj_scanpos = xsp; 2549 if (jj_3R_pp_supports_condition_332_9_80()) { 2550 jj_scanpos = xsp; 2551 if (jj_3R_pp_supports_condition_336_9_81()) { 2552 jj_scanpos = xsp; 2553 if (jj_3R_pp_supports_condition_340_9_82()) return true; 2554 } 2555 } 2556 } 2557 return false; 2558 } 2559 2560 private boolean jj_3R_w_518_7_52() 2561 { 2562 Token xsp; 2563 xsp = jj_scanpos; 2564 if (jj_scan_token(27)) { 2565 jj_scanpos = xsp; 2566 if (jj_3R_w_518_13_76()) return true; 2567 } 2568 return false; 2569 } 2570 2571 private boolean jj_3_13() 2572 { 2573 if (jj_3R_ident_478_5_34()) return true; 2574 if (jj_scan_token(HEXCOLOR)) return true; 2575 return false; 2576 } 2577 2578 private boolean jj_3R_literal_1089_9_60() 2579 { 2580 Token xsp; 2581 xsp = jj_scanpos; 2582 if (jj_3_13()) { 2583 jj_scanpos = xsp; 2584 if (jj_3R_literal_1098_9_86()) { 2585 jj_scanpos = xsp; 2586 if (jj_3R_literal_1100_9_87()) { 2587 jj_scanpos = xsp; 2588 if (jj_3R_literal_1102_9_88()) { 2589 jj_scanpos = xsp; 2590 if (jj_3_14()) { 2591 jj_scanpos = xsp; 2592 if (jj_3R_literal_1107_9_89()) { 2593 jj_scanpos = xsp; 2594 if (jj_3R_literal_1109_9_90()) return true; 2595 } 2596 } 2597 } 2598 } 2599 } 2600 } 2601 return false; 2602 } 2603 2604 private boolean jj_3R_tag_key_706_9_91() 2605 { 2606 if (jj_3R_string_468_5_100()) return true; 2607 return false; 2608 } 2609 2610 private boolean jj_3R_tag_key_706_9_61() 2611 { 2612 Token xsp; 2613 xsp = jj_scanpos; 2614 if (jj_3R_tag_key_706_9_91()) { 2615 jj_scanpos = xsp; 2616 if (jj_3R_tag_key_708_9_92()) return true; 2617 } 2618 return false; 2619 } 2620 2621 private boolean jj_3R_conditional_expression_901_5_53() 2622 { 2623 if (jj_3R_or_expression_922_5_77()) return true; 2624 Token xsp; 2625 xsp = jj_scanpos; 2626 if (jj_3R_conditional_expression_903_9_78()) jj_scanpos = xsp; 2627 return false; 2628 } 2629 2630 private boolean jj_3R_w_518_5_31() 2631 { 2632 Token xsp; 2633 while (true) { 2634 xsp = jj_scanpos; 2635 if (jj_3R_w_518_7_52()) { jj_scanpos = xsp; break; } 2636 } 2637 return false; 2638 } 2639 2640 private boolean jj_3_6() 2641 { 2642 if (jj_3R_simple_key_value_condition_740_5_24()) return true; 2643 if (jj_3R_s_507_5_23()) return true; 2644 if (jj_scan_token(RSQUARE)) return true; 2645 return false; 2646 } 2647 2648 private boolean jj_3_5() 2649 { 2650 if (jj_3R_simple_key_condition_718_5_22()) return true; 2651 if (jj_3R_s_507_5_23()) return true; 2652 if (jj_scan_token(RSQUARE)) return true; 2653 return false; 2654 } 2655 2656 private boolean jj_3R_function_1076_11_128() 2657 { 2658 if (jj_scan_token(COMMA)) return true; 2659 if (jj_3R_w_518_5_31()) return true; 2660 if (jj_3R_expression_889_5_32()) return true; 2661 return false; 2662 } 2663 2664 private boolean jj_3R_s_507_5_23() 2665 { 2666 Token xsp; 2667 xsp = jj_scanpos; 2668 if (jj_scan_token(27)) jj_scanpos = xsp; 2669 return false; 2670 } 2671 2672 private boolean jj_3R_expression_889_5_32() 2673 { 2674 if (jj_3R_conditional_expression_901_5_53()) return true; 2675 return false; 2676 } 2677 2678 private boolean jj_3R_function_1075_9_54() 2679 { 2680 if (jj_3R_expression_889_5_32()) return true; 2681 Token xsp; 2682 while (true) { 2683 xsp = jj_scanpos; 2684 if (jj_3R_function_1076_11_128()) { jj_scanpos = xsp; break; } 2685 } 2686 return false; 2687 } 2688 2689 private boolean jj_3_11() 2690 { 2691 if (jj_3R_expression_889_5_32()) return true; 2692 Token xsp; 2693 xsp = jj_scanpos; 2694 if (jj_scan_token(40)) { 2695 jj_scanpos = xsp; 2696 if (jj_scan_token(18)) return true; 2697 } 2698 return false; 2699 } 2700 2701 private boolean jj_3R_string_or_ident_487_19_103() 2702 { 2703 if (jj_3R_string_468_5_100()) return true; 2704 return false; 2705 } 2706 2707 private boolean jj_3_10() 2708 { 2709 if (jj_3R_float_array_532_5_30()) return true; 2710 if (jj_3R_w_518_5_31()) return true; 2711 Token xsp; 2712 xsp = jj_scanpos; 2713 if (jj_scan_token(40)) { 2714 jj_scanpos = xsp; 2715 if (jj_scan_token(18)) return true; 2716 } 2717 return false; 2718 } 2719 2720 private boolean jj_3R_function_1072_5_33() 2721 { 2722 if (jj_3R_ident_478_5_34()) return true; 2723 if (jj_3R_w_518_5_31()) return true; 2724 if (jj_scan_token(LPAR)) return true; 2725 if (jj_3R_w_518_5_31()) return true; 2726 Token xsp; 2727 xsp = jj_scanpos; 2728 if (jj_3R_function_1075_9_54()) jj_scanpos = xsp; 2729 if (jj_scan_token(RPAR)) return true; 2730 return false; 2731 } 2732 2733 private boolean jj_3R_float__460_41_95() 2734 { 2735 if (jj_3R_ufloat_451_5_50()) return true; 2736 return false; 2737 } 2738 2739 private boolean jj_3R_regex_495_5_29() 2740 { 2741 if (jj_scan_token(REGEX)) return true; 2742 return false; 2743 } 2744 2745 private boolean jj_3R_primary_1062_9_127() 2746 { 2747 if (jj_scan_token(LPAR)) return true; 2748 if (jj_3R_w_518_5_31()) return true; 2749 if (jj_3R_expression_889_5_32()) return true; 2750 if (jj_scan_token(RPAR)) return true; 2751 return false; 2752 } 2753 2754 private boolean jj_3R_string_or_ident_487_7_102() 2755 { 2756 if (jj_3R_ident_478_5_34()) return true; 2757 return false; 2758 } 2759 2760 private boolean jj_3R_string_or_ident_487_5_93() 2761 { 2762 Token xsp; 2763 xsp = jj_scanpos; 2764 if (jj_3R_string_or_ident_487_7_102()) { 2765 jj_scanpos = xsp; 2766 if (jj_3R_string_or_ident_487_19_103()) return true; 2767 } 2768 return false; 2769 } 2770 2771 private boolean jj_3_4() 2772 { 2773 if (jj_3R_uint_435_5_21()) return true; 2774 if (jj_scan_token(MINUS)) return true; 2775 return false; 2776 } 2777 2778 private boolean jj_3R_primary_1052_9_126() 2779 { 2780 if (jj_3R_literal_1089_9_60()) return true; 2781 return false; 2782 } 2783 2784 private boolean jj_3R_ident_478_5_34() 2785 { 2786 Token xsp; 2787 xsp = jj_scanpos; 2788 if (jj_scan_token(11)) { 2789 jj_scanpos = xsp; 2790 if (jj_scan_token(10)) return true; 2791 } 2792 return false; 2793 } 2794 2795 private boolean jj_3R_int__443_39_49() 2796 { 2797 if (jj_3R_uint_435_5_21()) return true; 2798 return false; 2799 } 2800 2801 private boolean jj_3R_primary_1049_5_121() 2802 { 2803 Token xsp; 2804 xsp = jj_scanpos; 2805 if (jj_3_12()) { 2806 jj_scanpos = xsp; 2807 if (jj_3R_primary_1052_9_126()) { 2808 jj_scanpos = xsp; 2809 if (jj_3R_primary_1062_9_127()) return true; 2810 } 2811 } 2812 return false; 2813 } 2814 2815 private boolean jj_3_12() 2816 { 2817 if (jj_3R_function_1072_5_33()) return true; 2818 return false; 2819 } 2820 2821 private boolean jj_3R_multiplicative_expression_1012_38_123() 2822 { 2823 if (jj_scan_token(SLASH)) return true; 2824 return false; 2825 } 2826 2827 private boolean jj_3R_string_468_5_100() 2828 { 2829 if (jj_scan_token(STRING)) return true; 2830 return false; 2831 } 2832 2833 private boolean jj_3R_unary_expression_1032_9_125() 2834 { 2835 if (jj_scan_token(EXCLAMATION)) return true; 2836 if (jj_3R_w_518_5_31()) return true; 2837 return false; 2838 } 2839 2840 private boolean jj_3R_unary_expression_1030_9_124() 2841 { 2842 if (jj_scan_token(MINUS)) return true; 2843 if (jj_3R_w_518_5_31()) return true; 2844 return false; 2845 } 2846 2847 private boolean jj_3R_unary_expression_1030_9_120() 2848 { 2849 Token xsp; 2850 xsp = jj_scanpos; 2851 if (jj_3R_unary_expression_1030_9_124()) { 2852 jj_scanpos = xsp; 2853 if (jj_3R_unary_expression_1032_9_125()) return true; 2854 } 2855 return false; 2856 } 2857 2858 private boolean jj_3R_float__460_5_94() 2859 { 2860 if (jj_scan_token(MINUS)) return true; 2861 if (jj_3R_ufloat_451_5_50()) return true; 2862 return false; 2863 } 2864 2865 private boolean jj_3R_float__460_5_75() 2866 { 2867 Token xsp; 2868 xsp = jj_scanpos; 2869 if (jj_3R_float__460_5_94()) { 2870 jj_scanpos = xsp; 2871 if (jj_3R_float__460_41_95()) return true; 2872 } 2873 return false; 2874 } 2875 2876 private boolean jj_3R_unary_expression_1029_5_116() 2877 { 2878 Token xsp; 2879 xsp = jj_scanpos; 2880 if (jj_3R_unary_expression_1030_9_120()) jj_scanpos = xsp; 2881 if (jj_3R_primary_1049_5_121()) return true; 2882 if (jj_3R_w_518_5_31()) return true; 2883 return false; 2884 } 2885 2886 private boolean jj_3R_additive_expression_993_37_119() 2887 { 2888 if (jj_scan_token(MINUS)) return true; 2889 return false; 2890 } 2891 2892 private boolean jj_3R_ufloat_451_5_50() 2893 { 2894 Token xsp; 2895 xsp = jj_scanpos; 2896 if (jj_scan_token(24)) { 2897 jj_scanpos = xsp; 2898 if (jj_scan_token(12)) return true; 2899 } 2900 return false; 2901 } 2902 2903 private boolean jj_3R_multiplicative_expression_1012_11_122() 2904 { 2905 if (jj_scan_token(STAR)) return true; 2906 return false; 2907 } 2908 2909 private boolean jj_3R_multiplicative_expression_1012_9_117() 2910 { 2911 Token xsp; 2912 xsp = jj_scanpos; 2913 if (jj_3R_multiplicative_expression_1012_11_122()) { 2914 jj_scanpos = xsp; 2915 if (jj_3R_multiplicative_expression_1012_38_123()) return true; 2916 } 2917 if (jj_3R_w_518_5_31()) return true; 2918 if (jj_3R_unary_expression_1029_5_116()) return true; 2919 return false; 2920 } 2921 2922 private boolean jj_3R_int__443_5_25() 2923 { 2924 Token xsp; 2925 xsp = jj_scanpos; 2926 if (jj_3R_int__443_5_48()) { 2927 jj_scanpos = xsp; 2928 if (jj_3R_int__443_39_49()) return true; 2929 } 2930 return false; 2931 } 2932 2933 private boolean jj_3R_int__443_5_48() 2934 { 2935 if (jj_scan_token(MINUS)) return true; 2936 if (jj_3R_uint_435_5_21()) return true; 2937 return false; 2938 } 2939 2940 private boolean jj_3R_multiplicative_expression_1010_5_108() 2941 { 2942 if (jj_3R_unary_expression_1029_5_116()) return true; 2943 Token xsp; 2944 while (true) { 2945 xsp = jj_scanpos; 2946 if (jj_3R_multiplicative_expression_1012_9_117()) { jj_scanpos = xsp; break; } 2947 } 2948 return false; 2949 } 2950 2951 private boolean jj_3R_pp_supports_declaration_condition_380_61_39() 2952 { 2953 if (jj_scan_token(COLON)) return true; 2954 if (jj_3R_pp_w_400_2_19()) return true; 2955 if (jj_3R_literal_1089_9_60()) return true; 2956 return false; 2957 } 2958 2959 private boolean jj_3R_uint_435_5_21() 2960 { 2961 if (jj_scan_token(UINT)) return true; 2962 return false; 2963 } 2964 2965 private boolean jj_3R_additive_expression_993_11_118() 2966 { 2967 if (jj_scan_token(PLUS)) return true; 2968 return false; 2969 } 2970 2971 private boolean jj_3R_additive_expression_993_9_109() 2972 { 2973 Token xsp; 2974 xsp = jj_scanpos; 2975 if (jj_3R_additive_expression_993_11_118()) { 2976 jj_scanpos = xsp; 2977 if (jj_3R_additive_expression_993_37_119()) return true; 2978 } 2979 if (jj_3R_w_518_5_31()) return true; 2980 if (jj_3R_multiplicative_expression_1010_5_108()) return true; 2981 return false; 2982 } 2983 2984 private boolean jj_3R_simple_key_value_condition_787_21_74() 2985 { 2986 if (jj_scan_token(LESS)) return true; 2987 return false; 2988 } 2989 2990 private boolean jj_3R_simple_key_value_condition_785_21_73() 2991 { 2992 if (jj_scan_token(LESS_EQUAL)) return true; 2993 return false; 2994 } 2995 2996 private boolean jj_3R_additive_expression_991_5_106() 2997 { 2998 if (jj_3R_multiplicative_expression_1010_5_108()) return true; 2999 Token xsp; 3000 while (true) { 3001 xsp = jj_scanpos; 3002 if (jj_3R_additive_expression_993_9_109()) { jj_scanpos = xsp; break; } 3003 } 3004 return false; 3005 } 3006 3007 private boolean jj_3R_simple_key_value_condition_783_21_72() 3008 { 3009 if (jj_scan_token(GREATER)) return true; 3010 return false; 3011 } 3012 3013 private boolean jj_3R_simple_key_value_condition_777_25_70() 3014 { 3015 if (jj_3R_string_or_ident_487_5_93()) return true; 3016 return false; 3017 } 3018 3019 private boolean jj_3R_simple_key_value_condition_781_21_71() 3020 { 3021 if (jj_scan_token(GREATER_EQUAL)) return true; 3022 return false; 3023 } 3024 3025 private boolean jj_3R_simple_key_value_condition_775_25_69() 3026 { 3027 if (jj_3R_float__460_5_75()) return true; 3028 return false; 3029 } 3030 3031 private boolean jj_3R_relational_expression_973_13_115() 3032 { 3033 if (jj_scan_token(EXCLAMATION)) return true; 3034 if (jj_scan_token(EQUAL)) return true; 3035 return false; 3036 } 3037 3038 private boolean jj_3R_relational_expression_971_13_114() 3039 { 3040 if (jj_scan_token(EQUAL)) return true; 3041 Token xsp; 3042 xsp = jj_scanpos; 3043 if (jj_scan_token(36)) jj_scanpos = xsp; 3044 return false; 3045 } 3046 3047 private boolean jj_3R_simple_key_value_condition_780_13_47() 3048 { 3049 Token xsp; 3050 xsp = jj_scanpos; 3051 if (jj_3R_simple_key_value_condition_781_21_71()) { 3052 jj_scanpos = xsp; 3053 if (jj_3R_simple_key_value_condition_783_21_72()) { 3054 jj_scanpos = xsp; 3055 if (jj_3R_simple_key_value_condition_785_21_73()) { 3056 jj_scanpos = xsp; 3057 if (jj_3R_simple_key_value_condition_787_21_74()) return true; 3058 } 3059 } 3060 } 3061 if (jj_3R_s_507_5_23()) return true; 3062 if (jj_3R_float__460_5_75()) return true; 3063 return false; 3064 } 3065 3066 private boolean jj_3R_ufloat_unit_1123_51_57() 3067 { 3068 if (jj_scan_token(PERCENT)) return true; 3069 return false; 3070 } 3071 3072 private boolean jj_3R_relational_expression_969_13_113() 3073 { 3074 if (jj_scan_token(LESS)) return true; 3075 return false; 3076 } 3077 3078 private boolean jj_3R_relational_expression_967_13_112() 3079 { 3080 if (jj_scan_token(GREATER)) return true; 3081 return false; 3082 } 3083 3084 private boolean jj_3_8() 3085 { 3086 if (jj_3R_int__443_5_25()) return true; 3087 return false; 3088 } 3089 3090 private boolean jj_3R_simple_key_value_condition_767_21_67() 3091 { 3092 if (jj_scan_token(STAR)) return true; 3093 if (jj_scan_token(EQUAL)) return true; 3094 return false; 3095 } 3096 3097 private boolean jj_3R_relational_expression_965_13_111() 3098 { 3099 if (jj_scan_token(LESS_EQUAL)) return true; 3100 return false; 3101 } 3102 3103 private boolean jj_3R_pp_w_400_4_38() 3104 { 3105 if (jj_3R_pp_w1_389_5_59()) return true; 3106 return false; 3107 } 3108 3109 private boolean jj_3R_simple_key_value_condition_765_21_66() 3110 { 3111 if (jj_scan_token(DOLLAR)) return true; 3112 if (jj_scan_token(EQUAL)) return true; 3113 return false; 3114 } 3115 3116 private boolean jj_3R_relational_expression_963_13_110() 3117 { 3118 if (jj_scan_token(GREATER_EQUAL)) return true; 3119 return false; 3120 } 3121 3122 private boolean jj_3R_simple_key_value_condition_770_15_68() 3123 { 3124 if (jj_scan_token(STAR)) return true; 3125 return false; 3126 } 3127 3128 private boolean jj_3R_pp_w_400_2_19() 3129 { 3130 Token xsp; 3131 while (true) { 3132 xsp = jj_scanpos; 3133 if (jj_3R_pp_w_400_4_38()) { jj_scanpos = xsp; break; } 3134 } 3135 return false; 3136 } 3137 3138 private boolean jj_3R_simple_key_value_condition_763_21_65() 3139 { 3140 if (jj_scan_token(CARET)) return true; 3141 if (jj_scan_token(EQUAL)) return true; 3142 return false; 3143 } 3144 3145 private boolean jj_3R_simple_key_value_condition_761_21_64() 3146 { 3147 if (jj_scan_token(TILDE)) return true; 3148 if (jj_scan_token(EQUAL)) return true; 3149 return false; 3150 } 3151 3152 private boolean jj_3R_relational_expression_962_9_107() 3153 { 3154 Token xsp; 3155 xsp = jj_scanpos; 3156 if (jj_3R_relational_expression_963_13_110()) { 3157 jj_scanpos = xsp; 3158 if (jj_3R_relational_expression_965_13_111()) { 3159 jj_scanpos = xsp; 3160 if (jj_3R_relational_expression_967_13_112()) { 3161 jj_scanpos = xsp; 3162 if (jj_3R_relational_expression_969_13_113()) { 3163 jj_scanpos = xsp; 3164 if (jj_3R_relational_expression_971_13_114()) { 3165 jj_scanpos = xsp; 3166 if (jj_3R_relational_expression_973_13_115()) return true; 3167 } 3168 } 3169 } 3170 } 3171 } 3172 if (jj_3R_w_518_5_31()) return true; 3173 if (jj_3R_additive_expression_991_5_106()) return true; 3174 return false; 3175 } 3176 3177 private boolean jj_3R_pp_w1_393_5_85() 3178 { 3179 if (jj_scan_token(PP_COMMENT_START)) return true; 3180 if (jj_scan_token(PP_COMMENT_END)) return true; 3181 return false; 3182 } 3183 3184 private boolean jj_3R_simple_key_value_condition_759_21_63() 3185 { 3186 if (jj_scan_token(EQUAL)) return true; 3187 return false; 3188 } 3189 3190 private boolean jj_3R_pp_w1_391_5_84() 3191 { 3192 if (jj_scan_token(PP_WHITESPACE)) return true; 3193 return false; 3194 } 3195 3196 private boolean jj_3R_simple_key_value_condition_757_21_62() 3197 { 3198 if (jj_scan_token(EXCLAMATION)) return true; 3199 if (jj_scan_token(EQUAL)) return true; 3200 return false; 3201 } 3202 3203 private boolean jj_3R_pp_w1_389_5_83() 3204 { 3205 if (jj_scan_token(PP_NEWLINECHAR)) return true; 3206 return false; 3207 } 3208 3209 private boolean jj_3R_pp_w1_389_5_59() 3210 { 3211 Token xsp; 3212 xsp = jj_scanpos; 3213 if (jj_3R_pp_w1_389_5_83()) { 3214 jj_scanpos = xsp; 3215 if (jj_3R_pp_w1_391_5_84()) { 3216 jj_scanpos = xsp; 3217 if (jj_3R_pp_w1_393_5_85()) return true; 3218 } 3219 } 3220 return false; 3221 } 3222 3223 private boolean jj_3R_relational_expression_960_5_104() 3224 { 3225 if (jj_3R_additive_expression_991_5_106()) return true; 3226 Token xsp; 3227 xsp = jj_scanpos; 3228 if (jj_3R_relational_expression_962_9_107()) jj_scanpos = xsp; 3229 return false; 3230 } 3231 3232 private boolean jj_3R_simple_key_value_condition_750_21_27() 3233 { 3234 if (jj_scan_token(EXCLAMATION)) return true; 3235 if (jj_scan_token(TILDE)) return true; 3236 return false; 3237 } 3238 3239 private boolean jj_3R_ufloat_unit_1123_30_56() 3240 { 3241 if (jj_scan_token(DEG)) return true; 3242 return false; 3243 } 3244 3245 private boolean jj_3R_simple_key_value_condition_748_21_26() 3246 { 3247 if (jj_scan_token(EQUAL)) return true; 3248 if (jj_scan_token(TILDE)) return true; 3249 return false; 3250 } 3251 3252 private boolean jj_3R_simple_key_value_condition_756_13_46() 3253 { 3254 Token xsp; 3255 xsp = jj_scanpos; 3256 if (jj_3R_simple_key_value_condition_757_21_62()) { 3257 jj_scanpos = xsp; 3258 if (jj_3R_simple_key_value_condition_759_21_63()) { 3259 jj_scanpos = xsp; 3260 if (jj_3R_simple_key_value_condition_761_21_64()) { 3261 jj_scanpos = xsp; 3262 if (jj_3R_simple_key_value_condition_763_21_65()) { 3263 jj_scanpos = xsp; 3264 if (jj_3R_simple_key_value_condition_765_21_66()) { 3265 jj_scanpos = xsp; 3266 if (jj_3R_simple_key_value_condition_767_21_67()) return true; 3267 } 3268 } 3269 } 3270 } 3271 } 3272 if (jj_3R_s_507_5_23()) return true; 3273 xsp = jj_scanpos; 3274 if (jj_3R_simple_key_value_condition_770_15_68()) jj_scanpos = xsp; 3275 xsp = jj_scanpos; 3276 if (jj_3_8()) { 3277 jj_scanpos = xsp; 3278 if (jj_3R_simple_key_value_condition_775_25_69()) { 3279 jj_scanpos = xsp; 3280 if (jj_3R_simple_key_value_condition_777_25_70()) return true; 3281 } 3282 } 3283 return false; 3284 } 3285 3286 private boolean jj_3R_simple_key_value_condition_753_15_28() 3287 { 3288 if (jj_scan_token(STAR)) return true; 3289 return false; 3290 } 3291 3292 private boolean jj_3R_pp_supports_declaration_condition_380_5_20() 3293 { 3294 if (jj_scan_token(LPAR)) return true; 3295 if (jj_3R_pp_w_400_2_19()) return true; 3296 if (jj_scan_token(IDENT)) return true; 3297 if (jj_3R_pp_w_400_2_19()) return true; 3298 Token xsp; 3299 xsp = jj_scanpos; 3300 if (jj_3R_pp_supports_declaration_condition_380_61_39()) jj_scanpos = xsp; 3301 if (jj_scan_token(RPAR)) return true; 3302 return false; 3303 } 3304 3305 /** Generated Token Manager. */ 3306 public MapCSSParserTokenManager token_source; 3307 SimpleCharStream jj_input_stream; 3308 /** Current token. */ 3309 public Token token; 3310 /** Next token. */ 3311 public Token jj_nt; 3312 private int jj_ntk; 3313 private Token jj_scanpos, jj_lastpos; 3314 private int jj_la; 3315 private int jj_gen; 3316 final private int[] jj_la1 = new int[78]; 3317 static private int[] jj_la1_0; 3318 static private int[] jj_la1_1; 3319 static { 3320 jj_la1_init_0(); 3321 jj_la1_init_1(); 3322 } 3323 private static void jj_la1_init_0() { 3324 jj_la1_0 = new int[] {0xfb38fe,0xf9380e,0xfb38fe,0x2,0x4,0x8,0x80000,0x80000,0x400000,0xe0,0xe0,0x1000,0x1001000,0x1001000,0xc00,0x2c00,0x8000000,0x8000000,0x8000000,0x200000,0x10000800,0x200000,0x0,0x40400000,0x40400000,0x0,0x0,0x10000800,0x10000800,0x0,0x40400000,0x40400000,0x0,0x1000,0x0,0x1000,0x5083c00,0x400000,0x2c00,0x0,0x12c00,0x0,0x12c00,0x0,0x10000000,0x10000000,0x10000000,0x1003c00,0x0,0x10000000,0x0,0x400000,0x10080c00,0xc00,0x0,0x0,0x40000,0x40000,0x40000,0xc00,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x30000000,0x30000000,0x0,0x0,0x5083c00,0x200000,0x5083c00,0x2800,0x5001000,0xc00,}; 3325 } 3326 private static void jj_la1_init_1() { 3327 jj_la1_1 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1000,0x0,0x1000,0x0,0x0,0x0,0x2000000,0x2000000,0x0,0x0,0x0,0x80c,0x20020,0x20020,0xf8080c,0xf8080c,0xf8080c,0x0,0x400,0x20020,0x20020,0x80,0x0,0x1000,0x0,0x1820,0x0,0x0,0x20,0x0,0x4000,0x0,0x30,0x0,0x18070,0x0,0x1000,0xf,0x1807f,0x20,0x20000,0x0,0x1000,0x20000,0x10,0x100,0x100,0x100,0x1000,0x4000,0x200,0x2000,0x10,0x3f,0x3f,0x1800,0x1800,0x0,0x0,0x1020,0x1020,0x800,0x0,0x1820,0x800,0x0,0x1040000,}; 3328 } 3329 final private JJCalls[] jj_2_rtns = new JJCalls[14]; 3330 private boolean jj_rescan = false; 3331 private int jj_gc = 0; 3332 3333 /** Constructor with InputStream. */ 3334 public MapCSSParser(java.io.InputStream stream) { 3335 this(stream, null); 3336 } 3337 /** Constructor with InputStream and supplied encoding */ 3338 public MapCSSParser(java.io.InputStream stream, String encoding) { 3339 try { jj_input_stream = new SimpleCharStream(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e.getMessage()); } 3340 token_source = new MapCSSParserTokenManager(jj_input_stream); 3341 token = new Token(); 3342 jj_ntk = -1; 3343 jj_gen = 0; 3344 for (int i = 0; i < 78; i++) jj_la1[i] = -1; 3345 for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); 3346 } 3347 3348 /** Reinitialise. */ 3349 public void ReInit(java.io.InputStream stream) { 3350 ReInit(stream, null); 3351 } 3352 /** Reinitialise. */ 3353 public void ReInit(java.io.InputStream stream, String encoding) { 3354 try { jj_input_stream.ReInit(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e.getMessage()); } 3355 token_source.ReInit(jj_input_stream); 3356 token = new Token(); 3357 jj_ntk = -1; 3358 jj_gen = 0; 3359 for (int i = 0; i < 78; i++) jj_la1[i] = -1; 3360 for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); 3361 } 3362 3363 /** Constructor. */ 3364 public MapCSSParser(java.io.Reader stream) { 3365 jj_input_stream = new SimpleCharStream(stream, 1, 1); 3366 token_source = new MapCSSParserTokenManager(jj_input_stream); 3367 token = new Token(); 3368 jj_ntk = -1; 3369 jj_gen = 0; 3370 for (int i = 0; i < 78; i++) jj_la1[i] = -1; 3371 for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); 3372 } 3373 3374 /** Reinitialise. */ 3375 public void ReInit(java.io.Reader stream) { 3376 if (jj_input_stream == null) { 3377 jj_input_stream = new SimpleCharStream(stream, 1, 1); 3378 } else { 3379 jj_input_stream.ReInit(stream, 1, 1); 3380 } 3381 if (token_source == null) { 3382 token_source = new MapCSSParserTokenManager(jj_input_stream); 3383 } 3384 3385 token_source.ReInit(jj_input_stream); 3386 token = new Token(); 3387 jj_ntk = -1; 3388 jj_gen = 0; 3389 for (int i = 0; i < 78; i++) jj_la1[i] = -1; 3390 for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); 3391 } 3392 3393 /** Constructor with generated Token Manager. */ 3394 public MapCSSParser(MapCSSParserTokenManager tm) { 3395 token_source = tm; 3396 token = new Token(); 3397 jj_ntk = -1; 3398 jj_gen = 0; 3399 for (int i = 0; i < 78; i++) jj_la1[i] = -1; 3400 for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); 3401 } 3402 3403 /** Reinitialise. */ 3404 public void ReInit(MapCSSParserTokenManager tm) { 3405 token_source = tm; 3406 token = new Token(); 3407 jj_ntk = -1; 3408 jj_gen = 0; 3409 for (int i = 0; i < 78; i++) jj_la1[i] = -1; 3410 for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); 3411 } 3412 3413 private Token jj_consume_token(int kind) throws ParseException { 3414 Token oldToken; 3415 if ((oldToken = token).next != null) token = token.next; 3416 else token = token.next = token_source.getNextToken(); 3417 jj_ntk = -1; 3418 if (token.kind == kind) { 3419 jj_gen++; 3420 if (++jj_gc > 100) { 3421 jj_gc = 0; 3422 for (int i = 0; i < jj_2_rtns.length; i++) { 3423 JJCalls c = jj_2_rtns[i]; 3424 while (c != null) { 3425 if (c.gen < jj_gen) c.first = null; 3426 c = c.next; 3427 } 3428 } 3429 } 3430 return token; 3431 } 3432 token = oldToken; 3433 jj_kind = kind; 3434 throw generateParseException(); 3435 } 3436 3437 @SuppressWarnings("serial") 3438 static private final class LookaheadSuccess extends java.lang.Error { 3439 @Override 3440 public Throwable fillInStackTrace() { 3441 return this; 3442 } 3443 } 3444 static private final LookaheadSuccess jj_ls = new LookaheadSuccess(); 3445 private boolean jj_scan_token(int kind) { 3446 if (jj_scanpos == jj_lastpos) { 3447 jj_la--; 3448 if (jj_scanpos.next == null) { 3449 jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken(); 3450 } else { 3451 jj_lastpos = jj_scanpos = jj_scanpos.next; 3452 } 3453 } else { 3454 jj_scanpos = jj_scanpos.next; 3455 } 3456 if (jj_rescan) { 3457 int i = 0; Token tok = token; 3458 while (tok != null && tok != jj_scanpos) { i++; tok = tok.next; } 3459 if (tok != null) jj_add_error_token(kind, i); 3460 } 3461 if (jj_scanpos.kind != kind) return true; 3462 if (jj_la == 0 && jj_scanpos == jj_lastpos) throw jj_ls; 3463 return false; 3464 } 3465 3466 3467/** Get the next Token. */ 3468 final public Token getNextToken() { 3469 if (token.next != null) token = token.next; 3470 else token = token.next = token_source.getNextToken(); 3471 jj_ntk = -1; 3472 jj_gen++; 3473 return token; 3474 } 3475 3476/** Get the specific Token. */ 3477 final public Token getToken(int index) { 3478 Token t = token; 3479 for (int i = 0; i < index; i++) { 3480 if (t.next != null) t = t.next; 3481 else t = t.next = token_source.getNextToken(); 3482 } 3483 return t; 3484 } 3485 3486 private int jj_ntk_f() { 3487 if ((jj_nt=token.next) == null) 3488 return (jj_ntk = (token.next=token_source.getNextToken()).kind); 3489 else 3490 return (jj_ntk = jj_nt.kind); 3491 } 3492 3493 private java.util.List jj_expentries = new java.util.ArrayList(); 3494 private int[] jj_expentry; 3495 private int jj_kind = -1; 3496 private int[] jj_lasttokens = new int[100]; 3497 private int jj_endpos; 3498 3499 private void jj_add_error_token(int kind, int pos) { 3500 if (pos >= 100) { 3501 return; 3502 } 3503 3504 if (pos == jj_endpos + 1) { 3505 jj_lasttokens[jj_endpos++] = kind; 3506 } else if (jj_endpos != 0) { 3507 jj_expentry = new int[jj_endpos]; 3508 3509 for (int i = 0; i < jj_endpos; i++) { 3510 jj_expentry[i] = jj_lasttokens[i]; 3511 } 3512 3513 for (java.util.Iterator it = jj_expentries.iterator(); it.hasNext();) { 3514 int[] oldentry = (int[])(it.next()); 3515 if (oldentry.length == jj_expentry.length) { 3516 boolean isMatched = true; 3517 3518 for (int i = 0; i < jj_expentry.length; i++) { 3519 if (oldentry[i] != jj_expentry[i]) { 3520 isMatched = false; 3521 break; 3522 } 3523 3524 } 3525 if (isMatched) { 3526 jj_expentries.add(jj_expentry); 3527 break; 3528 } 3529 } 3530 } 3531 3532 if (pos != 0) { 3533 jj_lasttokens[(jj_endpos = pos) - 1] = kind; 3534 } 3535 } 3536 } 3537 3538 /** Generate ParseException. */ 3539 public ParseException generateParseException() { 3540 jj_expentries.clear(); 3541 boolean[] la1tokens = new boolean[61]; 3542 if (jj_kind >= 0) { 3543 la1tokens[jj_kind] = true; 3544 jj_kind = -1; 3545 } 3546 for (int i = 0; i < 78; i++) { 3547 if (jj_la1[i] == jj_gen) { 3548 for (int j = 0; j < 32; j++) { 3549 if ((jj_la1_0[i] & (1<<j)) != 0) { 3550 la1tokens[j] = true; 3551 } 3552 if ((jj_la1_1[i] & (1<<j)) != 0) { 3553 la1tokens[32+j] = true; 3554 } 3555 } 3556 } 3557 } 3558 for (int i = 0; i < 61; i++) { 3559 if (la1tokens[i]) { 3560 jj_expentry = new int[1]; 3561 jj_expentry[0] = i; 3562 jj_expentries.add(jj_expentry); 3563 } 3564 } 3565 jj_endpos = 0; 3566 jj_rescan_token(); 3567 jj_add_error_token(0, 0); 3568 int[][] exptokseq = new int[jj_expentries.size()][]; 3569 for (int i = 0; i < jj_expentries.size(); i++) { 3570 exptokseq[i] = (int[])jj_expentries.get(i); 3571 } 3572 return new ParseException(token, exptokseq, tokenImage); 3573 } 3574 3575 private boolean trace_enabled; 3576 3577/** Trace enabled. */ 3578 final public boolean trace_enabled() { 3579 return trace_enabled; 3580 } 3581 3582 /** Enable tracing. */ 3583 final public void enable_tracing() { 3584 } 3585 3586 /** Disable tracing. */ 3587 final public void disable_tracing() { 3588 } 3589 3590 private void jj_rescan_token() { 3591 jj_rescan = true; 3592 for (int i = 0; i < 14; i++) { 3593 try { 3594 JJCalls p = jj_2_rtns[i]; 3595 3596 do { 3597 if (p.gen > jj_gen) { 3598 jj_la = p.arg; jj_lastpos = jj_scanpos = p.first; 3599 switch (i) { 3600 case 0: jj_3_1(); break; 3601 case 1: jj_3_2(); break; 3602 case 2: jj_3_3(); break; 3603 case 3: jj_3_4(); break; 3604 case 4: jj_3_5(); break; 3605 case 5: jj_3_6(); break; 3606 case 6: jj_3_7(); break; 3607 case 7: jj_3_8(); break; 3608 case 8: jj_3_9(); break; 3609 case 9: jj_3_10(); break; 3610 case 10: jj_3_11(); break; 3611 case 11: jj_3_12(); break; 3612 case 12: jj_3_13(); break; 3613 case 13: jj_3_14(); break; 3614 } 3615 } 3616 p = p.next; 3617 } while (p != null); 3618 3619 } catch(LookaheadSuccess ls) { } 3620 } 3621 jj_rescan = false; 3622 } 3623 3624 private void jj_save(int index, int xla) { 3625 JJCalls p = jj_2_rtns[index]; 3626 while (p.gen > jj_gen) { 3627 if (p.next == null) { p = p.next = new JJCalls(); break; } 3628 p = p.next; 3629 } 3630 3631 p.gen = jj_gen + xla - jj_la; 3632 p.first = token; 3633 p.arg = xla; 3634 } 3635 3636 static final class JJCalls { 3637 int gen; 3638 Token first; 3639 int arg; 3640 JJCalls next; 3641 } 3642 3643}