Overview

Namespaces

  • None
  • WPGMZA
    • Integration
    • Selector

Classes

  • AttributeSelector
  • Parser
  • PseudoSelector
  • Selector
  • Token
  • Tokenizer
  • TokenStream
  • XPathConverter

Exceptions

  • ConvertException
  • ParseException

Functions

  • trace
  • Overview
  • Namespace
  • Class

Class TokenStream

This class provides stream functions to navigate an array of tokens

Namespace: WPGMZA\Selector
Located at class.selector-to-xpath.php
Methods summary
public
# __construct( WPGMZA\Selector\Token[] $arr )

Constructor

Constructor

Parameters

$arr
array of tokens
public WPGMZA\Selector\Token|null
# peek( string|null $expectedType = null, integer $calledByRead = 0 )

Peeks at the next token in the stream, without advancing the cursor

Peeks at the next token in the stream, without advancing the cursor

Parameters

$expectedType
The token type to expect.
$calledByRead
Used for internal debug logging.

Returns

WPGMZA\Selector\Token|null
The peeked token, or null at the end of the stream.

Throws

WPGMZA\Selector\ParseException
If $expectedType is non-null, and the peeked token is null or not the expected type.
public WPGMZA\Selector\Token|null
# read( string|null $expectedType = null )

Reads the next token in the stream. This performs the same actions as peek, but will advance the cursor before returning the token. The cursor may not advance past the token count.

Reads the next token in the stream. This performs the same actions as peek, but will advance the cursor before returning the token. The cursor may not advance past the token count.

Parameters

$expectedType
The token type to expect.

Returns

WPGMZA\Selector\Token|null
The peeked token, or null at the end of the stream.

Throws

WPGMZA\Selector\ParseException
If $expectedType is non-null, and the peeked token is null or not the expected type.
public boolean
# eof( )

Returns true if the cursor has reached the end of the token stream

Returns true if the cursor has reached the end of the token stream

Returns

boolean
Properties summary
protected $tokens
#
protected $cursor
#
API documentation generated by ApiGen