What is it? mean in the tokenization section of the W3C CSS spec?

Since my terrible experience with cssparser, I set myself the task of embedding a CSS parser in Java using Parboiled . I already have all the color specs, but of course I need everything else ...

So, I went looking for the CSS specification and found it on the W3C website. I am now in the process of writing the rules for all the "atoms", but found something disturbing in this section :

UNICODE-RANGE u\+[0-9a-f?]{1,6}(-[0-9a-f]{1,6})? 

The part that bothers me is the question mark in [0-9a-f?] .

The heading of the paragraph says that the regular expressions used here are Lex style. ? doesn't really matter in the character class (thanks @scizzo for confirmation). So is this a typo in the W3C specification, or ? really allowed in unicode range? If so, what does it mean?

Wrap . I have my answer. However, the specification is incorrect: the “unicode range of the question mark” can only be on its own. Given the expression above, this expression will be allowed, while it is clearly illegal: u+4??-733f

+6
source share
1 answer

Yes, this is a literal question mark. From Flex documentation :

Note that inside the character class, all regular expression operators lose their special meaning except escape ('\') and character class operators, '-', ']', and at the beginning of the class, '^'.

Now, according to the W3C ? can be used as a kind of wildcard :

? characters mean "any value of a digit" (for example, U + 4 ??)

+4
source

Source: https://habr.com/ru/post/904571/


All Articles