Ignore:
Timestamp:
2013-12-28T01:31:47+01:00 (10 years ago)
Author:
simon04
Message:

see #9414 fix #9409 - extend MapCSS condition syntax to allow the comparison of two key values

The syntax is [key1 = *key2] where * is inspired by the C de-reference operator, and = stands for any of =/!=/~=/^=/$=/*=/=~/!~.

File:
1 edited

Legend:

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

    r6547 r6554  
    367367    int i;
    368368    Condition.Op op;
     369    boolean considerValAsKey = false;
    369370}
    370371{
    371372    key=tag_key() s()
    372373    (
    373         LOOKAHEAD(2)
    374             <EQUAL> <TILDE> { op=Condition.Op.REGEX; } s() val=regex()
    375         |
    376         LOOKAHEAD(2)
    377             <EXCLAMATION> <TILDE> { op=Condition.Op.NREGEX; } s() val=regex()
     374        LOOKAHEAD(3)
     375            (
     376                    <EQUAL> <TILDE> { op=Condition.Op.REGEX; }
     377                |
     378                    <EXCLAMATION> <TILDE> { op=Condition.Op.NREGEX; }
     379            )
     380            s()
     381            ( <STAR> { considerValAsKey=true; } )?
     382            val=regex()
    378383        |
    379384            (
     
    391396            )
    392397            s()
     398            ( <STAR> { considerValAsKey=true; } )?
    393399            (
    394400                LOOKAHEAD(2)
     
    412418            f=float_() { val=Float.toString(f); }
    413419    )
    414     { return Condition.create(key, val, op, context); }
     420    { return Condition.create(key, val, op, context, considerValAsKey); }
    415421}
    416422
Note: See TracChangeset for help on using the changeset viewer.