Modify

Opened 11 years ago

Closed 11 years ago

#10066 closed enhancement (wontfix)

[Patch] MapCSS parser: skip all whitespace

Reported by: simon04 Owned by: team
Priority: normal Milestone:
Component: Internal mappaint style Version:
Keywords: Cc: bastiK

Description

In order to resolve the limitation "JOSM MapCSS is not liberal with white spaces in the selector…" from wiki:Help/Styles/MapCSSImplementation, we could ignore whitespaces at the lexing phase, i.e., by using the JavaCC SKIP keyword …

With this modification, also [highway ! = footway] would be parsed correctly (note the space between ! and =). To get around this, one would have to combine <EXCLAMATION> <EQUAL> into one token like it is done for <PIPE_Z>.

Is there a special reason, why whitespace handling is done in each grammar rule separately?

Attachments (1)

parser.jj.patch (10.8 KB ) - added by simon04 11 years ago.

Download all attachments as: .zip

Change History (3)

by simon04, 11 years ago

Attachment: parser.jj.patch added

comment:1 by bastiK, 11 years ago

Also from the wiki:

But, if we were to write it like this (with white space between the object type and the tests), it would not parse:

 relation [type=route]
   way [highway]

The idea behind this is strict compliance with the CSS standard:

p.info {

}

matches a paragraph <p class="info">, but

p .info {

}

matches elements inside a paragraph with class info, e.g. <p>x<span class="info">y</span></p>.
This means that white space cannot be ignored because it makes a descendant selector.

Now MapCSS is not the same as CSS, but the idea was to use the CSS standard, unless there is a reason not to.

In this case, the reason would be, that it is just easier if you can put white-space anywhere. But this argument doesn't convince me. :)

comment:2 by simon04, 11 years ago

Resolution: wontfix
Status: newclosed

hm, right. I didn't think of that – let's keep it as it is. :-)

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain team.
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.