After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 795923 - css.lang: Numbers and units fixes
css.lang: Numbers and units fixes
Status: RESOLVED FIXED
Product: gtksourceview
Classification: Platform
Component: Syntax files
git master
Other Linux
: Normal normal
: ---
Assigned To: GTK Sourceview maintainers
GTK Sourceview maintainers
Depends on:
Blocks:
 
 
Reported: 2018-05-08 12:31 UTC by Jeffery To
Modified: 2018-05-09 09:23 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
css.lang: Numbers and units fixes (3.94 KB, patch)
2018-05-08 12:42 UTC, Jeffery To
none Details | Review

Description Jeffery To 2018-05-08 12:31:39 UTC
There are a few issues with current number/unit highlighting:

* Scientific notation isn't accepted for numbers with units (e.g. 1e3px)
* Turn unit (e.g. rotate(1.5turn)) isn't highlighted
* Resolutions (e.g. 72dpi) must be strictly positive
* Numerators/denominators of aspect ratios (e.g. 16/9) are highlighted as separate numbers
* Invalid numbers (i.e. "12.") are highlighted

Will attach a patch shortly.

(This is a continuation of bug 795550)
Comment 1 Jeffery To 2018-05-08 12:42:33 UTC
Created attachment 371802 [details] [review]
css.lang: Numbers and units fixes

* Unify number and float contexts, adding a number regex that more
closely follows the CSS definition of a number[1]
* Use the number regex for dimension and resolution contexts
* Add the turn unit to the dimension context
* Make resolutions strictly positive (allowing for an optional plus sign)[2]
* Add a ratio context for aspect ratio media queries[3]

Note that the ratio context doesn't use the number regex, because ratios only allow (strictly positive) integers for their numerators and denominators.

[1] https://developer.mozilla.org/en-US/docs/Web/CSS/number
[2] https://developer.mozilla.org/en-US/docs/Web/CSS/resolution
[3] https://developer.mozilla.org/en-US/docs/Web/CSS/ratio
Comment 2 Sébastien Wilmet 2018-05-09 09:23:53 UTC
Thanks, pushed as commit 896e22d6b6ebf172823f249235c28f36482f7ed1.