Subversion-Projekte lars-tiefland.laravel_shop

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
148 lars 1
<?php
2
/**
3
* Smarty Internal Plugin Configfilelexer
4
*
5
* This is the lexer to break the config file source into tokens
6
* @package Smarty
7
* @subpackage Config
8
* @author Uwe Tews
9
*/
10
/**
11
* Smarty_Internal_Configfilelexer
12
*
13
* This is the config file lexer.
14
* It is generated from the smarty_internal_configfilelexer.plex file
15
*
16
* @package Smarty
17
* @subpackage Compiler
18
* @author Uwe Tews
19
*/
20
class Smarty_Internal_Configfilelexer
21
{
22
    /**
23
     * Source
24
     *
25
     * @var string
26
     */
27
    public $data;
28
      /**
29
      * Source length
30
      *
31
      * @var int
32
      */
33
     public $dataLength = null;
34
   /**
35
     * byte counter
36
     *
37
     * @var int
38
     */
39
    public $counter;
40
    /**
41
     * token number
42
     *
43
     * @var int
44
     */
45
    public $token;
46
    /**
47
     * token value
48
     *
49
     * @var string
50
     */
51
    public $value;
52
    /**
53
     * current line
54
     *
55
     * @var int
56
     */
57
    public $line;
58
    /**
59
     * state number
60
     *
61
     * @var int
62
     */
63
    public $state = 1;
64
    /**
65
     * Smarty object
66
     *
67
     * @var Smarty
68
     */
69
    public $smarty = null;
70
    /**
71
     * compiler object
72
     *
73
     * @var Smarty_Internal_Config_File_Compiler
74
     */
75
    private $compiler = null;
76
    /**
77
     * copy of config_booleanize
78
     *
79
     * @var bool
80
     */
81
    private $configBooleanize = false;
82
    /**
83
     * trace file
84
     *
85
     * @var resource
86
     */
87
    public $yyTraceFILE;
88
    /**
89
     * trace prompt
90
     *
91
     * @var string
92
     */
93
    public $yyTracePrompt;
94
    /**
95
     * state names
96
     *
97
     * @var array
98
     */
99
    public $state_name = array(1 => 'START', 2 => 'VALUE', 3 => 'NAKED_STRING_VALUE', 4 => 'COMMENT', 5 => 'SECTION', 6 => 'TRIPPLE');
100
 
101
    /**
102
     * storage for assembled token patterns
103
     *
104
     * @var string
105
     */
106
    private $yy_global_pattern1 = null;
107
    private $yy_global_pattern2 = null;
108
    private $yy_global_pattern3 = null;
109
    private $yy_global_pattern4 = null;
110
    private $yy_global_pattern5 = null;
111
    private $yy_global_pattern6 = null;
112
 
113
    /**
114
     * token names
115
     *
116
     * @var array
117
     */
118
    public $smarty_token_names = array(        // Text for parser error messages
119
    );
120
 
121
    /**
122
     * constructor
123
     *
124
     * @param   string                             $data template source
125
     * @param Smarty_Internal_Config_File_Compiler $compiler
126
     */
127
    public function __construct($data, Smarty_Internal_Config_File_Compiler $compiler)
128
    {
129
        $this->data = $data . "\n"; //now all lines are \n-terminated
130
        $this->dataLength = strlen($data);
131
        $this->counter = 0;
132
        if (preg_match('/^\xEF\xBB\xBF/', $this->data, $match)) {
133
            $this->counter += strlen($match[0]);
134
        }
135
        $this->line = 1;
136
        $this->compiler = $compiler;
137
        $this->smarty = $compiler->smarty;
138
        $this->configBooleanize = $this->smarty->config_booleanize;
139
    }
140
 
141
   public function replace ($input) {
142
        return $input;
143
   }
144
 
145
    public function PrintTrace()
146
    {
147
        $this->yyTraceFILE = fopen('php://output', 'w');
148
        $this->yyTracePrompt = '<br>';
149
    }
150
 
151
 
152
/*!lex2php
153
%input $this->data
154
%counter $this->counter
155
%token $this->token
156
%value $this->value
157
%line $this->line
158
commentstart = /#|;/
159
openB = /\[/
160
closeB = /\]/
161
section = /.*?(?=[\.=\[\]\r\n])/
162
equal = /=/
163
whitespace = /[ \t\r]+/
164
dot = /\./
165
id = /[0-9]*[a-zA-Z_]\w*/
166
newline = /\n/
167
single_quoted_string = /'[^'\\]*(?:\\.[^'\\]*)*'(?=[ \t\r]*[\n#;])/
168
double_quoted_string = /"[^"\\]*(?:\\.[^"\\]*)*"(?=[ \t\r]*[\n#;])/
169
tripple_quotes = /"""/
170
tripple_quotes_end = /"""(?=[ \t\r]*[\n#;])/
171
text = /[\S\s]/
172
float = /\d+\.\d+(?=[ \t\r]*[\n#;])/
173
int = /\d+(?=[ \t\r]*[\n#;])/
174
maybe_bool = /[a-zA-Z]+(?=[ \t\r]*[\n#;])/
175
naked_string = /[^\n]+?(?=[ \t\r]*\n)/
176
*/
177
 
178
/*!lex2php
179
%statename START
180
 
181
commentstart {
182
    $this->token = Smarty_Internal_Configfileparser::TPC_COMMENTSTART;
183
    $this->yypushstate(self::COMMENT);
184
}
185
openB {
186
    $this->token = Smarty_Internal_Configfileparser::TPC_OPENB;
187
    $this->yypushstate(self::SECTION);
188
}
189
closeB {
190
    $this->token = Smarty_Internal_Configfileparser::TPC_CLOSEB;
191
}
192
equal {
193
    $this->token = Smarty_Internal_Configfileparser::TPC_EQUAL;
194
    $this->yypushstate(self::VALUE);
195
}
196
whitespace {
197
    return false;
198
}
199
newline {
200
    $this->token = Smarty_Internal_Configfileparser::TPC_NEWLINE;
201
}
202
id {
203
    $this->token = Smarty_Internal_Configfileparser::TPC_ID;
204
}
205
text {
206
    $this->token = Smarty_Internal_Configfileparser::TPC_OTHER;
207
}
208
 
209
*/
210
 
211
/*!lex2php
212
%statename VALUE
213
 
214
whitespace {
215
    return false;
216
}
217
float {
218
    $this->token = Smarty_Internal_Configfileparser::TPC_FLOAT;
219
    $this->yypopstate();
220
}
221
int {
222
    $this->token = Smarty_Internal_Configfileparser::TPC_INT;
223
    $this->yypopstate();
224
}
225
tripple_quotes {
226
    $this->token = Smarty_Internal_Configfileparser::TPC_TRIPPLE_QUOTES;
227
    $this->yypushstate(self::TRIPPLE);
228
}
229
single_quoted_string {
230
    $this->token = Smarty_Internal_Configfileparser::TPC_SINGLE_QUOTED_STRING;
231
    $this->yypopstate();
232
}
233
double_quoted_string {
234
    $this->token = Smarty_Internal_Configfileparser::TPC_DOUBLE_QUOTED_STRING;
235
    $this->yypopstate();
236
}
237
maybe_bool {
238
    if (!$this->configBooleanize || !in_array(strtolower($this->value), array('true', 'false', 'on', 'off', 'yes', 'no')) ) {
239
        $this->yypopstate();
240
        $this->yypushstate(self::NAKED_STRING_VALUE);
241
        return true; //reprocess in new state
242
    } else {
243
        $this->token = Smarty_Internal_Configfileparser::TPC_BOOL;
244
        $this->yypopstate();
245
    }
246
}
247
naked_string {
248
    $this->token = Smarty_Internal_Configfileparser::TPC_NAKED_STRING;
249
    $this->yypopstate();
250
}
251
newline {
252
    $this->token = Smarty_Internal_Configfileparser::TPC_NAKED_STRING;
253
    $this->value = '';
254
    $this->yypopstate();
255
}
256
 
257
*/
258
 
259
/*!lex2php
260
%statename NAKED_STRING_VALUE
261
 
262
naked_string {
263
    $this->token = Smarty_Internal_Configfileparser::TPC_NAKED_STRING;
264
    $this->yypopstate();
265
}
266
 
267
*/
268
 
269
/*!lex2php
270
%statename COMMENT
271
 
272
whitespace {
273
    return false;
274
}
275
naked_string {
276
    $this->token = Smarty_Internal_Configfileparser::TPC_NAKED_STRING;
277
}
278
newline {
279
    $this->token = Smarty_Internal_Configfileparser::TPC_NEWLINE;
280
    $this->yypopstate();
281
}
282
 
283
*/
284
 
285
/*!lex2php
286
%statename SECTION
287
 
288
dot {
289
    $this->token = Smarty_Internal_Configfileparser::TPC_DOT;
290
}
291
section {
292
    $this->token = Smarty_Internal_Configfileparser::TPC_SECTION;
293
    $this->yypopstate();
294
}
295
 
296
*/
297
/*!lex2php
298
%statename TRIPPLE
299
 
300
tripple_quotes_end {
301
    $this->token = Smarty_Internal_Configfileparser::TPC_TRIPPLE_QUOTES_END;
302
    $this->yypopstate();
303
    $this->yypushstate(self::START);
304
}
305
text {
306
  $to = strlen($this->data);
307
  preg_match("/\"\"\"[ \t\r]*[\n#;]/",$this->data,$match,PREG_OFFSET_CAPTURE,$this->counter);
308
  if (isset($match[0][1])) {
309
    $to = $match[0][1];
310
  } else {
311
    $this->compiler->trigger_config_file_error ('missing or misspelled literal closing tag');
312
  }
313
  $this->value = substr($this->data,$this->counter,$to-$this->counter);
314
  $this->token = Smarty_Internal_Configfileparser::TPC_TRIPPLE_TEXT;
315
}
316
*/
317
 
318
}