\QueryPath\CSSScanner

Scanner for CSS selector parsing.

This provides a simple scanner for traversing an input stream.

Summary

Methods
Properties
Constants
__construct()
position()
peek()
nextToken()
getNameString()
getQuotedString()
getPseudoClassString()
$is
$value
$token
$recurse
$it
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Properties

$is

$is : 

Type

$value

$value : 

Type

$token

$token : 

Type

$recurse

$recurse : 

Type

$it

$it : 

Type

Methods

__construct()

__construct(\QueryPath\CSS\InputStream  $in) 

Given a new input stream, tokenize the CSS selector string.

Parameters

\QueryPath\CSS\InputStream $in

An input stream to be scanned.

position()

position() 

Return the position of the reader in the string.

peek()

peek() : \QueryPath\CSS\char

See the next char without removing it from the stack.

Returns

\QueryPath\CSS\char —

Returns the next character on the stack.

nextToken()

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

integer —

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.)

getNameString()

getNameString() 

Get a name string from the input stream.

A name string must be composed of only characters defined in Token:char: -_a-zA-Z0-9

getQuotedString()

getQuotedString() 

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.

getPseudoClassString()

getPseudoClassString()