Lexer
in package
Lexes a template string.
Tags
Table of Contents
- PUNCTUATION = '()[]{}?:.,|'
- REGEX_DQ_STRING_DELIM = '/"/A'
- REGEX_DQ_STRING_PART = '/[^#"\\]*(?:(?:\\.|#(?!\{))[^#"\\]*)*/As'
- REGEX_NAME = '/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/A'
- REGEX_NUMBER = '/[0-9]+(?:\.[0-9]+)?([Ee][\+\-][0-9]+)?/A'
- REGEX_STRING = '/"([^#"\\]*(?:\\.[^#"\\]*)*)"|'([^'\\]*(?:\\.[^'\\]*)*)'/As'
- STATE_BLOCK = 1
- STATE_DATA = 0
- STATE_INTERPOLATION = 4
- STATE_STRING = 3
- STATE_VAR = 2
- $brackets : mixed
- $code : mixed
- $currentVarBlockLine : mixed
- $cursor : mixed
- $end : mixed
- $env : mixed
- $isInitialized : mixed
- $lineno : mixed
- $options : mixed
- $position : mixed
- $positions : mixed
- $regexes : mixed
- $source : mixed
- $state : mixed
- $states : mixed
- $tokens : mixed
- __construct() : mixed
- tokenize() : mixed
- getOperatorRegex() : mixed
- initialize() : mixed
- lexBlock() : mixed
- lexComment() : mixed
- lexData() : mixed
- lexExpression() : mixed
- lexInterpolation() : mixed
- lexRawData() : mixed
- lexString() : mixed
- lexVar() : mixed
- moveCursor() : mixed
- popState() : mixed
- pushState() : mixed
- pushToken() : mixed
Constants
PUNCTUATION
public
mixed
PUNCTUATION
= '()[]{}?:.,|'
REGEX_DQ_STRING_DELIM
public
mixed
REGEX_DQ_STRING_DELIM
= '/"/A'
REGEX_DQ_STRING_PART
public
mixed
REGEX_DQ_STRING_PART
= '/[^#"\\]*(?:(?:\\.|#(?!\{))[^#"\\]*)*/As'
REGEX_NAME
public
mixed
REGEX_NAME
= '/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/A'
REGEX_NUMBER
public
mixed
REGEX_NUMBER
= '/[0-9]+(?:\.[0-9]+)?([Ee][\+\-][0-9]+)?/A'
REGEX_STRING
public
mixed
REGEX_STRING
= '/"([^#"\\]*(?:\\.[^#"\\]*)*)"|'([^'\\]*(?:\\.[^'\\]*)*)'/As'
STATE_BLOCK
public
mixed
STATE_BLOCK
= 1
STATE_DATA
public
mixed
STATE_DATA
= 0
STATE_INTERPOLATION
public
mixed
STATE_INTERPOLATION
= 4
STATE_STRING
public
mixed
STATE_STRING
= 3
STATE_VAR
public
mixed
STATE_VAR
= 2
Properties
$brackets
private
mixed
$brackets
$code
private
mixed
$code
$currentVarBlockLine
private
mixed
$currentVarBlockLine
$cursor
private
mixed
$cursor
$end
private
mixed
$end
$env
private
mixed
$env
$isInitialized
private
mixed
$isInitialized
= false
$lineno
private
mixed
$lineno
$options
private
mixed
$options
$position
private
mixed
$position
$positions
private
mixed
$positions
$regexes
private
mixed
$regexes
$source
private
mixed
$source
$state
private
mixed
$state
$states
private
mixed
$states
$tokens
private
mixed
$tokens
Methods
__construct()
public
__construct(Environment $env[, array<string|int, mixed> $options = [] ]) : mixed
Parameters
- $env : Environment
- $options : array<string|int, mixed> = []
Return values
mixed —tokenize()
public
tokenize(Source $source) : mixed
Parameters
- $source : Source
Return values
mixed —getOperatorRegex()
private
getOperatorRegex() : mixed
Return values
mixed —initialize()
private
initialize() : mixed
Return values
mixed —lexBlock()
private
lexBlock() : mixed
Return values
mixed —lexComment()
private
lexComment() : mixed
Return values
mixed —lexData()
private
lexData() : mixed
Return values
mixed —lexExpression()
private
lexExpression() : mixed
Return values
mixed —lexInterpolation()
private
lexInterpolation() : mixed
Return values
mixed —lexRawData()
private
lexRawData() : mixed
Return values
mixed —lexString()
private
lexString() : mixed
Return values
mixed —lexVar()
private
lexVar() : mixed
Return values
mixed —moveCursor()
private
moveCursor(mixed $text) : mixed
Parameters
- $text : mixed
Return values
mixed —popState()
private
popState() : mixed
Return values
mixed —pushState()
private
pushState(mixed $state) : mixed
Parameters
- $state : mixed
Return values
mixed —pushToken()
private
pushToken(mixed $type[, mixed $value = '' ]) : mixed
Parameters
- $type : mixed
- $value : mixed = ''