Changeset 3876 in josm
- Timestamp:
- 2011-02-09T12:02:41+01:00 (14 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui/mappaint
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/mappaint/MapPaintStyles.java
r3863 r3876 136 136 } finally { 137 137 try { 138 in.close(); 138 if (in != null) { 139 in.close(); 140 } 139 141 } catch (IOException ex) { 140 142 } -
trunk/src/org/openstreetmap/josm/gui/mappaint/StyleSource.java
r3863 r3876 49 49 } 50 50 51 private ImageIcon pencil = ImageProvider.get("dialogs/mappaint", "pencil");51 private static ImageIcon pencil; 52 52 53 53 protected ImageIcon getSourceIcon() { 54 if (pencil == null) { 55 pencil = ImageProvider.get("dialogs/mappaint", "pencil"); 56 } 54 57 return pencil; 55 58 } -
trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/Condition.java
r3860 r3876 2 2 package org.openstreetmap.josm.gui.mappaint.mapcss; 3 3 4 import static org.openstreetmap.josm.tools.Utils.equal; 5 6 import java.util.EnumSet; 7 import java.util.regex.Matcher; 8 import java.util.regex.Pattern; 9 10 import org.openstreetmap.josm.data.osm.Node; 4 11 import org.openstreetmap.josm.data.osm.Relation; 5 12 import org.openstreetmap.josm.data.osm.Way; 6 13 import org.openstreetmap.josm.gui.mappaint.Environment; 7 import org.openstreetmap.josm. tools.Utils;14 import org.openstreetmap.josm.gui.mappaint.mapcss.Condition.Op; 8 15 9 16 abstract public class Condition { … … 11 18 abstract public boolean applies(Environment e); 12 19 13 public static enum Op {EQ, NEQ} 20 public static enum Op { EQ, NEQ, GREATER_OR_EQUAL, GREATER, LESS_OR_EQUAL, LESS, 21 REGEX, ONE_OF, BEGINS_WITH, ENDS_WITH, CONTAINS } 22 23 public final static EnumSet<Op> COMPARISON_OPERATERS = 24 EnumSet.of(Op.GREATER_OR_EQUAL, Op.GREATER, Op.LESS_OR_EQUAL, Op.LESS); 14 25 15 26 public static class KeyValueCondition extends Condition { … … 18 29 public String v; 19 30 public Op op; 31 private float v_float; 20 32 21 33 public KeyValueCondition(String k, String v, Op op) { 22 23 34 this.k = k; 24 35 this.v = v; 25 36 this.op = op; 37 if (COMPARISON_OPERATERS.contains(op)) { 38 v_float = Float.parseFloat(v); 39 } 26 40 } 27 41 28 42 @Override 29 public boolean applies(Environment e) { 43 public boolean applies(Environment env) { 44 String val = env.osm.get(k); 45 if (val == null) 46 return false; 30 47 switch (op) { 31 48 case EQ: 32 return Utils.equal(e.osm.get(k), v);49 return equal(val, v); 33 50 case NEQ: 34 return !Utils.equal(e.osm.get(k), v); 51 return !equal(val, v); 52 case REGEX: 53 Pattern p = Pattern.compile(v); 54 Matcher m = p.matcher(val); 55 return m.find(); 56 case ONE_OF: 57 String[] parts = val.split(";"); 58 for (String part : parts) { 59 if (equal(v, part.trim())) 60 return true; 61 } 62 return false; 63 case BEGINS_WITH: 64 return val.startsWith(v); 65 case ENDS_WITH: 66 return val.endsWith(v); 67 case CONTAINS: 68 return val.contains(v); 69 } 70 float val_float; 71 try { 72 val_float = Float.parseFloat(val); 73 } catch (NumberFormatException e) { 74 return false; 75 } 76 switch (op) { 77 case GREATER_OR_EQUAL: 78 return val_float >= v_float; 79 case GREATER: 80 return val_float > v_float; 81 case LESS_OR_EQUAL: 82 return val_float <= v_float; 83 case LESS: 84 return val_float < v_float; 35 85 default: 36 86 throw new AssertionError(); … … 40 90 @Override 41 91 public String toString() { 42 return "[" + k + (op == Op.EQ ? "=" : "!=")+ v + "]";92 return "[" + k + "'" + op + "'" + v + "]"; 43 93 } 44 94 } … … 77 127 @Override 78 128 public boolean applies(Environment e) { 79 if ( "closed".equals(id)) {129 if (equal(id, "closed")) { 80 130 if (e.osm instanceof Way && ((Way) e.osm).isClosed()) 81 131 return true; … … 83 133 return true; 84 134 return false; 135 } else if (equal(id, "modified")) { 136 return e.osm.isModified() || e.osm.isNewOrUndeleted(); 137 } else if (equal(id, "new")) { 138 return e.osm.isNew(); 139 } else if (equal(id, "connection") && (e.osm instanceof Node)) { 140 return ((Node) e.osm).isConnectionNode(); 85 141 } 86 142 return true; -
trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/Instruction.java
r3862 r3876 30 30 public AssignmentInstruction(String key, Object val) { 31 31 this.key = key; 32 this.val = val; 32 if (val instanceof Expression.LiteralExpression) { 33 this.val = ((Expression.LiteralExpression) val).evaluate(null); 34 } else { 35 this.val = val; 36 } 33 37 } 34 38 -
trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSRule.java
r3848 r3876 18 18 @Override 19 19 public String toString() { 20 return Utils.join(",", selectors) + " {\n " + Utils.join(" ;\n ", declaration) + "\n}";20 return Utils.join(",", selectors) + " {\n " + Utils.join("\n ", declaration) + "\n}"; 21 21 } 22 22 } -
trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/parser/MapCSSParser.java
r3867 r3876 67 67 } 68 68 69 final public float float_() throws ParseException { 70 float f; 71 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 72 case MINUS: 73 jj_consume_token(MINUS); 74 f = ufloat(); 75 {if (true) return -f;} 76 break; 77 case UINT: 78 case UFLOAT: 79 f = ufloat(); 80 {if (true) return f;} 81 break; 82 default: 83 jj_la1[1] = jj_gen; 84 jj_consume_token(-1); 85 throw new ParseException(); 86 } 87 throw new Error("Missing return statement in function"); 88 } 89 69 90 final public String string() throws ParseException { 70 91 Token t; 71 92 t = jj_consume_token(STRING); 72 93 {if (true) return t.image.substring(1, t.image.length() - 1).replace("\\\"", "\"").replace("\\\\", "\\");} 73 94 throw new Error("Missing return statement in function"); 74 95 } … … 87 108 break; 88 109 default: 89 jj_la1[ 1] = jj_gen;110 jj_la1[2] = jj_gen; 90 111 jj_consume_token(-1); 91 112 throw new ParseException(); 92 113 } 114 throw new Error("Missing return statement in function"); 115 } 116 117 final public String regex() throws ParseException { 118 Token t; 119 t = jj_consume_token(REGEX); 120 {if (true) return t.image.substring(1, t.image.length() - 1);} 93 121 throw new Error("Missing return statement in function"); 94 122 } … … 103 131 break; 104 132 default: 105 jj_la1[ 2] = jj_gen;133 jj_la1[3] = jj_gen; 106 134 ; 107 135 } … … 120 148 break; 121 149 default: 122 jj_la1[ 3] = jj_gen;150 jj_la1[4] = jj_gen; 123 151 break label_1; 124 152 } … … 132 160 break; 133 161 default: 134 jj_la1[ 4] = jj_gen;162 jj_la1[5] = jj_gen; 135 163 jj_consume_token(-1); 136 164 throw new ParseException(); … … 158 186 break; 159 187 default: 160 jj_la1[ 5] = jj_gen;188 jj_la1[6] = jj_gen; 161 189 break label_2; 162 190 } … … 182 210 break; 183 211 default: 184 jj_la1[ 6] = jj_gen;212 jj_la1[7] = jj_gen; 185 213 break label_3; 186 214 } 187 r = rule(); 188 if (r != null) { sheet.rules.add(r); } 189 w(); 215 try { 216 r = rule(); 217 if (r != null) { sheet.rules.add(r); } 218 w(); 219 } catch (ParseException ex) { 220 error_skipto(RBRACE); 221 w(); 222 } 190 223 } 191 224 jj_consume_token(0); … … 196 229 Selector sel; 197 230 List<Instruction> decl; 198 try { 231 sel = selector(); 232 selectors.add(sel); 233 w(); 234 label_4: 235 while (true) { 236 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 237 case COMMA: 238 ; 239 break; 240 default: 241 jj_la1[8] = jj_gen; 242 break label_4; 243 } 244 jj_consume_token(COMMA); 245 w(); 199 246 sel = selector(); 200 247 selectors.add(sel); 201 248 w(); 202 label_4:203 while (true) {204 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {205 case COMMA:206 ;207 break;208 default:209 jj_la1[7] = jj_gen;210 break label_4;211 }212 jj_consume_token(COMMA);213 w();214 sel = selector();215 selectors.add(sel);216 w();217 }218 } catch (ParseException ex) {219 error_skipto(RBRACE);220 {if (true) return null;}221 249 } 222 250 decl = declaration(); … … 239 267 break; 240 268 default: 241 jj_la1[ 8] = jj_gen;269 jj_la1[9] = jj_gen; 242 270 jj_consume_token(-1); 243 271 throw new ParseException(); … … 248 276 break; 249 277 default: 250 jj_la1[ 9] = jj_gen;278 jj_la1[10] = jj_gen; 251 279 ; 252 280 } … … 259 287 break; 260 288 default: 261 jj_la1[1 0] = jj_gen;289 jj_la1[11] = jj_gen; 262 290 break label_5; 263 291 } … … 270 298 break; 271 299 default: 272 jj_la1[1 1] = jj_gen;300 jj_la1[12] = jj_gen; 273 301 jj_consume_token(-1); 274 302 throw new ParseException(); … … 277 305 } 278 306 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 279 case SLASH:280 307 case DCOLON: 281 308 sub = subpart(); 282 309 break; 283 310 default: 284 jj_la1[1 2] = jj_gen;311 jj_la1[13] = jj_gen; 285 312 ; 286 313 } … … 308 335 break; 309 336 default: 310 jj_la1[1 3] = jj_gen;337 jj_la1[14] = jj_gen; 311 338 ; 312 339 } 313 340 break; 314 341 default: 315 jj_la1[1 4] = jj_gen;342 jj_la1[15] = jj_gen; 316 343 ; 317 344 } 318 345 break; 319 346 default: 320 jj_la1[1 5] = jj_gen;347 jj_la1[16] = jj_gen; 321 348 jj_consume_token(-1); 322 349 throw new ParseException(); … … 330 357 Expression e; 331 358 jj_consume_token(LSQUARE); 332 if (jj_2_1( 2)) {359 if (jj_2_1(3)) { 333 360 c = simple_key_condition(); 334 361 jj_consume_token(RSQUARE); 335 336 } else if (jj_2_2( 3)) {362 {if (true) return c;} 363 } else if (jj_2_2(5)) { 337 364 c = simple_key_value_condition(); 365 jj_consume_token(RSQUARE); 366 {if (true) return c;} 338 367 } else { 339 368 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { … … 348 377 case MINUS: 349 378 e = expression(); 350 c = new Condition.ExpressionCondition(e); 379 jj_consume_token(RSQUARE); 380 {if (true) return new Condition.ExpressionCondition(e);} 351 381 break; 352 382 default: 353 jj_la1[1 6] = jj_gen;383 jj_la1[17] = jj_gen; 354 384 jj_consume_token(-1); 355 385 throw new ParseException(); 356 386 } 357 387 } 358 jj_consume_token(RSQUARE);359 {if (true) return c;}360 388 throw new Error("Missing return statement in function"); 361 389 } … … 370 398 break; 371 399 default: 372 jj_la1[1 7] = jj_gen;400 jj_la1[18] = jj_gen; 373 401 ; 374 402 } … … 379 407 380 408 final public Condition simple_key_value_condition() throws ParseException { 381 boolean not = false;382 409 String key; 383 410 String val; 411 float f; 412 Condition.Op op; 384 413 key = string_or_ident(); 385 414 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 386 case EXCLAMATION_EQUAL: 387 jj_consume_token(EXCLAMATION_EQUAL); 388 not = true; 389 break; 415 case STAR: 390 416 case EQUAL: 391 jj_consume_token(EQUAL); 417 case EXCLAMATION: 418 case TILDE: 419 case DOLLAR: 420 case CARET: 421 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 422 case EXCLAMATION: 423 jj_consume_token(EXCLAMATION); 424 jj_consume_token(EQUAL); 425 op=Condition.Op.NEQ; 426 val = string_or_ident(); 427 break; 428 case EQUAL: 429 jj_consume_token(EQUAL); 430 op=Condition.Op.EQ; 431 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 432 case TILDE: 433 jj_consume_token(TILDE); 434 op=Condition.Op.REGEX; 435 val = regex(); 436 break; 437 case IDENT: 438 case STRING: 439 val = string_or_ident(); 440 break; 441 default: 442 jj_la1[19] = jj_gen; 443 jj_consume_token(-1); 444 throw new ParseException(); 445 } 446 break; 447 case TILDE: 448 jj_consume_token(TILDE); 449 jj_consume_token(EQUAL); 450 op=Condition.Op.ONE_OF; 451 val = string_or_ident(); 452 break; 453 case CARET: 454 jj_consume_token(CARET); 455 jj_consume_token(EQUAL); 456 op=Condition.Op.BEGINS_WITH; 457 val = string_or_ident(); 458 break; 459 case DOLLAR: 460 jj_consume_token(DOLLAR); 461 jj_consume_token(EQUAL); 462 op=Condition.Op.ENDS_WITH; 463 val = string_or_ident(); 464 break; 465 case STAR: 466 jj_consume_token(STAR); 467 jj_consume_token(EQUAL); 468 op=Condition.Op.CONTAINS; 469 val = string_or_ident(); 470 break; 471 default: 472 jj_la1[20] = jj_gen; 473 jj_consume_token(-1); 474 throw new ParseException(); 475 } 476 {if (true) return new Condition.KeyValueCondition(key, val, op);} 477 break; 478 case GREATER_EQUAL: 479 case LESS_EQUAL: 480 case GREATER: 481 case LESS: 482 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 483 case GREATER_EQUAL: 484 jj_consume_token(GREATER_EQUAL); 485 op=Condition.Op.GREATER_OR_EQUAL; 486 break; 487 case GREATER: 488 jj_consume_token(GREATER); 489 op=Condition.Op.GREATER; 490 break; 491 case LESS_EQUAL: 492 jj_consume_token(LESS_EQUAL); 493 op=Condition.Op.LESS_OR_EQUAL; 494 break; 495 case LESS: 496 jj_consume_token(LESS); 497 op=Condition.Op.LESS; 498 break; 499 default: 500 jj_la1[21] = jj_gen; 501 jj_consume_token(-1); 502 throw new ParseException(); 503 } 504 f = float_(); 505 {if (true) return new Condition.KeyValueCondition(key, Float.toString(f), op);} 392 506 break; 393 507 default: 394 jj_la1[ 18] = jj_gen;508 jj_la1[22] = jj_gen; 395 509 jj_consume_token(-1); 396 510 throw new ParseException(); 397 511 } 398 val = string_or_ident();399 {if (true) return new Condition.KeyValueCondition(key, val, not ? Condition.Op.NEQ : Condition.Op.EQ);}400 512 throw new Error("Missing return statement in function"); 401 513 } … … 411 523 break; 412 524 default: 413 jj_la1[ 19] = jj_gen;525 jj_la1[23] = jj_gen; 414 526 ; 415 527 } … … 421 533 final public String subpart() throws ParseException { 422 534 Token t; 423 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 424 case SLASH: 425 jj_consume_token(SLASH); 426 break; 427 case DCOLON: 428 jj_consume_token(DCOLON); 429 break; 430 default: 431 jj_la1[20] = jj_gen; 432 jj_consume_token(-1); 433 throw new ParseException(); 434 } 535 jj_consume_token(DCOLON); 435 536 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 436 537 case IDENT: … … 441 542 break; 442 543 default: 443 jj_la1[2 1] = jj_gen;544 jj_la1[24] = jj_gen; 444 545 jj_consume_token(-1); 445 546 throw new ParseException(); … … 452 553 List<Instruction> ins = new ArrayList<Instruction>(); 453 554 Instruction i; 555 Token key; 556 Object val; 454 557 jj_consume_token(LBRACE); 455 558 w(); 456 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 457 case RBRACE: 458 jj_consume_token(RBRACE); 459 {if (true) return ins;} 460 break; 461 default: 462 jj_la1[22] = jj_gen; 463 ; 464 } 465 try { 466 i = instruction(); 467 if (i != null) ins.add(i); 468 label_6: 469 while (true) { 470 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 471 case SEMICOLON: 472 ; 473 break; 474 default: 475 jj_la1[23] = jj_gen; 476 break label_6; 477 } 478 jj_consume_token(SEMICOLON); 559 label_6: 560 while (true) { 561 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 562 case IDENT: 563 ; 564 break; 565 default: 566 jj_la1[25] = jj_gen; 567 break label_6; 568 } 569 key = jj_consume_token(IDENT); 570 w(); 571 jj_consume_token(COLON); 572 w(); 573 if (jj_2_3(2147483647)) { 574 val = float_array(); 575 ins.add(new Instruction.AssignmentInstruction(key.image, val)); 479 576 w(); 480 577 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 481 578 case RBRACE: 482 579 jj_consume_token(RBRACE); 483 {if (true) return ins;} 580 {if (true) return ins;} 581 break; 582 case SEMICOLON: 583 jj_consume_token(SEMICOLON); 584 w(); 484 585 break; 485 586 default: 486 jj_la1[24] = jj_gen; 487 ; 587 jj_la1[26] = jj_gen; 588 jj_consume_token(-1); 589 throw new ParseException(); 488 590 } 489 i = instruction(); 490 if (i != null) ins.add(i); 491 } 492 jj_consume_token(RBRACE); 493 {if (true) return ins;} 494 } catch (ParseException ex) { 495 error_skipto(RBRACE); 496 {if (true) return ins;} 497 } 498 throw new Error("Missing return statement in function"); 499 } 500 501 final public Instruction instruction() throws ParseException { 502 Token key; 503 Object val; 504 key = jj_consume_token(IDENT); 505 w(); 506 jj_consume_token(COLON); 507 w(); 508 if (jj_2_3(2)) { 509 val = float_array(); 510 w(); 511 } else { 512 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 513 case IDENT: 514 case UINT: 515 case UFLOAT: 516 case STRING: 517 case HEXCOLOR: 518 case LPAR: 519 case EXCLAMATION: 520 case PLUS: 521 case MINUS: 591 } else if (jj_2_4(2147483647)) { 522 592 val = expression(); 523 break; 524 default: 525 jj_la1[25] = jj_gen; 526 jj_consume_token(-1); 527 throw new ParseException(); 528 } 529 } 530 if (val instanceof LiteralExpression) 531 {if (true) return new Instruction.AssignmentInstruction(key.image, ((LiteralExpression) val).evaluate(null));} 532 else 533 {if (true) return new Instruction.AssignmentInstruction(key.image, val);} 593 ins.add(new Instruction.AssignmentInstruction(key.image, val)); 594 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 595 case RBRACE: 596 jj_consume_token(RBRACE); 597 {if (true) return ins;} 598 break; 599 case SEMICOLON: 600 jj_consume_token(SEMICOLON); 601 w(); 602 break; 603 default: 604 jj_la1[27] = jj_gen; 605 jj_consume_token(-1); 606 throw new ParseException(); 607 } 608 } else { 609 val = readRaw(); 610 w(); 611 ins.add(new Instruction.AssignmentInstruction(key.image, val)); 612 } 613 } 614 jj_consume_token(RBRACE); 615 {if (true) return ins;} 534 616 throw new Error("Missing return statement in function"); 535 617 } … … 542 624 case EXCLAMATION: 543 625 jj_consume_token(EXCLAMATION); 544 626 op = "not"; 545 627 w(); 546 628 e = primary(); 547 629 args.add(e); 548 630 w(); 549 631 break; 550 632 case MINUS: 551 633 jj_consume_token(MINUS); 552 634 op = "minus"; 553 635 w(); 554 636 e = primary(); 555 637 args.add(e); 556 638 w(); 557 639 break; … … 594 676 break; 595 677 default: 596 jj_la1[2 6] = jj_gen;678 jj_la1[28] = jj_gen; 597 679 break label_7; 598 680 } … … 613 695 break; 614 696 default: 615 jj_la1[2 7] = jj_gen;697 jj_la1[29] = jj_gen; 616 698 break label_8; 617 699 } … … 632 714 break; 633 715 default: 634 jj_la1[ 28] = jj_gen;716 jj_la1[30] = jj_gen; 635 717 break label_9; 636 718 } … … 651 733 break; 652 734 default: 653 jj_la1[ 29] = jj_gen;735 jj_la1[31] = jj_gen; 654 736 break label_10; 655 737 } … … 658 740 case GREATER_EQUAL: 659 741 jj_consume_token(GREATER_EQUAL); 660 742 op = "greater_equal"; 661 743 w(); 662 744 e = primary(); 663 745 args.add(e); 664 746 w(); 665 747 break; 666 748 case LESS_EQUAL: 667 749 jj_consume_token(LESS_EQUAL); 668 750 op = "less_equal"; 669 751 w(); 670 752 e = primary(); 671 753 args.add(e); 672 754 w(); 673 755 break; 674 756 case GREATER: 675 757 jj_consume_token(GREATER); 676 758 op = "greater"; 677 759 w(); 678 760 e = primary(); 679 761 args.add(e); 680 762 w(); 681 763 break; … … 687 769 break; 688 770 default: 689 jj_la1[3 0] = jj_gen;771 jj_la1[32] = jj_gen; 690 772 ; 691 773 } 692 774 op = "equal"; 693 775 w(); 694 776 e = primary(); 695 777 args.add(e); 696 778 w(); 697 779 break; 698 780 case LESS: 699 781 jj_consume_token(LESS); 700 782 op = "less"; 701 783 w(); 702 784 e = primary(); 703 785 args.add(e); 704 786 w(); 705 787 break; … … 707 789 jj_consume_token(AMPERSAND); 708 790 jj_consume_token(AMPERSAND); 709 791 op = "and"; 710 792 w(); 711 793 e = primary(); 712 794 args.add(e); 713 795 w(); 714 796 break; … … 716 798 jj_consume_token(PIPE); 717 799 jj_consume_token(PIPE); 718 800 op = "or"; 719 801 w(); 720 802 e = primary(); 721 803 args.add(e); 722 804 w(); 723 805 break; 724 806 case QUESTION: 725 807 jj_consume_token(QUESTION); 726 808 op = "cond"; 727 809 w(); 728 810 e = primary(); 729 811 args.add(e); 730 812 w(); 731 813 jj_consume_token(COLON); 732 814 w(); 733 815 e = primary(); 734 816 args.add(e); 735 817 w(); 736 818 break; 737 819 default: 738 jj_la1[3 1] = jj_gen;820 jj_la1[33] = jj_gen; 739 821 jj_consume_token(-1); 740 822 throw new ParseException(); … … 742 824 break; 743 825 default: 744 jj_la1[3 2] = jj_gen;826 jj_la1[34] = jj_gen; 745 827 ; 746 828 } 747 829 break; 748 830 default: 749 jj_la1[3 3] = jj_gen;831 jj_la1[35] = jj_gen; 750 832 jj_consume_token(-1); 751 833 throw new ParseException(); … … 761 843 FunctionExpression fn; 762 844 Object lit; 763 if (jj_2_ 4(2)) {845 if (jj_2_5(2)) { 764 846 // both function and identifier start with an identifier 765 847 fn = function(); … … 781 863 nested = expression(); 782 864 jj_consume_token(RPAR); 783 865 {if (true) return nested;} 784 866 break; 785 867 default: 786 jj_la1[3 4] = jj_gen;868 jj_la1[36] = jj_gen; 787 869 jj_consume_token(-1); 788 870 throw new ParseException(); … … 821 903 break; 822 904 default: 823 jj_la1[3 5] = jj_gen;905 jj_la1[37] = jj_gen; 824 906 break label_11; 825 907 } … … 831 913 break; 832 914 default: 833 jj_la1[3 6] = jj_gen;915 jj_la1[38] = jj_gen; 834 916 ; 835 917 } … … 852 934 jj_consume_token(PLUS); 853 935 f = ufloat(); 854 936 {if (true) return new Instruction.RelativeFloat(f);} 855 937 break; 856 938 case UINT: … … 870 952 break; 871 953 default: 872 jj_la1[3 7] = jj_gen;954 jj_la1[39] = jj_gen; 873 955 jj_consume_token(-1); 874 956 throw new ParseException(); … … 879 961 void error_skipto(int kind) throws ParseException { 880 962 ParseException e = generateParseException(); 963 System.err.println("Skipping to the next rule, because of an error:"); 881 964 System.err.println(e); 882 965 if (sheet != null) { … … 891 974 } 892 975 976 /** 977 * read everything to the next semicolon 978 */ 979 String readRaw() throws ParseException { 980 Token t; 981 StringBuilder s = new StringBuilder(); 982 while (true) { 983 t = getNextToken(); 984 if (t.kind == SEMICOLON || t.kind == EOF) 985 break; 986 s.append(t.image); 987 } 988 if (t.kind == EOF) 989 throw new ParseException("Reached end of file while parsing"); 990 return s.toString(); 991 } 992 893 993 private boolean jj_2_1(int xla) { 894 994 jj_la = xla; jj_lastpos = jj_scanpos = token; … … 919 1019 } 920 1020 921 private boolean jj_3R_12() { 1021 private boolean jj_2_5(int xla) { 1022 jj_la = xla; jj_lastpos = jj_scanpos = token; 1023 try { return !jj_3_5(); } 1024 catch(LookaheadSuccess ls) { return true; } 1025 finally { jj_save(4, xla); } 1026 } 1027 1028 private boolean jj_3R_29() { 1029 if (jj_3R_45()) return true; 1030 return false; 1031 } 1032 1033 private boolean jj_3R_17() { 1034 if (jj_scan_token(IDENT)) return true; 1035 if (jj_3R_15()) return true; 1036 if (jj_scan_token(LPAR)) return true; 1037 if (jj_3R_15()) return true; 922 1038 Token xsp; 923 1039 xsp = jj_scanpos; 924 if (jj_3R_16()) jj_scanpos = xsp; 925 if (jj_3R_17()) return true; 926 return false; 927 } 928 929 private boolean jj_3R_20() { 930 if (jj_scan_token(COMMA)) return true; 931 return false; 932 } 933 934 private boolean jj_3_4() { 935 if (jj_3R_15()) return true; 936 return false; 937 } 938 939 private boolean jj_3R_25() { 940 if (jj_scan_token(STRING)) return true; 941 return false; 942 } 943 944 private boolean jj_3R_14() { 945 if (jj_3R_19()) return true; 946 Token xsp; 947 if (jj_3R_20()) return true; 1040 if (jj_3R_70()) jj_scanpos = xsp; 1041 if (jj_scan_token(RPAR)) return true; 1042 return false; 1043 } 1044 1045 private boolean jj_3R_24() { 1046 Token xsp; 1047 xsp = jj_scanpos; 1048 if (jj_scan_token(9)) { 1049 jj_scanpos = xsp; 1050 if (jj_3R_42()) return true; 1051 } 1052 return false; 1053 } 1054 1055 private boolean jj_3R_15() { 1056 Token xsp; 948 1057 while (true) { 949 1058 xsp = jj_scanpos; 950 if (jj_3R_20()) { jj_scanpos = xsp; break; } 951 } 1059 if (jj_3R_24()) { jj_scanpos = xsp; break; } 1060 } 1061 return false; 1062 } 1063 1064 private boolean jj_3R_51() { 1065 if (jj_scan_token(LPAR)) return true; 1066 if (jj_3R_15()) return true; 1067 if (jj_3R_16()) return true; 1068 if (jj_scan_token(RPAR)) return true; 1069 return false; 1070 } 1071 1072 private boolean jj_3R_50() { 1073 if (jj_3R_65()) return true; 1074 return false; 1075 } 1076 1077 private boolean jj_3R_41() { 1078 Token xsp; 1079 xsp = jj_scanpos; 1080 if (jj_scan_token(9)) jj_scanpos = xsp; 1081 return false; 1082 } 1083 1084 private boolean jj_3R_49() { 1085 if (jj_3R_22()) return true; 1086 return false; 1087 } 1088 1089 private boolean jj_3R_43() { 1090 Token xsp; 1091 xsp = jj_scanpos; 1092 if (jj_3_5()) { 1093 jj_scanpos = xsp; 1094 if (jj_3R_50()) { 1095 jj_scanpos = xsp; 1096 if (jj_3R_51()) return true; 1097 } 1098 } 1099 return false; 1100 } 1101 1102 private boolean jj_3_5() { 1103 if (jj_3R_17()) return true; 1104 return false; 1105 } 1106 1107 private boolean jj_3R_63() { 1108 if (jj_scan_token(QUESTION)) return true; 1109 if (jj_3R_15()) return true; 1110 if (jj_3R_43()) return true; 1111 if (jj_3R_15()) return true; 1112 if (jj_scan_token(COLON)) return true; 1113 if (jj_3R_15()) return true; 1114 if (jj_3R_43()) return true; 1115 if (jj_3R_15()) return true; 1116 return false; 1117 } 1118 1119 private boolean jj_3R_39() { 1120 if (jj_scan_token(LESS)) return true; 1121 return false; 1122 } 1123 1124 private boolean jj_3R_62() { 1125 if (jj_scan_token(PIPE)) return true; 1126 if (jj_scan_token(PIPE)) return true; 1127 if (jj_3R_15()) return true; 1128 if (jj_3R_43()) return true; 1129 if (jj_3R_15()) return true; 1130 return false; 1131 } 1132 1133 private boolean jj_3R_38() { 1134 if (jj_scan_token(LESS_EQUAL)) return true; 1135 return false; 1136 } 1137 1138 private boolean jj_3R_61() { 1139 if (jj_scan_token(AMPERSAND)) return true; 1140 if (jj_scan_token(AMPERSAND)) return true; 1141 if (jj_3R_15()) return true; 1142 if (jj_3R_43()) return true; 1143 if (jj_3R_15()) return true; 1144 return false; 1145 } 1146 1147 private boolean jj_3R_37() { 1148 if (jj_scan_token(GREATER)) return true; 1149 return false; 1150 } 1151 1152 private boolean jj_3R_64() { 1153 if (jj_scan_token(REGEX)) return true; 1154 return false; 1155 } 1156 1157 private boolean jj_3R_60() { 1158 if (jj_scan_token(LESS)) return true; 1159 if (jj_3R_15()) return true; 1160 if (jj_3R_43()) return true; 1161 if (jj_3R_15()) return true; 1162 return false; 1163 } 1164 1165 private boolean jj_3R_36() { 1166 if (jj_scan_token(GREATER_EQUAL)) return true; 1167 return false; 1168 } 1169 1170 private boolean jj_3R_59() { 1171 if (jj_scan_token(EQUAL)) return true; 1172 Token xsp; 1173 xsp = jj_scanpos; 1174 if (jj_scan_token(22)) jj_scanpos = xsp; 1175 if (jj_3R_15()) return true; 1176 if (jj_3R_43()) return true; 1177 if (jj_3R_15()) return true; 1178 return false; 1179 } 1180 1181 private boolean jj_3R_58() { 1182 if (jj_scan_token(GREATER)) return true; 1183 if (jj_3R_15()) return true; 1184 if (jj_3R_43()) return true; 1185 if (jj_3R_15()) return true; 1186 return false; 1187 } 1188 1189 private boolean jj_3R_57() { 1190 if (jj_scan_token(LESS_EQUAL)) return true; 1191 if (jj_3R_15()) return true; 1192 if (jj_3R_43()) return true; 1193 if (jj_3R_15()) return true; 1194 return false; 1195 } 1196 1197 private boolean jj_3R_35() { 1198 if (jj_scan_token(STAR)) return true; 1199 if (jj_scan_token(EQUAL)) return true; 1200 if (jj_3R_19()) return true; 1201 return false; 1202 } 1203 1204 private boolean jj_3R_47() { 1205 if (jj_3R_19()) return true; 1206 return false; 1207 } 1208 1209 private boolean jj_3R_69() { 1210 if (jj_scan_token(SLASH)) return true; 1211 if (jj_3R_15()) return true; 1212 if (jj_3R_43()) return true; 1213 if (jj_3R_15()) return true; 1214 return false; 1215 } 1216 1217 private boolean jj_3R_56() { 1218 if (jj_scan_token(GREATER_EQUAL)) return true; 1219 if (jj_3R_15()) return true; 1220 if (jj_3R_43()) return true; 1221 if (jj_3R_15()) return true; 1222 return false; 1223 } 1224 1225 private boolean jj_3R_19() { 1226 Token xsp; 1227 xsp = jj_scanpos; 1228 if (jj_3R_28()) { 1229 jj_scanpos = xsp; 1230 if (jj_3R_29()) return true; 1231 } 1232 return false; 1233 } 1234 1235 private boolean jj_3R_28() { 1236 if (jj_scan_token(IDENT)) return true; 1237 return false; 1238 } 1239 1240 private boolean jj_3R_34() { 1241 if (jj_scan_token(DOLLAR)) return true; 1242 if (jj_scan_token(EQUAL)) return true; 1243 if (jj_3R_19()) return true; 1244 return false; 1245 } 1246 1247 private boolean jj_3R_68() { 1248 if (jj_scan_token(MINUS)) return true; 1249 if (jj_3R_15()) return true; 1250 if (jj_3R_43()) return true; 1251 if (jj_3R_15()) return true; 1252 return false; 1253 } 1254 1255 private boolean jj_3R_55() { 1256 Token xsp; 1257 if (jj_3R_69()) return true; 1258 while (true) { 1259 xsp = jj_scanpos; 1260 if (jj_3R_69()) { jj_scanpos = xsp; break; } 1261 } 1262 return false; 1263 } 1264 1265 private boolean jj_3R_46() { 1266 if (jj_scan_token(TILDE)) return true; 1267 if (jj_3R_64()) return true; 1268 return false; 1269 } 1270 1271 private boolean jj_3R_21() { 1272 Token xsp; 1273 xsp = jj_scanpos; 1274 if (jj_3R_36()) { 1275 jj_scanpos = xsp; 1276 if (jj_3R_37()) { 1277 jj_scanpos = xsp; 1278 if (jj_3R_38()) { 1279 jj_scanpos = xsp; 1280 if (jj_3R_39()) return true; 1281 } 1282 } 1283 } 1284 if (jj_3R_40()) return true; 1285 return false; 1286 } 1287 1288 private boolean jj_3R_33() { 1289 if (jj_scan_token(CARET)) return true; 1290 if (jj_scan_token(EQUAL)) return true; 1291 if (jj_3R_19()) return true; 1292 return false; 1293 } 1294 1295 private boolean jj_3R_67() { 1296 if (jj_scan_token(STAR)) return true; 1297 if (jj_3R_15()) return true; 1298 if (jj_3R_43()) return true; 1299 if (jj_3R_15()) return true; 1300 return false; 1301 } 1302 1303 private boolean jj_3R_54() { 1304 Token xsp; 1305 if (jj_3R_68()) return true; 1306 while (true) { 1307 xsp = jj_scanpos; 1308 if (jj_3R_68()) { jj_scanpos = xsp; break; } 1309 } 1310 return false; 1311 } 1312 1313 private boolean jj_3R_32() { 1314 if (jj_scan_token(TILDE)) return true; 1315 if (jj_scan_token(EQUAL)) return true; 1316 if (jj_3R_19()) return true; 1317 return false; 1318 } 1319 1320 private boolean jj_3R_66() { 1321 if (jj_scan_token(PLUS)) return true; 1322 if (jj_3R_15()) return true; 1323 if (jj_3R_43()) return true; 1324 if (jj_3R_15()) return true; 1325 return false; 1326 } 1327 1328 private boolean jj_3R_53() { 1329 Token xsp; 1330 if (jj_3R_67()) return true; 1331 while (true) { 1332 xsp = jj_scanpos; 1333 if (jj_3R_67()) { jj_scanpos = xsp; break; } 1334 } 1335 return false; 1336 } 1337 1338 private boolean jj_3R_52() { 1339 Token xsp; 1340 if (jj_3R_66()) return true; 1341 while (true) { 1342 xsp = jj_scanpos; 1343 if (jj_3R_66()) { jj_scanpos = xsp; break; } 1344 } 1345 return false; 1346 } 1347 1348 private boolean jj_3R_44() { 1349 Token xsp; 1350 xsp = jj_scanpos; 1351 if (jj_3R_52()) { 1352 jj_scanpos = xsp; 1353 if (jj_3R_53()) { 1354 jj_scanpos = xsp; 1355 if (jj_3R_54()) { 1356 jj_scanpos = xsp; 1357 if (jj_3R_55()) { 1358 jj_scanpos = xsp; 1359 if (jj_3R_56()) { 1360 jj_scanpos = xsp; 1361 if (jj_3R_57()) { 1362 jj_scanpos = xsp; 1363 if (jj_3R_58()) { 1364 jj_scanpos = xsp; 1365 if (jj_3R_59()) { 1366 jj_scanpos = xsp; 1367 if (jj_3R_60()) { 1368 jj_scanpos = xsp; 1369 if (jj_3R_61()) { 1370 jj_scanpos = xsp; 1371 if (jj_3R_62()) { 1372 jj_scanpos = xsp; 1373 if (jj_3R_63()) return true; 1374 } 1375 } 1376 } 1377 } 1378 } 1379 } 1380 } 1381 } 1382 } 1383 } 1384 } 1385 return false; 1386 } 1387 1388 private boolean jj_3R_45() { 1389 if (jj_scan_token(STRING)) return true; 1390 return false; 1391 } 1392 1393 private boolean jj_3R_31() { 1394 if (jj_scan_token(EQUAL)) return true; 1395 Token xsp; 1396 xsp = jj_scanpos; 1397 if (jj_3R_46()) { 1398 jj_scanpos = xsp; 1399 if (jj_3R_47()) return true; 1400 } 1401 return false; 1402 } 1403 1404 private boolean jj_3R_30() { 1405 if (jj_scan_token(EXCLAMATION)) return true; 1406 if (jj_scan_token(EQUAL)) return true; 1407 if (jj_3R_19()) return true; 1408 return false; 1409 } 1410 1411 private boolean jj_3R_48() { 1412 if (jj_scan_token(MINUS)) return true; 1413 if (jj_3R_22()) return true; 1414 return false; 1415 } 1416 1417 private boolean jj_3R_40() { 1418 Token xsp; 1419 xsp = jj_scanpos; 1420 if (jj_3R_48()) { 1421 jj_scanpos = xsp; 1422 if (jj_3R_49()) return true; 1423 } 1424 return false; 1425 } 1426 1427 private boolean jj_3R_20() { 1428 Token xsp; 1429 xsp = jj_scanpos; 1430 if (jj_3R_30()) { 1431 jj_scanpos = xsp; 1432 if (jj_3R_31()) { 1433 jj_scanpos = xsp; 1434 if (jj_3R_32()) { 1435 jj_scanpos = xsp; 1436 if (jj_3R_33()) { 1437 jj_scanpos = xsp; 1438 if (jj_3R_34()) { 1439 jj_scanpos = xsp; 1440 if (jj_3R_35()) return true; 1441 } 1442 } 1443 } 1444 } 1445 } 1446 return false; 1447 } 1448 1449 private boolean jj_3R_27() { 1450 if (jj_3R_43()) return true; 1451 if (jj_3R_15()) return true; 1452 Token xsp; 1453 xsp = jj_scanpos; 1454 if (jj_3R_44()) jj_scanpos = xsp; 1455 return false; 1456 } 1457 1458 private boolean jj_3R_26() { 1459 if (jj_scan_token(MINUS)) return true; 1460 if (jj_3R_15()) return true; 1461 if (jj_3R_43()) return true; 1462 if (jj_3R_15()) return true; 1463 return false; 1464 } 1465 1466 private boolean jj_3R_22() { 1467 Token xsp; 1468 xsp = jj_scanpos; 1469 if (jj_scan_token(3)) { 1470 jj_scanpos = xsp; 1471 if (jj_scan_token(2)) return true; 1472 } 1473 return false; 1474 } 1475 1476 private boolean jj_3R_25() { 1477 if (jj_scan_token(EXCLAMATION)) return true; 1478 if (jj_3R_15()) return true; 1479 if (jj_3R_43()) return true; 1480 if (jj_3R_15()) return true; 1481 return false; 1482 } 1483 1484 private boolean jj_3R_13() { 1485 if (jj_3R_19()) return true; 1486 Token xsp; 1487 xsp = jj_scanpos; 1488 if (jj_3R_20()) { 1489 jj_scanpos = xsp; 1490 if (jj_3R_21()) return true; 1491 } 1492 return false; 1493 } 1494 1495 private boolean jj_3R_16() { 1496 Token xsp; 1497 xsp = jj_scanpos; 1498 if (jj_3R_25()) { 1499 jj_scanpos = xsp; 1500 if (jj_3R_26()) { 1501 jj_scanpos = xsp; 1502 if (jj_3R_27()) return true; 1503 } 1504 } 1505 return false; 1506 } 1507 1508 private boolean jj_3_4() { 1509 if (jj_3R_16()) return true; 1510 Token xsp; 1511 xsp = jj_scanpos; 1512 if (jj_scan_token(27)) { 1513 jj_scanpos = xsp; 1514 if (jj_scan_token(13)) return true; 1515 } 1516 return false; 1517 } 1518 1519 private boolean jj_3R_74() { 1520 if (jj_scan_token(HEXCOLOR)) return true; 1521 return false; 1522 } 1523 1524 private boolean jj_3R_73() { 1525 if (jj_3R_22()) return true; 1526 return false; 1527 } 1528 1529 private boolean jj_3_3() { 1530 if (jj_3R_14()) return true; 1531 if (jj_3R_15()) return true; 1532 Token xsp; 1533 xsp = jj_scanpos; 1534 if (jj_scan_token(27)) { 1535 jj_scanpos = xsp; 1536 if (jj_scan_token(13)) return true; 1537 } 1538 return false; 1539 } 1540 1541 private boolean jj_3R_72() { 1542 if (jj_scan_token(PLUS)) return true; 1543 if (jj_3R_22()) return true; 1544 return false; 1545 } 1546 1547 private boolean jj_3R_71() { 1548 if (jj_3R_19()) return true; 1549 return false; 1550 } 1551 1552 private boolean jj_3R_65() { 1553 Token xsp; 1554 xsp = jj_scanpos; 1555 if (jj_3R_71()) { 1556 jj_scanpos = xsp; 1557 if (jj_3R_72()) { 1558 jj_scanpos = xsp; 1559 if (jj_3R_73()) { 1560 jj_scanpos = xsp; 1561 if (jj_3R_74()) return true; 1562 } 1563 } 1564 } 1565 return false; 1566 } 1567 1568 private boolean jj_3R_18() { 1569 if (jj_scan_token(EXCLAMATION)) return true; 1570 return false; 1571 } 1572 1573 private boolean jj_3R_12() { 1574 Token xsp; 1575 xsp = jj_scanpos; 1576 if (jj_3R_18()) jj_scanpos = xsp; 1577 if (jj_3R_19()) return true; 952 1578 return false; 953 1579 } 954 1580 955 1581 private boolean jj_3R_23() { 956 if (jj_3R_25()) return true; 1582 if (jj_scan_token(COMMA)) return true; 1583 if (jj_3R_41()) return true; 1584 if (jj_3R_22()) return true; 1585 return false; 1586 } 1587 1588 private boolean jj_3R_75() { 1589 if (jj_scan_token(COMMA)) return true; 1590 if (jj_3R_15()) return true; 1591 if (jj_3R_16()) return true; 1592 return false; 1593 } 1594 1595 private boolean jj_3R_14() { 1596 if (jj_3R_22()) return true; 1597 Token xsp; 1598 if (jj_3R_23()) return true; 1599 while (true) { 1600 xsp = jj_scanpos; 1601 if (jj_3R_23()) { jj_scanpos = xsp; break; } 1602 } 957 1603 return false; 958 1604 } … … 960 1606 private boolean jj_3_2() { 961 1607 if (jj_3R_13()) return true; 962 return false; 963 } 964 965 private boolean jj_3R_26() { 1608 if (jj_scan_token(RSQUARE)) return true; 1609 return false; 1610 } 1611 1612 private boolean jj_3R_70() { 1613 if (jj_3R_16()) return true; 1614 Token xsp; 1615 while (true) { 1616 xsp = jj_scanpos; 1617 if (jj_3R_75()) { jj_scanpos = xsp; break; } 1618 } 1619 return false; 1620 } 1621 1622 private boolean jj_3R_42() { 966 1623 if (jj_scan_token(COMMENT_START)) return true; 967 return false; 968 } 969 970 private boolean jj_3R_19() { 971 Token xsp; 972 xsp = jj_scanpos; 973 if (jj_scan_token(3)) { 974 jj_scanpos = xsp; 975 if (jj_scan_token(2)) return true; 976 } 1624 if (jj_scan_token(COMMENT_END)) return true; 977 1625 return false; 978 1626 } … … 981 1629 if (jj_3R_12()) return true; 982 1630 if (jj_scan_token(RSQUARE)) return true; 983 return false;984 }985 986 private boolean jj_3R_24() {987 Token xsp;988 xsp = jj_scanpos;989 if (jj_scan_token(7)) {990 jj_scanpos = xsp;991 if (jj_3R_26()) return true;992 }993 return false;994 }995 996 private boolean jj_3R_21() {997 Token xsp;998 while (true) {999 xsp = jj_scanpos;1000 if (jj_3R_24()) { jj_scanpos = xsp; break; }1001 }1002 return false;1003 }1004 1005 private boolean jj_3_3() {1006 if (jj_3R_14()) return true;1007 return false;1008 }1009 1010 private boolean jj_3R_18() {1011 if (jj_scan_token(EXCLAMATION_EQUAL)) return true;1012 return false;1013 }1014 1015 private boolean jj_3R_15() {1016 if (jj_scan_token(IDENT)) return true;1017 if (jj_3R_21()) return true;1018 if (jj_scan_token(LPAR)) return true;1019 return false;1020 }1021 1022 private boolean jj_3R_13() {1023 if (jj_3R_17()) return true;1024 Token xsp;1025 xsp = jj_scanpos;1026 if (jj_3R_18()) {1027 jj_scanpos = xsp;1028 if (jj_scan_token(20)) return true;1029 }1030 if (jj_3R_17()) return true;1031 return false;1032 }1033 1034 private boolean jj_3R_17() {1035 Token xsp;1036 xsp = jj_scanpos;1037 if (jj_3R_22()) {1038 jj_scanpos = xsp;1039 if (jj_3R_23()) return true;1040 }1041 return false;1042 }1043 1044 private boolean jj_3R_22() {1045 if (jj_scan_token(IDENT)) return true;1046 return false;1047 }1048 1049 private boolean jj_3R_16() {1050 if (jj_scan_token(EXCLAMATION)) return true;1051 1631 return false; 1052 1632 } … … 1063 1643 private int jj_la; 1064 1644 private int jj_gen; 1065 final private int[] jj_la1 = new int[ 38];1645 final private int[] jj_la1 = new int[40]; 1066 1646 static private int[] jj_la1_0; 1067 1647 static private int[] jj_la1_1; … … 1071 1651 } 1072 1652 private static void jj_la1_init_0() { 1073 jj_la1_0 = new int[] {0xc,0x 12,0x80,0x80,0x80,0x4000000,0x102,0x4000000,0x102,0x10000000,0x801000,0x801000,0x1000200,0x4,0x40000000,0x40000004,0x6020405e,0x200000,0x500000,0x200000,0x1000200,0x102,0x800,0x2000000,0x800,0x6020405e,0x20000000,0x100,0x40000000,0x200,0x100000,0xe81f0300,0xe81f0300,0x6020405e,0x2000405e,0x4000000,0x6020405e,0x2000005e,};1653 jj_la1_0 = new int[] {0xc,0xc,0x12,0x200,0x200,0x200,0x10000000,0x402,0x10000000,0x402,0x40000000,0x2004000,0x2004000,0x4000000,0x4,0x0,0x4,0x8081011e,0x800000,0x1000012,0x1c00400,0x3c0000,0x1fc0400,0x800000,0x402,0x2,0x8002000,0x8002000,0x80000000,0x400,0x0,0x800,0x400000,0xa07c0c00,0xa07c0c00,0x8081011e,0x8001011e,0x10000000,0x8081011e,0x8000011e,}; 1074 1654 } 1075 1655 private static void jj_la1_init_1() { 1076 jj_la1_1 = new int[] {0x0,0x 0,0x0,0x2,0x2,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x1,0x0,0x0,0x0,0x0,0x0,};1656 jj_la1_1 = new int[] {0x0,0x1,0x0,0x0,0x20,0x20,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x1,0x1,0x0,0x0,0x18,0x0,0x18,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x7,0x7,0x1,0x0,0x0,0x1,0x0,}; 1077 1657 } 1078 final private JJCalls[] jj_2_rtns = new JJCalls[ 4];1658 final private JJCalls[] jj_2_rtns = new JJCalls[5]; 1079 1659 private boolean jj_rescan = false; 1080 1660 private int jj_gc = 0; … … 1091 1671 jj_ntk = -1; 1092 1672 jj_gen = 0; 1093 for (int i = 0; i < 38; i++) jj_la1[i] = -1;1673 for (int i = 0; i < 40; i++) jj_la1[i] = -1; 1094 1674 for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); 1095 1675 } … … 1106 1686 jj_ntk = -1; 1107 1687 jj_gen = 0; 1108 for (int i = 0; i < 38; i++) jj_la1[i] = -1;1688 for (int i = 0; i < 40; i++) jj_la1[i] = -1; 1109 1689 for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); 1110 1690 } … … 1117 1697 jj_ntk = -1; 1118 1698 jj_gen = 0; 1119 for (int i = 0; i < 38; i++) jj_la1[i] = -1;1699 for (int i = 0; i < 40; i++) jj_la1[i] = -1; 1120 1700 for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); 1121 1701 } … … 1128 1708 jj_ntk = -1; 1129 1709 jj_gen = 0; 1130 for (int i = 0; i < 38; i++) jj_la1[i] = -1;1710 for (int i = 0; i < 40; i++) jj_la1[i] = -1; 1131 1711 for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); 1132 1712 } … … 1138 1718 jj_ntk = -1; 1139 1719 jj_gen = 0; 1140 for (int i = 0; i < 38; i++) jj_la1[i] = -1;1720 for (int i = 0; i < 40; i++) jj_la1[i] = -1; 1141 1721 for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); 1142 1722 } … … 1148 1728 jj_ntk = -1; 1149 1729 jj_gen = 0; 1150 for (int i = 0; i < 38; i++) jj_la1[i] = -1;1730 for (int i = 0; i < 40; i++) jj_la1[i] = -1; 1151 1731 for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); 1152 1732 } … … 1260 1840 public ParseException generateParseException() { 1261 1841 jj_expentries.clear(); 1262 boolean[] la1tokens = new boolean[ 37];1842 boolean[] la1tokens = new boolean[41]; 1263 1843 if (jj_kind >= 0) { 1264 1844 la1tokens[jj_kind] = true; 1265 1845 jj_kind = -1; 1266 1846 } 1267 for (int i = 0; i < 38; i++) {1847 for (int i = 0; i < 40; i++) { 1268 1848 if (jj_la1[i] == jj_gen) { 1269 1849 for (int j = 0; j < 32; j++) { … … 1277 1857 } 1278 1858 } 1279 for (int i = 0; i < 37; i++) {1859 for (int i = 0; i < 41; i++) { 1280 1860 if (la1tokens[i]) { 1281 1861 jj_expentry = new int[1]; … … 1304 1884 private void jj_rescan_token() { 1305 1885 jj_rescan = true; 1306 for (int i = 0; i < 4; i++) {1886 for (int i = 0; i < 5; i++) { 1307 1887 try { 1308 1888 JJCalls p = jj_2_rtns[i]; … … 1315 1895 case 2: jj_3_3(); break; 1316 1896 case 3: jj_3_4(); break; 1897 case 4: jj_3_5(); break; 1317 1898 } 1318 1899 } -
trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/parser/MapCSSParser.jj
r3867 r3876 36 36 | < UINT: ["1"-"9"] ( ["0"-"9"] )* > 37 37 | < UFLOAT: ( ["0"-"9"] )+ ( "." ( ["0"-"9"] )+ )? > 38 | < STRING: "\"" ( [" ","!","#"-"&","("-"[","]"-"~","\u0080"-"\uFFFF"] | "\\\"" | "\\\\" )* "\"" > 38 | < STRING: "\"" ( [" ","!","#"-"[","]"-"~","\u0080"-"\uFFFF"] | "\\\"" | "\\\\" )* "\"" > 39 | < #REGEX_CHAR_WITHOUT_STAR: [" "-")","+"-".","0"-"[","]"-"~","\u0080"-"\uFFFF"] | "\\/" | "\\\\" > 40 | < REGEX: "/" <REGEX_CHAR_WITHOUT_STAR> ( <REGEX_CHAR_WITHOUT_STAR> | "*" )* "/" > 39 41 | < #H: ["0"-"9","a"-"f","A"-"F"] > 40 42 | < HEXCOLOR: "#" ( <H><H><H><H><H><H> | <H><H><H> ) > … … 54 56 | < EQUAL: "=" > 55 57 | < EXCLAMATION: "!" > 56 | < EXCLAMATION_EQUAL: "!=" >58 | < TILDE: "~" > 57 59 | < COLON: ":" > 58 60 | < DCOLON: "::" > … … 65 67 | < AMPERSAND: "&" > 66 68 | < QUESTION: "?" > 69 | < DOLLAR: "$" > 70 | < CARET: "^" > 67 71 | < COMMENT_START: "/*" > : COMMENT 68 72 | < UNEXPECTED_CHAR : ~[] > // avoid TokenMgrErrors because they are hard to recover from … … 122 126 } 123 127 128 float float_() : 129 { 130 float f; 131 } 132 { 133 <MINUS> f=ufloat() { return -f; } | f=ufloat() { return f; } 134 } 135 124 136 String string() : 125 137 { … … 128 140 { 129 141 t=<STRING> 130 { 131 return t.image.substring(1, t.image.length() - 1).replace("\\\"", "\"").replace("\\\\", "\\"); 132 } 142 { return t.image.substring(1, t.image.length() - 1).replace("\\\"", "\"").replace("\\\\", "\\"); } 133 143 } 134 144 … … 140 150 { 141 151 t=<IDENT> { return t.image; } | s=string() { return s; } 152 } 153 154 String regex() : 155 { 156 Token t; 157 } 158 { 159 t=<REGEX> 160 { return t.image.substring(1, t.image.length() - 1); } 142 161 } 143 162 … … 159 178 } 160 179 { 161 ( <S> | ( <COMMENT_START> <COMMENT_END> ))*180 ( <S> | <COMMENT_START> <COMMENT_END> )* 162 181 } 163 182 … … 192 211 { this.sheet = sheet; } 193 212 w() 194 ( r=rule() { if (r != null) { sheet.rules.add(r); } } w() )* 213 ( 214 try { 215 r=rule() { if (r != null) { sheet.rules.add(r); } } w() 216 } catch (ParseException ex) { 217 error_skipto(RBRACE); 218 w(); 219 } 220 )* 195 221 <EOF> 196 222 } … … 203 229 } 204 230 { 205 try { 231 sel=selector() { selectors.add(sel); } w() 232 ( 233 <COMMA> w() 206 234 sel=selector() { selectors.add(sel); } w() 207 ( 208 <COMMA> w() 209 sel=selector() { selectors.add(sel); } w() 210 )* 211 } catch (ParseException ex) { 212 error_skipto(RBRACE); 213 return null; 214 } 235 )* 215 236 decl=declaration() 216 237 { return new MapCSSRule(selectors, decl); } … … 241 262 <PIPE_Z> 242 263 ( 243 ( <MINUS> max=uint() ) | 244 ( min=uint() ( <MINUS> ( max=uint() )? )? ) 264 <MINUS> max=uint() 265 | 266 min=uint() ( <MINUS> ( max=uint() )? )? 245 267 ) 246 268 { return new Pair<Integer, Integer>(min, max); } … … 254 276 { 255 277 <LSQUARE> 256 ( 257 LOOKAHEAD(2) 258 ( c=simple_key_condition() <RSQUARE> { return c; } ) 259 | 278 ( 260 279 LOOKAHEAD(3) 261 c=simple_key_value_condition() 262 | 263 e=expression() { c = new Condition.ExpressionCondition(e); } 280 c=simple_key_condition() <RSQUARE> { return c; } 281 | 282 LOOKAHEAD(5) 283 c=simple_key_value_condition() <RSQUARE> { return c; } 284 | 285 e=expression() <RSQUARE> { return new Condition.ExpressionCondition(e); } 264 286 ) 265 <RSQUARE>266 { return c; }267 287 } 268 288 … … 280 300 Condition simple_key_value_condition() : 281 301 { 282 boolean not = false;283 302 String key; 284 303 String val; 304 float f; 305 Condition.Op op; 285 306 } 286 307 { 287 308 key=string_or_ident() 288 ( <EXCLAMATION_EQUAL> { not = true; } | <EQUAL> ) 289 val=string_or_ident() 290 { return new Condition.KeyValueCondition(key, val, not ? Condition.Op.NEQ : Condition.Op.EQ); } 309 ( 310 ( 311 <EXCLAMATION> <EQUAL> { op=Condition.Op.NEQ; } val=string_or_ident() 312 | 313 <EQUAL> { op=Condition.Op.EQ; } 314 ( 315 <TILDE> { op=Condition.Op.REGEX; } 316 val=regex() 317 | 318 val=string_or_ident() 319 ) 320 | 321 <TILDE> <EQUAL> { op=Condition.Op.ONE_OF; } val=string_or_ident() 322 | 323 <CARET> <EQUAL> { op=Condition.Op.BEGINS_WITH; } val=string_or_ident() 324 | 325 <DOLLAR> <EQUAL> { op=Condition.Op.ENDS_WITH; } val=string_or_ident() 326 | 327 <STAR> <EQUAL> { op=Condition.Op.CONTAINS; } val=string_or_ident() 328 ) 329 { return new Condition.KeyValueCondition(key, val, op); } 330 | 331 ( 332 <GREATER_EQUAL> { op=Condition.Op.GREATER_OR_EQUAL; } 333 | 334 <GREATER> { op=Condition.Op.GREATER; } 335 | 336 <LESS_EQUAL> { op=Condition.Op.LESS_OR_EQUAL; } 337 | 338 <LESS> { op=Condition.Op.LESS; } 339 ) 340 f=float_() 341 { return new Condition.KeyValueCondition(key, Float.toString(f), op); } 342 ) 291 343 } 292 344 … … 307 359 } 308 360 { 309 ( <SLASH> | <DCOLON> )361 <DCOLON> 310 362 ( t=<IDENT> | t=<STAR> ) 311 363 { return t.image; } … … 316 368 List<Instruction> ins = new ArrayList<Instruction>(); 317 369 Instruction i; 318 }319 {320 <LBRACE> w()321 ( <RBRACE> { return ins; } )?322 try {323 i=instruction() { if (i != null) ins.add(i); }324 (325 <SEMICOLON> w()326 ( <RBRACE> { return ins; } )?327 i=instruction() { if (i != null) ins.add(i); }328 )*329 <RBRACE> { return ins; }330 } catch (ParseException ex) {331 error_skipto(RBRACE);332 return ins;333 }334 }335 336 Instruction instruction() :337 {338 370 Token key; 339 371 Object val; 340 372 } 341 373 { 342 key=<IDENT> w() 343 <COLON> w() 344 ( 345 LOOKAHEAD(2) // both number and float array start with a number 346 ( val=float_array() w() ) 347 | 348 val=expression() 349 ) 350 { 351 if (val instanceof LiteralExpression) 352 return new Instruction.AssignmentInstruction(key.image, ((LiteralExpression) val).evaluate(null)); 353 else 354 return new Instruction.AssignmentInstruction(key.image, val); 355 } 374 <LBRACE> w() 375 ( 376 key=<IDENT> w() <COLON> w() 377 ( 378 LOOKAHEAD( float_array() w() ( <SEMICOLON> | <RBRACE> ) ) 379 val=float_array() 380 { ins.add(new Instruction.AssignmentInstruction(key.image, val)); } 381 w() 382 ( <RBRACE> { return ins; } | <SEMICOLON> w() ) 383 | 384 LOOKAHEAD( expression() ( <SEMICOLON> | <RBRACE> ) ) 385 val=expression() 386 { ins.add(new Instruction.AssignmentInstruction(key.image, val)); } 387 ( <RBRACE> { return ins; } | <SEMICOLON> w() ) 388 | 389 val=readRaw() w() { ins.add(new Instruction.AssignmentInstruction(key.image, val)); } 390 ) 391 )* 392 <RBRACE> 393 { return ins; } 356 394 } 357 395 … … 364 402 { 365 403 ( 366 ( <EXCLAMATION> { op = "not"; } w() e=primary() { args.add(e); } w())367 | 368 ( <MINUS> { op = "minus"; } w() e=primary() { args.add(e); } w())369 | 370 404 <EXCLAMATION> { op = "not"; } w() e=primary() { args.add(e); } w() 405 | 406 <MINUS> { op = "minus"; } w() e=primary() { args.add(e); } w() 407 | 408 371 409 ( 372 410 e=primary() { args.add(e); } w() … … 380 418 ( <SLASH> { op = "divided_by"; } w() e=primary() { args.add(e); } w() )+ 381 419 | 382 ( <GREATER_EQUAL> { op = "greater_equal"; } w() e=primary() { args.add(e); } w())383 | 384 ( <LESS_EQUAL> { op = "less_equal"; } w() e=primary() { args.add(e); } w())385 | 386 ( <GREATER> { op = "greater"; } w() e=primary() { args.add(e); } w())387 | 388 ( <EQUAL> ( <EQUAL> )? { op = "equal"; } w() e=primary() { args.add(e); } w())389 | 390 ( <LESS> { op = "less"; } w() e=primary() { args.add(e); } w())391 | 392 ( <AMPERSAND> <AMPERSAND> { op = "and"; } w() e=primary() { args.add(e); } w())393 | 394 ( <PIPE> <PIPE> { op = "or"; } w() e=primary() { args.add(e); } w())395 | 396 ( <QUESTION> { op = "cond"; } w() e=primary() { args.add(e); } w() <COLON> w() e=primary() { args.add(e); } w())420 <GREATER_EQUAL> { op = "greater_equal"; } w() e=primary() { args.add(e); } w() 421 | 422 <LESS_EQUAL> { op = "less_equal"; } w() e=primary() { args.add(e); } w() 423 | 424 <GREATER> { op = "greater"; } w() e=primary() { args.add(e); } w() 425 | 426 <EQUAL> ( <EQUAL> )? { op = "equal"; } w() e=primary() { args.add(e); } w() 427 | 428 <LESS> { op = "less"; } w() e=primary() { args.add(e); } w() 429 | 430 <AMPERSAND> <AMPERSAND> { op = "and"; } w() e=primary() { args.add(e); } w() 431 | 432 <PIPE> <PIPE> { op = "or"; } w() e=primary() { args.add(e); } w() 433 | 434 <QUESTION> { op = "cond"; } w() e=primary() { args.add(e); } w() <COLON> w() e=primary() { args.add(e); } w() 397 435 )? 398 436 ) … … 417 455 lit=literal() { return new LiteralExpression(lit); } 418 456 | 419 ( <LPAR> w() nested=expression() <RPAR> ){ return nested; }457 <LPAR> w() nested=expression() <RPAR> { return nested; } 420 458 } 421 459 … … 447 485 val=string_or_ident() { return val; } 448 486 | 449 ( <PLUS> f=ufloat()) { return new Instruction.RelativeFloat(f); }487 <PLUS> f=ufloat() { return new Instruction.RelativeFloat(f); } 450 488 | 451 489 f=ufloat() { return f; } … … 466 504 void error_skipto(int kind) { 467 505 ParseException e = generateParseException(); 506 System.err.println("Skipping to the next rule, because of an error:"); 468 507 System.err.println(e); 469 508 if (sheet != null) { … … 478 517 } 479 518 519 JAVACODE 520 /** 521 * read everything to the next semicolon 522 */ 523 String readRaw() { 524 Token t; 525 StringBuilder s = new StringBuilder(); 526 while (true) { 527 t = getNextToken(); 528 if (t.kind == SEMICOLON || t.kind == EOF) 529 break; 530 s.append(t.image); 531 } 532 if (t.kind == EOF) 533 throw new ParseException("Reached end of file while parsing"); 534 return s.toString(); 535 } 536 -
trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/parser/MapCSSParserConstants.java
r3867 r3876 20 20 int STRING = 4; 21 21 /** RegularExpression Id. */ 22 int H= 5;22 int REGEX_CHAR_WITHOUT_STAR = 5; 23 23 /** RegularExpression Id. */ 24 int HEXCOLOR= 6;24 int REGEX = 6; 25 25 /** RegularExpression Id. */ 26 int S= 7;26 int H = 7; 27 27 /** RegularExpression Id. */ 28 int STAR = 8;28 int HEXCOLOR = 8; 29 29 /** RegularExpression Id. */ 30 int S LASH= 9;30 int S = 9; 31 31 /** RegularExpression Id. */ 32 int LBRACE= 10;32 int STAR = 10; 33 33 /** RegularExpression Id. */ 34 int RBRACE= 11;34 int SLASH = 11; 35 35 /** RegularExpression Id. */ 36 int L SQUARE = 12;36 int LBRACE = 12; 37 37 /** RegularExpression Id. */ 38 int R SQUARE = 13;38 int RBRACE = 13; 39 39 /** RegularExpression Id. */ 40 int L PAR= 14;40 int LSQUARE = 14; 41 41 /** RegularExpression Id. */ 42 int R PAR= 15;42 int RSQUARE = 15; 43 43 /** RegularExpression Id. */ 44 int GREATER_EQUAL= 16;44 int LPAR = 16; 45 45 /** RegularExpression Id. */ 46 int LESS_EQUAL= 17;46 int RPAR = 17; 47 47 /** RegularExpression Id. */ 48 int GREATER = 18;48 int GREATER_EQUAL = 18; 49 49 /** RegularExpression Id. */ 50 int LESS = 19;50 int LESS_EQUAL = 19; 51 51 /** RegularExpression Id. */ 52 int EQUAL= 20;52 int GREATER = 20; 53 53 /** RegularExpression Id. */ 54 int EXCLAMATION= 21;54 int LESS = 21; 55 55 /** RegularExpression Id. */ 56 int E XCLAMATION_EQUAL = 22;56 int EQUAL = 22; 57 57 /** RegularExpression Id. */ 58 int COLON = 23;58 int EXCLAMATION = 23; 59 59 /** RegularExpression Id. */ 60 int DCOLON= 24;60 int TILDE = 24; 61 61 /** RegularExpression Id. */ 62 int SEMICOLON = 25;62 int COLON = 25; 63 63 /** RegularExpression Id. */ 64 int COMMA= 26;64 int DCOLON = 26; 65 65 /** RegularExpression Id. */ 66 int PIPE= 27;66 int SEMICOLON = 27; 67 67 /** RegularExpression Id. */ 68 int PIPE_Z= 28;68 int COMMA = 28; 69 69 /** RegularExpression Id. */ 70 int P LUS= 29;70 int PIPE = 29; 71 71 /** RegularExpression Id. */ 72 int MINUS= 30;72 int PIPE_Z = 30; 73 73 /** RegularExpression Id. */ 74 int AMPERSAND= 31;74 int PLUS = 31; 75 75 /** RegularExpression Id. */ 76 int QUESTION= 32;76 int MINUS = 32; 77 77 /** RegularExpression Id. */ 78 int COMMENT_START= 33;78 int AMPERSAND = 33; 79 79 /** RegularExpression Id. */ 80 int UNEXPECTED_CHAR= 34;80 int QUESTION = 34; 81 81 /** RegularExpression Id. */ 82 int COMMENT_END = 35; 82 int DOLLAR = 35; 83 /** RegularExpression Id. */ 84 int CARET = 36; 85 /** RegularExpression Id. */ 86 int COMMENT_START = 37; 87 /** RegularExpression Id. */ 88 int UNEXPECTED_CHAR = 38; 89 /** RegularExpression Id. */ 90 int COMMENT_END = 39; 83 91 84 92 /** Lexical state. */ … … 94 102 "<UFLOAT>", 95 103 "<STRING>", 104 "<REGEX_CHAR_WITHOUT_STAR>", 105 "<REGEX>", 96 106 "<H>", 97 107 "<HEXCOLOR>", … … 111 121 "\"=\"", 112 122 "\"!\"", 113 "\" !=\"",123 "\"~\"", 114 124 "\":\"", 115 125 "\"::\"", … … 122 132 "\"&\"", 123 133 "\"?\"", 134 "\"$\"", 135 "\"^\"", 124 136 "\"/*\"", 125 137 "<UNEXPECTED_CHAR>", 126 138 "\"*/\"", 127 "<token of kind 36>",139 "<token of kind 40>", 128 140 }; 129 141 -
trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/parser/MapCSSParserTokenManager.java
r3867 r3876 26 26 switch (pos) 27 27 { 28 case 0: 29 if ((active0 & 0x2000000800L) != 0L) 30 return 14; 31 return -1; 28 32 default : 29 33 return -1; … … 45 49 { 46 50 case 33: 51 return jjStopAtPos(0, 23); 52 case 36: 53 return jjStopAtPos(0, 35); 54 case 38: 55 return jjStopAtPos(0, 33); 56 case 40: 57 return jjStopAtPos(0, 16); 58 case 41: 59 return jjStopAtPos(0, 17); 60 case 42: 61 return jjStopAtPos(0, 10); 62 case 43: 63 return jjStopAtPos(0, 31); 64 case 44: 65 return jjStopAtPos(0, 28); 66 case 45: 67 return jjStopAtPos(0, 32); 68 case 47: 69 jjmatchedKind = 11; 70 return jjMoveStringLiteralDfa1_0(0x2000000000L); 71 case 58: 72 jjmatchedKind = 25; 73 return jjMoveStringLiteralDfa1_0(0x4000000L); 74 case 59: 75 return jjStopAtPos(0, 27); 76 case 60: 47 77 jjmatchedKind = 21; 48 return jjMoveStringLiteralDfa1_0(0x400000L); 49 case 38: 50 return jjStopAtPos(0, 31); 51 case 40: 78 return jjMoveStringLiteralDfa1_0(0x80000L); 79 case 61: 80 return jjStopAtPos(0, 22); 81 case 62: 82 jjmatchedKind = 20; 83 return jjMoveStringLiteralDfa1_0(0x40000L); 84 case 63: 85 return jjStopAtPos(0, 34); 86 case 91: 52 87 return jjStopAtPos(0, 14); 53 case 41:88 case 93: 54 89 return jjStopAtPos(0, 15); 55 case 42: 56 return jjStopAtPos(0, 8); 57 case 43: 58 return jjStopAtPos(0, 29); 59 case 44: 60 return jjStopAtPos(0, 26); 61 case 45: 62 return jjStopAtPos(0, 30); 63 case 47: 64 jjmatchedKind = 9; 65 return jjMoveStringLiteralDfa1_0(0x200000000L); 66 case 58: 67 jjmatchedKind = 23; 68 return jjMoveStringLiteralDfa1_0(0x1000000L); 69 case 59: 70 return jjStopAtPos(0, 25); 71 case 60: 72 jjmatchedKind = 19; 73 return jjMoveStringLiteralDfa1_0(0x20000L); 74 case 61: 75 return jjStopAtPos(0, 20); 76 case 62: 77 jjmatchedKind = 18; 78 return jjMoveStringLiteralDfa1_0(0x10000L); 79 case 63: 80 return jjStopAtPos(0, 32); 81 case 91: 90 case 94: 91 return jjStopAtPos(0, 36); 92 case 123: 82 93 return jjStopAtPos(0, 12); 83 case 93: 94 case 124: 95 jjmatchedKind = 29; 96 return jjMoveStringLiteralDfa1_0(0x40000000L); 97 case 125: 84 98 return jjStopAtPos(0, 13); 85 case 123: 86 return jjStopAtPos(0, 10); 87 case 124: 88 jjmatchedKind = 27; 89 return jjMoveStringLiteralDfa1_0(0x10000000L); 90 case 125: 91 return jjStopAtPos(0, 11); 99 case 126: 100 return jjStopAtPos(0, 24); 92 101 default : 93 102 return jjMoveNfa_0(0, 0); … … 104 113 { 105 114 case 42: 106 if ((active0 & 0x200000000 L) != 0L)107 return jjStopAtPos(1, 3 3);115 if ((active0 & 0x2000000000L) != 0L) 116 return jjStopAtPos(1, 37); 108 117 break; 109 118 case 58: 110 if ((active0 & 0x 1000000L) != 0L)111 return jjStopAtPos(1, 2 4);119 if ((active0 & 0x4000000L) != 0L) 120 return jjStopAtPos(1, 26); 112 121 break; 113 122 case 61: 114 if ((active0 & 0x10000L) != 0L) 115 return jjStopAtPos(1, 16); 116 else if ((active0 & 0x20000L) != 0L) 117 return jjStopAtPos(1, 17); 118 else if ((active0 & 0x400000L) != 0L) 119 return jjStopAtPos(1, 22); 123 if ((active0 & 0x40000L) != 0L) 124 return jjStopAtPos(1, 18); 125 else if ((active0 & 0x80000L) != 0L) 126 return jjStopAtPos(1, 19); 120 127 break; 121 128 case 122: 122 if ((active0 & 0x 10000000L) != 0L)123 return jjStopAtPos(1, 28);129 if ((active0 & 0x40000000L) != 0L) 130 return jjStopAtPos(1, 30); 124 131 break; 125 132 default : … … 137 144 { 138 145 int startsAt = 0; 139 jjnewStateCnt = 22;146 jjnewStateCnt = 30; 140 147 int i = 1; 141 148 jjstateSet[0] = startState; … … 152 159 switch(jjstateSet[--i]) 153 160 { 161 case 14: 162 if ((0xffff7bff00000000L & l) != 0L) 163 jjCheckNAddStates(0, 2); 164 break; 154 165 case 0: 155 166 if ((0x3ff000000000000L & l) != 0L) … … 161 172 else if ((0x100003600L & l) != 0L) 162 173 { 163 if (kind > 7)164 kind = 7;165 jjCheckNAdd(2 1);174 if (kind > 9) 175 kind = 9; 176 jjCheckNAdd(29); 166 177 } 167 178 else if (curChar == 35) 168 jjstateSet[jjnewStateCnt++] = 14; 179 jjstateSet[jjnewStateCnt++] = 22; 180 else if (curChar == 47) 181 jjAddStates(3, 4); 169 182 else if (curChar == 34) 170 jjCheckNAddStates( 0, 2);183 jjCheckNAddStates(5, 7); 171 184 if ((0x3fe000000000000L & l) != 0L) 172 185 { … … 218 231 case 11: 219 232 if (curChar == 34) 220 jjCheckNAddStates( 0, 2);233 jjCheckNAddStates(5, 7); 221 234 break; 222 235 case 8: 223 if ((0xffffff 7b00000000L & l) != 0L)224 jjCheckNAddStates( 0, 2);236 if ((0xfffffffb00000000L & l) != 0L) 237 jjCheckNAddStates(5, 7); 225 238 break; 226 239 case 9: … … 229 242 break; 230 243 case 13: 244 if (curChar == 47) 245 jjAddStates(3, 4); 246 break; 247 case 15: 248 if ((0xffff7fff00000000L & l) != 0L) 249 jjCheckNAddStates(0, 2); 250 break; 251 case 16: 252 if (curChar == 47 && kind > 6) 253 kind = 6; 254 break; 255 case 19: 256 if (curChar == 47) 257 jjCheckNAddStates(0, 2); 258 break; 259 case 21: 231 260 if (curChar == 35) 232 jjstateSet[jjnewStateCnt++] = 14;233 break; 234 case 14:261 jjstateSet[jjnewStateCnt++] = 22; 262 break; 263 case 22: 235 264 if ((0x3ff000000000000L & l) != 0L) 236 jjAddStates( 3, 4);237 break; 238 case 15:265 jjAddStates(8, 9); 266 break; 267 case 23: 239 268 if ((0x3ff000000000000L & l) != 0L) 240 jjstateSet[jjnewStateCnt++] = 16;241 break; 242 case 16:269 jjstateSet[jjnewStateCnt++] = 24; 270 break; 271 case 24: 243 272 if ((0x3ff000000000000L & l) != 0L) 244 jjstateSet[jjnewStateCnt++] = 17;245 break; 246 case 17:273 jjstateSet[jjnewStateCnt++] = 25; 274 break; 275 case 25: 247 276 if ((0x3ff000000000000L & l) != 0L) 248 jjstateSet[jjnewStateCnt++] = 18;249 break; 250 case 18:251 case 2 0:277 jjstateSet[jjnewStateCnt++] = 26; 278 break; 279 case 26: 280 case 28: 252 281 if ((0x3ff000000000000L & l) != 0L) 253 jjCheckNAdd( 19);254 break; 255 case 19:256 if ((0x3ff000000000000L & l) != 0L && kind > 6)257 kind = 6;258 break; 259 case 2 1:282 jjCheckNAdd(27); 283 break; 284 case 27: 285 if ((0x3ff000000000000L & l) != 0L && kind > 8) 286 kind = 8; 287 break; 288 case 29: 260 289 if ((0x100003600L & l) == 0L) 261 290 break; 262 if (kind > 7)263 kind = 7;264 jjCheckNAdd(2 1);291 if (kind > 9) 292 kind = 9; 293 jjCheckNAdd(29); 265 294 break; 266 295 default : break; … … 275 304 switch(jjstateSet[--i]) 276 305 { 306 case 14: 307 if ((0x7fffffffefffffffL & l) != 0L) 308 jjCheckNAddStates(0, 2); 309 else if (curChar == 92) 310 jjCheckNAddTwoStates(19, 18); 311 break; 277 312 case 0: 278 313 case 1: … … 285 320 case 8: 286 321 if ((0x7fffffffefffffffL & l) != 0L) 287 jjCheckNAddStates( 0, 2);322 jjCheckNAddStates(5, 7); 288 323 break; 289 324 case 10: 290 325 if (curChar == 92) 291 jjAddStates( 5, 6);326 jjAddStates(10, 11); 292 327 break; 293 328 case 12: 294 329 if (curChar == 92) 330 jjCheckNAddStates(5, 7); 331 break; 332 case 15: 333 if ((0x7fffffffefffffffL & l) != 0L) 295 334 jjCheckNAddStates(0, 2); 296 335 break; 297 case 14: 336 case 17: 337 if (curChar == 92) 338 jjCheckNAddTwoStates(18, 19); 339 break; 340 case 18: 341 if (curChar == 92) 342 jjCheckNAddStates(0, 2); 343 break; 344 case 20: 345 if (curChar == 92) 346 jjCheckNAddTwoStates(19, 18); 347 break; 348 case 22: 298 349 if ((0x7e0000007eL & l) != 0L) 299 jjAddStates( 3, 4);300 break; 301 case 15:350 jjAddStates(8, 9); 351 break; 352 case 23: 302 353 if ((0x7e0000007eL & l) != 0L) 303 jjstateSet[jjnewStateCnt++] = 16;304 break; 305 case 16:354 jjstateSet[jjnewStateCnt++] = 24; 355 break; 356 case 24: 306 357 if ((0x7e0000007eL & l) != 0L) 307 jjstateSet[jjnewStateCnt++] = 17;308 break; 309 case 17:358 jjstateSet[jjnewStateCnt++] = 25; 359 break; 360 case 25: 310 361 if ((0x7e0000007eL & l) != 0L) 311 jjstateSet[jjnewStateCnt++] = 18;312 break; 313 case 18:314 case 2 0:362 jjstateSet[jjnewStateCnt++] = 26; 363 break; 364 case 26: 365 case 28: 315 366 if ((0x7e0000007eL & l) != 0L) 316 jjCheckNAdd( 19);317 break; 318 case 19:319 if ((0x7e0000007eL & l) != 0L && kind > 6)320 kind = 6;367 jjCheckNAdd(27); 368 break; 369 case 27: 370 if ((0x7e0000007eL & l) != 0L && kind > 8) 371 kind = 8; 321 372 break; 322 373 default : break; … … 335 386 switch(jjstateSet[--i]) 336 387 { 388 case 14: 389 case 15: 390 if (jjCanMove_0(hiByte, i1, i2, l1, l2)) 391 jjCheckNAddStates(0, 2); 392 break; 337 393 case 8: 338 394 if (jjCanMove_0(hiByte, i1, i2, l1, l2)) 339 jjAddStates( 0, 2);395 jjAddStates(5, 7); 340 396 break; 341 397 default : break; … … 350 406 } 351 407 ++curPos; 352 if ((i = jjnewStateCnt) == (startsAt = 22- (jjnewStateCnt = startsAt)))408 if ((i = jjnewStateCnt) == (startsAt = 30 - (jjnewStateCnt = startsAt))) 353 409 return curPos; 354 410 try { curChar = input_stream.readChar(); } … … 361 417 { 362 418 case 42: 363 return jjMoveStringLiteralDfa1_1(0x800000000 L);419 return jjMoveStringLiteralDfa1_1(0x8000000000L); 364 420 default : 365 421 return 1; … … 375 431 { 376 432 case 47: 377 if ((active0 & 0x800000000 L) != 0L)378 return jjStopAtPos(1, 3 5);433 if ((active0 & 0x8000000000L) != 0L) 434 return jjStopAtPos(1, 39); 379 435 break; 380 436 default : … … 384 440 } 385 441 static final int[] jjnextStates = { 386 8, 9, 10, 15, 20, 11, 12,442 15, 16, 17, 14, 20, 8, 9, 10, 23, 28, 11, 12, 387 443 }; 388 444 private static final boolean jjCanMove_0(int hiByte, int i1, int i2, long l1, long l2) … … 401 457 /** Token literal values. */ 402 458 public static final String[] jjstrLiteralImages = { 403 "", null, null, null, null, null, null, null, "\52", "\57", "\173", "\175",404 "\1 33", "\135", "\50", "\51", "\76\75", "\74\75", "\76", "\74", "\75", "\41",405 "\41 \75", "\72", "\72\72", "\73", "\54", "\174", "\174\172", "\53", "\55", "\46", "\77",406 "\ 57\52", null, "\52\57", null, };459 "", null, null, null, null, null, null, null, null, null, "\52", "\57", 460 "\173", "\175", "\133", "\135", "\50", "\51", "\76\75", "\74\75", "\76", "\74", "\75", 461 "\41", "\176", "\72", "\72\72", "\73", "\54", "\174", "\174\172", "\53", "\55", 462 "\46", "\77", "\44", "\136", "\57\52", null, "\52\57", null, }; 407 463 408 464 /** Lexer state names. */ … … 415 471 public static final int[] jjnewLexState = { 416 472 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 417 -1, -1, -1, -1, -1, -1, -1, -1, 1, -1, 0, -1,473 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, -1, 0, -1, 418 474 }; 419 475 static final long[] jjtoToken = { 420 0xfffffff dfL,476 0xffffffff5fL, 421 477 }; 422 478 static final long[] jjtoSkip = { 423 0x1000000000 L,479 0x10000000000L, 424 480 }; 425 481 protected SimpleCharStream input_stream; 426 private final int[] jjrounds = new int[ 22];427 private final int[] jjstateSet = new int[ 44];482 private final int[] jjrounds = new int[30]; 483 private final int[] jjstateSet = new int[60]; 428 484 protected char curChar; 429 485 /** Constructor. */ … … 452 508 int i; 453 509 jjround = 0x80000001; 454 for (i = 22; i-- > 0;)510 for (i = 30; i-- > 0;) 455 511 jjrounds[i] = 0x80000000; 456 512 } … … 529 585 jjmatchedPos = 0; 530 586 curPos = jjMoveStringLiteralDfa0_0(); 531 if (jjmatchedPos == 0 && jjmatchedKind > 3 4)587 if (jjmatchedPos == 0 && jjmatchedKind > 38) 532 588 { 533 jjmatchedKind = 3 4;589 jjmatchedKind = 38; 534 590 } 535 591 break; … … 538 594 jjmatchedPos = 0; 539 595 curPos = jjMoveStringLiteralDfa0_1(); 540 if (jjmatchedPos == 0 && jjmatchedKind > 36)596 if (jjmatchedPos == 0 && jjmatchedKind > 40) 541 597 { 542 jjmatchedKind = 36;598 jjmatchedKind = 40; 543 599 } 544 600 break;
Note:
See TracChangeset
for help on using the changeset viewer.