Lexer
public abstract class Lexer
www.doctrine-project.org
Field Summary | |
---|---|
array The next token in the query string. | |
array The last matched/seen token. |
Method Summary | |
---|---|
protected abstract array | Lexical catchable patterns |
string | getLiteral(integer token) Gets the literal for a given token. |
protected abstract array | Lexical non-catchable patterns |
array|null | glimpse() Peeks at the next token, returns it and immediately resets the peek. |
boolean | isA(mixed value, integer token) Checks if given value is identical to the given token |
boolean | isNextToken(integer|string token) Checks whether a given token matches the current lookahead. |
array|null | moveNext() Moves to the next token in the input string. |
array | peek() Moves the lookahead token forward. |
void | reset() Resets the scanner |
void | Resets the peek pointer to 0 |
void | resetPosition(integer position) Resets the lexer position on the input to the given position |
void | setInput(string input) Inputs data to be tokenized |
void | skipUntil(mixed type, $type The) Tells the lexer to skip input tokens until it sees a token with the given value. |
public array The next token in the query string. $lookahead
public array The last matched/seen token. $token
protected abstract array getCatchablePatterns()
Lexical catchable patterns
public string getLiteral(integer token)
Gets the literal for a given token.
protected abstract array getNonCatchablePatterns()
Lexical non-catchable patterns
public array|null glimpse()
Peeks at the next token, returns it and immediately resets the peek.
public boolean isA(mixed value, integer token)
Checks if given value is identical to the given token
public boolean isNextToken(integer|string token)
Checks whether a given token matches the current lookahead.
public array|null moveNext()
Moves to the next token in the input string.
A token is an associative array containing three items: - 'value' : the string value of the token in the input string - 'type' : the type of the token (identifier, numeric, string, input parameter, none) - 'position' : the position of the token in the input string
public array peek()
Moves the lookahead token forward.
public void reset()
Resets the scanner
public void resetPeek()
Resets the peek pointer to 0
public void resetPosition(integer position)
Resets the lexer position on the input to the given position
public void setInput(string input)
Inputs data to be tokenized
public void skipUntil(mixed type, $type The)
Tells the lexer to skip input tokens until it sees a token with the given value.
Simple generic lexical scanner.