Changeset 7064 in josm for trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSParser.jj
- Timestamp:
- 2014-05-05T13:26:03+02:00 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSParser.jj
r7057 r7064 18 18 import org.openstreetmap.josm.gui.mappaint.mapcss.Instruction; 19 19 import org.openstreetmap.josm.gui.mappaint.mapcss.MapCSSRule; 20 import org.openstreetmap.josm.gui.mappaint.mapcss.MapCSSRule.Declaration; 20 21 import org.openstreetmap.josm.gui.mappaint.mapcss.MapCSSStyleSource; 21 22 import org.openstreetmap.josm.gui.mappaint.mapcss.Selector; … … 48 49 MapCSSStyleSource sheet; 49 50 StringBuilder sb; 51 int declarationCounter; 50 52 51 53 /** … … 71 73 public MapCSSParser(InputStream in, String encoding, LexicalState initState) { 72 74 this(createTokenManager(in, encoding, initState)); 75 declarationCounter = 0; 73 76 } 74 77 … … 469 472 void sheet(MapCSSStyleSource sheet): 470 473 { 471 MapCSSRule r;472 474 } 473 475 { … … 476 478 ( 477 479 try { 478 r =rule() { if (r != null) { sheet.rules.add(r); } }w()480 rule() w() 479 481 } catch (MapCSSException mex) { 480 482 error_skipto(RBRACE, mex); … … 488 490 } 489 491 490 MapCSSRulerule():492 void rule(): 491 493 { 492 494 List<Selector> selectors = new ArrayList<Selector>(); 493 495 Selector sel; 494 List<Instruction>decl;496 Declaration decl; 495 497 } 496 498 { … … 501 503 )* 502 504 decl=declaration() 503 { return new MapCSSRule(selectors, decl); } 505 { 506 for (Selector s : selectors) { 507 sheet.rules.add(new MapCSSRule(s, decl)); 508 } 509 } 504 510 } 505 511 … … 707 713 } 708 714 709 List<Instruction>declaration() :715 Declaration declaration() : 710 716 { 711 717 List<Instruction> ins = new ArrayList<Instruction>(); … … 723 729 ( <EQUAL> val=expression() )? 724 730 { ins.add(new Instruction.AssignmentInstruction(key.image, val == null ? true : val, true)); } 725 ( <RBRACE> { return ins; } | <SEMICOLON> w() )731 ( <RBRACE> { return new Declaration(ins, declarationCounter++); } | <SEMICOLON> w() ) 726 732 ) 727 733 | … … 732 738 { ins.add(new Instruction.AssignmentInstruction(key.image, val, false)); } 733 739 w() 734 ( <RBRACE> { return ins; } | <SEMICOLON> w() )740 ( <RBRACE> { return new Declaration(ins, declarationCounter++); } | <SEMICOLON> w() ) 735 741 | 736 742 LOOKAHEAD( expression() ( <SEMICOLON> | <RBRACE> ) ) 737 743 val=expression() 738 744 { ins.add(new Instruction.AssignmentInstruction(key.image, val, false)); } 739 ( <RBRACE> { return ins; } | <SEMICOLON> w() )745 ( <RBRACE> { return new Declaration(ins, declarationCounter++); } | <SEMICOLON> w() ) 740 746 | 741 747 val=readRaw() w() { ins.add(new Instruction.AssignmentInstruction(key.image, val, false)); } … … 743 749 )* 744 750 <RBRACE> 745 { return ins; }751 { return new Declaration(ins, declarationCounter++); } 746 752 } 747 753
Note:
See TracChangeset
for help on using the changeset viewer.