Doctrine


Doctrine\Common\Lexer
/Doctrine/Common/Lexer.php at line 35

Class Lexer

Lexer

public abstract class Lexer

Simple generic lexical scanner.

License:
http://www.opensource.org/licenses/lgpl-license.php LGPL
See Also:
www.doctrine-project.org
Since:
2.0
Version:
$Revision: 3938 $
Author:
Guilherme Blanco
Jonathan Wage
Roman Borschel

Field Summary
array The next token in the query string.

$lookahead

array The last matched/seen token.

$token

Method Summary
protected abstract array

getCatchablePatterns()

Lexical catchable patterns

string

getLiteral(integer token)

Gets the literal for a given token.

protected abstract array

getNonCatchablePatterns()

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

resetPeek()

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.

Field Detail

/Doctrine/Common/Lexer.php at line 55

lookahead

public array The next token in the query string. $lookahead


/Doctrine/Common/Lexer.php at line 60

token

public array The last matched/seen token. $token


Method Detail

/Doctrine/Common/Lexer.php at line 242

getCatchablePatterns

protected abstract array getCatchablePatterns()

Lexical catchable patterns


/Doctrine/Common/Lexer.php at line 222

getLiteral

public string getLiteral(integer token)

Gets the literal for a given token.


/Doctrine/Common/Lexer.php at line 249

getNonCatchablePatterns

protected abstract array getNonCatchablePatterns()

Lexical non-catchable patterns


/Doctrine/Common/Lexer.php at line 180

glimpse

public array|null glimpse()

Peeks at the next token, returns it and immediately resets the peek.

Returns:
The next token or NULL if there are no more tokens ahead.

/Doctrine/Common/Lexer.php at line 156

isA

public boolean isA(mixed value, integer token)

Checks if given value is identical to the given token


/Doctrine/Common/Lexer.php at line 111

isNextToken

public boolean isNextToken(integer|string token)

Checks whether a given token matches the current lookahead.


/Doctrine/Common/Lexer.php at line 127

moveNext

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

Returns:
the next token; null if there is no more tokens left

/Doctrine/Common/Lexer.php at line 166

peek

public array peek()

Moves the lookahead token forward.

Returns:
| null The next token or NULL if there are no more tokens ahead.

/Doctrine/Common/Lexer.php at line 78

reset

public void reset()

Resets the scanner


/Doctrine/Common/Lexer.php at line 90

resetPeek

public void resetPeek()

Resets the peek pointer to 0


/Doctrine/Common/Lexer.php at line 100

resetPosition

public void resetPosition(integer position)

Resets the lexer position on the input to the given position

Parameters:
position - Position to place the lexical scanner

/Doctrine/Common/Lexer.php at line 67

setInput

public void setInput(string input)

Inputs data to be tokenized

Parameters:
input - input to be tokenized

/Doctrine/Common/Lexer.php at line 142

skipUntil

public void skipUntil(mixed type, $type The)

Tells the lexer to skip input tokens until it sees a token with the given value.

Parameters:
The - token type to skip until.

Doctrine