mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-04 18:34:27 +02:00
- improvement introduce shortcuts in lexer/parser rules for most frequent terms for higher
compilation speed
This commit is contained in:
@@ -1,4 +1,8 @@
|
||||
===== 3.1.24.dev ===== (xx.xx.2015)
|
||||
18.05.2015
|
||||
- improvement introduce shortcuts in lexer/parser rules for most frequent terms for higher
|
||||
compilation speed
|
||||
|
||||
16.05.2015
|
||||
- bugfix {php}{/php} did work just for single lines https://github.com/smarty-php/smarty/issues/33
|
||||
- improvement remove not needed ?><?php transitions from compiled code
|
||||
|
@@ -132,8 +132,8 @@ class Smarty_Internal_Templatelexer
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $state_name = array(1 => 'TEXT', 2 => 'SMARTY', 3 => 'LITERAL', 4 => 'DOUBLEQUOTEDSTRING',
|
||||
5 => 'CHILDBODY', 6 => 'CHILDBLOCK', 7 => 'CHILDLITERAL');
|
||||
public $state_name = array(1 => 'TEXT', 2 => 'TAG', 3 => 'TAGBODY', 4 => 'LITERAL', 5 => 'DOUBLEQUOTEDSTRING',
|
||||
6 => 'CHILDBODY', 7 => 'CHILDBLOCK', 8 => 'CHILDLITERAL');
|
||||
|
||||
/**
|
||||
* storage for assembled token patterns
|
||||
@@ -147,6 +147,7 @@ class Smarty_Internal_Templatelexer
|
||||
private $yy_global_pattern5 = null;
|
||||
private $yy_global_pattern6 = null;
|
||||
private $yy_global_pattern7 = null;
|
||||
private $yy_global_pattern8 = null;
|
||||
|
||||
/**
|
||||
* token names
|
||||
@@ -231,7 +232,6 @@ class Smarty_Internal_Templatelexer
|
||||
linebreak = /[\t ]*[\r\n]+[\t ]*/
|
||||
text = /[\S\s]/
|
||||
textdoublequoted = /([^"\\]*?)((?:\\.[^"\\]*?)*?)(?=(SMARTYldel|\$|`\$|"))/
|
||||
dollarid = /\$[0-9]*[a-zA-Z_]\w*/
|
||||
namespace = /([0-9]*[a-zA-Z_]\w*)?(\\[0-9]*[a-zA-Z_]\w*)+/
|
||||
all = /[\S\s]+/
|
||||
emptyjava = /\{\}/
|
||||
@@ -244,6 +244,8 @@ class Smarty_Internal_Templatelexer
|
||||
slash = /\//
|
||||
ldel = /SMARTYldel\s*/
|
||||
rdel = /\s*SMARTYrdel/
|
||||
nocacherdel = /(\s+nocache)?\s*SMARTYrdel/
|
||||
notblockid = /(?:(?!block)[0-9]*[a-zA-Z_]\w*)/
|
||||
smartyblockchildparent = /[\$]smarty\.block\.(child|parent)/
|
||||
integer = /\d+/
|
||||
hex = /0[xX][0-9a-fA-F]+/
|
||||
@@ -262,16 +264,14 @@ class Smarty_Internal_Templatelexer
|
||||
colon = /\s*\:\s*/
|
||||
at = /@/
|
||||
hatch = /#/
|
||||
semicolon = /\s*\;/
|
||||
semicolon = /\s*\;\s*/
|
||||
equal = /\s*=\s*/
|
||||
space = /\s+/
|
||||
ptr = /\s*\->\s*/
|
||||
aptr = /\s*=>\s*/
|
||||
singlequotestring = /'[^'\\]*(?:\\.[^'\\]*)*'/
|
||||
backtick = /`/
|
||||
backtickdollar = /`\$/
|
||||
vert = /\|/
|
||||
andsym = /\s*\&\s*/
|
||||
qmark = /\s*\?\s*/
|
||||
constant = /([_]+[A-Z0-9][0-9A-Z_]*|[A-Z][0-9A-Z_]*)(?![0-9A-Z_]*[a-z])/
|
||||
attr = /\s+[0-9]*[a-zA-Z_][a-zA-Z0-9_\-:]*\s*=\s*/
|
||||
@@ -304,20 +304,6 @@ class Smarty_Internal_Templatelexer
|
||||
comment {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_COMMENT;
|
||||
}
|
||||
ldel strip rdel {
|
||||
if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
|
||||
} else {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_STRIPON;
|
||||
}
|
||||
}
|
||||
ldel slash strip rdel {
|
||||
if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
|
||||
} else {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_STRIPOFF;
|
||||
}
|
||||
}
|
||||
ldel literal rdel {
|
||||
if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
|
||||
@@ -326,67 +312,12 @@ class Smarty_Internal_Templatelexer
|
||||
$this->yypushstate(self::LITERAL);
|
||||
}
|
||||
}
|
||||
ldel if {
|
||||
if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
|
||||
} else {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_LDELIF;
|
||||
$this->yypushstate(self::SMARTY);
|
||||
$this->taglineno = $this->line;
|
||||
}
|
||||
}
|
||||
ldel for {
|
||||
if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
|
||||
} else {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_LDELFOR;
|
||||
$this->yypushstate(self::SMARTY);
|
||||
$this->taglineno = $this->line;
|
||||
}
|
||||
}
|
||||
ldel foreach {
|
||||
if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
|
||||
} else {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_LDELFOREACH;
|
||||
$this->yypushstate(self::SMARTY);
|
||||
$this->taglineno = $this->line;
|
||||
}
|
||||
}
|
||||
ldel setfilter {
|
||||
if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
|
||||
} else {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_LDELSETFILTER;
|
||||
$this->yypushstate(self::SMARTY);
|
||||
$this->taglineno = $this->line;
|
||||
}
|
||||
}
|
||||
phptag {
|
||||
if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
|
||||
} else {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_PHP;
|
||||
$this->phpType = 'tag';
|
||||
$this->taglineno = $this->line;
|
||||
}
|
||||
}
|
||||
ldel slash {
|
||||
if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
|
||||
} else {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_LDELSLASH;
|
||||
$this->yypushstate(self::SMARTY);
|
||||
$this->taglineno = $this->line;
|
||||
}
|
||||
}
|
||||
ldel {
|
||||
if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
|
||||
} else {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_LDEL;
|
||||
$this->yypushstate(self::SMARTY);
|
||||
$this->taglineno = $this->line;
|
||||
$this->yypushstate(self::TAG);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
rdel {
|
||||
@@ -425,11 +356,67 @@ class Smarty_Internal_Templatelexer
|
||||
$this->value = substr($this->data,$this->counter,$to-$this->counter);
|
||||
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
|
||||
}
|
||||
|
||||
|
||||
*/
|
||||
/*!lex2php
|
||||
%statename SMARTY
|
||||
%statename TAG
|
||||
ldel if {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_LDELIF;
|
||||
$this->yybegin(self::TAGBODY);
|
||||
$this->taglineno = $this->line;
|
||||
}
|
||||
ldel for {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_LDELFOR;
|
||||
$this->yybegin(self::TAGBODY);
|
||||
$this->taglineno = $this->line;
|
||||
}
|
||||
ldel foreach {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_LDELFOREACH;
|
||||
$this->yybegin(self::TAGBODY);
|
||||
$this->taglineno = $this->line;
|
||||
}
|
||||
ldel setfilter {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_LDELSETFILTER;
|
||||
$this->yybegin(self::TAGBODY);
|
||||
$this->taglineno = $this->line;
|
||||
}
|
||||
phptag {
|
||||
$this->yypopstate();
|
||||
$this->token = Smarty_Internal_Templateparser::TP_PHP;
|
||||
$this->phpType = 'tag';
|
||||
$this->taglineno = $this->line;
|
||||
}
|
||||
ldel id nocacherdel {
|
||||
$this->yypopstate();
|
||||
$this->token = Smarty_Internal_Templateparser::TP_SIMPLETAG;
|
||||
$this->taglineno = $this->line;
|
||||
}
|
||||
ldel slash notblockid rdel {
|
||||
$this->yypopstate();
|
||||
$this->token = Smarty_Internal_Templateparser::TP_CLOSETAG;
|
||||
$this->taglineno = $this->line;
|
||||
}
|
||||
ldel dollar id nocacherdel {
|
||||
$this->yypopstate();
|
||||
$this->token = Smarty_Internal_Templateparser::TP_SIMPELOUTPUT;
|
||||
$this->taglineno = $this->line;
|
||||
}
|
||||
ldel slash {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_LDELSLASH;
|
||||
$this->yybegin(self::TAGBODY);
|
||||
$this->taglineno = $this->line;
|
||||
}
|
||||
ldel {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_LDEL;
|
||||
$this->yybegin(self::TAGBODY);
|
||||
$this->taglineno = $this->line;
|
||||
}
|
||||
*/
|
||||
/*!lex2php
|
||||
%statename TAGBODY
|
||||
rdel {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_RDEL;
|
||||
$this->yypopstate();
|
||||
}
|
||||
double_quote {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_QUOTE;
|
||||
$this->yypushstate(self::DOUBLEQUOTEDSTRING);
|
||||
@@ -441,13 +428,12 @@ class Smarty_Internal_Templatelexer
|
||||
$this->token = Smarty_Internal_Templateparser::TP_SMARTYBLOCKCHILDPARENT;
|
||||
$this->taglineno = $this->line;
|
||||
}
|
||||
dollar id {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_DOLLARID;
|
||||
}
|
||||
dollar {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_DOLLAR;
|
||||
}
|
||||
rdel {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_RDEL;
|
||||
$this->yypopstate();
|
||||
}
|
||||
isin {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_ISIN;
|
||||
}
|
||||
@@ -555,9 +541,6 @@ class Smarty_Internal_Templatelexer
|
||||
colon {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_COLON;
|
||||
}
|
||||
andsym {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_ANDSYM;
|
||||
}
|
||||
qmark {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_QMARK;
|
||||
}
|
||||
@@ -567,49 +550,12 @@ class Smarty_Internal_Templatelexer
|
||||
space {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_SPACE;
|
||||
}
|
||||
ldel if {
|
||||
if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
|
||||
} else {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_LDELIF;
|
||||
$this->yypushstate(self::SMARTY);
|
||||
$this->taglineno = $this->line;
|
||||
}
|
||||
}
|
||||
ldel for {
|
||||
if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
|
||||
} else {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_LDELFOR;
|
||||
$this->yypushstate(self::SMARTY);
|
||||
$this->taglineno = $this->line;
|
||||
}
|
||||
}
|
||||
ldel foreach {
|
||||
if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
|
||||
} else {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_LDELFOREACH;
|
||||
$this->yypushstate(self::SMARTY);
|
||||
$this->taglineno = $this->line;
|
||||
}
|
||||
}
|
||||
ldel slash {
|
||||
if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
|
||||
} else {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_LDELSLASH;
|
||||
$this->yypushstate(self::SMARTY);
|
||||
$this->taglineno = $this->line;
|
||||
}
|
||||
}
|
||||
ldel {
|
||||
if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
|
||||
} else {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_LDEL;
|
||||
$this->yypushstate(self::SMARTY);
|
||||
$this->taglineno = $this->line;
|
||||
$this->yypushstate(self::TAG);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
text {
|
||||
@@ -646,72 +592,50 @@ class Smarty_Internal_Templatelexer
|
||||
*/
|
||||
/*!lex2php
|
||||
%statename DOUBLEQUOTEDSTRING
|
||||
ldel if {
|
||||
if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
|
||||
} else {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_LDELIF;
|
||||
$this->yypushstate(self::SMARTY);
|
||||
$this->taglineno = $this->line;
|
||||
}
|
||||
}
|
||||
ldel for {
|
||||
if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
|
||||
} else {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_LDELFOR;
|
||||
$this->yypushstate(self::SMARTY);
|
||||
$this->taglineno = $this->line;
|
||||
}
|
||||
}
|
||||
ldel foreach {
|
||||
if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
|
||||
} else {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_LDELFOREACH;
|
||||
$this->yypushstate(self::SMARTY);
|
||||
$this->taglineno = $this->line;
|
||||
}
|
||||
}
|
||||
ldel literal rdel {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
|
||||
}
|
||||
ldel slash literal rdel {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
|
||||
}
|
||||
|
||||
ldel slash {
|
||||
if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
|
||||
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
|
||||
} else {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_LDELSLASH;
|
||||
$this->yypushstate(self::SMARTY);
|
||||
$this->taglineno = $this->line;
|
||||
$this->yypushstate(self::TAG);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
ldel id {
|
||||
if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
|
||||
} else {
|
||||
$this->yypushstate(self::TAG);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
ldel {
|
||||
if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
|
||||
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
|
||||
} else {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_LDEL;
|
||||
$this->yypushstate(self::SMARTY);
|
||||
$this->taglineno = $this->line;
|
||||
$this->yypushstate(self::TAGBODY);
|
||||
}
|
||||
}
|
||||
double_quote {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_QUOTE;
|
||||
$this->yypopstate();
|
||||
}
|
||||
backtickdollar {
|
||||
backtick dollar {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_BACKTICK;
|
||||
$this->value = substr($this->value,0,-1);
|
||||
$this->yypushstate(self::SMARTY);
|
||||
$this->yypushstate(self::TAGBODY);
|
||||
$this->taglineno = $this->line;
|
||||
}
|
||||
dollarid {
|
||||
dollar id {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_DOLLARID;
|
||||
}
|
||||
|
||||
dollar {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
|
||||
}
|
||||
|
@@ -240,7 +240,7 @@ template ::= .
|
||||
// template elements
|
||||
//
|
||||
// Smarty tag
|
||||
template_element(res)::= smartytag(st) RDEL. {
|
||||
template_element(res)::= smartytag(st). {
|
||||
if ($this->compiler->has_code) {
|
||||
res = $this->mergePrefixCode(st);
|
||||
} else {
|
||||
@@ -336,28 +336,49 @@ literal_element(res) ::= LITERAL(l). {
|
||||
res = l;
|
||||
}
|
||||
|
||||
smartytag(res) ::= tag(t) RDEL. {
|
||||
res = t;
|
||||
}
|
||||
//
|
||||
// output tags start here
|
||||
//
|
||||
smartytag(res) ::= SIMPELOUTPUT(i). {
|
||||
$var = trim(substr(i, $this->lex->ldel_length, -$this->lex->rdel_length), ' $');
|
||||
if (preg_match('/^(.*)(\s+nocache)$/', $var, $match)) {
|
||||
res = $this->compiler->compileTag('private_print_expression',array('nocache'),array('value'=>$this->compiler->compileVariable('\''.$match[1].'\'')));
|
||||
} else {
|
||||
res = $this->compiler->compileTag('private_print_expression',array(),array('value'=>$this->compiler->compileVariable('\''.$var.'\'')));
|
||||
}
|
||||
}
|
||||
|
||||
// output with optional attributes
|
||||
smartytag(res) ::= LDEL value(e). {
|
||||
tag(res) ::= LDEL variable(e). {
|
||||
res = $this->compiler->compileTag('private_print_expression',array(),array('value'=>e));
|
||||
}
|
||||
|
||||
smartytag(res) ::= LDEL value(e) modifierlist(l) attributes(a). {
|
||||
tag(res) ::= LDEL variable(e) modifierlist(l) attributes(a). {
|
||||
res = $this->compiler->compileTag('private_print_expression',a,array('value'=>e, 'modifierlist'=>l));
|
||||
}
|
||||
|
||||
smartytag(res) ::= LDEL value(e) attributes(a). {
|
||||
tag(res) ::= LDEL variable(e) attributes(a). {
|
||||
res = $this->compiler->compileTag('private_print_expression',a,array('value'=>e));
|
||||
}
|
||||
tag(res) ::= LDEL value(e). {
|
||||
res = $this->compiler->compileTag('private_print_expression',array(),array('value'=>e));
|
||||
}
|
||||
tag(res) ::= LDEL value(e) modifierlist(l) attributes(a). {
|
||||
res = $this->compiler->compileTag('private_print_expression',a,array('value'=>e, 'modifierlist'=>l));
|
||||
}
|
||||
|
||||
tag(res) ::= LDEL value(e) attributes(a). {
|
||||
res = $this->compiler->compileTag('private_print_expression',a,array('value'=>e));
|
||||
}
|
||||
|
||||
smartytag(res) ::= LDEL expr(e) modifierlist(l) attributes(a). {
|
||||
tag(res) ::= LDEL expr(e) modifierlist(l) attributes(a). {
|
||||
res = $this->compiler->compileTag('private_print_expression',a,array('value'=>e,'modifierlist'=>l));
|
||||
}
|
||||
|
||||
smartytag(res) ::= LDEL expr(e) attributes(a). {
|
||||
tag(res) ::= LDEL expr(e) attributes(a). {
|
||||
res = $this->compiler->compileTag('private_print_expression',a,array('value'=>e));
|
||||
}
|
||||
|
||||
@@ -366,24 +387,46 @@ smartytag(res) ::= LDEL expr(e) attributes(a). {
|
||||
//
|
||||
|
||||
// assign new style
|
||||
smartytag(res) ::= LDEL DOLLAR ID(i) EQUAL value(e). {
|
||||
res = $this->compiler->compileTag('assign',array(array('value'=>e),array('var'=>"'".i."'")));
|
||||
tag(res) ::= LDEL DOLLARID(i) EQUAL value(e). {
|
||||
res = $this->compiler->compileTag('assign',array(array('value'=>e),array('var'=>'\''.substr(i,1).'\'')));
|
||||
}
|
||||
|
||||
smartytag(res) ::= LDEL DOLLAR ID(i) EQUAL expr(e). {
|
||||
res = $this->compiler->compileTag('assign',array(array('value'=>e),array('var'=>"'".i."'")));
|
||||
tag(res) ::= LDEL DOLLARID(i) EQUAL expr(e). {
|
||||
res = $this->compiler->compileTag('assign',array(array('value'=>e),array('var'=>'\''.substr(i,1).'\'')));
|
||||
}
|
||||
|
||||
smartytag(res) ::= LDEL DOLLAR ID(i) EQUAL expr(e) attributes(a). {
|
||||
res = $this->compiler->compileTag('assign',array_merge(array(array('value'=>e),array('var'=>"'".i."'")),a));
|
||||
tag(res) ::= LDEL DOLLARID(i) EQUAL expr(e) attributes(a). {
|
||||
res = $this->compiler->compileTag('assign',array_merge(array(array('value'=>e),array('var'=>'\''.substr(i,1).'\'')),a));
|
||||
}
|
||||
|
||||
smartytag(res) ::= LDEL varindexed(vi) EQUAL expr(e) attributes(a). {
|
||||
tag(res) ::= LDEL varindexed(vi) EQUAL expr(e) attributes(a). {
|
||||
res = $this->compiler->compileTag('assign',array_merge(array(array('value'=>e),array('var'=>vi['var'])),a),array('smarty_internal_index'=>vi['smarty_internal_index']));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// simple tag like {name}
|
||||
smartytag(res)::= SIMPLETAG(t). {
|
||||
$tag = trim(substr(t, $this->lex->ldel_length, -$this->lex->rdel_length));
|
||||
if ($tag == 'strip') {
|
||||
$this->strip = true;
|
||||
res = null;;
|
||||
} else {
|
||||
if (defined($tag)) {
|
||||
if (isset($this->smarty->security_policy)) {
|
||||
$this->smarty->security_policy->isTrustedConstant($tag, $this->compiler);
|
||||
}
|
||||
res = $this->compiler->compileTag('private_print_expression',array(),array('value'=>$tag));
|
||||
} else {
|
||||
if (preg_match('/^(.*)(\s+nocache)$/', $tag, $match)) {
|
||||
res = $this->compiler->compileTag($match[1],array('nocache'));
|
||||
} else {
|
||||
res = $this->compiler->compileTag($tag,array());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// tag with optional Smarty2 style attributes
|
||||
smartytag(res) ::= LDEL ID(i) attributes(a). {
|
||||
tag(res) ::= LDEL ID(i) attributes(a). {
|
||||
if (defined(i)) {
|
||||
if (isset($this->smarty->security_policy)) {
|
||||
$this->smarty->security_policy->isTrustedConstant(i, $this->compiler);
|
||||
@@ -393,7 +436,7 @@ smartytag(res) ::= LDEL ID(i) attributes(a). {
|
||||
res = $this->compiler->compileTag(i,a);
|
||||
}
|
||||
}
|
||||
smartytag(res) ::= LDEL ID(i). {
|
||||
tag(res) ::= LDEL ID(i). {
|
||||
if (defined(i)) {
|
||||
if (isset($this->smarty->security_policy)) {
|
||||
$this->smarty->security_policy->isTrustedConstant(i, $this->compiler);
|
||||
@@ -406,7 +449,7 @@ smartytag(res) ::= LDEL ID(i). {
|
||||
|
||||
|
||||
// tag with modifier and optional Smarty2 style attributes
|
||||
smartytag(res) ::= LDEL ID(i) modifierlist(l)attributes(a). {
|
||||
tag(res) ::= LDEL ID(i) modifierlist(l)attributes(a). {
|
||||
if (defined(i)) {
|
||||
if (isset($this->smarty->security_policy)) {
|
||||
$this->smarty->security_policy->isTrustedConstant(i, $this->compiler);
|
||||
@@ -419,39 +462,39 @@ smartytag(res) ::= LDEL ID(i) modifierlist(l)attributes(a). {
|
||||
}
|
||||
|
||||
// registered object tag
|
||||
smartytag(res) ::= LDEL ID(i) PTR ID(m) attributes(a). {
|
||||
tag(res) ::= LDEL ID(i) PTR ID(m) attributes(a). {
|
||||
res = $this->compiler->compileTag(i,a,array('object_method'=>m));
|
||||
}
|
||||
|
||||
// registered object tag with modifiers
|
||||
smartytag(res) ::= LDEL ID(i) PTR ID(me) modifierlist(l) attributes(a). {
|
||||
tag(res) ::= LDEL ID(i) PTR ID(me) modifierlist(l) attributes(a). {
|
||||
res = '<?php ob_start();?>'.$this->compiler->compileTag(i,a,array('object_method'=>me)).'<?php echo ';
|
||||
res .= $this->compiler->compileTag('private_modifier',array(),array('modifierlist'=>l,'value'=>'ob_get_clean()')).';?>';
|
||||
}
|
||||
|
||||
// {if}, {elseif} and {while} tag
|
||||
smartytag(res) ::= LDELIF(i) expr(ie). {
|
||||
tag(res) ::= LDELIF(i) expr(ie). {
|
||||
$tag = trim(substr(i,$this->lex->ldel_length));
|
||||
res = $this->compiler->compileTag(($tag == 'else if')? 'elseif' : $tag,array(),array('if condition'=>ie));
|
||||
}
|
||||
|
||||
smartytag(res) ::= LDELIF(i) expr(ie) attributes(a). {
|
||||
tag(res) ::= LDELIF(i) expr(ie) attributes(a). {
|
||||
$tag = trim(substr(i,$this->lex->ldel_length));
|
||||
res = $this->compiler->compileTag(($tag == 'else if')? 'elseif' : $tag,a,array('if condition'=>ie));
|
||||
}
|
||||
|
||||
smartytag(res) ::= LDELIF(i) statement(ie). {
|
||||
tag(res) ::= LDELIF(i) statement(ie). {
|
||||
$tag = trim(substr(i,$this->lex->ldel_length));
|
||||
res = $this->compiler->compileTag(($tag == 'else if')? 'elseif' : $tag,array(),array('if condition'=>ie));
|
||||
}
|
||||
|
||||
smartytag(res) ::= LDELIF(i) statement(ie) attributes(a). {
|
||||
tag(res) ::= LDELIF(i) statement(ie) attributes(a). {
|
||||
$tag = trim(substr(i,$this->lex->ldel_length));
|
||||
res = $this->compiler->compileTag(($tag == 'else if')? 'elseif' : $tag,a,array('if condition'=>ie));
|
||||
}
|
||||
|
||||
// {for} tag
|
||||
smartytag(res) ::= LDELFOR statements(st) SEMICOLON optspace expr(ie) SEMICOLON optspace DOLLAR varvar(v2) foraction(e2) attributes(a). {
|
||||
tag(res) ::= LDELFOR statements(st) SEMICOLON expr(ie) SEMICOLON varindexed(v2) foraction(e2) attributes(a). {
|
||||
res = $this->compiler->compileTag('for',array_merge(a,array(array('start'=>st),array('ifexp'=>ie),array('var'=>v2),array('step'=>e2))),1);
|
||||
}
|
||||
|
||||
@@ -463,47 +506,47 @@ smartytag(res) ::= LDELFOR statements(st) SEMICOLON optspace expr(ie) SEMICOLO
|
||||
res = e;
|
||||
}
|
||||
|
||||
smartytag(res) ::= LDELFOR statement(st) TO expr(v) attributes(a). {
|
||||
tag(res) ::= LDELFOR statement(st) TO expr(v) attributes(a). {
|
||||
res = $this->compiler->compileTag('for',array_merge(a,array(array('start'=>st),array('to'=>v))),0);
|
||||
}
|
||||
|
||||
smartytag(res) ::= LDELFOR statement(st) TO expr(v) STEP expr(v2) attributes(a). {
|
||||
tag(res) ::= LDELFOR statement(st) TO expr(v) STEP expr(v2) attributes(a). {
|
||||
res = $this->compiler->compileTag('for',array_merge(a,array(array('start'=>st),array('to'=>v),array('step'=>v2))),0);
|
||||
}
|
||||
|
||||
// {foreach} tag
|
||||
smartytag(res) ::= LDELFOREACH attributes(a). {
|
||||
tag(res) ::= LDELFOREACH attributes(a). {
|
||||
res = $this->compiler->compileTag('foreach',a);
|
||||
}
|
||||
|
||||
// {foreach $array as $var} tag
|
||||
smartytag(res) ::= LDELFOREACH SPACE value(v1) AS DOLLAR varvar(v0) attributes(a). {
|
||||
tag(res) ::= LDELFOREACH SPACE value(v1) AS varvar(v0) attributes(a). {
|
||||
res = $this->compiler->compileTag('foreach',array_merge(a,array(array('from'=>v1),array('item'=>v0))));
|
||||
}
|
||||
|
||||
smartytag(res) ::= LDELFOREACH SPACE value(v1) AS DOLLAR varvar(v2) APTR DOLLAR varvar(v0) attributes(a). {
|
||||
tag(res) ::= LDELFOREACH SPACE value(v1) AS varvar(v2) APTR varvar(v0) attributes(a). {
|
||||
res = $this->compiler->compileTag('foreach',array_merge(a,array(array('from'=>v1),array('item'=>v0),array('key'=>v2))));
|
||||
}
|
||||
|
||||
smartytag(res) ::= LDELFOREACH SPACE expr(e) AS DOLLAR varvar(v0) attributes(a). {
|
||||
tag(res) ::= LDELFOREACH SPACE expr(e) AS varvar(v0) attributes(a). {
|
||||
res = $this->compiler->compileTag('foreach',array_merge(a,array(array('from'=>e),array('item'=>v0))));
|
||||
}
|
||||
|
||||
smartytag(res) ::= LDELFOREACH SPACE expr(e) AS DOLLAR varvar(v1) APTR DOLLAR varvar(v0) attributes(a). {
|
||||
tag(res) ::= LDELFOREACH SPACE expr(e) AS varvar(v1) APTR varvar(v0) attributes(a). {
|
||||
res = $this->compiler->compileTag('foreach',array_merge(a,array(array('from'=>e),array('item'=>v0),array('key'=>v1))));
|
||||
}
|
||||
|
||||
// {setfilter}
|
||||
smartytag(res) ::= LDELSETFILTER ID(m) modparameters(p). {
|
||||
tag(res) ::= LDELSETFILTER ID(m) modparameters(p). {
|
||||
res = $this->compiler->compileTag('setfilter',array(),array('modifier_list'=>array(array_merge(array(m),p))));
|
||||
}
|
||||
|
||||
smartytag(res) ::= LDELSETFILTER ID(m) modparameters(p) modifierlist(l). {
|
||||
tag(res) ::= LDELSETFILTER ID(m) modparameters(p) modifierlist(l). {
|
||||
res = $this->compiler->compileTag('setfilter',array(),array('modifier_list'=>array_merge(array(array_merge(array(m),p)),l)));
|
||||
}
|
||||
|
||||
// {$smarty.block.child} or {$smarty.block.parent}
|
||||
smartytag(res) ::= LDEL SMARTYBLOCKCHILDPARENT(i). {
|
||||
tag(res) ::= LDEL SMARTYBLOCKCHILDPARENT(i). {
|
||||
$j = strrpos(i,'.');
|
||||
if (i[$j+1] == 'c') {
|
||||
// {$smarty.block.child}
|
||||
@@ -516,20 +559,29 @@ smartytag(res) ::= LDEL SMARTYBLOCKCHILDPARENT(i). {
|
||||
|
||||
|
||||
// end of block tag {/....}
|
||||
smartytag(res) ::= LDELSLASH ID(i). {
|
||||
smartytag(res)::= CLOSETAG(t). {
|
||||
$tag = trim(substr(t, $this->lex->ldel_length, -$this->lex->rdel_length), ' /');
|
||||
if ($tag == 'strip') {
|
||||
$this->strip = false;
|
||||
res = null;
|
||||
} else {
|
||||
res = $this->compiler->compileTag($tag.'close',array());
|
||||
}
|
||||
}
|
||||
tag(res) ::= LDELSLASH ID(i). {
|
||||
res = $this->compiler->compileTag(i.'close',array());
|
||||
}
|
||||
|
||||
smartytag(res) ::= LDELSLASH ID(i) modifierlist(l). {
|
||||
tag(res) ::= LDELSLASH ID(i) modifierlist(l). {
|
||||
res = $this->compiler->compileTag(i.'close',array(),array('modifier_list'=>l));
|
||||
}
|
||||
|
||||
// end of block object tag {/....}
|
||||
smartytag(res) ::= LDELSLASH ID(i) PTR ID(m). {
|
||||
tag(res) ::= LDELSLASH ID(i) PTR ID(m). {
|
||||
res = $this->compiler->compileTag(i.'close',array(),array('object_method'=>m));
|
||||
}
|
||||
|
||||
smartytag(res) ::= LDELSLASH ID(i) PTR ID(m) modifierlist(l). {
|
||||
tag(res) ::= LDELSLASH ID(i) PTR ID(m) modifierlist(l). {
|
||||
res = $this->compiler->compileTag(i.'close',array(),array('object_method'=>m, 'modifier_list'=>l));
|
||||
}
|
||||
|
||||
@@ -560,7 +612,7 @@ attribute(res) ::= SPACE ID(v) EQUAL ID(id). {
|
||||
}
|
||||
res = array(v=>id);
|
||||
} else {
|
||||
res = array(v=>"'".id."'");
|
||||
res = array(v=>'\''.id.'\'');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -573,7 +625,7 @@ attribute(res) ::= ATTR(v) value(e). {
|
||||
}
|
||||
|
||||
attribute(res) ::= SPACE ID(v). {
|
||||
res = "'".v."'";
|
||||
res = '\''.v.'\'';
|
||||
}
|
||||
|
||||
attribute(res) ::= SPACE expr(e). {
|
||||
@@ -602,8 +654,11 @@ statements(res) ::= statements(s1) COMMA statement(s). {
|
||||
res = s1;
|
||||
}
|
||||
|
||||
statement(res) ::= DOLLAR varvar(v) EQUAL expr(e). {
|
||||
res = array('var' => v, 'value'=>e);
|
||||
statement(res) ::= DOLLARID(i) EQUAL INTEGER(e). {
|
||||
res = array('var' => '\''.substr(i,1).'\'', 'value'=>e);
|
||||
}
|
||||
statement(res) ::= DOLLARID(i) EQUAL expr(e). {
|
||||
res = array('var' => '\''.substr(i,1).'\'', 'value'=>e);
|
||||
}
|
||||
|
||||
statement(res) ::= varindexed(vi) EQUAL expr(e). {
|
||||
@@ -630,8 +685,8 @@ expr(res) ::= ternary(v). {
|
||||
}
|
||||
|
||||
// resources/streams
|
||||
expr(res) ::= DOLLAR ID(i) COLON ID(i2). {
|
||||
res = '$_smarty_tpl->getStreamVariable(\''. i .'://'. i2 . '\')';
|
||||
expr(res) ::= DOLLARID(i) COLON ID(i2). {
|
||||
res = '$_smarty_tpl->getStreamVariable(\''.substr(i,1).'://' . i2 . '\')';
|
||||
}
|
||||
|
||||
// arithmetic expression
|
||||
@@ -643,11 +698,6 @@ expr(res) ::= expr(e) UNIMATH(m) value(v). {
|
||||
res = e . trim(m) . v;
|
||||
}
|
||||
|
||||
// bit operation
|
||||
expr(res) ::= expr(e) ANDSYM(m) value(v). {
|
||||
res = e . trim(m) . v;
|
||||
}
|
||||
|
||||
// array
|
||||
expr(res) ::= array(a). {
|
||||
res = a;
|
||||
@@ -683,8 +733,8 @@ expr(res) ::= variable(v1) INSTANCEOF(i) ns1(v2). {
|
||||
//
|
||||
// ternary
|
||||
//
|
||||
ternary(res) ::= OPENP expr(v) CLOSEP QMARK DOLLAR ID(e1) COLON expr(e2). {
|
||||
res = v.' ? '. $this->compiler->compileVariable("'".e1."'") . ' : '.e2;
|
||||
ternary(res) ::= OPENP expr(v) CLOSEP QMARK DOLLARID(e1) COLON expr(e2). {
|
||||
res = v.' ? '. $this->compiler->compileVariable('\''.substr(e1,1).'\'') . ' : '.e2;
|
||||
}
|
||||
|
||||
ternary(res) ::= OPENP expr(v) CLOSEP QMARK expr(e1) COLON expr(e2). {
|
||||
@@ -743,7 +793,7 @@ value(res) ::= ID(id). {
|
||||
}
|
||||
res = id;
|
||||
} else {
|
||||
res = "'".id."'";
|
||||
res = '\''.id.'\'';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -776,11 +826,10 @@ value(res) ::= varindexed(vi) DOUBLECOLON static_class_access(r). {
|
||||
$this->compiler->prefix_code[] = '<?php $_tmp'.self::$prefix_number.' = '. $this->compiler->compileVariable(vi['var']).vi['smarty_internal_index'].';?>';
|
||||
}
|
||||
res = '$_tmp'.self::$prefix_number.'::'.r[0].r[1];
|
||||
|
||||
}
|
||||
|
||||
// Smarty tag
|
||||
value(res) ::= smartytag(st) RDEL. {
|
||||
value(res) ::= smartytag(st). {
|
||||
self::$prefix_number++;
|
||||
$tmp = $this->compiler->appendCode('<?php ob_start();?>', st);
|
||||
$this->compiler->prefix_code[] = $this->compiler->appendCode($tmp, '<?php $_tmp'.self::$prefix_number.'=ob_get_clean();?>');
|
||||
@@ -820,9 +869,9 @@ ns1(res) ::= NAMESPACE(i). {
|
||||
res = i;
|
||||
}
|
||||
|
||||
ns1(res) ::= variable(v). {
|
||||
res = v;
|
||||
}
|
||||
//ns1(res) ::= variable(v). {
|
||||
// res = v;
|
||||
//}
|
||||
|
||||
|
||||
|
||||
@@ -831,6 +880,9 @@ ns1(res) ::= variable(v). {
|
||||
// variables
|
||||
//
|
||||
// Smarty variable (optional array)
|
||||
variable(res) ::= DOLLARID(i). {
|
||||
res = $this->compiler->compileVariable('\''.substr(i,1).'\'');
|
||||
}
|
||||
variable(res) ::= varindexed(vi). {
|
||||
if (vi['var'] == '\'smarty\'') {
|
||||
$smarty_var = $this->compiler->compileTag('private_special_variable',array(),vi['smarty_internal_index']);
|
||||
@@ -844,7 +896,7 @@ variable(res) ::= varindexed(vi). {
|
||||
}
|
||||
|
||||
// variable with property
|
||||
variable(res) ::= DOLLAR varvar(v) AT ID(p). {
|
||||
variable(res) ::= varvar(v) AT ID(p). {
|
||||
res = '$_smarty_tpl->tpl_vars['. v .']->'.p;
|
||||
}
|
||||
|
||||
@@ -870,7 +922,10 @@ variable(res) ::= HATCH variable(v) HATCH arrayindex(a). {
|
||||
res = '(is_array($tmp = $_smarty_tpl->getConfigVariable( '. v .')) ? $tmp'.a.' : null)';
|
||||
}
|
||||
|
||||
varindexed(res) ::= DOLLAR varvar(v) arrayindex(a). {
|
||||
varindexed(res) ::= DOLLARID(i) arrayindex(a). {
|
||||
res = array('var'=>'\''.substr(i,1).'\'', 'smarty_internal_index'=>a);
|
||||
}
|
||||
varindexed(res) ::= varvar(v) arrayindex(a). {
|
||||
res = array('var'=>v, 'smarty_internal_index'=>a);
|
||||
}
|
||||
|
||||
@@ -889,11 +944,14 @@ arrayindex ::= . {
|
||||
|
||||
// single index definition
|
||||
// Smarty2 style index
|
||||
indexdef(res) ::= DOT DOLLAR varvar(v). {
|
||||
indexdef(res) ::= DOT DOLLARID(i). {
|
||||
res = '['.$this->compiler->compileVariable('\''.substr(i,1).'\'').']';
|
||||
}
|
||||
indexdef(res) ::= DOT varvar(v). {
|
||||
res = '['.$this->compiler->compileVariable(v).']';
|
||||
}
|
||||
|
||||
indexdef(res) ::= DOT DOLLAR varvar(v) AT ID(p). {
|
||||
indexdef(res) ::= DOT varvar(v) AT ID(p). {
|
||||
res = '['.$this->compiler->compileVariable(v).'->'.p.']';
|
||||
}
|
||||
|
||||
@@ -902,19 +960,19 @@ indexdef(res) ::= DOT ID(i). {
|
||||
if (isset($this->smarty->security_policy)) {
|
||||
$this->smarty->security_policy->isTrustedConstant(i, $this->compiler);
|
||||
}
|
||||
res = "[". i ."]";
|
||||
res = '['. i .']';
|
||||
} else {
|
||||
res = "['". i ."']";
|
||||
}
|
||||
}
|
||||
|
||||
indexdef(res) ::= DOT INTEGER(n). {
|
||||
res = "[". n ."]";
|
||||
res = '['. n .']';
|
||||
}
|
||||
|
||||
|
||||
indexdef(res) ::= DOT LDEL expr(e) RDEL. {
|
||||
res = "[". e ."]";
|
||||
res = '['. e .']';
|
||||
}
|
||||
|
||||
// section tag index
|
||||
@@ -925,10 +983,25 @@ indexdef(res) ::= OPENB ID(i)CLOSEB. {
|
||||
indexdef(res) ::= OPENB ID(i) DOT ID(i2) CLOSEB. {
|
||||
res = '['.$this->compiler->compileTag('private_special_variable',array(),'[\'section\'][\''.i.'\'][\''.i2.'\']').']';
|
||||
}
|
||||
indexdef(res) ::= OPENB SINGLEQUOTESTRING(s) CLOSEB. {
|
||||
res = '['.s.']';
|
||||
}
|
||||
indexdef(res) ::= OPENB INTEGER(n) CLOSEB. {
|
||||
res = '['.n.']';
|
||||
}
|
||||
indexdef(res) ::= OPENB DOLLARID(i) CLOSEB. {
|
||||
res = '['.$this->compiler->compileVariable('\''.substr(i,1).'\'').']';;
|
||||
}
|
||||
indexdef(res) ::= OPENB variable(v) CLOSEB. {
|
||||
res = '['.v.']';
|
||||
}
|
||||
indexdef(res) ::= OPENB value(v) CLOSEB. {
|
||||
res = '['.v.']';
|
||||
}
|
||||
|
||||
// PHP style index
|
||||
indexdef(res) ::= OPENB expr(e) CLOSEB. {
|
||||
res = "[". e ."]";
|
||||
res = '['. e .']';
|
||||
}
|
||||
|
||||
// for assign append array
|
||||
@@ -940,9 +1013,14 @@ indexdef(res) ::= OPENB CLOSEB. {
|
||||
//
|
||||
// variable variable names
|
||||
//
|
||||
|
||||
// singel identifier element
|
||||
varvar(res) ::= varvarele(v). {
|
||||
res = v;
|
||||
varvar(res) ::= DOLLARID(i). {
|
||||
res = '\''.substr(i,1).'\'';
|
||||
}
|
||||
// single $
|
||||
varvar(res) ::= DOLLAR. {
|
||||
res = "''";
|
||||
}
|
||||
|
||||
// sequence of identifier elements
|
||||
@@ -954,6 +1032,10 @@ varvar(res) ::= varvar(v1) varvarele(v2). {
|
||||
varvarele(res) ::= ID(s). {
|
||||
res = '\''.s.'\'';
|
||||
}
|
||||
varvarele(res) ::= SIMPELOUTPUT(i). {
|
||||
$var = trim(substr(i, $this->lex->ldel_length, -$this->lex->rdel_length), ' $');
|
||||
res = $this->compiler->compileVariable('\''.$var.'\'');
|
||||
}
|
||||
|
||||
// variable sections of element
|
||||
varvarele(res) ::= LDEL expr(e) RDEL. {
|
||||
@@ -989,7 +1071,7 @@ objectelement(res)::= PTR ID(i) arrayindex(a). {
|
||||
res = '->'.i.a;
|
||||
}
|
||||
|
||||
objectelement(res)::= PTR DOLLAR varvar(v) arrayindex(a). {
|
||||
objectelement(res)::= PTR varvar(v) arrayindex(a). {
|
||||
if ($this->security) {
|
||||
$this->compiler->trigger_template_error (self::Err2);
|
||||
}
|
||||
@@ -1065,12 +1147,12 @@ method(res) ::= ID(f) OPENP params(p) CLOSEP. {
|
||||
res = f . "(". implode(',',p) .")";
|
||||
}
|
||||
|
||||
method(res) ::= DOLLAR ID(f) OPENP params(p) CLOSEP. {
|
||||
method(res) ::= DOLLARID(f) OPENP params(p) CLOSEP. {
|
||||
if ($this->security) {
|
||||
$this->compiler->trigger_template_error (self::Err2);
|
||||
}
|
||||
self::$prefix_number++;
|
||||
$this->compiler->prefix_code[] = '<?php $_tmp'.self::$prefix_number.'='.$this->compiler->compileVariable("'".f."'").';?>';
|
||||
$this->compiler->prefix_code[] = '<?php $_tmp'.self::$prefix_number.'='.$this->compiler->compileVariable('\''.substr(f,1).'\'').';?>';
|
||||
res = '$_tmp'.self::$prefix_number.'('. implode(',',p) .')';
|
||||
}
|
||||
|
||||
@@ -1147,13 +1229,13 @@ static_class_access(res) ::= ID(v). {
|
||||
}
|
||||
|
||||
// static class variables
|
||||
static_class_access(res) ::= DOLLAR ID(v) arrayindex(a). {
|
||||
res = array('$'.v, a, 'property');
|
||||
static_class_access(res) ::= DOLLARID(v) arrayindex(a). {
|
||||
res = array(v, a, 'property');
|
||||
}
|
||||
|
||||
// static class variables with object chain
|
||||
static_class_access(res) ::= DOLLAR ID(v) arrayindex(a) objectchain(oc). {
|
||||
res = array('$'.v, a.oc, 'property');
|
||||
static_class_access(res) ::= DOLLARID(v) arrayindex(a) objectchain(oc). {
|
||||
res = array(v, a.oc, 'property');
|
||||
}
|
||||
|
||||
|
||||
@@ -1272,7 +1354,7 @@ doublequotedcontent(res) ::= LDEL expr(e) RDEL. {
|
||||
res = new Smarty_Internal_ParseTree_Code($this, '(string)('.e.')');
|
||||
}
|
||||
|
||||
doublequotedcontent(res) ::= smartytag(st) RDEL. {
|
||||
doublequotedcontent(res) ::= smartytag(st). {
|
||||
res = new Smarty_Internal_ParseTree_Tag($this, st);
|
||||
}
|
||||
|
||||
@@ -1280,14 +1362,3 @@ doublequotedcontent(res) ::= TEXT(o). {
|
||||
res = new Smarty_Internal_ParseTree_DqContent($this, o);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// optional space
|
||||
//
|
||||
optspace(res) ::= SPACE(s). {
|
||||
res = s;
|
||||
}
|
||||
|
||||
optspace(res) ::= . {
|
||||
res = '';
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user