class lexer extends Lexer

Methods

TokenStream
tokenize(Source $source)

No description

string
strip_surrounding_quotes(array $tokens, string $code)

Strip surrounding quotes

string
fix_inline_variable_tokens(array $tokens, string $code)

Fix tokens that may have inline variables

string
add_surrounding_quotes(array $tokens, string $code)

Add surrounding quotes

string
fix_begin_tokens(string $code, array $parent_nodes = array())

Fix begin tokens (convert our BEGIN to Twig for)

string
fix_if_tokens(string $code)

Fix IF statements

string
fix_define_tokens(string $code)

Fix DEFINE statements and {$VARNAME} variables

string
replace_twig_tag_masks(string $code, array $twig_tags)

Replace Twig tag masks with Twig tag calls

Details

at line 18
TokenStream tokenize(Source $source)

No description

Parameters

Source $source

Return Value

TokenStream

at line 136
protected string strip_surrounding_quotes(array $tokens, string $code)

Strip surrounding quotes

First step to fix tokens that may have inline variables E.g. <!-- INCLUDE '{TEST}.html' to <!-- INCLUDE {TEST}.html

Parameters

array $tokens

array of tokens to search for (imploded to a regular expression)

string $code

Return Value

string

at line 155
protected string fix_inline_variable_tokens(array $tokens, string $code)

Fix tokens that may have inline variables

Second step to fix tokens that may have inline variables E.g. <!-- INCLUDE '{TEST}.html' to <!-- INCLUDE ' ~ {TEST} ~ '.html

Parameters

array $tokens

array of tokens to search for (imploded to a regular expression)

string $code

Return Value

string

at line 178
protected string add_surrounding_quotes(array $tokens, string $code)

Add surrounding quotes

Last step to fix tokens that may have inline variables E.g. <!-- INCLUDE '{TEST}.html' to <!-- INCLUDE '' ~ {TEST} ~ '.html'

Parameters

array $tokens

array of tokens to search for (imploded to a regular expression)

string $code

Return Value

string

at line 192
string fix_begin_tokens(string $code, array $parent_nodes = array())

Fix begin tokens (convert our BEGIN to Twig for)

Not meant to be used outside of this context, public because the anonymous function calls this

Parameters

string $code
array $parent_nodes

(used in recursion)

Return Value

string

at line 265
protected string fix_if_tokens(string $code)

Fix IF statements

Parameters

string $code

Return Value

string

at line 297
protected string fix_define_tokens(string $code)

Fix DEFINE statements and {$VARNAME} variables

Parameters

string $code

Return Value

string

at line 335
protected string replace_twig_tag_masks(string $code, array $twig_tags)

Replace Twig tag masks with Twig tag calls

E.g. with {% block foo %}

Parameters

string $code
array $twig_tags

All tags we want to create a mask for

Return Value

string