Changeset 14489 in josm


Ignore:
Timestamp:
2018-12-02T15:30:24+01:00 (4 months ago)
Author:
Don-vip
Message:

see #17053 - fix parsing regression involving the - operator

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/validation/tests/MapCSSTagChecker.java

    r14486 r14489  
    469469                    try {
    470470                        final String val = ai.val instanceof Expression
    471                                 ? Optional.of(((Expression) ai.val).evaluate(new Environment())).map(Object::toString).orElse(null)
     471                                ? Optional.ofNullable(((Expression) ai.val).evaluate(new Environment())).map(Object::toString).orElse(null)
    472472                                : ai.val instanceof String
    473473                                ? (String) ai.val
  • trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSParser.jj

    r14481 r14489  
    166166{
    167167    < IDENT: ["a"-"z","A"-"Z","_"] ( ["a"-"z","A"-"Z","_","-","0"-"9"] )* >
    168 |   < EXTIDENT: <MINUS> <IDENT> >
    169168|   < UINT: ( ["0"-"9"] )+ >
    170169|   < STRING: "\"" ( [" ","!","#"-"[","]"-"~","\u0080"-"\uFFFF"] | "\\\"" | "\\\\" )*  "\"" >
     
    284283{
    285284    (
    286         (t=<PP_AND> | t=<PP_OR> | t=<PP_NOT> | t=<UINT> | t=<STRING> | t=<REGEX> | t=<LPAR> | t=<RPAR> | t=<COMMA> | t=<COLON> | t=<IDENT> | t=<EXTIDENT> | t=<PP_SOMETHING_ELSE>) { if (write) sb.append(t.image); }
     285        (t=<PP_AND> | t=<PP_OR> | t=<PP_NOT> | t=<UINT> | t=<STRING> | t=<REGEX> | t=<LPAR> | t=<RPAR> | t=<COMMA> | t=<COLON> | t=<IDENT> | t=<PP_SOMETHING_ELSE>) { if (write) sb.append(t.image); }
    287286        |
    288287            pp_w1()
     
    907906        )
    908907    |
    909         <EXTIDENT> w() <COLON> w() expression() <SEMICOLON> w()
     908        <MINUS> <IDENT> w() <COLON> w() expression() <SEMICOLON> w()
    910909    |
    911910        key=<IDENT> w() <COLON> w()
  • trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSParserTest.java

    r14142 r14489  
    461461        assertFalse(condition.applies(new Environment(OsmUtils.createPrimitive("way name=fÓo"))));
    462462    }
     463
     464    /**
     465     * Non-regression test for <a href="https://josm.openstreetmap.de/ticket/17053">Bug #17053</a>.
     466     */
     467    @Test
     468    public void testTicket17053() {
     469        MapCSSStyleSource sheet = new MapCSSStyleSource(
     470            "way {\n" +
     471            "    placement_offset: eval(\n" +
     472            "        cond(prop(\"placement_value\")=\"right_of:1\",eval((prop(lane_width_forward_1)/2)-prop(lane_offset_forward_1)),\n" +
     473            "        0\n" +
     474            "        )\n" +
     475            "       );\n" +
     476            "}");
     477        sheet.loadStyleSource();
     478        assertTrue(sheet.getErrors().toString(), sheet.getErrors().isEmpty());
     479    }
    463480}
  • trunk/test/unit/org/openstreetmap/josm/gui/preferences/imagery/ImageryPreferenceTestIT.java

    r14488 r14489  
    8383        checkUrl(info, info.getAttributionLinkURL());
    8484        String eula = info.getEulaAcceptanceRequired();
    85         if(eula != null) {
     85        if (eula != null) {
    8686            checkUrl(info, eula.replaceAll("\\{lang\\}", ""));
    8787        }
Note: See TracChangeset for help on using the changeset viewer.