bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#20859: 25.0.50; css-mode: Comments within URIs


From: Simen Heggestøyl
Subject: bug#20859: 25.0.50; css-mode: Comments within URIs
Date: Sat, 20 Jun 2015 17:04:38 +0200

In CSS, the syntax of URIs is described as follows:

  The format of a URI value is 'url(' followed by optional white space
  followed by an optional single quote (') or double quote (")
  character followed by the URI itself, followed by an optional single
  quote (') or double quote (") character followed by optional white
  space followed by ')'. The two quote characters must be the
  same. [1]

This means that all of the following are legal URI entries:

  url("http://www.example.com/")
  url('http://www.example.com/')
  url(http://www.example.com/)

However, css-mode doesn't currently interpret the stuff between the
parenthesis in the quote-less form as strings. This means that URIs
containing /* (or // in scss-mode, which is more common for URIs) will
be interpreted as comment starters by Emacs.

I attempted to fix this by setting syntax-propertize-function to the
following:

  (syntax-propertize-rules
     ("url\\(\(\\)[[:space:]]*[[:graph:]]*[[:space:]]*\\(\)\\)"
      (1 "|") (2 "|")))

This almost solves the problem, but with the quirk that "(" and ")"
are interpreted as part of the string.

Would it be possible to assign string syntax to the stuff between the
two parenthesis without having any visible string delimiters? I'm
thankful for any hints for getting closer to a solution!

-- Simen


[1] http://www.w3.org/TR/CSS21/syndata.html#uri

reply via email to

[Prev in Thread] Current Thread [Next in Thread]