Scanner for CSS selector parsing.
This provides a simple scanner for traversing an input stream.
Given a new input stream, tokenize the CSS selector string.
An input stream to be scanned.
nextToken() : integer
Get the next token in the input stream.
This sets the current token to the value of the next token in the stream.
Returns an int value corresponding to one of the Token constants, or FALSE if the end of the string is reached. (Remember to use strong equality checking on FALSE, since 0 is a valid token id.)
This gets a string with any legal 'string' characters.
See CSS Selectors specification, section 11, for the definition of string.
This will check for string1, string2, and the case where a string is unquoted (Oddly absent from the "official" grammar, though such strings are present as examples in the spec.)
Note: Though the grammar supplied by CSS 3 Selectors section 11 does not address the contents of a pseudo-class value, the spec itself indicates that a pseudo-class value is a "value between parenthesis" [6.6]. The examples given use URLs among other things, making them closer to the definition of 'string' than to 'name'. So we handle them here as strings.