Modify

Opened 2 years ago

Closed 2 years ago

#5985 closed defect (fixed)

MapCSS conditions don't handle unquoted numeric values

Reported by: framm Owned by: bastiK
Priority: normal Component: Internal mappaint style
Version: Keywords: mapcss
Cc:

Description

The MapCSS implementation (great work!) does not allow unquoted values that begin with a number, e.g.

way[width=5] { ... }

doesn't work (and not display an error message either), whereas

way[width=five] { ... }

and

way[width="5"] { ... }

both work. This is probably due to simple_key_value_condition expecting a "string_or_ident" value, and IDENT must always begin with a letter, and STRING must always begin with double quotes. It is non-intiutive that one has to use quotes if the value is numeric; Potlatch does not require it. Can it be fixed without completely breaking the parser?

Attachments (0)

Change History (2)

comment:1 in reply to: ↑ description Changed 2 years ago by bastiK

Replying to framm:

The MapCSS implementation (great work!) does not allow unquoted values that begin with a number, e.g.

way[width=5] { ... }

doesn't work (and not display an error message either), whereas

"width=5" is parsed as expression where the string "width" is compared to the integer 5 and it evaluates to false. So the error handling is a little problematic because formally, there is no error.

way[width=five] { ... }

and

way[width="5"] { ... }

both work. This is probably due to simple_key_value_condition expecting a "string_or_ident" value, and IDENT must always begin with a letter, and STRING must always begin with double quotes. It is non-intiutive that one has to use quotes if the value is numeric; Potlatch does not require it. Can it be fixed without completely breaking the parser?

sure

comment:2 Changed 2 years ago by bastiK

  • Resolution set to fixed
  • Status changed from new to closed

In [3911/josm]:

fixed #5985 - MapCSS conditions don't handle unquoted numeric values

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed .
as The resolution will be set. Next status will be 'closed'.
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.