Ignore:
Timestamp:
2015-02-19T11:52:05+01:00 (7 years ago)
Author:
bastiK
Message:

MapCSS: add support for dynamic subparts

This feature is not useful on its own (aimed at loops & jumps).
Will keep this undocumented for now.

File:
1 edited

Legend:

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

    r7761 r8086  
    1212import java.util.List;
    1313
     14import org.openstreetmap.josm.Main;
    1415import org.openstreetmap.josm.gui.mappaint.Keyword;
    1516import org.openstreetmap.josm.gui.mappaint.mapcss.Condition;
    1617import org.openstreetmap.josm.gui.mappaint.mapcss.Condition.Context;
    1718import org.openstreetmap.josm.gui.mappaint.mapcss.Expression;
     19import org.openstreetmap.josm.gui.mappaint.mapcss.ExpressionFactory;
    1820import org.openstreetmap.josm.gui.mappaint.mapcss.Instruction;
     21import org.openstreetmap.josm.gui.mappaint.mapcss.LiteralExpression;
     22import org.openstreetmap.josm.gui.mappaint.mapcss.MapCSSException;
    1923import org.openstreetmap.josm.gui.mappaint.mapcss.MapCSSRule;
    2024import org.openstreetmap.josm.gui.mappaint.mapcss.MapCSSRule.Declaration;
    2125import org.openstreetmap.josm.gui.mappaint.mapcss.MapCSSStyleSource;
    2226import org.openstreetmap.josm.gui.mappaint.mapcss.Selector;
    23 import org.openstreetmap.josm.gui.mappaint.mapcss.ExpressionFactory;
    24 import org.openstreetmap.josm.gui.mappaint.mapcss.LiteralExpression;
    25 import org.openstreetmap.josm.gui.mappaint.mapcss.MapCSSException;
    2627import org.openstreetmap.josm.gui.mappaint.mapcss.Selector.ChildOrParentSelector;
    2728import org.openstreetmap.josm.gui.mappaint.mapcss.Selector.GeneralSelector;
    2829import org.openstreetmap.josm.gui.mappaint.mapcss.Selector.LinkSelector;
     30import org.openstreetmap.josm.gui.mappaint.mapcss.Subpart;
    2931import org.openstreetmap.josm.tools.ColorHelper;
    3032import org.openstreetmap.josm.tools.Pair;
    31 import org.openstreetmap.josm.Main;
    3233
    3334/**
     
    553554    Pair<Integer, Integer> r = null;
    554555    List<Condition> conditions = new ArrayList<Condition>();
    555     String sub = null;
     556    Subpart sub = null;
    556557}
    557558{
     
    708709}
    709710
    710 String subpart() :
     711Subpart subpart() :
    711712{
    712713    String s;
     714    Expression e;
    713715}
    714716{
    715717    <DCOLON>
    716     ( s=ident() { return s; } | <STAR> { return "*"; } )
     718    (
     719        s=ident() { return new Subpart.StringSubpart(s); }
     720    |
     721        <STAR> { return new Subpart.StringSubpart("*"); }
     722    |
     723        <LPAR> e=expression() <RPAR> { return new Subpart.ExpressionSubpart(e); }
     724    )
    717725}
    718726
Note: See TracChangeset for help on using the changeset viewer.