Changeset 7166 in josm for trunk/src/org


Ignore:
Timestamp:
2014-05-22T13:08:33+02:00 (10 years ago)
Author:
simon04
Message:

fix #10059 - MapCSS, child selector: make greater-than-sign optional

The following selectors are equivalent:
relation[type=route] way[highway]
relation[type=route] > way[highway]

Location:
trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSParser.jj

    r7115 r7166  
    524524        (
    525525            (
    526                 <GREATER> { type = Selector.ChildOrParentSelectorType.CHILD; }
     526                (
     527                    <GREATER> { type = Selector.ChildOrParentSelectorType.CHILD; }
     528                |
     529                    <LESS> { type = Selector.ChildOrParentSelectorType.PARENT; }
     530                |
     531                    <PLUS> { type = Selector.ChildOrParentSelectorType.SIBLING; }
     532                )
     533                ( ( c=condition(Context.LINK) | c=class_or_pseudoclass(Context.LINK) ) { conditions.add(c); } )*
    527534            |
    528                 <LESS> { type = Selector.ChildOrParentSelectorType.PARENT; }
     535                <ELEMENT_OF> { type = Selector.ChildOrParentSelectorType.ELEMENT_OF; }
    529536            |
    530                 <PLUS> { type = Selector.ChildOrParentSelectorType.SIBLING; }
     537                <CROSSING> { type = Selector.ChildOrParentSelectorType.CROSSING; }
    531538            )
    532             ( ( c=condition(Context.LINK) | c=class_or_pseudoclass(Context.LINK) ) { conditions.add(c); } )*
    533         |
    534             <ELEMENT_OF> { type = Selector.ChildOrParentSelectorType.ELEMENT_OF; }
    535         |
    536             <CROSSING> { type = Selector.ChildOrParentSelectorType.CROSSING; }
     539            w()
     540        |
     541            { /* <GREATER> is optional for child selector */ type = Selector.ChildOrParentSelectorType.CHILD; }
    537542        )
    538543        { selLink = new LinkSelector(conditions); }
    539         w()
    540544        selRight=selector() w()
    541545    )?
  • trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/Selector.java

    r7138 r7166  
    9797         */
    9898        public ChildOrParentSelector(Selector a, LinkSelector link, Selector b, ChildOrParentSelectorType type) {
     99            CheckParameterUtil.ensureParameterNotNull(a, "a");
     100            CheckParameterUtil.ensureParameterNotNull(b, "b");
     101            CheckParameterUtil.ensureParameterNotNull(link, "link");
     102            CheckParameterUtil.ensureParameterNotNull(type, "type");
    99103            this.left = a;
    100104            this.link = link;
Note: See TracChangeset for help on using the changeset viewer.