Changeset 19453 in josm for trunk/resources/data/validator


Ignore:
Timestamp:
2026-01-05T14:15:41+01:00 (7 days ago)
Author:
stoecker
Message:

Improve validator for level tag (patch by tordanik), fix #22427

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/resources/data/validator/numeric.mapcss

    r19151 r19453  
    4040  assertNoMatch: "node level=-1";
    4141}
    42 
    43 *[building:levels][building:levels !~ /^(([0-9]|[1-9][0-9]*)(\.5)?)$/]!.negative_value,
    44 *[level][level !~ /^((((-*[1-9]|[0-9])|-*[1-9][0-9]*)(\.5)?)|-0\.5)(;((((-*[1-9]|[0-9])|-*[1-9][0-9]*)(\.5)?)|-0\.5))*$/] { /* all numbers from -∞ to ∞ in 0.5 steps, optional multiple values separated by a ; */
     42*[building:levels][building:levels !~ /^(([0-9]|[1-9][0-9]*)(\.5)?)$/]!.negative_value {
     43  throwWarning: tr("{0} should have numbers only with optional .5 increments", "{0.key}");
     44  assertNoMatch: "node building:levels=1.5";
     45  assertNoMatch: "node building:levels=-1"; /* excluded here via !.negative_value in selector */
     46  assertMatch: "node building:levels=1A";
     47  assertNoMatch: "node building:levels=0"; /* valid because there can be building:levels:underground > 0 or roof:levels > 0 */
     48}
     49
     50/* level values: all numbers from -∞ to ∞ in 0.5 steps, optional multiple values separated by a ;, optional second value separated by a - */
     51*[level][level !~ /^((((-?[1-9]|[0-9])|-?[1-9][0-9]*)(\.5)?)|-0\.5)(?:(;((((-?[1-9]|[0-9])|-?[1-9][0-9]*)(\.5)?)|-0\.5))*|(-((((-?[1-9]|[0-9])|-?[1-9][0-9]*)(\.5)?)|-0\.5)))$/] {
    4552  throwWarning: tr("{0} should have numbers only with optional .5 increments", "{0.key}");
    4653  assertMatch: "node level=one";
     
    5057  assertMatch: "node level=2.3";
    5158  assertMatch: "node level=-0";
     59  assertMatch: "node level=1-2-3";
     60  assertMatch: "way level=--5";
     61  assertMatch: "way level=--5-4";
     62  assertMatch: "way level=-5---4";
    5263  assertNoMatch: "node level=0";
    5364  assertNoMatch: "node level=1";
     
    6273  assertNoMatch: "node level=-0.5;0";
    6374  assertNoMatch: "node level=-1;-0.5";
    64   assertNoMatch: "node building:levels=1.5";
    65   assertNoMatch: "node building:levels=-1"; /* tested already by rule above "negative values" and excluded here via !.negative_value in selector */
    66   assertMatch: "node building:levels=1A";
    67   assertNoMatch: "node building:levels=0"; /* valid because there can be building:levels:underground > 0 or roof:levels > 0 */
     75  assertNoMatch: "node level=0-3";
     76  assertNoMatch: "node level=-1-100";
     77  assertNoMatch: "node level=-10--5";
     78  assertNoMatch: "node level=0--1";
    6879}
    6980
Note: See TracChangeset for help on using the changeset viewer.