class Compiler extends Object

Latte compiler.

Constants

CONTENT_HTML

Context-aware escaping content types

CONTENT_XHTML

Context-aware escaping content types

CONTENT_XML

Context-aware escaping content types

CONTENT_JS

Context-aware escaping content types

CONTENT_CSS

Context-aware escaping content types

CONTENT_URL

Context-aware escaping content types

CONTENT_ICAL

Context-aware escaping content types

CONTENT_TEXT

Context-aware escaping content types

internal CONTEXT_COMMENT

internal CONTEXT_SINGLE_QUOTED_ATTR

internal CONTEXT_DOUBLE_QUOTED_ATTR

internal CONTEXT_UNQUOTED_ATTR

Methods

__construct()

No description

addMacro($name, IMacro $macro)

Adds new macro.

string
compile(array $tokens)

Compiles tokens to PHP code.

setContentType($type)

No description

string
getContentType()

No description

setContext($context, $sub = NULL)

No description

array
getContext()

No description

string
getTemplateId()

No description

MacroNode|null
getMacroNode()

No description

int
getLine()

Returns current line number.

expandTokens($s)

No description

openMacro($name, $args = NULL, $modifiers = NULL, $isRightmost = FALSE, $nPrefix = NULL)

Generates code for {macro ...} to the output.

closeMacro($name, $args = NULL, $modifiers = NULL, $isRightmost = FALSE, $nPrefix = NULL)

Generates code for {/macro ...} to the output.

void
writeAttrsMacro($code)

Generates code for macro to the output.

expandMacro($name, $args, $modifiers = NULL, $nPrefix = NULL)

Expands macro and returns node & code.

Details

at line 68
__construct()

No description

at line 79
Compiler addMacro($name, IMacro $macro)

Adds new macro.

Parameters

$name
IMacro $macro

Return Value

Compiler

at line 92
string compile(array $tokens)

Compiles tokens to PHP code.

Parameters

array $tokens

Return Value

string

at line 136
Compiler setContentType($type)

No description

Parameters

$type

Return Value

Compiler

at line 147
string getContentType()

No description

Return Value

string

at line 156
Compiler setContext($context, $sub = NULL)

No description

Parameters

$context
$sub

Return Value

Compiler

at line 166
array getContext()

No description

Return Value

array

[context, subcontext]

at line 175
string getTemplateId()

No description

Return Value

string

at line 184
MacroNode|null getMacroNode()

No description

Return Value

MacroNode|null

at line 194
int getLine()

Returns current line number.

Return Value

int

at line 201
expandTokens($s)

internal  
 

No description

Parameters

$s

at line 377
MacroNode openMacro($name, $args = NULL, $modifiers = NULL, $isRightmost = FALSE, $nPrefix = NULL)

internal  
 

Generates code for {macro ...} to the output.

Parameters

$name
$args
$modifiers
$isRightmost
$nPrefix

Return Value

MacroNode

at line 400
MacroNode closeMacro($name, $args = NULL, $modifiers = NULL, $isRightmost = FALSE, $nPrefix = NULL)

internal  
 

Generates code for {/macro ...} to the output.

Parameters

$name
$args
$modifiers
$isRightmost
$nPrefix

Return Value

MacroNode

at line 458
void writeAttrsMacro($code)

internal  
 

Generates code for macro to the output.

Parameters

$code

Return Value

void

at line 538
MacroNode expandMacro($name, $args, $modifiers = NULL, $nPrefix = NULL)

internal  
 

Expands macro and returns node & code.

Parameters

$name
$args
$modifiers
$nPrefix

Return Value

MacroNode