Modify

Opened 14 years ago

Closed 14 years ago

#5985 closed defect (fixed)

MapCSS conditions don't handle unquoted numeric values

Reported by: framm Owned by: bastiK
Priority: normal Milestone:
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)

in reply to:  description comment:1 by bastiK, 14 years ago

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 by bastiK, 14 years ago

Resolution: fixed
Status: newclosed

In [3911/josm]:

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

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain bastiK.
as The resolution will be set.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.