Ignore:
Timestamp:
2013-12-27T16:14:28+01:00 (13 years ago)
Author:
simon04
Message:

MapCSS: add regular expression support for key conditions

For instance, [/^addr:/] matches any addr:* key.

File:
1 edited

Legend:

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

    r6532 r6547  
    345345{
    346346    boolean not = false;
    347     boolean yes = false;
    348     boolean no = false;
     347    Condition.KeyMatchType matchType = null;;
    349348    String key;
    350349}
    351350{
    352351    ( <EXCLAMATION> { not = true; } )?
    353     key=tag_key()
    354     ( LOOKAHEAD(2) <QUESTION> <EXCLAMATION> { no = true; } )?
    355     ( <QUESTION> { yes = true; } )?
    356     { return Condition.create(key, not, yes, no, context); }
     352    (
     353        { matchType = Condition.KeyMatchType.REGEX; } key = regex()
     354    |
     355        key = tag_key()
     356    )
     357    ( LOOKAHEAD(2) <QUESTION> <EXCLAMATION> { matchType = Condition.KeyMatchType.FALSE; } )?
     358    (              <QUESTION>               { matchType = Condition.KeyMatchType.TRUE;  } )?
     359    { return Condition.create(key, not, matchType, context); }
    357360}
    358361
Note: See TracChangeset for help on using the changeset viewer.