GNOME Bugzilla – Bug 795550
css.lang: Add support for scientific notation and turn unit
Last modified: 2018-05-04 06:39:01 UTC
Scientific notation for numbers[1] and the turn unit[2] may not be used often but they are support by browsers and would be nice to have them correctly highlighted. Will attach a patch for this shortly. [1] https://developer.mozilla.org/en-US/docs/Web/CSS/number#Examples [2] https://developer.mozilla.org/en-US/docs/Web/CSS/angle#turn
Created attachment 371394 [details] [review] css.lang: Add support for scientific notation and turn unit This adds scientific notation and the turn unit to the dimension context.
I seem to have missed the case of an uppercase E, I will update the patch soon-ish, but I noticed there are also contexts for "resolution", "number" and "float"/"float number" (which already accepts scientific notation). Should I also update the resolution and number contexts with scientific notation (since wherever a number can be parsed, scientific notation is acceptable)? (As a tangent, I'm trying to understand the difference between number and float-number, i.e. can these two be combined into one? Why can't float be "spelled out" in a regex like in dimension, instead of an extended regex as it is now? And why does float accept a string like "12." when that's not a valid CSS number?)
Review of attachment 371394 [details] [review]: .
There's more I'd like to do with the number-related contexts, so I will close this and submit a larger patch in a new bug. Also, with regards to the uppercase E, CSS syntax is case insensitive; I will submit a separate patch to address this.