author | Markus Bröker <broeker.markus@googlemail.com> |
Thu, 12 Nov 2015 14:39:16 +0100 | |
changeset 0 | 4869aea77e21 |
permissions | -rw-r--r-- |
0
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1 |
/** |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
2 |
* Smarty Internal Plugin Templateparser |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
3 |
* |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
4 |
* This is the template parser |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
5 |
* |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
6 |
* |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
7 |
* @package Smarty |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
8 |
* @subpackage Compiler |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
9 |
* @author Uwe Tews |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
10 |
*/ |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
11 |
%stack_size 500 |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
12 |
%name TP_ |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
13 |
%declare_class { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
14 |
/** |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
15 |
* Smarty Internal Plugin Templateparser |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
16 |
* |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
17 |
* This is the template parser. |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
18 |
* It is generated from the smarty_internal_templateparser.y file |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
19 |
* @package Smarty |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
20 |
* @subpackage Compiler |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
21 |
* @author Uwe Tews |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
22 |
*/ |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
23 |
class Smarty_Internal_Templateparser |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
24 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
25 |
%include_class |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
26 |
{ |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
27 |
const Err1 = "Security error: Call to private object member not allowed"; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
28 |
const Err2 = "Security error: Call to dynamic object member not allowed"; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
29 |
const Err3 = "PHP in template not allowed. Use SmartyBC to enable it"; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
30 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
31 |
/** |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
32 |
* result status |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
33 |
* |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
34 |
* @var bool |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
35 |
*/ |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
36 |
public $successful = true; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
37 |
/** |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
38 |
* return value |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
39 |
* |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
40 |
* @var mixed |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
41 |
*/ |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
42 |
public $retvalue = 0; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
43 |
/** |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
44 |
* counter for prefix code |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
45 |
* |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
46 |
* @var int |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
47 |
*/ |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
48 |
public static $prefix_number = 0; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
49 |
/** |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
50 |
* @var |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
51 |
*/ |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
52 |
public $yymajor; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
53 |
/** |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
54 |
* last index of array variable |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
55 |
* |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
56 |
* @var mixed |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
57 |
*/ |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
58 |
public $last_index; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
59 |
/** |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
60 |
* last variable name |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
61 |
* |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
62 |
* @var string |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
63 |
*/ |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
64 |
public $last_variable; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
65 |
/** |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
66 |
* root parse tree buffer |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
67 |
* |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
68 |
* @var Smarty_Internal_ParseTree |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
69 |
*/ |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
70 |
public $root_buffer; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
71 |
/** |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
72 |
* current parse tree object |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
73 |
* |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
74 |
* @var Smarty_Internal_ParseTree |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
75 |
*/ |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
76 |
public $current_buffer; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
77 |
/** |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
78 |
* lexer object |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
79 |
* |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
80 |
* @var Smarty_Internal_Templatelexer |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
81 |
*/ |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
82 |
private $lex; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
83 |
/** |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
84 |
* internal error flag |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
85 |
* |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
86 |
* @var bool |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
87 |
*/ |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
88 |
private $internalError = false; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
89 |
/** |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
90 |
* {strip} status |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
91 |
* |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
92 |
* @var bool |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
93 |
*/ |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
94 |
public $strip = false; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
95 |
/** |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
96 |
* compiler object |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
97 |
* |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
98 |
* @var Smarty_Internal_TemplateCompilerBase |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
99 |
*/ |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
100 |
public $compiler = null; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
101 |
/** |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
102 |
* smarty object |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
103 |
* |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
104 |
* @var Smarty |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
105 |
*/ |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
106 |
public $smarty = null; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
107 |
/** |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
108 |
* template object |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
109 |
* |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
110 |
* @var Smarty_Internal_Template |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
111 |
*/ |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
112 |
public $template = null; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
113 |
/** |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
114 |
* block nesting level |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
115 |
* |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
116 |
* @var int |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
117 |
*/ |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
118 |
public $block_nesting_level = 0; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
119 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
120 |
/** |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
121 |
* security object |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
122 |
* |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
123 |
* @var Smarty_Security |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
124 |
*/ |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
125 |
private $security = null; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
126 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
127 |
/** |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
128 |
* constructor |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
129 |
* |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
130 |
* @param Smarty_Internal_Templatelexer $lex |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
131 |
* @param Smarty_Internal_TemplateCompilerBase $compiler |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
132 |
*/ |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
133 |
function __construct(Smarty_Internal_Templatelexer $lex, Smarty_Internal_TemplateCompilerBase $compiler) |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
134 |
{ |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
135 |
$this->lex = $lex; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
136 |
$this->compiler = $compiler; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
137 |
$this->template = $this->compiler->template; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
138 |
$this->smarty = $this->template->smarty; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
139 |
$this->security = isset($this->smarty->security_policy) ? $this->smarty->security_policy : false; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
140 |
$this->current_buffer = $this->root_buffer = new Smarty_Internal_ParseTree_Template($this); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
141 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
142 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
143 |
/** |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
144 |
* insert PHP code in current buffer |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
145 |
* |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
146 |
* @param string $code |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
147 |
*/ |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
148 |
public function insertPhpCode($code) |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
149 |
{ |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
150 |
$this->current_buffer->append_subtree(new Smarty_Internal_ParseTree_Tag($this, $code)); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
151 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
152 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
153 |
/** |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
154 |
* merge PHP code with prefix code and return parse tree tag object |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
155 |
* |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
156 |
* @param string $code |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
157 |
* |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
158 |
* @return Smarty_Internal_ParseTree_Tag |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
159 |
*/ |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
160 |
public function mergePrefixCode($code) |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
161 |
{ |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
162 |
$tmp =''; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
163 |
foreach ($this->compiler->prefix_code as $preCode) { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
164 |
$tmp = empty($tmp) ? $preCode : $this->compiler->appendCode($tmp, $preCode); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
165 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
166 |
$this->compiler->prefix_code=array(); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
167 |
$tmp = empty($tmp) ? $code : $this->compiler->appendCode($tmp, $code); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
168 |
return new Smarty_Internal_ParseTree_Tag($this, $this->compiler->processNocacheCode($tmp,true)); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
169 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
170 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
171 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
172 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
173 |
%token_prefix TP_ |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
174 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
175 |
%parse_accept |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
176 |
{ |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
177 |
$this->successful = !$this->internalError; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
178 |
$this->internalError = false; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
179 |
$this->retvalue = $this->_retvalue; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
180 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
181 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
182 |
%syntax_error |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
183 |
{ |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
184 |
$this->internalError = true; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
185 |
$this->yymajor = $yymajor; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
186 |
$this->compiler->trigger_template_error(); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
187 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
188 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
189 |
%stack_overflow |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
190 |
{ |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
191 |
$this->internalError = true; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
192 |
$this->compiler->trigger_template_error("Stack overflow in template parser"); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
193 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
194 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
195 |
%left VERT. |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
196 |
%left COLON. |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
197 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
198 |
// |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
199 |
// complete template |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
200 |
// |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
201 |
start(res) ::= template. { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
202 |
res = $this->root_buffer->to_smarty_php(); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
203 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
204 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
205 |
// |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
206 |
// loop over template elements |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
207 |
// |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
208 |
// single template element |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
209 |
template ::= template_element(e). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
210 |
if (e != null) { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
211 |
$this->current_buffer->append_subtree(e); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
212 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
213 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
214 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
215 |
// loop of elements |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
216 |
template ::= template template_element(e). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
217 |
if (e != null) { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
218 |
// because of possible code injection |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
219 |
$this->current_buffer->append_subtree(e); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
220 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
221 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
222 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
223 |
// empty template |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
224 |
template ::= . |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
225 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
226 |
// |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
227 |
// template elements |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
228 |
// |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
229 |
// Smarty tag |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
230 |
template_element(res)::= smartytag(st). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
231 |
if ($this->compiler->has_code) { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
232 |
res = $this->mergePrefixCode(st); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
233 |
} else { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
234 |
res = null; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
235 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
236 |
$this->compiler->has_variable_string = false; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
237 |
$this->block_nesting_level = count($this->compiler->_tag_stack); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
238 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
239 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
240 |
// Literal |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
241 |
template_element(res) ::= literal(l). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
242 |
res = new Smarty_Internal_ParseTree_Text($this, l); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
243 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
244 |
// php tags |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
245 |
template_element(res)::= PHP(o). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
246 |
$code = $this->compiler->compileTag('private_php',array(array('code' => o), array('type' => $this->lex->phpType )),array()); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
247 |
if ($this->compiler->has_code && !empty($code)) { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
248 |
$tmp =''; foreach ($this->compiler->prefix_code as $code) {$tmp.=$code;} $this->compiler->prefix_code=array(); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
249 |
res = new Smarty_Internal_ParseTree_Tag($this, $this->compiler->processNocacheCode($tmp.$code,true)); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
250 |
} else { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
251 |
res = null; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
252 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
253 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
254 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
255 |
// nocache code |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
256 |
template_element(res)::= NOCACHE(c). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
257 |
$this->compiler->tag_nocache = true; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
258 |
$save = $this->template->has_nocache_code; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
259 |
res = new Smarty_Internal_ParseTree_Tag($this, $this->compiler->processNocacheCode("<?php echo '{c}';?>\n", $this->compiler, true)); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
260 |
$this->template->has_nocache_code = $save; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
261 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
262 |
// template text |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
263 |
template_element(res)::= text_content(t). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
264 |
res = $this->compiler->processText(t); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
265 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
266 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
267 |
text_content(res) ::= TEXT(o). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
268 |
res = o; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
269 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
270 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
271 |
text_content(res) ::= text_content(t) TEXT(o). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
272 |
res = t . o; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
273 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
274 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
275 |
// strip on |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
276 |
template_element ::= STRIPON(d). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
277 |
$this->strip = true; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
278 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
279 |
// strip off |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
280 |
template_element ::= STRIPOFF(d). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
281 |
$this->strip = false; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
282 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
283 |
// process source of inheritance child block |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
284 |
template_element ::= BLOCKSOURCE(s). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
285 |
if ($this->strip) { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
286 |
SMARTY_INTERNAL_COMPILE_BLOCK::blockSource($this->compiler, preg_replace('![\t ]*[\r\n]+[\t ]*!', '', s)); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
287 |
} else { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
288 |
SMARTY_INTERNAL_COMPILE_BLOCK::blockSource($this->compiler, s); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
289 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
290 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
291 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
292 |
// Litteral |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
293 |
literal(res) ::= LITERALSTART LITERALEND. { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
294 |
res = ''; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
295 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
296 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
297 |
literal(res) ::= LITERALSTART literal_elements(l) LITERALEND. { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
298 |
res = l; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
299 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
300 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
301 |
literal_elements(res) ::= literal_elements(l1) literal_element(l2). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
302 |
res = l1.l2; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
303 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
304 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
305 |
literal_elements(res) ::= . { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
306 |
res = ''; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
307 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
308 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
309 |
literal_element(res) ::= literal(l). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
310 |
res = l; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
311 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
312 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
313 |
literal_element(res) ::= LITERAL(l). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
314 |
res = l; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
315 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
316 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
317 |
smartytag(res) ::= tag(t) RDEL. { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
318 |
res = t; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
319 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
320 |
// |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
321 |
// output tags start here |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
322 |
// |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
323 |
smartytag(res) ::= SIMPLEOUTPUT(i). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
324 |
$var = trim(substr(i, $this->lex->ldel_length, -$this->lex->rdel_length), ' $'); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
325 |
if (preg_match('/^(.*)(\s+nocache)$/', $var, $match)) { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
326 |
res = $this->compiler->compileTag('private_print_expression',array('nocache'),array('value'=>$this->compiler->compileVariable('\''.$match[1].'\''))); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
327 |
} else { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
328 |
res = $this->compiler->compileTag('private_print_expression',array(),array('value'=>$this->compiler->compileVariable('\''.$var.'\''))); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
329 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
330 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
331 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
332 |
// output with optional attributes |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
333 |
tag(res) ::= LDEL variable(e). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
334 |
res = $this->compiler->compileTag('private_print_expression',array(),array('value'=>e)); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
335 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
336 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
337 |
tag(res) ::= LDEL variable(e) attributes(a). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
338 |
res = $this->compiler->compileTag('private_print_expression',a,array('value'=>e)); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
339 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
340 |
tag(res) ::= LDEL value(e). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
341 |
res = $this->compiler->compileTag('private_print_expression',array(),array('value'=>e)); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
342 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
343 |
tag(res) ::= LDEL value(e) attributes(a). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
344 |
res = $this->compiler->compileTag('private_print_expression',a,array('value'=>e)); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
345 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
346 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
347 |
tag(res) ::= LDEL expr(e). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
348 |
res = $this->compiler->compileTag('private_print_expression',array(),array('value'=>e)); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
349 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
350 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
351 |
tag(res) ::= LDEL expr(e) attributes(a). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
352 |
res = $this->compiler->compileTag('private_print_expression',a,array('value'=>e)); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
353 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
354 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
355 |
// |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
356 |
// Smarty tags start here |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
357 |
// |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
358 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
359 |
// assign new style |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
360 |
tag(res) ::= LDEL DOLLARID(i) EQUAL value(e). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
361 |
res = $this->compiler->compileTag('assign',array(array('value'=>e),array('var'=>'\''.substr(i,1).'\''))); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
362 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
363 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
364 |
tag(res) ::= LDEL DOLLARID(i) EQUAL expr(e). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
365 |
res = $this->compiler->compileTag('assign',array(array('value'=>e),array('var'=>'\''.substr(i,1).'\''))); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
366 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
367 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
368 |
tag(res) ::= LDEL DOLLARID(i) EQUAL expr(e) attributes(a). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
369 |
res = $this->compiler->compileTag('assign',array_merge(array(array('value'=>e),array('var'=>'\''.substr(i,1).'\'')),a)); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
370 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
371 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
372 |
tag(res) ::= LDEL varindexed(vi) EQUAL expr(e) attributes(a). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
373 |
res = $this->compiler->compileTag('assign',array_merge(array(array('value'=>e),array('var'=>vi['var'])),a),array('smarty_internal_index'=>vi['smarty_internal_index'])); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
374 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
375 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
376 |
// simple tag like {name} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
377 |
smartytag(res)::= SIMPLETAG(t). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
378 |
$tag = trim(substr(t, $this->lex->ldel_length, -$this->lex->rdel_length)); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
379 |
if ($tag == 'strip') { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
380 |
$this->strip = true; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
381 |
res = null;; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
382 |
} else { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
383 |
if (defined($tag)) { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
384 |
if ($this->security) { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
385 |
$this->security->isTrustedConstant($tag, $this->compiler); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
386 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
387 |
res = $this->compiler->compileTag('private_print_expression',array(),array('value'=>$tag)); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
388 |
} else { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
389 |
if (preg_match('/^(.*)(\s+nocache)$/', $tag, $match)) { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
390 |
res = $this->compiler->compileTag($match[1],array("'nocache'")); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
391 |
} else { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
392 |
res = $this->compiler->compileTag($tag,array()); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
393 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
394 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
395 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
396 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
397 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
398 |
// tag with optional Smarty2 style attributes |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
399 |
tag(res) ::= LDEL ID(i) attributes(a). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
400 |
if (defined(i)) { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
401 |
if ($this->security) { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
402 |
$this->security->isTrustedConstant(i, $this->compiler); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
403 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
404 |
res = $this->compiler->compileTag('private_print_expression',a,array('value'=>i)); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
405 |
} else { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
406 |
res = $this->compiler->compileTag(i,a); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
407 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
408 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
409 |
tag(res) ::= LDEL ID(i). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
410 |
if (defined(i)) { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
411 |
if ($this->security) { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
412 |
$this->security->isTrustedConstant(i, $this->compiler); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
413 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
414 |
res = $this->compiler->compileTag('private_print_expression',array(),array('value'=>i)); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
415 |
} else { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
416 |
res = $this->compiler->compileTag(i,array()); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
417 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
418 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
419 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
420 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
421 |
// tag with modifier and optional Smarty2 style attributes |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
422 |
tag(res) ::= LDEL ID(i) modifierlist(l)attributes(a). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
423 |
if (defined(i)) { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
424 |
if ($this->security) { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
425 |
$this->security->isTrustedConstant(i, $this->compiler); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
426 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
427 |
res = $this->compiler->compileTag('private_print_expression',a,array('value'=>i, 'modifierlist'=>l)); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
428 |
} else { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
429 |
res = '<?php ob_start();?>'.$this->compiler->compileTag(i,a).'<?php echo '; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
430 |
res .= $this->compiler->compileTag('private_modifier',array(),array('modifierlist'=>l,'value'=>'ob_get_clean()')).';?>'; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
431 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
432 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
433 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
434 |
// registered object tag |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
435 |
tag(res) ::= LDEL ID(i) PTR ID(m) attributes(a). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
436 |
res = $this->compiler->compileTag(i,a,array('object_method'=>m)); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
437 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
438 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
439 |
// registered object tag with modifiers |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
440 |
tag(res) ::= LDEL ID(i) PTR ID(me) modifierlist(l) attributes(a). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
441 |
res = '<?php ob_start();?>'.$this->compiler->compileTag(i,a,array('object_method'=>me)).'<?php echo '; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
442 |
res .= $this->compiler->compileTag('private_modifier',array(),array('modifierlist'=>l,'value'=>'ob_get_clean()')).';?>'; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
443 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
444 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
445 |
// {if}, {elseif} and {while} tag |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
446 |
tag(res) ::= LDELIF(i) expr(ie). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
447 |
$tag = trim(substr(i,$this->lex->ldel_length)); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
448 |
res = $this->compiler->compileTag(($tag == 'else if')? 'elseif' : $tag,array(),array('if condition'=>ie)); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
449 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
450 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
451 |
tag(res) ::= LDELIF(i) expr(ie) attributes(a). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
452 |
$tag = trim(substr(i,$this->lex->ldel_length)); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
453 |
res = $this->compiler->compileTag(($tag == 'else if')? 'elseif' : $tag,a,array('if condition'=>ie)); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
454 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
455 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
456 |
tag(res) ::= LDELIF(i) statement(ie). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
457 |
$tag = trim(substr(i,$this->lex->ldel_length)); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
458 |
res = $this->compiler->compileTag(($tag == 'else if')? 'elseif' : $tag,array(),array('if condition'=>ie)); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
459 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
460 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
461 |
tag(res) ::= LDELIF(i) statement(ie) attributes(a). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
462 |
$tag = trim(substr(i,$this->lex->ldel_length)); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
463 |
res = $this->compiler->compileTag(($tag == 'else if')? 'elseif' : $tag,a,array('if condition'=>ie)); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
464 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
465 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
466 |
// {for} tag |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
467 |
tag(res) ::= LDELFOR statements(st) SEMICOLON expr(ie) SEMICOLON varindexed(v2) foraction(e2) attributes(a). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
468 |
res = $this->compiler->compileTag('for',array_merge(a,array(array('start'=>st),array('ifexp'=>ie),array('var'=>v2),array('step'=>e2))),1); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
469 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
470 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
471 |
foraction(res) ::= EQUAL expr(e). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
472 |
res = '='.e; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
473 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
474 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
475 |
foraction(res) ::= INCDEC(e). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
476 |
res = e; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
477 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
478 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
479 |
tag(res) ::= LDELFOR statement(st) TO expr(v) attributes(a). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
480 |
res = $this->compiler->compileTag('for',array_merge(a,array(array('start'=>st),array('to'=>v))),0); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
481 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
482 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
483 |
tag(res) ::= LDELFOR statement(st) TO expr(v) STEP expr(v2) attributes(a). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
484 |
res = $this->compiler->compileTag('for',array_merge(a,array(array('start'=>st),array('to'=>v),array('step'=>v2))),0); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
485 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
486 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
487 |
// {foreach} tag |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
488 |
tag(res) ::= LDELFOREACH attributes(a). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
489 |
res = $this->compiler->compileTag('foreach',a); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
490 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
491 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
492 |
// {foreach $array as $var} tag |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
493 |
tag(res) ::= LDELFOREACH SPACE value(v1) AS varvar(v0) attributes(a). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
494 |
res = $this->compiler->compileTag('foreach',array_merge(a,array(array('from'=>v1),array('item'=>v0)))); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
495 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
496 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
497 |
tag(res) ::= LDELFOREACH SPACE value(v1) AS varvar(v2) APTR varvar(v0) attributes(a). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
498 |
res = $this->compiler->compileTag('foreach',array_merge(a,array(array('from'=>v1),array('item'=>v0),array('key'=>v2)))); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
499 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
500 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
501 |
tag(res) ::= LDELFOREACH SPACE expr(e) AS varvar(v0) attributes(a). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
502 |
res = $this->compiler->compileTag('foreach',array_merge(a,array(array('from'=>e),array('item'=>v0)))); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
503 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
504 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
505 |
tag(res) ::= LDELFOREACH SPACE expr(e) AS varvar(v1) APTR varvar(v0) attributes(a). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
506 |
res = $this->compiler->compileTag('foreach',array_merge(a,array(array('from'=>e),array('item'=>v0),array('key'=>v1)))); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
507 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
508 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
509 |
// {setfilter} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
510 |
tag(res) ::= LDELSETFILTER ID(m) modparameters(p). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
511 |
res = $this->compiler->compileTag('setfilter',array(),array('modifier_list'=>array(array_merge(array(m),p)))); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
512 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
513 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
514 |
tag(res) ::= LDELSETFILTER ID(m) modparameters(p) modifierlist(l). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
515 |
res = $this->compiler->compileTag('setfilter',array(),array('modifier_list'=>array_merge(array(array_merge(array(m),p)),l))); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
516 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
517 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
518 |
// {$smarty.block.child} or {$smarty.block.parent} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
519 |
tag(res) ::= LDEL SMARTYBLOCKCHILDPARENT(i). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
520 |
$j = strrpos(i,'.'); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
521 |
if (i[$j+1] == 'c') { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
522 |
// {$smarty.block.child} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
523 |
res = SMARTY_INTERNAL_COMPILE_BLOCK::compileChildBlock($this->compiler); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
524 |
} else { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
525 |
// {$smarty.block.parent} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
526 |
res = SMARTY_INTERNAL_COMPILE_BLOCK::compileParentBlock($this->compiler); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
527 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
528 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
529 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
530 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
531 |
// end of block tag {/....} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
532 |
smartytag(res)::= CLOSETAG(t). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
533 |
$tag = trim(substr(t, $this->lex->ldel_length, -$this->lex->rdel_length), ' /'); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
534 |
if ($tag == 'strip') { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
535 |
$this->strip = false; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
536 |
res = null; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
537 |
} else { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
538 |
res = $this->compiler->compileTag($tag.'close',array()); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
539 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
540 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
541 |
tag(res) ::= LDELSLASH ID(i). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
542 |
res = $this->compiler->compileTag(i.'close',array()); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
543 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
544 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
545 |
tag(res) ::= LDELSLASH ID(i) modifierlist(l). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
546 |
res = $this->compiler->compileTag(i.'close',array(),array('modifier_list'=>l)); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
547 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
548 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
549 |
// end of block object tag {/....} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
550 |
tag(res) ::= LDELSLASH ID(i) PTR ID(m). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
551 |
res = $this->compiler->compileTag(i.'close',array(),array('object_method'=>m)); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
552 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
553 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
554 |
tag(res) ::= LDELSLASH ID(i) PTR ID(m) modifierlist(l). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
555 |
res = $this->compiler->compileTag(i.'close',array(),array('object_method'=>m, 'modifier_list'=>l)); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
556 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
557 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
558 |
// |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
559 |
//Attributes of Smarty tags |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
560 |
// |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
561 |
// list of attributes |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
562 |
attributes(res) ::= attributes(a1) attribute(a2). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
563 |
res = a1; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
564 |
res[] = a2; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
565 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
566 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
567 |
// single attribute |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
568 |
attributes(res) ::= attribute(a). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
569 |
res = array(a); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
570 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
571 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
572 |
// no attributes |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
573 |
attributes(res) ::= . { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
574 |
res = array(); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
575 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
576 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
577 |
// attribute |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
578 |
attribute(res) ::= SPACE ID(v) EQUAL ID(id). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
579 |
if (defined(id)) { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
580 |
if ($this->security) { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
581 |
$this->security->isTrustedConstant(id, $this->compiler); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
582 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
583 |
res = array(v=>id); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
584 |
} else { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
585 |
res = array(v=>'\''.id.'\''); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
586 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
587 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
588 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
589 |
attribute(res) ::= ATTR(v) expr(e). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
590 |
res = array(trim(v," =\n\r\t")=>e); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
591 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
592 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
593 |
attribute(res) ::= ATTR(v) value(e). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
594 |
res = array(trim(v," =\n\r\t")=>e); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
595 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
596 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
597 |
attribute(res) ::= SPACE ID(v). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
598 |
res = '\''.v.'\''; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
599 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
600 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
601 |
attribute(res) ::= SPACE expr(e). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
602 |
res = e; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
603 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
604 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
605 |
attribute(res) ::= SPACE value(v). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
606 |
res = v; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
607 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
608 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
609 |
attribute(res) ::= SPACE INTEGER(i) EQUAL expr(e). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
610 |
res = array(i=>e); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
611 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
612 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
613 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
614 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
615 |
// |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
616 |
// statement |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
617 |
// |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
618 |
statements(res) ::= statement(s). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
619 |
res = array(s); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
620 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
621 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
622 |
statements(res) ::= statements(s1) COMMA statement(s). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
623 |
s1[]=s; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
624 |
res = s1; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
625 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
626 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
627 |
statement(res) ::= DOLLARID(i) EQUAL INTEGER(e). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
628 |
res = array('var' => '\''.substr(i,1).'\'', 'value'=>e); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
629 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
630 |
statement(res) ::= DOLLARID(i) EQUAL expr(e). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
631 |
res = array('var' => '\''.substr(i,1).'\'', 'value'=>e); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
632 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
633 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
634 |
statement(res) ::= varindexed(vi) EQUAL expr(e). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
635 |
res = array('var' => vi, 'value'=>e); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
636 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
637 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
638 |
statement(res) ::= OPENP statement(st) CLOSEP. { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
639 |
res = st; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
640 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
641 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
642 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
643 |
// |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
644 |
// expressions |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
645 |
// |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
646 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
647 |
// single value |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
648 |
expr(res) ::= value(v). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
649 |
res = v; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
650 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
651 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
652 |
// ternary |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
653 |
expr(res) ::= ternary(v). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
654 |
res = v; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
655 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
656 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
657 |
// resources/streams |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
658 |
expr(res) ::= DOLLARID(i) COLON ID(i2). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
659 |
res = '$_smarty_tpl->getStreamVariable(\''.substr(i,1).'://' . i2 . '\')'; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
660 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
661 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
662 |
// arithmetic expression |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
663 |
expr(res) ::= expr(e) MATH(m) value(v). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
664 |
res = e . trim(m) . v; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
665 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
666 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
667 |
expr(res) ::= expr(e) UNIMATH(m) value(v). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
668 |
res = e . trim(m) . v; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
669 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
670 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
671 |
// array |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
672 |
expr(res) ::= array(a). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
673 |
res = a; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
674 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
675 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
676 |
// modifier |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
677 |
expr(res) ::= expr(e) modifierlist(l). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
678 |
res = $this->compiler->compileTag('private_modifier',array(),array('value'=>e,'modifierlist'=>l)); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
679 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
680 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
681 |
// if expression |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
682 |
// simple expression |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
683 |
expr(res) ::= expr(e1) lop(c) expr(e2). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
684 |
res = (isset(c['pre']) ? c['pre'] : '') . e1.c['op'].e2 . (isset(c['pre']) ? ')' : ''); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
685 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
686 |
expr(res) ::= expr(e1) scond(c). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
687 |
res = c . e1 . ')'; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
688 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
689 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
690 |
expr(res) ::= expr(e1) ISIN array(a). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
691 |
res = 'in_array('.e1.','.a.')'; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
692 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
693 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
694 |
expr(res) ::= expr(e1) ISIN value(v). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
695 |
res = 'in_array('.e1.',(array)'.v.')'; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
696 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
697 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
698 |
expr(res) ::= variable(v1) INSTANCEOF(i) ns1(v2). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
699 |
res = v1.i.v2; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
700 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
701 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
702 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
703 |
// |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
704 |
// ternary |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
705 |
// |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
706 |
ternary(res) ::= OPENP expr(v) CLOSEP QMARK DOLLARID(e1) COLON expr(e2). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
707 |
res = v.' ? '. $this->compiler->compileVariable('\''.substr(e1,1).'\'') . ' : '.e2; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
708 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
709 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
710 |
ternary(res) ::= OPENP expr(v) CLOSEP QMARK expr(e1) COLON expr(e2). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
711 |
res = v.' ? '.e1.' : '.e2; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
712 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
713 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
714 |
// value |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
715 |
value(res) ::= variable(v). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
716 |
res = v; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
717 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
718 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
719 |
// +/- value |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
720 |
value(res) ::= UNIMATH(m) value(v). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
721 |
res = m.v; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
722 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
723 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
724 |
// logical negation |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
725 |
value(res) ::= NOT value(v). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
726 |
res = '!'.v; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
727 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
728 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
729 |
value(res) ::= TYPECAST(t) value(v). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
730 |
res = t.v; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
731 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
732 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
733 |
value(res) ::= variable(v) INCDEC(o). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
734 |
res = v.o; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
735 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
736 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
737 |
// numeric |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
738 |
value(res) ::= HEX(n). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
739 |
res = n; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
740 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
741 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
742 |
value(res) ::= INTEGER(n). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
743 |
res = n; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
744 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
745 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
746 |
value(res) ::= INTEGER(n1) DOT INTEGER(n2). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
747 |
res = n1.'.'.n2; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
748 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
749 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
750 |
value(res) ::= INTEGER(n1) DOT. { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
751 |
res = n1.'.'; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
752 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
753 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
754 |
value(res) ::= DOT INTEGER(n1). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
755 |
res = '.'.n1; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
756 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
757 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
758 |
// ID, true, false, null |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
759 |
value(res) ::= ID(id). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
760 |
if (defined(id)) { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
761 |
if ($this->security) { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
762 |
$this->security->isTrustedConstant(id, $this->compiler); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
763 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
764 |
res = id; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
765 |
} else { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
766 |
res = '\''.id.'\''; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
767 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
768 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
769 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
770 |
// function call |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
771 |
value(res) ::= function(f). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
772 |
res = f; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
773 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
774 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
775 |
// expression |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
776 |
value(res) ::= OPENP expr(e) CLOSEP. { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
777 |
res = "(". e .")"; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
778 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
779 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
780 |
// singele quoted string |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
781 |
value(res) ::= SINGLEQUOTESTRING(t). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
782 |
res = t; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
783 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
784 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
785 |
// double quoted string |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
786 |
value(res) ::= doublequoted_with_quotes(s). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
787 |
res = s; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
788 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
789 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
790 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
791 |
value(res) ::= varindexed(vi) DOUBLECOLON static_class_access(r). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
792 |
self::$prefix_number++; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
793 |
if (vi['var'] == '\'smarty\'') { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
794 |
$this->compiler->prefix_code[] = '<?php $_tmp'.self::$prefix_number.' = '. $this->compiler->compileTag('private_special_variable',array(),vi['smarty_internal_index']).';?>'; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
795 |
} else { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
796 |
$this->compiler->prefix_code[] = '<?php $_tmp'.self::$prefix_number.' = '. $this->compiler->compileVariable(vi['var']).vi['smarty_internal_index'].';?>'; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
797 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
798 |
res = '$_tmp'.self::$prefix_number.'::'.r[0].r[1]; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
799 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
800 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
801 |
// Smarty tag |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
802 |
value(res) ::= smartytag(st). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
803 |
self::$prefix_number++; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
804 |
$tmp = $this->compiler->appendCode('<?php ob_start();?>', st); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
805 |
$this->compiler->prefix_code[] = $this->compiler->appendCode($tmp, '<?php $_tmp'.self::$prefix_number.'=ob_get_clean();?>'); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
806 |
res = '$_tmp'.self::$prefix_number; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
807 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
808 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
809 |
value(res) ::= value(v) modifierlist(l). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
810 |
res = $this->compiler->compileTag('private_modifier',array(),array('value'=>v,'modifierlist'=>l)); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
811 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
812 |
// name space constant |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
813 |
value(res) ::= NAMESPACE(c). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
814 |
res = c; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
815 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
816 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
817 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
818 |
// static class access |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
819 |
value(res) ::= ns1(c)DOUBLECOLON static_class_access(s). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
820 |
if (!in_array(strtolower(c), array('self', 'parent')) && (!$this->security || $this->security->isTrustedStaticClassAccess(c, s, $this->compiler))) { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
821 |
if (isset($this->smarty->registered_classes[c])) { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
822 |
res = $this->smarty->registered_classes[c].'::'.s[0].s[1]; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
823 |
} else { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
824 |
res = c.'::'.s[0].s[1]; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
825 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
826 |
} else { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
827 |
$this->compiler->trigger_template_error ("static class '".c."' is undefined or not allowed by security setting"); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
828 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
829 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
830 |
// |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
831 |
// namespace stuff |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
832 |
// |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
833 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
834 |
ns1(res) ::= ID(i). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
835 |
res = i; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
836 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
837 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
838 |
ns1(res) ::= NAMESPACE(i). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
839 |
res = i; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
840 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
841 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
842 |
//ns1(res) ::= variable(v). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
843 |
// res = v; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
844 |
//} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
845 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
846 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
847 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
848 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
849 |
// |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
850 |
// variables |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
851 |
// |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
852 |
// Smarty variable (optional array) |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
853 |
variable(res) ::= DOLLARID(i). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
854 |
res = $this->compiler->compileVariable('\''.substr(i,1).'\''); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
855 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
856 |
variable(res) ::= varindexed(vi). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
857 |
if (vi['var'] == '\'smarty\'') { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
858 |
$smarty_var = $this->compiler->compileTag('private_special_variable',array(),vi['smarty_internal_index']); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
859 |
res = $smarty_var; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
860 |
} else { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
861 |
// used for array reset,next,prev,end,current |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
862 |
$this->last_variable = vi['var']; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
863 |
$this->last_index = vi['smarty_internal_index']; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
864 |
res = $this->compiler->compileVariable(vi['var']).vi['smarty_internal_index']; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
865 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
866 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
867 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
868 |
// variable with property |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
869 |
variable(res) ::= varvar(v) AT ID(p). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
870 |
res = '$_smarty_tpl->tpl_vars['. v .']->'.p; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
871 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
872 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
873 |
// object |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
874 |
variable(res) ::= object(o). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
875 |
res = o; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
876 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
877 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
878 |
// config variable |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
879 |
variable(res) ::= HATCH ID(i) HATCH. { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
880 |
res = '$_smarty_tpl->getConfigVariable( \''. i .'\')'; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
881 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
882 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
883 |
variable(res) ::= HATCH ID(i) HATCH arrayindex(a). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
884 |
res = '(is_array($tmp = $_smarty_tpl->getConfigVariable( \''. i .'\')) ? $tmp'.a.' :null)'; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
885 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
886 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
887 |
variable(res) ::= HATCH variable(v) HATCH. { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
888 |
res = '$_smarty_tpl->getConfigVariable( '. v .')'; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
889 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
890 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
891 |
variable(res) ::= HATCH variable(v) HATCH arrayindex(a). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
892 |
res = '(is_array($tmp = $_smarty_tpl->getConfigVariable( '. v .')) ? $tmp'.a.' : null)'; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
893 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
894 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
895 |
varindexed(res) ::= DOLLARID(i) arrayindex(a). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
896 |
res = array('var'=>'\''.substr(i,1).'\'', 'smarty_internal_index'=>a); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
897 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
898 |
varindexed(res) ::= varvar(v) arrayindex(a). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
899 |
res = array('var'=>v, 'smarty_internal_index'=>a); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
900 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
901 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
902 |
// |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
903 |
// array index |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
904 |
// |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
905 |
// multiple array index |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
906 |
arrayindex(res) ::= arrayindex(a1) indexdef(a2). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
907 |
res = a1.a2; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
908 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
909 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
910 |
// no array index |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
911 |
arrayindex ::= . { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
912 |
return; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
913 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
914 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
915 |
// single index definition |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
916 |
// Smarty2 style index |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
917 |
indexdef(res) ::= DOT DOLLARID(i). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
918 |
res = '['.$this->compiler->compileVariable('\''.substr(i,1).'\'').']'; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
919 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
920 |
indexdef(res) ::= DOT varvar(v). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
921 |
res = '['.$this->compiler->compileVariable(v).']'; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
922 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
923 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
924 |
indexdef(res) ::= DOT varvar(v) AT ID(p). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
925 |
res = '['.$this->compiler->compileVariable(v).'->'.p.']'; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
926 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
927 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
928 |
indexdef(res) ::= DOT ID(i). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
929 |
if (defined(i)) { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
930 |
if ($this->security) { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
931 |
$this->security->isTrustedConstant(i, $this->compiler); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
932 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
933 |
res = '['. i .']'; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
934 |
} else { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
935 |
res = "['". i ."']"; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
936 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
937 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
938 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
939 |
indexdef(res) ::= DOT INTEGER(n). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
940 |
res = '['. n .']'; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
941 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
942 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
943 |
indexdef(res) ::= DOT LDEL expr(e) RDEL. { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
944 |
res = '['. e .']'; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
945 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
946 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
947 |
// section tag index |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
948 |
indexdef(res) ::= OPENB ID(i)CLOSEB. { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
949 |
res = '['.$this->compiler->compileTag('private_special_variable',array(),'[\'section\'][\''.i.'\'][\'index\']').']'; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
950 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
951 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
952 |
indexdef(res) ::= OPENB ID(i) DOT ID(i2) CLOSEB. { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
953 |
res = '['.$this->compiler->compileTag('private_special_variable',array(),'[\'section\'][\''.i.'\'][\''.i2.'\']').']'; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
954 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
955 |
indexdef(res) ::= OPENB SINGLEQUOTESTRING(s) CLOSEB. { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
956 |
res = '['.s.']'; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
957 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
958 |
indexdef(res) ::= OPENB INTEGER(n) CLOSEB. { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
959 |
res = '['.n.']'; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
960 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
961 |
indexdef(res) ::= OPENB DOLLARID(i) CLOSEB. { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
962 |
res = '['.$this->compiler->compileVariable('\''.substr(i,1).'\'').']';; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
963 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
964 |
indexdef(res) ::= OPENB variable(v) CLOSEB. { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
965 |
res = '['.v.']'; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
966 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
967 |
indexdef(res) ::= OPENB value(v) CLOSEB. { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
968 |
res = '['.v.']'; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
969 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
970 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
971 |
// PHP style index |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
972 |
indexdef(res) ::= OPENB expr(e) CLOSEB. { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
973 |
res = '['. e .']'; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
974 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
975 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
976 |
// for assign append array |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
977 |
indexdef(res) ::= OPENB CLOSEB. { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
978 |
res = '[]'; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
979 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
980 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
981 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
982 |
// |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
983 |
// variable variable names |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
984 |
// |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
985 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
986 |
// singel identifier element |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
987 |
varvar(res) ::= DOLLARID(i). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
988 |
res = '\''.substr(i,1).'\''; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
989 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
990 |
// single $ |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
991 |
varvar(res) ::= DOLLAR. { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
992 |
res = "''"; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
993 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
994 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
995 |
// sequence of identifier elements |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
996 |
varvar(res) ::= varvar(v1) varvarele(v2). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
997 |
res = v1.'.'.v2; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
998 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
999 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1000 |
// fix sections of element |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1001 |
varvarele(res) ::= ID(s). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1002 |
res = '\''.s.'\''; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1003 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1004 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1005 |
// variable sections of element |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1006 |
varvarele(res) ::= LDEL expr(e) RDEL. { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1007 |
res = '('.e.')'; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1008 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1009 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1010 |
// |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1011 |
// objects |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1012 |
// |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1013 |
object(res) ::= varindexed(vi) objectchain(oc). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1014 |
if (vi['var'] == '\'smarty\'') { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1015 |
res = $this->compiler->compileTag('private_special_variable',array(),vi['smarty_internal_index']).oc; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1016 |
} else { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1017 |
res = $this->compiler->compileVariable(vi['var']).vi['smarty_internal_index'].oc; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1018 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1019 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1020 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1021 |
// single element |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1022 |
objectchain(res) ::= objectelement(oe). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1023 |
res = oe; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1024 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1025 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1026 |
// chain of elements |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1027 |
objectchain(res) ::= objectchain(oc) objectelement(oe). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1028 |
res = oc.oe; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1029 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1030 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1031 |
// variable |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1032 |
objectelement(res)::= PTR ID(i) arrayindex(a). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1033 |
if ($this->security && substr(i,0,1) == '_') { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1034 |
$this->compiler->trigger_template_error (self::Err1); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1035 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1036 |
res = '->'.i.a; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1037 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1038 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1039 |
objectelement(res)::= PTR varvar(v) arrayindex(a). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1040 |
if ($this->security) { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1041 |
$this->compiler->trigger_template_error (self::Err2); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1042 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1043 |
res = '->{'.$this->compiler->compileVariable(v).a.'}'; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1044 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1045 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1046 |
objectelement(res)::= PTR LDEL expr(e) RDEL arrayindex(a). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1047 |
if ($this->security) { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1048 |
$this->compiler->trigger_template_error (self::Err2); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1049 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1050 |
res = '->{'.e.a.'}'; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1051 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1052 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1053 |
objectelement(res)::= PTR ID(ii) LDEL expr(e) RDEL arrayindex(a). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1054 |
if ($this->security) { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1055 |
$this->compiler->trigger_template_error (self::Err2); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1056 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1057 |
res = '->{\''.ii.'\'.'.e.a.'}'; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1058 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1059 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1060 |
// method |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1061 |
objectelement(res)::= PTR method(f). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1062 |
res = '->'.f; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1063 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1064 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1065 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1066 |
// |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1067 |
// function |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1068 |
// |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1069 |
function(res) ::= ns1(f) OPENP params(p) CLOSEP. { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1070 |
if (!$this->security || $this->security->isTrustedPhpFunction(f, $this->compiler)) { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1071 |
if (strcasecmp(f,'isset') === 0 || strcasecmp(f,'empty') === 0 || strcasecmp(f,'array') === 0 || is_callable(f)) { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1072 |
$func_name = strtolower(f); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1073 |
if ($func_name == 'isset') { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1074 |
if (count(p) == 0) { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1075 |
$this->compiler->trigger_template_error ('Illegal number of paramer in "isset()"'); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1076 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1077 |
$par = implode(',',p); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1078 |
if (strncasecmp($par,'$_smarty_tpl->getConfigVariable',strlen('$_smarty_tpl->getConfigVariable')) === 0) { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1079 |
self::$prefix_number++; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1080 |
$this->compiler->prefix_code[] = '<?php $_tmp'.self::$prefix_number.'='.str_replace(')',', false)',$par).';?>'; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1081 |
$isset_par = '$_tmp'.self::$prefix_number; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1082 |
} else { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1083 |
$isset_par=str_replace("')->value","',null,true,false)->value",$par); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1084 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1085 |
res = f . "(". $isset_par .")"; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1086 |
} elseif (in_array($func_name,array('empty','reset','current','end','prev','next'))){ |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1087 |
if (count(p) != 1) { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1088 |
$this->compiler->trigger_template_error ('Illegal number of paramer in "empty()"'); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1089 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1090 |
if ($func_name == 'empty') { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1091 |
res = $func_name.'('.str_replace("')->value","',null,true,false)->value",p[0]).')'; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1092 |
} else { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1093 |
res = $func_name.'('.p[0].')'; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1094 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1095 |
} else { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1096 |
res = f . "(". implode(',',p) .")"; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1097 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1098 |
} else { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1099 |
$this->compiler->trigger_template_error ("unknown function \"" . f . "\""); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1100 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1101 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1102 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1103 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1104 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1105 |
// |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1106 |
// method |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1107 |
// |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1108 |
method(res) ::= ID(f) OPENP params(p) CLOSEP. { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1109 |
if ($this->security && substr(f,0,1) == '_') { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1110 |
$this->compiler->trigger_template_error (self::Err1); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1111 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1112 |
res = f . "(". implode(',',p) .")"; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1113 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1114 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1115 |
method(res) ::= DOLLARID(f) OPENP params(p) CLOSEP. { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1116 |
if ($this->security) { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1117 |
$this->compiler->trigger_template_error (self::Err2); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1118 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1119 |
self::$prefix_number++; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1120 |
$this->compiler->prefix_code[] = '<?php $_tmp'.self::$prefix_number.'='.$this->compiler->compileVariable('\''.substr(f,1).'\'').';?>'; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1121 |
res = '$_tmp'.self::$prefix_number.'('. implode(',',p) .')'; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1122 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1123 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1124 |
// function/method parameter |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1125 |
// multiple parameters |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1126 |
params(res) ::= params(p) COMMA expr(e). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1127 |
res = array_merge(p,array(e)); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1128 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1129 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1130 |
// single parameter |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1131 |
params(res) ::= expr(e). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1132 |
res = array(e); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1133 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1134 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1135 |
// kein parameter |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1136 |
params(res) ::= . { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1137 |
res = array(); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1138 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1139 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1140 |
// |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1141 |
// modifier |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1142 |
// |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1143 |
modifierlist(res) ::= modifierlist(l) modifier(m) modparameters(p). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1144 |
res = array_merge(l,array(array_merge(m,p))); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1145 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1146 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1147 |
modifierlist(res) ::= modifier(m) modparameters(p). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1148 |
res = array(array_merge(m,p)); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1149 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1150 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1151 |
modifier(res) ::= VERT AT ID(m). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1152 |
res = array(m); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1153 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1154 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1155 |
modifier(res) ::= VERT ID(m). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1156 |
res = array(m); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1157 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1158 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1159 |
// |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1160 |
// modifier parameter |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1161 |
// |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1162 |
// multiple parameter |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1163 |
modparameters(res) ::= modparameters(mps) modparameter(mp). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1164 |
res = array_merge(mps,mp); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1165 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1166 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1167 |
// no parameter |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1168 |
modparameters(res) ::= . { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1169 |
res = array(); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1170 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1171 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1172 |
// parameter expression |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1173 |
modparameter(res) ::= COLON value(mp). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1174 |
res = array(mp); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1175 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1176 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1177 |
modparameter(res) ::= COLON array(mp). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1178 |
res = array(mp); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1179 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1180 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1181 |
// static class methode call |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1182 |
static_class_access(res) ::= method(m). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1183 |
res = array(m, '', 'method'); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1184 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1185 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1186 |
// static class methode call with object chainig |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1187 |
static_class_access(res) ::= method(m) objectchain(oc). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1188 |
res = array(m, oc, 'method'); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1189 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1190 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1191 |
// static class constant |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1192 |
static_class_access(res) ::= ID(v). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1193 |
res = array(v, ''); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1194 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1195 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1196 |
// static class variables |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1197 |
static_class_access(res) ::= DOLLARID(v) arrayindex(a). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1198 |
res = array(v, a, 'property'); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1199 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1200 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1201 |
// static class variables with object chain |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1202 |
static_class_access(res) ::= DOLLARID(v) arrayindex(a) objectchain(oc). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1203 |
res = array(v, a.oc, 'property'); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1204 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1205 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1206 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1207 |
// if conditions and operators |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1208 |
lop(res) ::= LOGOP(o). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1209 |
res['op'] = ' '. trim(o) . ' '; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1210 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1211 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1212 |
lop(res) ::= TLOGOP(o). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1213 |
static $lops = array( |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1214 |
'eq' => array('op' => ' == ', 'pre' => null), |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1215 |
'ne' => array('op' => ' != ', 'pre' => null), |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1216 |
'neq' => array('op' => ' != ', 'pre' => null), |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1217 |
'gt' => array('op' => ' > ', 'pre' => null), |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1218 |
'ge' => array('op' => ' >= ', 'pre' => null), |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1219 |
'gte' => array('op' => ' >= ', 'pre' => null), |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1220 |
'lt' => array('op' => ' < ', 'pre' => null), |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1221 |
'le' => array('op' => ' <= ', 'pre' => null), |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1222 |
'lte' => array('op' => ' <= ', 'pre' => null), |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1223 |
'mod' => array('op' => ' % ', 'pre' => null), |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1224 |
'and' => array('op' => ' && ', 'pre' => null), |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1225 |
'or' => array('op' => ' || ', 'pre' => null), |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1226 |
'xor' => array('op' => ' xor ', 'pre' => null), |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1227 |
'isdivby' => array('op' => ' % ', 'pre' => '!('), |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1228 |
'isnotdivby' => array('op' => ' % ', 'pre' => '('), |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1229 |
'isevenby' => array('op' => ' / ', 'pre' => '!(1 & '), |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1230 |
'isnotevenby' => array('op' => ' / ', 'pre' => '(1 & '), |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1231 |
'isoddby' => array('op' => ' / ', 'pre' => '(1 & '), |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1232 |
'isnotoddby' => array('op' => ' / ', 'pre' => '!(1 & '), |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1233 |
); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1234 |
$op = strtolower(preg_replace('/\s*/', '', o)); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1235 |
res = $lops[$op]; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1236 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1237 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1238 |
scond(res) ::= SINGLECOND(o). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1239 |
static $scond = array ( |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1240 |
'iseven' => '!(1 & ', |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1241 |
'isnoteven' => '(1 & ', |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1242 |
'isodd' => '(1 & ', |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1243 |
'isnotodd' => '!(1 & ', |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1244 |
); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1245 |
$op = strtolower(str_replace(' ', '', o)); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1246 |
res = $scond[$op]; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1247 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1248 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1249 |
// |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1250 |
// ARRAY element assignment |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1251 |
// |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1252 |
array(res) ::= OPENB arrayelements(a) CLOSEB. { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1253 |
res = 'array('.a.')'; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1254 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1255 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1256 |
arrayelements(res) ::= arrayelement(a). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1257 |
res = a; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1258 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1259 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1260 |
arrayelements(res) ::= arrayelements(a1) COMMA arrayelement(a). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1261 |
res = a1.','.a; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1262 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1263 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1264 |
arrayelements ::= . { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1265 |
return; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1266 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1267 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1268 |
arrayelement(res) ::= value(e1) APTR expr(e2). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1269 |
res = e1.'=>'.e2; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1270 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1271 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1272 |
arrayelement(res) ::= ID(i) APTR expr(e2). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1273 |
res = '\''.i.'\'=>'.e2; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1274 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1275 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1276 |
arrayelement(res) ::= expr(e). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1277 |
res = e; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1278 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1279 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1280 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1281 |
// |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1282 |
// double qouted strings |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1283 |
// |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1284 |
doublequoted_with_quotes(res) ::= QUOTE QUOTE. { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1285 |
res = "''"; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1286 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1287 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1288 |
doublequoted_with_quotes(res) ::= QUOTE doublequoted(s) QUOTE. { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1289 |
res = s->to_smarty_php(); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1290 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1291 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1292 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1293 |
doublequoted(res) ::= doublequoted(o1) doublequotedcontent(o2). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1294 |
o1->append_subtree(o2); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1295 |
res = o1; |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1296 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1297 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1298 |
doublequoted(res) ::= doublequotedcontent(o). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1299 |
res = new Smarty_Internal_ParseTree_Dq($this, o); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1300 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1301 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1302 |
doublequotedcontent(res) ::= BACKTICK variable(v) BACKTICK. { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1303 |
res = new Smarty_Internal_ParseTree_Code($this, '(string)'.v); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1304 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1305 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1306 |
doublequotedcontent(res) ::= BACKTICK expr(e) BACKTICK. { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1307 |
res = new Smarty_Internal_ParseTree_Code($this, '(string)'.e); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1308 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1309 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1310 |
doublequotedcontent(res) ::= DOLLARID(i). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1311 |
res = new Smarty_Internal_ParseTree_Code($this, '(string)$_smarty_tpl->tpl_vars[\''. substr(i,1) .'\']->value'); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1312 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1313 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1314 |
doublequotedcontent(res) ::= LDEL variable(v) RDEL. { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1315 |
res = new Smarty_Internal_ParseTree_Code($this, '(string)'.v); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1316 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1317 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1318 |
doublequotedcontent(res) ::= LDEL expr(e) RDEL. { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1319 |
res = new Smarty_Internal_ParseTree_Code($this, '(string)('.e.')'); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1320 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1321 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1322 |
doublequotedcontent(res) ::= smartytag(st). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1323 |
res = new Smarty_Internal_ParseTree_Tag($this, st); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1324 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1325 |
|
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1326 |
doublequotedcontent(res) ::= TEXT(o). { |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1327 |
res = new Smarty_Internal_ParseTree_DqContent($this, o); |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1328 |
} |
4869aea77e21
Bröker-Framework BFW-1
Markus Bröker <broeker.markus@googlemail.com>
parents:
diff
changeset
|
1329 |