diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml deleted file mode 100644 index c82a456e..00000000 --- a/.github/workflows/cd.yml +++ /dev/null @@ -1,60 +0,0 @@ -on: - push: - tags: - - '*' - -name: CD - -jobs: - release: - if: ${{ startsWith(github.ref_name, '5.') }} - runs-on: ubuntu-latest - - env: - PHP_EXTENSIONS: dom, json, libxml, mbstring, pdo_sqlite, soap, xml, xmlwriter - - steps: - - name: checkout code - uses: actions/checkout@v3 - - - name: Install PHP with extensions - uses: shivammathur/setup-php@v2 - with: - php-version: 8.1 - extensions: ${{ env.PHP_EXTENSIONS }} - - - name: Install dependencies - uses: php-actions/composer@v6 - - - name: Run make - run: make - - - name: create release assets - run: | - mkdir release - git archive release - cd release - make - cd .. - tar -cvzf release.tar.gz release - - - name: create release - uses: actions/create-release@v1 - id: create_release - with: - draft: false - prerelease: false - release_name: ${{ steps.version.outputs.version }} - tag_name: ${{ github.ref }} - env: - GITHUB_TOKEN: ${{ github.token }} - - - name: upload artifacts - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ github.token }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./release.tar.gz - asset_name: release.tar.gz - asset_content_type: application/gzip \ No newline at end of file diff --git a/.gitignore b/.gitignore index 92834d9a..33463018 100644 --- a/.gitignore +++ b/.gitignore @@ -5,7 +5,3 @@ phpunit* .phpunit.result.cache /vendor/* /composer.lock -/src/Lexer/ConfigfileLexer.php -/src/Lexer/TemplateLexer.php -/src/Parser/ConfigfileParser.php -/src/Parser/TemplateParser.php diff --git a/demo/index.php b/demo/index.php index bf3aa489..705478ff 100644 --- a/demo/index.php +++ b/demo/index.php @@ -6,7 +6,7 @@ */ $smarty = new \Smarty\Smarty; -//$smarty->force_compile = true; + $smarty->debugging = true; $smarty->caching = true; $smarty->cache_lifetime = 120; diff --git a/src/Lexer/ConfigfileLexer.php b/src/Lexer/ConfigfileLexer.php new file mode 100644 index 00000000..d592c823 --- /dev/null +++ b/src/Lexer/ConfigfileLexer.php @@ -0,0 +1,707 @@ + 'START', 2 => 'VALUE', 3 => 'NAKED_STRING_VALUE', 4 => 'COMMENT', 5 => 'SECTION', 6 => 'TRIPPLE'); + + /** + * storage for assembled token patterns + * + * @var string + */ + private $yy_global_pattern1 = null; + private $yy_global_pattern2 = null; + private $yy_global_pattern3 = null; + private $yy_global_pattern4 = null; + private $yy_global_pattern5 = null; + private $yy_global_pattern6 = null; + + /** + * token names + * + * @var array + */ + public $smarty_token_names = array( // Text for parser error messages + ); + + /** + * constructor + * + * @param string $data template source + * @param \Smarty\Compiler\Configfile $compiler + */ + public function __construct($data, \Smarty\Compiler\Configfile $compiler) + { + $this->data = $data . "\n"; //now all lines are \n-terminated + $this->dataLength = strlen($data); + $this->counter = 0; + if (preg_match('/^\xEF\xBB\xBF/', $this->data, $match)) { + $this->counter += strlen($match[0]); + } + $this->line = 1; + $this->compiler = $compiler; + $this->smarty = $compiler->smarty; + $this->configBooleanize = $this->smarty->config_booleanize; + } + + public function replace ($input) { + return $input; + } + + public function PrintTrace() + { + $this->yyTraceFILE = fopen('php://output', 'w'); + $this->yyTracePrompt = '
'; + } + + + + private $_yy_state = 1; + private $_yy_stack = array(); + + public function yylex() + { + return $this->{'yylex' . $this->_yy_state}(); + } + + public function yypushstate($state) + { + if ($this->yyTraceFILE) { + fprintf($this->yyTraceFILE, "%sState push %s\n", $this->yyTracePrompt, isset($this->state_name[$this->_yy_state]) ? $this->state_name[$this->_yy_state] : $this->_yy_state); + } + array_push($this->_yy_stack, $this->_yy_state); + $this->_yy_state = $state; + if ($this->yyTraceFILE) { + fprintf($this->yyTraceFILE, "%snew State %s\n", $this->yyTracePrompt, isset($this->state_name[$this->_yy_state]) ? $this->state_name[$this->_yy_state] : $this->_yy_state); + } + } + + public function yypopstate() + { + if ($this->yyTraceFILE) { + fprintf($this->yyTraceFILE, "%sState pop %s\n", $this->yyTracePrompt, isset($this->state_name[$this->_yy_state]) ? $this->state_name[$this->_yy_state] : $this->_yy_state); + } + $this->_yy_state = array_pop($this->_yy_stack); + if ($this->yyTraceFILE) { + fprintf($this->yyTraceFILE, "%snew State %s\n", $this->yyTracePrompt, isset($this->state_name[$this->_yy_state]) ? $this->state_name[$this->_yy_state] : $this->_yy_state); + } + + } + + public function yybegin($state) + { + $this->_yy_state = $state; + if ($this->yyTraceFILE) { + fprintf($this->yyTraceFILE, "%sState set %s\n", $this->yyTracePrompt, isset($this->state_name[$this->_yy_state]) ? $this->state_name[$this->_yy_state] : $this->_yy_state); + } + } + + + + + public function yylex1() + { + if (!isset($this->yy_global_pattern1)) { + $this->yy_global_pattern1 = $this->replace("/\G(#|;)|\G(\\[)|\G(\\])|\G(=)|\G([ \t\r]+)|\G(\n)|\G([0-9]*[a-zA-Z_]\\w*)|\G([\S\s])/isS"); + } + if (!isset($this->dataLength)) { + $this->dataLength = strlen($this->data); + } + if ($this->counter >= $this->dataLength) { + return false; // end of input + } + + do { + if (preg_match($this->yy_global_pattern1,$this->data, $yymatches, 0, $this->counter)) { + if (!isset($yymatches[ 0 ][1])) { + $yymatches = preg_grep("/(.|\s)+/", $yymatches); + } else { + $yymatches = array_filter($yymatches); + } + if (empty($yymatches)) { + throw new Exception('Error: lexing failed because a rule matched' . + ' an empty string. Input "' . substr($this->data, + $this->counter, 5) . '... state START'); + } + next($yymatches); // skip global match + $this->token = key($yymatches); // token number + $this->value = current($yymatches); // token value + $r = $this->{'yy_r1_' . $this->token}(); + if ($r === null) { + $this->counter += strlen($this->value); + $this->line += substr_count($this->value, "\n"); + // accept this token + return true; + } elseif ($r === true) { + // we have changed state + // process this token in the new state + return $this->yylex(); + } elseif ($r === false) { + $this->counter += strlen($this->value); + $this->line += substr_count($this->value, "\n"); + if ($this->counter >= $this->dataLength) { + return false; // end of input + } + // skip this token + continue; + } } else { + throw new Exception('Unexpected input at line' . $this->line . + ': ' . $this->data[$this->counter]); + } + break; + } while (true); + + } // end function + + + const START = 1; + public function yy_r1_1() + { + + $this->token = \Smarty\Parser\ConfigfileParser::TPC_COMMENTSTART; + $this->yypushstate(self::COMMENT); + } + public function yy_r1_2() + { + + $this->token = \Smarty\Parser\ConfigfileParser::TPC_OPENB; + $this->yypushstate(self::SECTION); + } + public function yy_r1_3() + { + + $this->token = \Smarty\Parser\ConfigfileParser::TPC_CLOSEB; + } + public function yy_r1_4() + { + + $this->token = \Smarty\Parser\ConfigfileParser::TPC_EQUAL; + $this->yypushstate(self::VALUE); + } + public function yy_r1_5() + { + + return false; + } + public function yy_r1_6() + { + + $this->token = \Smarty\Parser\ConfigfileParser::TPC_NEWLINE; + } + public function yy_r1_7() + { + + $this->token = \Smarty\Parser\ConfigfileParser::TPC_ID; + } + public function yy_r1_8() + { + + $this->token = \Smarty\Parser\ConfigfileParser::TPC_OTHER; + } + + + + public function yylex2() + { + if (!isset($this->yy_global_pattern2)) { + $this->yy_global_pattern2 = $this->replace("/\G([ \t\r]+)|\G(\\d+\\.\\d+(?=[ \t\r]*[\n#;]))|\G(\\d+(?=[ \t\r]*[\n#;]))|\G(\"\"\")|\G('[^'\\\\]*(?:\\\\.[^'\\\\]*)*'(?=[ \t\r]*[\n#;]))|\G(\"[^\"\\\\]*(?:\\\\.[^\"\\\\]*)*\"(?=[ \t\r]*[\n#;]))|\G([a-zA-Z]+(?=[ \t\r]*[\n#;]))|\G([^\n]+?(?=[ \t\r]*\n))|\G(\n)/isS"); + } + if (!isset($this->dataLength)) { + $this->dataLength = strlen($this->data); + } + if ($this->counter >= $this->dataLength) { + return false; // end of input + } + + do { + if (preg_match($this->yy_global_pattern2,$this->data, $yymatches, 0, $this->counter)) { + if (!isset($yymatches[ 0 ][1])) { + $yymatches = preg_grep("/(.|\s)+/", $yymatches); + } else { + $yymatches = array_filter($yymatches); + } + if (empty($yymatches)) { + throw new Exception('Error: lexing failed because a rule matched' . + ' an empty string. Input "' . substr($this->data, + $this->counter, 5) . '... state VALUE'); + } + next($yymatches); // skip global match + $this->token = key($yymatches); // token number + $this->value = current($yymatches); // token value + $r = $this->{'yy_r2_' . $this->token}(); + if ($r === null) { + $this->counter += strlen($this->value); + $this->line += substr_count($this->value, "\n"); + // accept this token + return true; + } elseif ($r === true) { + // we have changed state + // process this token in the new state + return $this->yylex(); + } elseif ($r === false) { + $this->counter += strlen($this->value); + $this->line += substr_count($this->value, "\n"); + if ($this->counter >= $this->dataLength) { + return false; // end of input + } + // skip this token + continue; + } } else { + throw new Exception('Unexpected input at line' . $this->line . + ': ' . $this->data[$this->counter]); + } + break; + } while (true); + + } // end function + + + const VALUE = 2; + public function yy_r2_1() + { + + return false; + } + public function yy_r2_2() + { + + $this->token = \Smarty\Parser\ConfigfileParser::TPC_FLOAT; + $this->yypopstate(); + } + public function yy_r2_3() + { + + $this->token = \Smarty\Parser\ConfigfileParser::TPC_INT; + $this->yypopstate(); + } + public function yy_r2_4() + { + + $this->token = \Smarty\Parser\ConfigfileParser::TPC_TRIPPLE_QUOTES; + $this->yypushstate(self::TRIPPLE); + } + public function yy_r2_5() + { + + $this->token = \Smarty\Parser\ConfigfileParser::TPC_SINGLE_QUOTED_STRING; + $this->yypopstate(); + } + public function yy_r2_6() + { + + $this->token = \Smarty\Parser\ConfigfileParser::TPC_DOUBLE_QUOTED_STRING; + $this->yypopstate(); + } + public function yy_r2_7() + { + + if (!$this->configBooleanize || !in_array(strtolower($this->value), array('true', 'false', 'on', 'off', 'yes', 'no')) ) { + $this->yypopstate(); + $this->yypushstate(self::NAKED_STRING_VALUE); + return true; //reprocess in new state + } else { + $this->token = \Smarty\Parser\ConfigfileParser::TPC_BOOL; + $this->yypopstate(); + } + } + public function yy_r2_8() + { + + $this->token = \Smarty\Parser\ConfigfileParser::TPC_NAKED_STRING; + $this->yypopstate(); + } + public function yy_r2_9() + { + + $this->token = \Smarty\Parser\ConfigfileParser::TPC_NAKED_STRING; + $this->value = ''; + $this->yypopstate(); + } + + + + public function yylex3() + { + if (!isset($this->yy_global_pattern3)) { + $this->yy_global_pattern3 = $this->replace("/\G([^\n]+?(?=[ \t\r]*\n))/isS"); + } + if (!isset($this->dataLength)) { + $this->dataLength = strlen($this->data); + } + if ($this->counter >= $this->dataLength) { + return false; // end of input + } + + do { + if (preg_match($this->yy_global_pattern3,$this->data, $yymatches, 0, $this->counter)) { + if (!isset($yymatches[ 0 ][1])) { + $yymatches = preg_grep("/(.|\s)+/", $yymatches); + } else { + $yymatches = array_filter($yymatches); + } + if (empty($yymatches)) { + throw new Exception('Error: lexing failed because a rule matched' . + ' an empty string. Input "' . substr($this->data, + $this->counter, 5) . '... state NAKED_STRING_VALUE'); + } + next($yymatches); // skip global match + $this->token = key($yymatches); // token number + $this->value = current($yymatches); // token value + $r = $this->{'yy_r3_' . $this->token}(); + if ($r === null) { + $this->counter += strlen($this->value); + $this->line += substr_count($this->value, "\n"); + // accept this token + return true; + } elseif ($r === true) { + // we have changed state + // process this token in the new state + return $this->yylex(); + } elseif ($r === false) { + $this->counter += strlen($this->value); + $this->line += substr_count($this->value, "\n"); + if ($this->counter >= $this->dataLength) { + return false; // end of input + } + // skip this token + continue; + } } else { + throw new Exception('Unexpected input at line' . $this->line . + ': ' . $this->data[$this->counter]); + } + break; + } while (true); + + } // end function + + + const NAKED_STRING_VALUE = 3; + public function yy_r3_1() + { + + $this->token = \Smarty\Parser\ConfigfileParser::TPC_NAKED_STRING; + $this->yypopstate(); + } + + + + public function yylex4() + { + if (!isset($this->yy_global_pattern4)) { + $this->yy_global_pattern4 = $this->replace("/\G([ \t\r]+)|\G([^\n]+?(?=[ \t\r]*\n))|\G(\n)/isS"); + } + if (!isset($this->dataLength)) { + $this->dataLength = strlen($this->data); + } + if ($this->counter >= $this->dataLength) { + return false; // end of input + } + + do { + if (preg_match($this->yy_global_pattern4,$this->data, $yymatches, 0, $this->counter)) { + if (!isset($yymatches[ 0 ][1])) { + $yymatches = preg_grep("/(.|\s)+/", $yymatches); + } else { + $yymatches = array_filter($yymatches); + } + if (empty($yymatches)) { + throw new Exception('Error: lexing failed because a rule matched' . + ' an empty string. Input "' . substr($this->data, + $this->counter, 5) . '... state COMMENT'); + } + next($yymatches); // skip global match + $this->token = key($yymatches); // token number + $this->value = current($yymatches); // token value + $r = $this->{'yy_r4_' . $this->token}(); + if ($r === null) { + $this->counter += strlen($this->value); + $this->line += substr_count($this->value, "\n"); + // accept this token + return true; + } elseif ($r === true) { + // we have changed state + // process this token in the new state + return $this->yylex(); + } elseif ($r === false) { + $this->counter += strlen($this->value); + $this->line += substr_count($this->value, "\n"); + if ($this->counter >= $this->dataLength) { + return false; // end of input + } + // skip this token + continue; + } } else { + throw new Exception('Unexpected input at line' . $this->line . + ': ' . $this->data[$this->counter]); + } + break; + } while (true); + + } // end function + + + const COMMENT = 4; + public function yy_r4_1() + { + + return false; + } + public function yy_r4_2() + { + + $this->token = \Smarty\Parser\ConfigfileParser::TPC_NAKED_STRING; + } + public function yy_r4_3() + { + + $this->token = \Smarty\Parser\ConfigfileParser::TPC_NEWLINE; + $this->yypopstate(); + } + + + + public function yylex5() + { + if (!isset($this->yy_global_pattern5)) { + $this->yy_global_pattern5 = $this->replace("/\G(\\.)|\G(.*?(?=[\.=[\]\r\n]))/isS"); + } + if (!isset($this->dataLength)) { + $this->dataLength = strlen($this->data); + } + if ($this->counter >= $this->dataLength) { + return false; // end of input + } + + do { + if (preg_match($this->yy_global_pattern5,$this->data, $yymatches, 0, $this->counter)) { + if (!isset($yymatches[ 0 ][1])) { + $yymatches = preg_grep("/(.|\s)+/", $yymatches); + } else { + $yymatches = array_filter($yymatches); + } + if (empty($yymatches)) { + throw new Exception('Error: lexing failed because a rule matched' . + ' an empty string. Input "' . substr($this->data, + $this->counter, 5) . '... state SECTION'); + } + next($yymatches); // skip global match + $this->token = key($yymatches); // token number + $this->value = current($yymatches); // token value + $r = $this->{'yy_r5_' . $this->token}(); + if ($r === null) { + $this->counter += strlen($this->value); + $this->line += substr_count($this->value, "\n"); + // accept this token + return true; + } elseif ($r === true) { + // we have changed state + // process this token in the new state + return $this->yylex(); + } elseif ($r === false) { + $this->counter += strlen($this->value); + $this->line += substr_count($this->value, "\n"); + if ($this->counter >= $this->dataLength) { + return false; // end of input + } + // skip this token + continue; + } } else { + throw new Exception('Unexpected input at line' . $this->line . + ': ' . $this->data[$this->counter]); + } + break; + } while (true); + + } // end function + + + const SECTION = 5; + public function yy_r5_1() + { + + $this->token = \Smarty\Parser\ConfigfileParser::TPC_DOT; + } + public function yy_r5_2() + { + + $this->token = \Smarty\Parser\ConfigfileParser::TPC_SECTION; + $this->yypopstate(); + } + + + public function yylex6() + { + if (!isset($this->yy_global_pattern6)) { + $this->yy_global_pattern6 = $this->replace("/\G(\"\"\"(?=[ \t\r]*[\n#;]))|\G([\S\s])/isS"); + } + if (!isset($this->dataLength)) { + $this->dataLength = strlen($this->data); + } + if ($this->counter >= $this->dataLength) { + return false; // end of input + } + + do { + if (preg_match($this->yy_global_pattern6,$this->data, $yymatches, 0, $this->counter)) { + if (!isset($yymatches[ 0 ][1])) { + $yymatches = preg_grep("/(.|\s)+/", $yymatches); + } else { + $yymatches = array_filter($yymatches); + } + if (empty($yymatches)) { + throw new Exception('Error: lexing failed because a rule matched' . + ' an empty string. Input "' . substr($this->data, + $this->counter, 5) . '... state TRIPPLE'); + } + next($yymatches); // skip global match + $this->token = key($yymatches); // token number + $this->value = current($yymatches); // token value + $r = $this->{'yy_r6_' . $this->token}(); + if ($r === null) { + $this->counter += strlen($this->value); + $this->line += substr_count($this->value, "\n"); + // accept this token + return true; + } elseif ($r === true) { + // we have changed state + // process this token in the new state + return $this->yylex(); + } elseif ($r === false) { + $this->counter += strlen($this->value); + $this->line += substr_count($this->value, "\n"); + if ($this->counter >= $this->dataLength) { + return false; // end of input + } + // skip this token + continue; + } } else { + throw new Exception('Unexpected input at line' . $this->line . + ': ' . $this->data[$this->counter]); + } + break; + } while (true); + + } // end function + + + const TRIPPLE = 6; + public function yy_r6_1() + { + + $this->token = \Smarty\Parser\ConfigfileParser::TPC_TRIPPLE_QUOTES_END; + $this->yypopstate(); + $this->yypushstate(self::START); + } + public function yy_r6_2() + { + + $to = strlen($this->data); + preg_match("/\"\"\"[ \t\r]*[\n#;]/",$this->data,$match,PREG_OFFSET_CAPTURE,$this->counter); + if (isset($match[0][1])) { + $to = $match[0][1]; + } else { + $this->compiler->trigger_config_file_error ('missing or misspelled literal closing tag'); + } + $this->value = substr($this->data,$this->counter,$to-$this->counter); + $this->token = \Smarty\Parser\ConfigfileParser::TPC_TRIPPLE_TEXT; + } + + +} diff --git a/src/Lexer/TemplateLexer.php b/src/Lexer/TemplateLexer.php new file mode 100644 index 00000000..5c7253ba --- /dev/null +++ b/src/Lexer/TemplateLexer.php @@ -0,0 +1,1083 @@ + + */ +class TemplateLexer +{ + /** + * Source + * + * @var string + */ + public $data; + + /** + * Source length + * + * @var int + */ + public $dataLength = null; + + /** + * byte counter + * + * @var int + */ + public $counter; + + /** + * token number + * + * @var int + */ + public $token; + + /** + * token value + * + * @var string + */ + public $value; + + /** + * current line + * + * @var int + */ + public $line; + + /** + * tag start line + * + * @var + */ + public $taglineno; + + /** + * state number + * + * @var int + */ + public $state = 1; + + /** + * Smarty object + * + * @var Smarty + */ + public $smarty = null; + + /** + * compiler object + * + * @var \Smarty\Compiler\Template + */ + public $compiler = null; + + /** + * trace file + * + * @var resource + */ + public $yyTraceFILE; + + /** + * trace prompt + * + * @var string + */ + public $yyTracePrompt; + + /** + * XML flag true while processing xml + * + * @var bool + */ + public $is_xml = false; + + /** + * state names + * + * @var array + */ + public $state_name = array(1 => 'TEXT', 2 => 'TAG', 3 => 'TAGBODY', 4 => 'LITERAL', 5 => 'DOUBLEQUOTEDSTRING',); + + /** + * token names + * + * @var array + */ + public $smarty_token_names = array( // Text for parser error messages + 'NOT' => '(!,not)', + 'OPENP' => '(', + 'CLOSEP' => ')', + 'OPENB' => '[', + 'CLOSEB' => ']', + 'PTR' => '->', + 'APTR' => '=>', + 'EQUAL' => '=', + 'NUMBER' => 'number', + 'UNIMATH' => '+" , "-', + 'MATH' => '*" , "/" , "%', + 'INCDEC' => '++" , "--', + 'SPACE' => ' ', + 'DOLLAR' => '$', + 'SEMICOLON' => ';', + 'COLON' => ':', + 'DOUBLECOLON' => '::', + 'AT' => '@', + 'HATCH' => '#', + 'QUOTE' => '"', + 'BACKTICK' => '`', + 'VERT' => '"|" modifier', + 'DOT' => '.', + 'COMMA' => '","', + 'QMARK' => '"?"', + 'ID' => 'id, name', + 'TEXT' => 'text', + 'LDELSLASH' => '{/..} closing tag', + 'LDEL' => '{...} Smarty tag', + 'COMMENT' => 'comment', + 'AS' => 'as', + 'TO' => 'to', + 'LOGOP' => '"<", "==" ... logical operator', + 'TLOGOP' => '"lt", "eq" ... logical operator; "is div by" ... if condition', + 'SCOND' => '"is even" ... if condition', + ); + + /** + * literal tag nesting level + * + * @var int + */ + private $literal_cnt = 0; + + /** + * preg token pattern for state TEXT + * + * @var string + */ + private $yy_global_pattern1 = null; + + /** + * preg token pattern for state TAG + * + * @var string + */ + private $yy_global_pattern2 = null; + + /** + * preg token pattern for state TAGBODY + * + * @var string + */ + private $yy_global_pattern3 = null; + + /** + * preg token pattern for state LITERAL + * + * @var string + */ + private $yy_global_pattern4 = null; + + /** + * preg token pattern for state DOUBLEQUOTEDSTRING + * + * @var null + */ + private $yy_global_pattern5 = null; + + /** + * preg token pattern for text + * + * @var null + */ + private $yy_global_text = null; + + /** + * preg token pattern for literal + * + * @var null + */ + private $yy_global_literal = null; + + /** + * constructor + * + * @param string $source template source + * @param \Smarty\Compiler\Template $compiler + */ + public function __construct($source, \Smarty\Compiler\Template $compiler) + { + $this->data = $source; + $this->dataLength = strlen($this->data); + $this->counter = 0; + if (preg_match('/^\xEF\xBB\xBF/i', $this->data, $match)) { + $this->counter += strlen($match[0]); + } + $this->line = 1; + $this->smarty = $compiler->getTemplate()->getSmarty(); + $this->compiler = $compiler; + $this->compiler->initDelimiterPreg(); + $this->smarty_token_names['LDEL'] = $this->smarty->getLeftDelimiter(); + $this->smarty_token_names['RDEL'] = $this->smarty->getRightDelimiter(); + } + + /** + * open lexer/parser trace file + * + */ + public function PrintTrace() + { + $this->yyTraceFILE = fopen('php://output', 'w'); + $this->yyTracePrompt = '
'; + } + + /** + * replace placeholders with runtime preg code + * + * @param string $preg + * + * @return string + */ + public function replace($preg) + { + return $this->compiler->replaceDelimiter($preg); + } + + /** + * check if current value is an autoliteral left delimiter + * + * @return bool + */ + public function isAutoLiteral() + { + return $this->smarty->getAutoLiteral() && isset($this->value[ $this->compiler->getLdelLength() ]) ? + strpos(" \n\t\r", $this->value[ $this->compiler->getLdelLength() ]) !== false : false; + } + + + private $_yy_state = 1; + private $_yy_stack = array(); + + public function yylex() + { + return $this->{'yylex' . $this->_yy_state}(); + } + + public function yypushstate($state) + { + if ($this->yyTraceFILE) { + fprintf($this->yyTraceFILE, "%sState push %s\n", $this->yyTracePrompt, isset($this->state_name[$this->_yy_state]) ? $this->state_name[$this->_yy_state] : $this->_yy_state); + } + array_push($this->_yy_stack, $this->_yy_state); + $this->_yy_state = $state; + if ($this->yyTraceFILE) { + fprintf($this->yyTraceFILE, "%snew State %s\n", $this->yyTracePrompt, isset($this->state_name[$this->_yy_state]) ? $this->state_name[$this->_yy_state] : $this->_yy_state); + } + } + + public function yypopstate() + { + if ($this->yyTraceFILE) { + fprintf($this->yyTraceFILE, "%sState pop %s\n", $this->yyTracePrompt, isset($this->state_name[$this->_yy_state]) ? $this->state_name[$this->_yy_state] : $this->_yy_state); + } + $this->_yy_state = array_pop($this->_yy_stack); + if ($this->yyTraceFILE) { + fprintf($this->yyTraceFILE, "%snew State %s\n", $this->yyTracePrompt, isset($this->state_name[$this->_yy_state]) ? $this->state_name[$this->_yy_state] : $this->_yy_state); + } + + } + + public function yybegin($state) + { + $this->_yy_state = $state; + if ($this->yyTraceFILE) { + fprintf($this->yyTraceFILE, "%sState set %s\n", $this->yyTracePrompt, isset($this->state_name[$this->_yy_state]) ? $this->state_name[$this->_yy_state] : $this->_yy_state); + } + } + + + + public function yylex1() + { + if (!isset($this->yy_global_pattern1)) { + $this->yy_global_pattern1 = $this->replace("/\G([{][}])|\G((SMARTYldel)SMARTYal[*])|\G((SMARTYldel)SMARTYautoliteral\\s+SMARTYliteral)|\G((SMARTYldel)SMARTYalliteral\\s*SMARTYrdel)|\G((SMARTYldel)SMARTYal[\/]literal\\s*SMARTYrdel)|\G((SMARTYldel)SMARTYal)|\G([\S\s])/isS"); + } + if (!isset($this->dataLength)) { + $this->dataLength = strlen($this->data); + } + if ($this->counter >= $this->dataLength) { + return false; // end of input + } + + do { + if (preg_match($this->yy_global_pattern1,$this->data, $yymatches, 0, $this->counter)) { + if (!isset($yymatches[ 0 ][1])) { + $yymatches = preg_grep("/(.|\s)+/", $yymatches); + } else { + $yymatches = array_filter($yymatches); + } + if (empty($yymatches)) { + throw new Exception('Error: lexing failed because a rule matched' . + ' an empty string. Input "' . substr($this->data, + $this->counter, 5) . '... state TEXT'); + } + next($yymatches); // skip global match + $this->token = key($yymatches); // token number + $this->value = current($yymatches); // token value + $r = $this->{'yy_r1_' . $this->token}(); + if ($r === null) { + $this->counter += strlen($this->value); + $this->line += substr_count($this->value, "\n"); + // accept this token + return true; + } elseif ($r === true) { + // we have changed state + // process this token in the new state + return $this->yylex(); + } elseif ($r === false) { + $this->counter += strlen($this->value); + $this->line += substr_count($this->value, "\n"); + if ($this->counter >= $this->dataLength) { + return false; // end of input + } + // skip this token + continue; + } } else { + throw new Exception('Unexpected input at line' . $this->line . + ': ' . $this->data[$this->counter]); + } + break; + } while (true); + + } // end function + + + const TEXT = 1; + public function yy_r1_1() + { + + $this->token = \Smarty\Parser\TemplateParser::TP_TEXT; + } + public function yy_r1_2() + { + + $to = $this->dataLength; + preg_match("/[*]{$this->compiler->getRdelPreg()}[\n]?/",$this->data,$match,PREG_OFFSET_CAPTURE,$this->counter); + if (isset($match[0][1])) { + $to = $match[0][1] + strlen($match[0][0]); + } else { + $this->compiler->trigger_template_error ("missing or misspelled comment closing tag '{$this->smarty->getRightDelimiter()}'"); + } + $this->value = substr($this->data,$this->counter,$to-$this->counter); + return false; + } + public function yy_r1_4() + { + + $this->token = \Smarty\Parser\TemplateParser::TP_TEXT; + } + public function yy_r1_6() + { + + $this->token = \Smarty\Parser\TemplateParser::TP_LITERALSTART; + $this->yypushstate(self::LITERAL); + } + public function yy_r1_8() + { + + $this->token = \Smarty\Parser\TemplateParser::TP_LITERALEND; + $this->yypushstate(self::LITERAL); + } + public function yy_r1_10() + { + + $this->yypushstate(self::TAG); + return true; + } + public function yy_r1_12() + { + + if (!isset($this->yy_global_text)) { + $this->yy_global_text = $this->replace('/(SMARTYldel)SMARTYal/isS'); + } + $to = $this->dataLength; + preg_match($this->yy_global_text, $this->data,$match,PREG_OFFSET_CAPTURE,$this->counter); + if (isset($match[0][1])) { + $to = $match[0][1]; + } + $this->value = substr($this->data,$this->counter,$to-$this->counter); + $this->token = \Smarty\Parser\TemplateParser::TP_TEXT; + } + + + public function yylex2() + { + if (!isset($this->yy_global_pattern2)) { + $this->yy_global_pattern2 = $this->replace("/\G((SMARTYldel)SMARTYal(if|elseif|else if|while)\\s+)|\G((SMARTYldel)SMARTYalfor\\s+)|\G((SMARTYldel)SMARTYalforeach(?![^\s]))|\G((SMARTYldel)SMARTYalsetfilter\\s+)|\G((SMARTYldel)SMARTYal[0-9]*[a-zA-Z_]\\w*(\\s+nocache)?\\s*SMARTYrdel)|\G((SMARTYldel)SMARTYal[$]smarty\\.block\\.(child|parent)\\s*SMARTYrdel)|\G((SMARTYldel)SMARTYal[\/][0-9]*[a-zA-Z_]\\w*\\s*SMARTYrdel)|\G((SMARTYldel)SMARTYal[$][0-9]*[a-zA-Z_]\\w*(\\s+nocache)?\\s*SMARTYrdel)|\G((SMARTYldel)SMARTYal[\/])|\G((SMARTYldel)SMARTYal)/isS"); + } + if (!isset($this->dataLength)) { + $this->dataLength = strlen($this->data); + } + if ($this->counter >= $this->dataLength) { + return false; // end of input + } + + do { + if (preg_match($this->yy_global_pattern2,$this->data, $yymatches, 0, $this->counter)) { + if (!isset($yymatches[ 0 ][1])) { + $yymatches = preg_grep("/(.|\s)+/", $yymatches); + } else { + $yymatches = array_filter($yymatches); + } + if (empty($yymatches)) { + throw new Exception('Error: lexing failed because a rule matched' . + ' an empty string. Input "' . substr($this->data, + $this->counter, 5) . '... state TAG'); + } + next($yymatches); // skip global match + $this->token = key($yymatches); // token number + $this->value = current($yymatches); // token value + $r = $this->{'yy_r2_' . $this->token}(); + if ($r === null) { + $this->counter += strlen($this->value); + $this->line += substr_count($this->value, "\n"); + // accept this token + return true; + } elseif ($r === true) { + // we have changed state + // process this token in the new state + return $this->yylex(); + } elseif ($r === false) { + $this->counter += strlen($this->value); + $this->line += substr_count($this->value, "\n"); + if ($this->counter >= $this->dataLength) { + return false; // end of input + } + // skip this token + continue; + } } else { + throw new Exception('Unexpected input at line' . $this->line . + ': ' . $this->data[$this->counter]); + } + break; + } while (true); + + } // end function + + + const TAG = 2; + public function yy_r2_1() + { + + $this->token = \Smarty\Parser\TemplateParser::TP_LDELIF; + $this->yybegin(self::TAGBODY); + $this->taglineno = $this->line; + } + public function yy_r2_4() + { + + $this->token = \Smarty\Parser\TemplateParser::TP_LDELFOR; + $this->yybegin(self::TAGBODY); + $this->taglineno = $this->line; + } + public function yy_r2_6() + { + + $this->token = \Smarty\Parser\TemplateParser::TP_LDELFOREACH; + $this->yybegin(self::TAGBODY); + $this->taglineno = $this->line; + } + public function yy_r2_8() + { + + $this->token = \Smarty\Parser\TemplateParser::TP_LDELSETFILTER; + $this->yybegin(self::TAGBODY); + $this->taglineno = $this->line; + } + public function yy_r2_10() + { + + $this->yypopstate(); + $this->token = \Smarty\Parser\TemplateParser::TP_SIMPLETAG; + $this->taglineno = $this->line; + } + public function yy_r2_13() + { + + $this->yypopstate(); + $this->token = \Smarty\Parser\TemplateParser::TP_SMARTYBLOCKCHILDPARENT; + $this->taglineno = $this->line; + } + public function yy_r2_16() + { + + $this->yypopstate(); + $this->token = \Smarty\Parser\TemplateParser::TP_CLOSETAG; + $this->taglineno = $this->line; + } + public function yy_r2_18() + { + + if ($this->_yy_stack[count($this->_yy_stack)-1] === self::TEXT) { + $this->yypopstate(); + $this->token = \Smarty\Parser\TemplateParser::TP_SIMPELOUTPUT; + $this->taglineno = $this->line; + } else { + $this->value = $this->smarty->getLeftDelimiter(); + $this->token = \Smarty\Parser\TemplateParser::TP_LDEL; + $this->yybegin(self::TAGBODY); + $this->taglineno = $this->line; + } + } + public function yy_r2_21() + { + + $this->token = \Smarty\Parser\TemplateParser::TP_LDELSLASH; + $this->yybegin(self::TAGBODY); + $this->taglineno = $this->line; + } + public function yy_r2_23() + { + + $this->token = \Smarty\Parser\TemplateParser::TP_LDEL; + $this->yybegin(self::TAGBODY); + $this->taglineno = $this->line; + } + + + public function yylex3() + { + if (!isset($this->yy_global_pattern3)) { + $this->yy_global_pattern3 = $this->replace("/\G(\\s*SMARTYrdel)|\G((SMARTYldel)SMARTYal)|\G([\"])|\G('[^'\\\\]*(?:\\\\.[^'\\\\]*)*')|\G([$][0-9]*[a-zA-Z_]\\w*)|\G([$])|\G(\\s+is\\s+in\\s+)|\G(\\s+as\\s+)|\G(\\s+to\\s+)|\G(\\s+step\\s+)|\G(\\s+instanceof\\s+)|\G(\\s*([!=][=]{1,2}|[<][=>]?|[>][=]?|[&|]{2})\\s*)|\G(\\s+(eq|ne|neq|gt|ge|gte|lt|le|lte|mod|and|or|xor)\\s+)|\G(\\s+is\\s+(not\\s+)?(odd|even|div)\\s+by\\s+)|\G(\\s+is\\s+(not\\s+)?(odd|even))|\G([!]\\s*|not\\s+)|\G([(](int(eger)?|bool(ean)?|float|double|real|string|binary|array|object)[)]\\s*)|\G(\\s*[(]\\s*)|\G(\\s*[)])|\G(\\[\\s*)|\G(\\s*\\])|\G(\\s*[-][>]\\s*)|\G(\\s*[=][>]\\s*)|\G(\\s*[=]\\s*)|\G(([+]|[-]){2})|\G(\\s*([+]|[-])\\s*)|\G(\\s*([*]{1,2}|[%\/^&]|[<>]{2})\\s*)|\G([@])|\G(array\\s*[(]\\s*)|\G([#])|\G(\\s+[0-9]*[a-zA-Z_][a-zA-Z0-9_\-:]*\\s*[=]\\s*)|\G(([0-9]*[a-zA-Z_]\\w*)?(\\\\[0-9]*[a-zA-Z_]\\w*)+)|\G([0-9]*[a-zA-Z_]\\w*)|\G(\\d+)|\G([`])|\G([|][@]?)|\G([.])|\G(\\s*[,]\\s*)|\G(\\s*[;]\\s*)|\G([:]{2})|\G(\\s*[:]\\s*)|\G(\\s*[?]\\s*)|\G(0[xX][0-9a-fA-F]+)|\G(\\s+)|\G([\S\s])/isS"); + } + if (!isset($this->dataLength)) { + $this->dataLength = strlen($this->data); + } + if ($this->counter >= $this->dataLength) { + return false; // end of input + } + + do { + if (preg_match($this->yy_global_pattern3,$this->data, $yymatches, 0, $this->counter)) { + if (!isset($yymatches[ 0 ][1])) { + $yymatches = preg_grep("/(.|\s)+/", $yymatches); + } else { + $yymatches = array_filter($yymatches); + } + if (empty($yymatches)) { + throw new Exception('Error: lexing failed because a rule matched' . + ' an empty string. Input "' . substr($this->data, + $this->counter, 5) . '... state TAGBODY'); + } + next($yymatches); // skip global match + $this->token = key($yymatches); // token number + $this->value = current($yymatches); // token value + $r = $this->{'yy_r3_' . $this->token}(); + if ($r === null) { + $this->counter += strlen($this->value); + $this->line += substr_count($this->value, "\n"); + // accept this token + return true; + } elseif ($r === true) { + // we have changed state + // process this token in the new state + return $this->yylex(); + } elseif ($r === false) { + $this->counter += strlen($this->value); + $this->line += substr_count($this->value, "\n"); + if ($this->counter >= $this->dataLength) { + return false; // end of input + } + // skip this token + continue; + } } else { + throw new Exception('Unexpected input at line' . $this->line . + ': ' . $this->data[$this->counter]); + } + break; + } while (true); + + } // end function + + + const TAGBODY = 3; + public function yy_r3_1() + { + + $this->token = \Smarty\Parser\TemplateParser::TP_RDEL; + $this->yypopstate(); + } + public function yy_r3_2() + { + + $this->yypushstate(self::TAG); + return true; + } + public function yy_r3_4() + { + + $this->token = \Smarty\Parser\TemplateParser::TP_QUOTE; + $this->yypushstate(self::DOUBLEQUOTEDSTRING); + $this->compiler->enterDoubleQuote(); + } + public function yy_r3_5() + { + + $this->token = \Smarty\Parser\TemplateParser::TP_SINGLEQUOTESTRING; + } + public function yy_r3_6() + { + + $this->token = \Smarty\Parser\TemplateParser::TP_DOLLARID; + } + public function yy_r3_7() + { + + $this->token = \Smarty\Parser\TemplateParser::TP_DOLLAR; + } + public function yy_r3_8() + { + + $this->token = \Smarty\Parser\TemplateParser::TP_ISIN; + } + public function yy_r3_9() + { + + $this->token = \Smarty\Parser\TemplateParser::TP_AS; + } + public function yy_r3_10() + { + + $this->token = \Smarty\Parser\TemplateParser::TP_TO; + } + public function yy_r3_11() + { + + $this->token = \Smarty\Parser\TemplateParser::TP_STEP; + } + public function yy_r3_12() + { + + $this->token = \Smarty\Parser\TemplateParser::TP_INSTANCEOF; + } + public function yy_r3_13() + { + + $this->token = \Smarty\Parser\TemplateParser::TP_LOGOP; + } + public function yy_r3_15() + { + + $this->token = \Smarty\Parser\TemplateParser::TP_SLOGOP; + } + public function yy_r3_17() + { + + $this->token = \Smarty\Parser\TemplateParser::TP_TLOGOP; + } + public function yy_r3_20() + { + + $this->token = \Smarty\Parser\TemplateParser::TP_SINGLECOND; + } + public function yy_r3_23() + { + + $this->token = \Smarty\Parser\TemplateParser::TP_NOT; + } + public function yy_r3_24() + { + + $this->token = \Smarty\Parser\TemplateParser::TP_TYPECAST; + } + public function yy_r3_28() + { + + $this->token = \Smarty\Parser\TemplateParser::TP_OPENP; + } + public function yy_r3_29() + { + + $this->token = \Smarty\Parser\TemplateParser::TP_CLOSEP; + } + public function yy_r3_30() + { + + $this->token = \Smarty\Parser\TemplateParser::TP_OPENB; + } + public function yy_r3_31() + { + + $this->token = \Smarty\Parser\TemplateParser::TP_CLOSEB; + } + public function yy_r3_32() + { + + $this->token = \Smarty\Parser\TemplateParser::TP_PTR; + } + public function yy_r3_33() + { + + $this->token = \Smarty\Parser\TemplateParser::TP_APTR; + } + public function yy_r3_34() + { + + $this->token = \Smarty\Parser\TemplateParser::TP_EQUAL; + } + public function yy_r3_35() + { + + $this->token = \Smarty\Parser\TemplateParser::TP_INCDEC; + } + public function yy_r3_37() + { + + $this->token = \Smarty\Parser\TemplateParser::TP_UNIMATH; + } + public function yy_r3_39() + { + + $this->token = \Smarty\Parser\TemplateParser::TP_MATH; + } + public function yy_r3_41() + { + + $this->token = \Smarty\Parser\TemplateParser::TP_AT; + } + public function yy_r3_42() + { + + $this->token = \Smarty\Parser\TemplateParser::TP_ARRAYOPEN; + } + public function yy_r3_43() + { + + $this->token = \Smarty\Parser\TemplateParser::TP_HATCH; + } + public function yy_r3_44() + { + + // resolve conflicts with shorttag and right_delimiter starting with '=' + if (substr($this->data, $this->counter + strlen($this->value) - 1, $this->compiler->getRdelLength()) === $this->smarty->getRightDelimiter()) { + preg_match('/\s+/',$this->value,$match); + $this->value = $match[0]; + $this->token = \Smarty\Parser\TemplateParser::TP_SPACE; + } else { + $this->token = \Smarty\Parser\TemplateParser::TP_ATTR; + } + } + public function yy_r3_45() + { + + $this->token = \Smarty\Parser\TemplateParser::TP_NAMESPACE; + } + public function yy_r3_48() + { + + $this->token = \Smarty\Parser\TemplateParser::TP_ID; + } + public function yy_r3_49() + { + + $this->token = \Smarty\Parser\TemplateParser::TP_INTEGER; + } + public function yy_r3_50() + { + + $this->token = \Smarty\Parser\TemplateParser::TP_BACKTICK; + $this->yypopstate(); + } + public function yy_r3_51() + { + + $this->token = \Smarty\Parser\TemplateParser::TP_VERT; + } + public function yy_r3_52() + { + + $this->token = \Smarty\Parser\TemplateParser::TP_DOT; + } + public function yy_r3_53() + { + + $this->token = \Smarty\Parser\TemplateParser::TP_COMMA; + } + public function yy_r3_54() + { + + $this->token = \Smarty\Parser\TemplateParser::TP_SEMICOLON; + } + public function yy_r3_55() + { + + $this->token = \Smarty\Parser\TemplateParser::TP_DOUBLECOLON; + } + public function yy_r3_56() + { + + $this->token = \Smarty\Parser\TemplateParser::TP_COLON; + } + public function yy_r3_57() + { + + $this->token = \Smarty\Parser\TemplateParser::TP_QMARK; + } + public function yy_r3_58() + { + + $this->token = \Smarty\Parser\TemplateParser::TP_HEX; + } + public function yy_r3_59() + { + + $this->token = \Smarty\Parser\TemplateParser::TP_SPACE; + } + public function yy_r3_60() + { + + $this->token = \Smarty\Parser\TemplateParser::TP_TEXT; + } + + + + public function yylex4() + { + if (!isset($this->yy_global_pattern4)) { + $this->yy_global_pattern4 = $this->replace("/\G((SMARTYldel)SMARTYalliteral\\s*SMARTYrdel)|\G((SMARTYldel)SMARTYal[\/]literal\\s*SMARTYrdel)|\G([\S\s])/isS"); + } + if (!isset($this->dataLength)) { + $this->dataLength = strlen($this->data); + } + if ($this->counter >= $this->dataLength) { + return false; // end of input + } + + do { + if (preg_match($this->yy_global_pattern4,$this->data, $yymatches, 0, $this->counter)) { + if (!isset($yymatches[ 0 ][1])) { + $yymatches = preg_grep("/(.|\s)+/", $yymatches); + } else { + $yymatches = array_filter($yymatches); + } + if (empty($yymatches)) { + throw new Exception('Error: lexing failed because a rule matched' . + ' an empty string. Input "' . substr($this->data, + $this->counter, 5) . '... state LITERAL'); + } + next($yymatches); // skip global match + $this->token = key($yymatches); // token number + $this->value = current($yymatches); // token value + $r = $this->{'yy_r4_' . $this->token}(); + if ($r === null) { + $this->counter += strlen($this->value); + $this->line += substr_count($this->value, "\n"); + // accept this token + return true; + } elseif ($r === true) { + // we have changed state + // process this token in the new state + return $this->yylex(); + } elseif ($r === false) { + $this->counter += strlen($this->value); + $this->line += substr_count($this->value, "\n"); + if ($this->counter >= $this->dataLength) { + return false; // end of input + } + // skip this token + continue; + } } else { + throw new Exception('Unexpected input at line' . $this->line . + ': ' . $this->data[$this->counter]); + } + break; + } while (true); + + } // end function + + + const LITERAL = 4; + public function yy_r4_1() + { + + $this->literal_cnt++; + $this->token = \Smarty\Parser\TemplateParser::TP_LITERAL; + } + public function yy_r4_3() + { + + if ($this->literal_cnt) { + $this->literal_cnt--; + $this->token = \Smarty\Parser\TemplateParser::TP_LITERAL; + } else { + $this->token = \Smarty\Parser\TemplateParser::TP_LITERALEND; + $this->yypopstate(); + } + } + public function yy_r4_5() + { + + if (!isset($this->yy_global_literal)) { + $this->yy_global_literal = $this->replace('/(SMARTYldel)SMARTYal[\/]?literalSMARTYrdel/isS'); + } + $to = $this->dataLength; + preg_match($this->yy_global_literal, $this->data,$match,PREG_OFFSET_CAPTURE,$this->counter); + if (isset($match[0][1])) { + $to = $match[0][1]; + } else { + $this->compiler->trigger_template_error ("missing or misspelled literal closing tag"); + } + $this->value = substr($this->data,$this->counter,$to-$this->counter); + $this->token = \Smarty\Parser\TemplateParser::TP_LITERAL; + } + + + public function yylex5() + { + if (!isset($this->yy_global_pattern5)) { + $this->yy_global_pattern5 = $this->replace("/\G((SMARTYldel)SMARTYautoliteral\\s+SMARTYliteral)|\G((SMARTYldel)SMARTYalliteral\\s*SMARTYrdel)|\G((SMARTYldel)SMARTYal[\/]literal\\s*SMARTYrdel)|\G((SMARTYldel)SMARTYal[\/])|\G((SMARTYldel)SMARTYal[0-9]*[a-zA-Z_]\\w*)|\G((SMARTYldel)SMARTYal)|\G([\"])|\G([`][$])|\G([$][0-9]*[a-zA-Z_]\\w*)|\G([$])|\G(([^\"\\\\]*?)((?:\\\\.[^\"\\\\]*?)*?)(?=((SMARTYldel)SMARTYal|\\$|`\\$|\"SMARTYliteral)))|\G([\S\s])/isS"); + } + if (!isset($this->dataLength)) { + $this->dataLength = strlen($this->data); + } + if ($this->counter >= $this->dataLength) { + return false; // end of input + } + + do { + if (preg_match($this->yy_global_pattern5,$this->data, $yymatches, 0, $this->counter)) { + if (!isset($yymatches[ 0 ][1])) { + $yymatches = preg_grep("/(.|\s)+/", $yymatches); + } else { + $yymatches = array_filter($yymatches); + } + if (empty($yymatches)) { + throw new Exception('Error: lexing failed because a rule matched' . + ' an empty string. Input "' . substr($this->data, + $this->counter, 5) . '... state DOUBLEQUOTEDSTRING'); + } + next($yymatches); // skip global match + $this->token = key($yymatches); // token number + $this->value = current($yymatches); // token value + $r = $this->{'yy_r5_' . $this->token}(); + if ($r === null) { + $this->counter += strlen($this->value); + $this->line += substr_count($this->value, "\n"); + // accept this token + return true; + } elseif ($r === true) { + // we have changed state + // process this token in the new state + return $this->yylex(); + } elseif ($r === false) { + $this->counter += strlen($this->value); + $this->line += substr_count($this->value, "\n"); + if ($this->counter >= $this->dataLength) { + return false; // end of input + } + // skip this token + continue; + } } else { + throw new Exception('Unexpected input at line' . $this->line . + ': ' . $this->data[$this->counter]); + } + break; + } while (true); + + } // end function + + + const DOUBLEQUOTEDSTRING = 5; + public function yy_r5_1() + { + + $this->token = \Smarty\Parser\TemplateParser::TP_TEXT; + } + public function yy_r5_3() + { + + $this->token = \Smarty\Parser\TemplateParser::TP_TEXT; + } + public function yy_r5_5() + { + + $this->token = \Smarty\Parser\TemplateParser::TP_TEXT; + } + public function yy_r5_7() + { + + $this->yypushstate(self::TAG); + return true; + } + public function yy_r5_9() + { + + $this->yypushstate(self::TAG); + return true; + } + public function yy_r5_11() + { + + $this->token = \Smarty\Parser\TemplateParser::TP_LDEL; + $this->taglineno = $this->line; + $this->yypushstate(self::TAGBODY); + } + public function yy_r5_13() + { + + $this->token = \Smarty\Parser\TemplateParser::TP_QUOTE; + $this->yypopstate(); + } + public function yy_r5_14() + { + + $this->token = \Smarty\Parser\TemplateParser::TP_BACKTICK; + $this->value = substr($this->value,0,-1); + $this->yypushstate(self::TAGBODY); + $this->taglineno = $this->line; + } + public function yy_r5_15() + { + + $this->token = \Smarty\Parser\TemplateParser::TP_DOLLARID; + } + public function yy_r5_16() + { + + $this->token = \Smarty\Parser\TemplateParser::TP_TEXT; + } + public function yy_r5_17() + { + + $this->token = \Smarty\Parser\TemplateParser::TP_TEXT; + } + public function yy_r5_22() + { + + $to = $this->dataLength; + $this->value = substr($this->data,$this->counter,$to-$this->counter); + $this->token = \Smarty\Parser\TemplateParser::TP_TEXT; + } + + } + + \ No newline at end of file diff --git a/src/Parser/ConfigfileParser.php b/src/Parser/ConfigfileParser.php new file mode 100644 index 00000000..7997a098 --- /dev/null +++ b/src/Parser/ConfigfileParser.php @@ -0,0 +1,972 @@ + '\\', + '\'' => '\''); + + /** + * constructor + * + * @param Lexer $lex + * @param Configfile $compiler + */ + public function __construct(Lexer $lex, Configfile $compiler) + { + $this->lex = $lex; + $this->smarty = $compiler->getSmarty(); + $this->compiler = $compiler; + $this->configOverwrite = $this->smarty->config_overwrite; + $this->configReadHidden = $this->smarty->config_read_hidden; + } + + /** + * parse optional boolean keywords + * + * @param string $str + * + * @return bool + */ + private function parse_bool($str) + { + $str = strtolower($str); + if (in_array($str, array('on', 'yes', 'true'))) { + $res = true; + } else { + $res = false; + } + return $res; + } + + /** + * parse single quoted string + * remove outer quotes + * unescape inner quotes + * + * @param string $qstr + * + * @return string + */ + private static function parse_single_quoted_string($qstr) + { + $escaped_string = substr($qstr, 1, strlen($qstr) - 2); //remove outer quotes + + $ss = preg_split('/(\\\\.)/', $escaped_string, - 1, PREG_SPLIT_DELIM_CAPTURE); + + $str = ''; + foreach ($ss as $s) { + if (strlen($s) === 2 && $s[0] === '\\') { + if (isset(self::$escapes_single[$s[1]])) { + $s = self::$escapes_single[$s[1]]; + } + } + $str .= $s; + } + return $str; + } + + /** + * parse double quoted string + * + * @param string $qstr + * + * @return string + */ + private static function parse_double_quoted_string($qstr) + { + $inner_str = substr($qstr, 1, strlen($qstr) - 2); + return stripcslashes($inner_str); + } + + /** + * parse triple quoted string + * + * @param string $qstr + * + * @return string + */ + private static function parse_tripple_double_quoted_string($qstr) + { + return stripcslashes($qstr); + } + + /** + * set a config variable in target array + * + * @param array $var + * @param array $target_array + */ + private function set_var(array $var, array &$target_array) + { + $key = $var['key']; + $value = $var['value']; + + if ($this->configOverwrite || !isset($target_array['vars'][$key])) { + $target_array['vars'][$key] = $value; + } else { + settype($target_array['vars'][$key], 'array'); + $target_array['vars'][$key][] = $value; + } + } + + /** + * add config variable to global vars + * + * @param array $vars + */ + private function add_global_vars(array $vars) + { + if (!isset($this->compiler->config_data['vars'])) { + $this->compiler->config_data['vars'] = array(); + } + foreach ($vars as $var) { + $this->set_var($var, $this->compiler->config_data); + } + } + + /** + * add config variable to section + * + * @param string $section_name + * @param array $vars + */ + private function add_section_vars($section_name, array $vars) + { + if (!isset($this->compiler->config_data['sections'][$section_name]['vars'])) { + $this->compiler->config_data['sections'][$section_name]['vars'] = array(); + } + foreach ($vars as $var) { + $this->set_var($var, $this->compiler->config_data['sections'][$section_name]); + } + } + + const TPC_OPENB = 1; + const TPC_SECTION = 2; + const TPC_CLOSEB = 3; + const TPC_DOT = 4; + const TPC_ID = 5; + const TPC_EQUAL = 6; + const TPC_FLOAT = 7; + const TPC_INT = 8; + const TPC_BOOL = 9; + const TPC_SINGLE_QUOTED_STRING = 10; + const TPC_DOUBLE_QUOTED_STRING = 11; + const TPC_TRIPPLE_QUOTES = 12; + const TPC_TRIPPLE_TEXT = 13; + const TPC_TRIPPLE_QUOTES_END = 14; + const TPC_NAKED_STRING = 15; + const TPC_OTHER = 16; + const TPC_NEWLINE = 17; + const TPC_COMMENTSTART = 18; + const YY_NO_ACTION = 60; + const YY_ACCEPT_ACTION = 59; + const YY_ERROR_ACTION = 58; + + const YY_SZ_ACTTAB = 39; +public static $yy_action = array( + 24, 25, 26, 27, 28, 12, 15, 23, 31, 32, + 59, 8, 9, 3, 21, 22, 33, 13, 33, 13, + 14, 10, 18, 16, 30, 11, 17, 20, 34, 7, + 5, 1, 2, 29, 4, 19, 52, 35, 6, + ); + public static $yy_lookahead = array( + 7, 8, 9, 10, 11, 12, 5, 27, 15, 16, + 20, 21, 25, 23, 25, 26, 17, 18, 17, 18, + 2, 25, 4, 13, 14, 1, 15, 24, 17, 22, + 3, 23, 23, 14, 6, 2, 28, 17, 3, +); + const YY_SHIFT_USE_DFLT = -8; + const YY_SHIFT_MAX = 19; + public static $yy_shift_ofst = array( + -8, 1, 1, 1, -7, -1, -1, 24, -8, -8, + -8, 18, 10, 11, 27, 28, 19, 20, 33, 35, +); + const YY_REDUCE_USE_DFLT = -21; + const YY_REDUCE_MAX = 10; + public static $yy_reduce_ofst = array( + -10, -11, -11, -11, -20, -13, -4, 3, 7, 8, + 9, +); + public static $yyExpectedTokens = array( + array(), + array(5, 17, 18, ), + array(5, 17, 18, ), + array(5, 17, 18, ), + array(7, 8, 9, 10, 11, 12, 15, 16, ), + array(17, 18, ), + array(17, 18, ), + array(1, ), + array(), + array(), + array(), + array(2, 4, ), + array(13, 14, ), + array(15, 17, ), + array(3, ), + array(6, ), + array(14, ), + array(17, ), + array(2, ), + array(3, ), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), +); + public static $yy_default = array( + 44, 40, 41, 37, 58, 58, 58, 36, 39, 44, + 44, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 38, 42, 43, 45, 46, 47, 48, 49, 50, 51, + 52, 53, 54, 55, 56, 57, +); + const YYNOCODE = 29; + const YYSTACKDEPTH = 100; + const YYNSTATE = 36; + const YYNRULE = 22; + const YYERRORSYMBOL = 19; + const YYERRSYMDT = 'yy0'; + const YYFALLBACK = 0; + public static $yyFallback = array( + ); + public function Trace($TraceFILE, $zTracePrompt) + { + if (!$TraceFILE) { + $zTracePrompt = 0; + } elseif (!$zTracePrompt) { + $TraceFILE = 0; + } + $this->yyTraceFILE = $TraceFILE; + $this->yyTracePrompt = $zTracePrompt; + } + + public function PrintTrace() + { + $this->yyTraceFILE = fopen('php://output', 'w'); + $this->yyTracePrompt = '
'; + } + + public $yyTraceFILE; + public $yyTracePrompt; + public $yyidx; /* Index of top element in stack */ + public $yyerrcnt; /* Shifts left before out of the error */ + public $yystack = array(); /* The parser's stack */ + + public $yyTokenName = array( + '$', 'OPENB', 'SECTION', 'CLOSEB', + 'DOT', 'ID', 'EQUAL', 'FLOAT', + 'INT', 'BOOL', 'SINGLE_QUOTED_STRING', 'DOUBLE_QUOTED_STRING', + 'TRIPPLE_QUOTES', 'TRIPPLE_TEXT', 'TRIPPLE_QUOTES_END', 'NAKED_STRING', + 'OTHER', 'NEWLINE', 'COMMENTSTART', 'error', + 'start', 'global_vars', 'sections', 'var_list', + 'section', 'newline', 'var', 'value', + ); + + public static $yyRuleName = array( + 'start ::= global_vars sections', + 'global_vars ::= var_list', + 'sections ::= sections section', + 'sections ::=', + 'section ::= OPENB SECTION CLOSEB newline var_list', + 'section ::= OPENB DOT SECTION CLOSEB newline var_list', + 'var_list ::= var_list newline', + 'var_list ::= var_list var', + 'var_list ::=', + 'var ::= ID EQUAL value', + 'value ::= FLOAT', + 'value ::= INT', + 'value ::= BOOL', + 'value ::= SINGLE_QUOTED_STRING', + 'value ::= DOUBLE_QUOTED_STRING', + 'value ::= TRIPPLE_QUOTES TRIPPLE_TEXT TRIPPLE_QUOTES_END', + 'value ::= TRIPPLE_QUOTES TRIPPLE_QUOTES_END', + 'value ::= NAKED_STRING', + 'value ::= OTHER', + 'newline ::= NEWLINE', + 'newline ::= COMMENTSTART NEWLINE', + 'newline ::= COMMENTSTART NAKED_STRING NEWLINE', + ); + + public function tokenName($tokenType) + { + if ($tokenType === 0) { + return 'End of Input'; + } + if ($tokenType > 0 && $tokenType < count($this->yyTokenName)) { + return $this->yyTokenName[$tokenType]; + } else { + return 'Unknown'; + } + } + + public static function yy_destructor($yymajor, $yypminor) + { + switch ($yymajor) { + default: break; /* If no destructor action specified: do nothing */ + } + } + + public function yy_pop_parser_stack() + { + if (empty($this->yystack)) { + return; + } + $yytos = array_pop($this->yystack); + if ($this->yyTraceFILE && $this->yyidx >= 0) { + fwrite($this->yyTraceFILE, + $this->yyTracePrompt . 'Popping ' . $this->yyTokenName[$yytos->major] . + "\n"); + } + $yymajor = $yytos->major; + self::yy_destructor($yymajor, $yytos->minor); + $this->yyidx--; + + return $yymajor; + } + + public function __destruct() + { + while ($this->yystack !== Array()) { + $this->yy_pop_parser_stack(); + } + if (is_resource($this->yyTraceFILE)) { + fclose($this->yyTraceFILE); + } + } + + public function yy_get_expected_tokens($token) + { + static $res3 = array(); + static $res4 = array(); + $state = $this->yystack[$this->yyidx]->stateno; + $expected = self::$yyExpectedTokens[$state]; + if (isset($res3[$state][$token])) { + if ($res3[$state][$token]) { + return $expected; + } + } else { + if ($res3[$state][$token] = in_array($token, self::$yyExpectedTokens[$state], true)) { + return $expected; + } + } + $stack = $this->yystack; + $yyidx = $this->yyidx; + do { + $yyact = $this->yy_find_shift_action($token); + if ($yyact >= self::YYNSTATE && $yyact < self::YYNSTATE + self::YYNRULE) { + // reduce action + $done = 0; + do { + if ($done++ === 100) { + $this->yyidx = $yyidx; + $this->yystack = $stack; + // too much recursion prevents proper detection + // so give up + return array_unique($expected); + } + $yyruleno = $yyact - self::YYNSTATE; + $this->yyidx -= self::$yyRuleInfo[$yyruleno][1]; + $nextstate = $this->yy_find_reduce_action( + $this->yystack[$this->yyidx]->stateno, + self::$yyRuleInfo[$yyruleno][0]); + if (isset(self::$yyExpectedTokens[$nextstate])) { + $expected = array_merge($expected, self::$yyExpectedTokens[$nextstate]); + if (isset($res4[$nextstate][$token])) { + if ($res4[$nextstate][$token]) { + $this->yyidx = $yyidx; + $this->yystack = $stack; + return array_unique($expected); + } + } else { + if ($res4[$nextstate][$token] = in_array($token, self::$yyExpectedTokens[$nextstate], true)) { + $this->yyidx = $yyidx; + $this->yystack = $stack; + return array_unique($expected); + } + } + } + if ($nextstate < self::YYNSTATE) { + // we need to shift a non-terminal + $this->yyidx++; + $x = (object) ['stateno' => null, 'major' => null, 'minor' => null]; + $x->stateno = $nextstate; + $x->major = self::$yyRuleInfo[$yyruleno][0]; + $this->yystack[$this->yyidx] = $x; + continue 2; + } elseif ($nextstate === self::YYNSTATE + self::YYNRULE + 1) { + $this->yyidx = $yyidx; + $this->yystack = $stack; + // the last token was just ignored, we can't accept + // by ignoring input, this is in essence ignoring a + // syntax error! + return array_unique($expected); + } elseif ($nextstate === self::YY_NO_ACTION) { + $this->yyidx = $yyidx; + $this->yystack = $stack; + // input accepted, but not shifted (I guess) + return $expected; + } else { + $yyact = $nextstate; + } + } while (true); + } + break; + } while (true); + $this->yyidx = $yyidx; + $this->yystack = $stack; + + return array_unique($expected); + } + + public function yy_is_expected_token($token) + { + static $res = array(); + static $res2 = array(); + if ($token === 0) { + return true; // 0 is not part of this + } + $state = $this->yystack[$this->yyidx]->stateno; + if (isset($res[$state][$token])) { + if ($res[$state][$token]) { + return true; + } + } else { + if ($res[$state][$token] = in_array($token, self::$yyExpectedTokens[$state], true)) { + return true; + } + } + $stack = $this->yystack; + $yyidx = $this->yyidx; + do { + $yyact = $this->yy_find_shift_action($token); + if ($yyact >= self::YYNSTATE && $yyact < self::YYNSTATE + self::YYNRULE) { + // reduce action + $done = 0; + do { + if ($done++ === 100) { + $this->yyidx = $yyidx; + $this->yystack = $stack; + // too much recursion prevents proper detection + // so give up + return true; + } + $yyruleno = $yyact - self::YYNSTATE; + $this->yyidx -= self::$yyRuleInfo[$yyruleno][1]; + $nextstate = $this->yy_find_reduce_action( + $this->yystack[$this->yyidx]->stateno, + self::$yyRuleInfo[$yyruleno][0]); + if (isset($res2[$nextstate][$token])) { + if ($res2[$nextstate][$token]) { + $this->yyidx = $yyidx; + $this->yystack = $stack; + return true; + } + } else { + if ($res2[$nextstate][$token] = (isset(self::$yyExpectedTokens[$nextstate]) && in_array($token, self::$yyExpectedTokens[$nextstate], true))) { + $this->yyidx = $yyidx; + $this->yystack = $stack; + return true; + } + } + if ($nextstate < self::YYNSTATE) { + // we need to shift a non-terminal + $this->yyidx++; + $x = (object) ['stateno' => null, 'major' => null, 'minor' => null]; + $x->stateno = $nextstate; + $x->major = self::$yyRuleInfo[$yyruleno][0]; + $this->yystack[$this->yyidx] = $x; + continue 2; + } elseif ($nextstate === self::YYNSTATE + self::YYNRULE + 1) { + $this->yyidx = $yyidx; + $this->yystack = $stack; + if (!$token) { + // end of input: this is valid + return true; + } + // the last token was just ignored, we can't accept + // by ignoring input, this is in essence ignoring a + // syntax error! + return false; + } elseif ($nextstate === self::YY_NO_ACTION) { + $this->yyidx = $yyidx; + $this->yystack = $stack; + // input accepted, but not shifted (I guess) + return true; + } else { + $yyact = $nextstate; + } + } while (true); + } + break; + } while (true); + $this->yyidx = $yyidx; + $this->yystack = $stack; + + return true; + } + + public function yy_find_shift_action($iLookAhead) + { + $stateno = $this->yystack[$this->yyidx]->stateno; + + /* if ($this->yyidx < 0) return self::YY_NO_ACTION; */ + if (!isset(self::$yy_shift_ofst[$stateno])) { + // no shift actions + return self::$yy_default[$stateno]; + } + $i = self::$yy_shift_ofst[$stateno]; + if ($i === self::YY_SHIFT_USE_DFLT) { + return self::$yy_default[$stateno]; + } + if ($iLookAhead === self::YYNOCODE) { + return self::YY_NO_ACTION; + } + $i += $iLookAhead; + if ($i < 0 || $i >= self::YY_SZ_ACTTAB || + self::$yy_lookahead[$i] != $iLookAhead) { + if (count(self::$yyFallback) && $iLookAhead < count(self::$yyFallback) + && ($iFallback = self::$yyFallback[$iLookAhead]) != 0) { + if ($this->yyTraceFILE) { + fwrite($this->yyTraceFILE, $this->yyTracePrompt . 'FALLBACK ' . + $this->yyTokenName[$iLookAhead] . ' => ' . + $this->yyTokenName[$iFallback] . "\n"); + } + + return $this->yy_find_shift_action($iFallback); + } + + return self::$yy_default[$stateno]; + } else { + return self::$yy_action[$i]; + } + } + + public function yy_find_reduce_action($stateno, $iLookAhead) + { + /* $stateno = $this->yystack[$this->yyidx]->stateno; */ + + if (!isset(self::$yy_reduce_ofst[$stateno])) { + return self::$yy_default[$stateno]; + } + $i = self::$yy_reduce_ofst[$stateno]; + if ($i === self::YY_REDUCE_USE_DFLT) { + return self::$yy_default[$stateno]; + } + if ($iLookAhead === self::YYNOCODE) { + return self::YY_NO_ACTION; + } + $i += $iLookAhead; + if ($i < 0 || $i >= self::YY_SZ_ACTTAB || + self::$yy_lookahead[$i] != $iLookAhead) { + return self::$yy_default[$stateno]; + } else { + return self::$yy_action[$i]; + } + } + + public function yy_shift($yyNewState, $yyMajor, $yypMinor) + { + $this->yyidx++; + if ($this->yyidx >= self::YYSTACKDEPTH) { + $this->yyidx--; + if ($this->yyTraceFILE) { + fprintf($this->yyTraceFILE, "%sStack Overflow!\n", $this->yyTracePrompt); + } + while ($this->yyidx >= 0) { + $this->yy_pop_parser_stack(); + } +// line 245 "src/Parser/ConfigfileParser.y" + + $this->internalError = true; + $this->compiler->trigger_config_file_error('Stack overflow in configfile parser'); + + return; + } + $yytos = (object) ['stateno' => null, 'major' => null, 'minor' => null]; + $yytos->stateno = $yyNewState; + $yytos->major = $yyMajor; + $yytos->minor = $yypMinor; + $this->yystack[] = $yytos; + if ($this->yyTraceFILE && $this->yyidx > 0) { + fprintf($this->yyTraceFILE, "%sShift %d\n", $this->yyTracePrompt, + $yyNewState); + fprintf($this->yyTraceFILE, "%sStack:", $this->yyTracePrompt); + for ($i = 1; $i <= $this->yyidx; $i++) { + fprintf($this->yyTraceFILE, " %s", + $this->yyTokenName[$this->yystack[$i]->major]); + } + fwrite($this->yyTraceFILE,"\n"); + } + } + + public static $yyRuleInfo = array( + array( 0 => 20, 1 => 2 ), + array( 0 => 21, 1 => 1 ), + array( 0 => 22, 1 => 2 ), + array( 0 => 22, 1 => 0 ), + array( 0 => 24, 1 => 5 ), + array( 0 => 24, 1 => 6 ), + array( 0 => 23, 1 => 2 ), + array( 0 => 23, 1 => 2 ), + array( 0 => 23, 1 => 0 ), + array( 0 => 26, 1 => 3 ), + array( 0 => 27, 1 => 1 ), + array( 0 => 27, 1 => 1 ), + array( 0 => 27, 1 => 1 ), + array( 0 => 27, 1 => 1 ), + array( 0 => 27, 1 => 1 ), + array( 0 => 27, 1 => 3 ), + array( 0 => 27, 1 => 2 ), + array( 0 => 27, 1 => 1 ), + array( 0 => 27, 1 => 1 ), + array( 0 => 25, 1 => 1 ), + array( 0 => 25, 1 => 2 ), + array( 0 => 25, 1 => 3 ), + ); + + public static $yyReduceMap = array( + 0 => 0, + 2 => 0, + 3 => 0, + 19 => 0, + 20 => 0, + 21 => 0, + 1 => 1, + 4 => 4, + 5 => 5, + 6 => 6, + 7 => 7, + 8 => 8, + 9 => 9, + 10 => 10, + 11 => 11, + 12 => 12, + 13 => 13, + 14 => 14, + 15 => 15, + 16 => 16, + 17 => 17, + 18 => 17, + ); +// line 251 "src/Parser/ConfigfileParser.y" + public function yy_r0(){ + $this->_retvalue = null; + } +// line 256 "src/Parser/ConfigfileParser.y" + public function yy_r1(){ + $this->add_global_vars($this->yystack[$this->yyidx + 0]->minor); + $this->_retvalue = null; + } +// line 270 "src/Parser/ConfigfileParser.y" + public function yy_r4(){ + $this->add_section_vars($this->yystack[$this->yyidx + -3]->minor, $this->yystack[$this->yyidx + 0]->minor); + $this->_retvalue = null; + } +// line 275 "src/Parser/ConfigfileParser.y" + public function yy_r5(){ + if ($this->configReadHidden) { + $this->add_section_vars($this->yystack[$this->yyidx + -3]->minor, $this->yystack[$this->yyidx + 0]->minor); + } + $this->_retvalue = null; + } +// line 283 "src/Parser/ConfigfileParser.y" + public function yy_r6(){ + $this->_retvalue = $this->yystack[$this->yyidx + -1]->minor; + } +// line 287 "src/Parser/ConfigfileParser.y" + public function yy_r7(){ + $this->_retvalue = array_merge($this->yystack[$this->yyidx + -1]->minor, array($this->yystack[$this->yyidx + 0]->minor)); + } +// line 291 "src/Parser/ConfigfileParser.y" + public function yy_r8(){ + $this->_retvalue = array(); + } +// line 297 "src/Parser/ConfigfileParser.y" + public function yy_r9(){ + $this->_retvalue = array('key' => $this->yystack[$this->yyidx + -2]->minor, 'value' => $this->yystack[$this->yyidx + 0]->minor); + } +// line 302 "src/Parser/ConfigfileParser.y" + public function yy_r10(){ + $this->_retvalue = (float) $this->yystack[$this->yyidx + 0]->minor; + } +// line 306 "src/Parser/ConfigfileParser.y" + public function yy_r11(){ + $this->_retvalue = (int) $this->yystack[$this->yyidx + 0]->minor; + } +// line 310 "src/Parser/ConfigfileParser.y" + public function yy_r12(){ + $this->_retvalue = $this->parse_bool($this->yystack[$this->yyidx + 0]->minor); + } +// line 314 "src/Parser/ConfigfileParser.y" + public function yy_r13(){ + $this->_retvalue = self::parse_single_quoted_string($this->yystack[$this->yyidx + 0]->minor); + } +// line 318 "src/Parser/ConfigfileParser.y" + public function yy_r14(){ + $this->_retvalue = self::parse_double_quoted_string($this->yystack[$this->yyidx + 0]->minor); + } +// line 322 "src/Parser/ConfigfileParser.y" + public function yy_r15(){ + $this->_retvalue = self::parse_tripple_double_quoted_string($this->yystack[$this->yyidx + -1]->minor); + } +// line 326 "src/Parser/ConfigfileParser.y" + public function yy_r16(){ + $this->_retvalue = ''; + } +// line 330 "src/Parser/ConfigfileParser.y" + public function yy_r17(){ + $this->_retvalue = $this->yystack[$this->yyidx + 0]->minor; + } + + private $_retvalue; + + public function yy_reduce($yyruleno) + { + if ($this->yyTraceFILE && $yyruleno >= 0 + && $yyruleno < count(self::$yyRuleName)) { + fprintf($this->yyTraceFILE, "%sReduce (%d) [%s].\n", + $this->yyTracePrompt, $yyruleno, + self::$yyRuleName[$yyruleno]); + } + + $this->_retvalue = $yy_lefthand_side = null; + if (isset(self::$yyReduceMap[$yyruleno])) { + // call the action + $this->_retvalue = null; + $this->{'yy_r' . self::$yyReduceMap[$yyruleno]}(); + $yy_lefthand_side = $this->_retvalue; + } + $yygoto = self::$yyRuleInfo[$yyruleno][0]; + $yysize = self::$yyRuleInfo[$yyruleno][1]; + $this->yyidx -= $yysize; + for ($i = $yysize; $i; $i--) { + // pop all of the right-hand side parameters + array_pop($this->yystack); + } + $yyact = $this->yy_find_reduce_action($this->yystack[$this->yyidx]->stateno, $yygoto); + if ($yyact < self::YYNSTATE) { + if (!$this->yyTraceFILE && $yysize) { + $this->yyidx++; + $x = (object) ['stateno' => null, 'major' => null, 'minor' => null]; + $x->stateno = $yyact; + $x->major = $yygoto; + $x->minor = $yy_lefthand_side; + $this->yystack[$this->yyidx] = $x; + } else { + $this->yy_shift($yyact, $yygoto, $yy_lefthand_side); + } + } elseif ($yyact === self::YYNSTATE + self::YYNRULE + 1) { + $this->yy_accept(); + } + } + + public function yy_parse_failed() + { + if ($this->yyTraceFILE) { + fprintf($this->yyTraceFILE, "%sFail!\n", $this->yyTracePrompt); + } while ($this->yyidx >= 0) { + $this->yy_pop_parser_stack(); + } + } + + public function yy_syntax_error($yymajor, $TOKEN) + { +// line 238 "src/Parser/ConfigfileParser.y" + + $this->internalError = true; + $this->yymajor = $yymajor; + $this->compiler->trigger_config_file_error(); + } + + public function yy_accept() + { + if ($this->yyTraceFILE) { + fprintf($this->yyTraceFILE, "%sAccept!\n", $this->yyTracePrompt); + } while ($this->yyidx >= 0) { + $this->yy_pop_parser_stack(); + } +// line 231 "src/Parser/ConfigfileParser.y" + + $this->successful = !$this->internalError; + $this->internalError = false; + $this->retvalue = $this->_retvalue; + } + + public function doParse($yymajor, $yytokenvalue) + { + $yyerrorhit = 0; /* True if yymajor has invoked an error */ + + if ($this->yyidx === null || $this->yyidx < 0) { + $this->yyidx = 0; + $this->yyerrcnt = -1; + $x = (object) ['stateno' => null, 'major' => null, 'minor' => null]; + $x->stateno = 0; + $x->major = 0; + $this->yystack = array(); + $this->yystack[] = $x; + } + $yyendofinput = ($yymajor==0); + + if ($this->yyTraceFILE) { + fprintf($this->yyTraceFILE, "%sInput %s\n", + $this->yyTracePrompt, $this->yyTokenName[$yymajor]); + } + + do { + $yyact = $this->yy_find_shift_action($yymajor); + if ($yymajor < self::YYERRORSYMBOL && + !$this->yy_is_expected_token($yymajor)) { + // force a syntax error + $yyact = self::YY_ERROR_ACTION; + } + if ($yyact < self::YYNSTATE) { + $this->yy_shift($yyact, $yymajor, $yytokenvalue); + $this->yyerrcnt--; + if ($yyendofinput && $this->yyidx >= 0) { + $yymajor = 0; + } else { + $yymajor = self::YYNOCODE; + } + } elseif ($yyact < self::YYNSTATE + self::YYNRULE) { + $this->yy_reduce($yyact - self::YYNSTATE); + } elseif ($yyact === self::YY_ERROR_ACTION) { + if ($this->yyTraceFILE) { + fprintf($this->yyTraceFILE, "%sSyntax Error!\n", + $this->yyTracePrompt); + } + if (self::YYERRORSYMBOL) { + if ($this->yyerrcnt < 0) { + $this->yy_syntax_error($yymajor, $yytokenvalue); + } + $yymx = $this->yystack[$this->yyidx]->major; + if ($yymx === self::YYERRORSYMBOL || $yyerrorhit) { + if ($this->yyTraceFILE) { + fprintf($this->yyTraceFILE, "%sDiscard input token %s\n", + $this->yyTracePrompt, $this->yyTokenName[$yymajor]); + } + $this->yy_destructor($yymajor, $yytokenvalue); + $yymajor = self::YYNOCODE; + } else { + while ($this->yyidx >= 0 && + $yymx !== self::YYERRORSYMBOL && + ($yyact = $this->yy_find_shift_action(self::YYERRORSYMBOL)) >= self::YYNSTATE + ){ + $this->yy_pop_parser_stack(); + } + if ($this->yyidx < 0 || $yymajor==0) { + $this->yy_destructor($yymajor, $yytokenvalue); + $this->yy_parse_failed(); + $yymajor = self::YYNOCODE; + } elseif ($yymx !== self::YYERRORSYMBOL) { + $u2 = 0; + $this->yy_shift($yyact, self::YYERRORSYMBOL, $u2); + } + } + $this->yyerrcnt = 3; + $yyerrorhit = 1; + } else { + if ($this->yyerrcnt <= 0) { + $this->yy_syntax_error($yymajor, $yytokenvalue); + } + $this->yyerrcnt = 3; + $this->yy_destructor($yymajor, $yytokenvalue); + if ($yyendofinput) { + $this->yy_parse_failed(); + } + $yymajor = self::YYNOCODE; + } + } else { + $this->yy_accept(); + $yymajor = self::YYNOCODE; + } + } while ($yymajor !== self::YYNOCODE && $this->yyidx >= 0); + } +} + diff --git a/src/Parser/TemplateParser.php b/src/Parser/TemplateParser.php new file mode 100644 index 00000000..7ae1bb3d --- /dev/null +++ b/src/Parser/TemplateParser.php @@ -0,0 +1,2930 @@ + +*/ +class TemplateParser +{ +// line 35 "src/Parser/TemplateParser.y" + + const ERR1 = 'Security error: Call to private object member not allowed'; + const ERR2 = 'Security error: Call to dynamic object member not allowed'; + + /** + * result status + * + * @var bool + */ + public $successful = true; + + /** + * return value + * + * @var mixed + */ + public $retvalue = 0; + + /** + * @var + */ + public $yymajor; + + /** + * last index of array variable + * + * @var mixed + */ + public $last_index; + + /** + * last variable name + * + * @var string + */ + public $last_variable; + + /** + * root parse tree buffer + * + * @var TemplateParseTree + */ + public $root_buffer; + + /** + * current parse tree object + * + * @var \Smarty\ParseTree\Base + */ + public $current_buffer; + + /** + * lexer object + * + * @var Lexer + */ + public $lex; + + /** + * internal error flag + * + * @var bool + */ + private $internalError = false; + + /** + * {strip} status + * + * @var bool + */ + public $strip = false; + /** + * compiler object + * + * @var TemplateCompiler + */ + public $compiler = null; + + /** + * smarty object + * + * @var \Smarty\Smarty + */ + public $smarty = null; + + /** + * template object + * + * @var \Smarty\Template + */ + public $template = null; + + /** + * block nesting level + * + * @var int + */ + public $block_nesting_level = 0; + + /** + * security object + * + * @var \Smarty\Security + */ + public $security = null; + + /** + * template prefix array + * + * @var \Smarty\ParseTree\Base[] + */ + public $template_prefix = array(); + + /** + * template prefix array + * + * @var \Smarty\ParseTree\Base[] + */ + public $template_postfix = array(); + + /** + * constructor + * + * @param Lexer $lex + * @param TemplateCompiler $compiler + */ + public function __construct(Lexer $lex, TemplateCompiler $compiler) + { + $this->lex = $lex; + $this->compiler = $compiler; + $this->template = $this->compiler->getTemplate(); + $this->smarty = $this->template->getSmarty(); + $this->security = $this->smarty->security_policy ?? false; + $this->current_buffer = $this->root_buffer = new TemplateParseTree(); + } + + /** + * insert PHP code in current buffer + * + * @param string $code + */ + public function insertPhpCode($code) + { + $this->current_buffer->append_subtree($this, new Tag($this, $code)); + } + + /** + * error rundown + * + */ + public function errorRunDown() + { + while ($this->yystack !== array()) { + $this->yy_pop_parser_stack(); + } + if (is_resource($this->yyTraceFILE)) { + fclose($this->yyTraceFILE); + } + } + + /** + * merge PHP code with prefix code and return parse tree tag object + * + * @param string $code + * + * @return Tag + */ + private function mergePrefixCode($code) + { + $tmp = ''; + foreach ($this->compiler->prefix_code as $preCode) { + $tmp .= $preCode; + } + $this->compiler->prefix_code = array(); + $tmp .= $code; + return new Tag($this, $this->compiler->processNocacheCode($tmp)); + } + + + const TP_VERT = 1; + const TP_COLON = 2; + const TP_TEXT = 3; + const TP_STRIPON = 4; + const TP_STRIPOFF = 5; + const TP_LITERALSTART = 6; + const TP_LITERALEND = 7; + const TP_LITERAL = 8; + const TP_SIMPELOUTPUT = 9; + const TP_SIMPLETAG = 10; + const TP_SMARTYBLOCKCHILDPARENT = 11; + const TP_LDEL = 12; + const TP_RDEL = 13; + const TP_DOLLARID = 14; + const TP_EQUAL = 15; + const TP_ID = 16; + const TP_PTR = 17; + const TP_LDELIF = 18; + const TP_LDELFOR = 19; + const TP_SEMICOLON = 20; + const TP_INCDEC = 21; + const TP_TO = 22; + const TP_STEP = 23; + const TP_LDELFOREACH = 24; + const TP_SPACE = 25; + const TP_AS = 26; + const TP_APTR = 27; + const TP_LDELSETFILTER = 28; + const TP_CLOSETAG = 29; + const TP_LDELSLASH = 30; + const TP_ATTR = 31; + const TP_INTEGER = 32; + const TP_COMMA = 33; + const TP_OPENP = 34; + const TP_CLOSEP = 35; + const TP_MATH = 36; + const TP_UNIMATH = 37; + const TP_ISIN = 38; + const TP_QMARK = 39; + const TP_NOT = 40; + const TP_TYPECAST = 41; + const TP_HEX = 42; + const TP_DOT = 43; + const TP_INSTANCEOF = 44; + const TP_SINGLEQUOTESTRING = 45; + const TP_DOUBLECOLON = 46; + const TP_NAMESPACE = 47; + const TP_AT = 48; + const TP_HATCH = 49; + const TP_OPENB = 50; + const TP_CLOSEB = 51; + const TP_DOLLAR = 52; + const TP_LOGOP = 53; + const TP_SLOGOP = 54; + const TP_TLOGOP = 55; + const TP_SINGLECOND = 56; + const TP_ARRAYOPEN = 57; + const TP_QUOTE = 58; + const TP_BACKTICK = 59; + const YY_NO_ACTION = 516; + const YY_ACCEPT_ACTION = 515; + const YY_ERROR_ACTION = 514; + + const YY_SZ_ACTTAB = 1963; +public static $yy_action = array( + 238, 239, 240, 1, 302, 127, 206, 185, 99, 6, + 53, 237, 212, 206, 30, 105, 220, 387, 151, 207, + 252, 208, 274, 200, 387, 22, 387, 309, 41, 387, + 122, 42, 43, 268, 216, 387, 226, 387, 195, 387, + 52, 4, 315, 290, 55, 304, 95, 215, 5, 50, + 238, 239, 240, 1, 290, 93, 381, 51, 227, 6, + 53, 260, 212, 171, 293, 105, 515, 92, 381, 207, + 252, 208, 132, 214, 381, 22, 254, 428, 41, 12, + 192, 42, 43, 268, 216, 169, 272, 217, 195, 428, + 52, 4, 131, 290, 222, 44, 21, 275, 5, 50, + 238, 239, 240, 1, 160, 129, 135, 194, 209, 6, + 53, 3, 212, 95, 247, 105, 44, 21, 275, 207, + 252, 208, 302, 214, 206, 22, 90, 52, 41, 13, + 290, 42, 43, 268, 216, 14, 272, 95, 195, 27, + 52, 4, 108, 290, 290, 145, 428, 248, 5, 50, + 238, 239, 240, 1, 137, 129, 192, 186, 428, 6, + 53, 484, 212, 298, 247, 105, 44, 21, 275, 207, + 252, 208, 210, 214, 150, 22, 248, 279, 41, 147, + 192, 42, 43, 268, 216, 122, 272, 228, 195, 247, + 52, 4, 144, 290, 230, 191, 136, 100, 5, 50, + 238, 239, 240, 1, 161, 128, 247, 194, 175, 6, + 53, 34, 212, 95, 247, 105, 44, 21, 275, 207, + 252, 208, 173, 214, 236, 11, 170, 293, 41, 95, + 280, 42, 43, 268, 216, 146, 272, 133, 195, 87, + 52, 4, 108, 290, 121, 247, 192, 257, 5, 50, + 238, 239, 240, 1, 94, 129, 141, 181, 108, 6, + 53, 248, 212, 256, 176, 105, 247, 288, 292, 207, + 252, 208, 26, 203, 246, 22, 235, 236, 41, 15, + 248, 42, 43, 268, 216, 148, 272, 192, 195, 88, + 52, 4, 89, 290, 33, 247, 170, 293, 5, 50, + 238, 239, 240, 1, 19, 130, 184, 194, 262, 6, + 53, 13, 212, 104, 176, 105, 149, 14, 428, 207, + 252, 208, 441, 214, 263, 22, 247, 224, 41, 441, + 428, 42, 43, 268, 216, 312, 272, 143, 195, 175, + 52, 4, 163, 290, 290, 175, 294, 247, 5, 50, + 238, 239, 240, 1, 255, 129, 132, 179, 348, 6, + 53, 248, 212, 12, 348, 105, 138, 176, 251, 207, + 252, 208, 25, 214, 291, 22, 100, 49, 41, 192, + 37, 42, 43, 268, 216, 228, 272, 228, 195, 29, + 52, 4, 325, 290, 229, 100, 348, 100, 5, 50, + 238, 239, 240, 1, 255, 129, 441, 194, 348, 6, + 53, 7, 212, 441, 348, 105, 255, 244, 134, 207, + 252, 208, 168, 180, 17, 22, 260, 49, 41, 83, + 14, 42, 43, 268, 216, 9, 272, 305, 195, 49, + 52, 4, 144, 290, 39, 40, 38, 176, 5, 50, + 238, 239, 240, 1, 300, 131, 290, 194, 139, 6, + 53, 283, 284, 285, 286, 105, 159, 299, 247, 207, + 252, 208, 84, 214, 255, 20, 247, 162, 45, 172, + 293, 42, 43, 268, 216, 37, 272, 247, 195, 251, + 52, 4, 165, 290, 39, 40, 38, 49, 5, 50, + 238, 239, 240, 1, 310, 131, 428, 194, 322, 6, + 53, 283, 284, 285, 286, 105, 16, 176, 428, 207, + 252, 208, 324, 214, 152, 20, 204, 189, 41, 156, + 429, 42, 43, 268, 216, 289, 272, 166, 195, 158, + 52, 4, 429, 290, 121, 10, 290, 223, 5, 50, + 277, 205, 206, 243, 94, 86, 102, 109, 183, 96, + 82, 9, 176, 215, 25, 94, 316, 288, 264, 32, + 319, 311, 8, 271, 196, 273, 85, 278, 288, 308, + 91, 277, 205, 206, 243, 250, 86, 102, 18, 182, + 96, 62, 249, 39, 40, 38, 94, 215, 25, 264, + 317, 13, 164, 142, 271, 196, 273, 14, 278, 288, + 283, 284, 285, 286, 277, 190, 206, 245, 167, 107, + 102, 153, 183, 96, 82, 277, 154, 206, 234, 94, + 107, 241, 264, 193, 111, 74, 242, 271, 196, 273, + 94, 278, 288, 264, 192, 174, 255, 106, 271, 196, + 273, 250, 278, 288, 18, 253, 349, 277, 249, 206, + 113, 261, 107, 199, 307, 193, 111, 74, 349, 49, + 265, 267, 94, 215, 349, 264, 250, 23, 269, 18, + 271, 196, 273, 249, 278, 288, 270, 7, 287, 277, + 219, 206, 54, 225, 101, 198, 307, 193, 114, 47, + 277, 112, 206, 313, 94, 107, 155, 264, 193, 114, + 69, 157, 271, 196, 273, 94, 278, 288, 264, 250, + 314, 323, 18, 271, 196, 273, 249, 278, 288, 277, + 34, 206, 326, 250, 107, 202, 18, 193, 114, 69, + 249, 35, 296, 457, 94, 296, 457, 264, 296, 13, + 457, 296, 271, 196, 273, 14, 278, 288, 211, 36, + 277, 13, 206, 296, 197, 107, 296, 14, 193, 111, + 74, 296, 39, 40, 38, 94, 296, 131, 264, 258, + 296, 296, 457, 271, 196, 273, 296, 278, 288, 283, + 284, 285, 286, 277, 296, 206, 296, 457, 107, 306, + 457, 193, 114, 69, 457, 296, 296, 296, 94, 296, + 259, 264, 52, 296, 192, 290, 271, 196, 273, 296, + 278, 288, 277, 296, 206, 296, 383, 101, 201, 296, + 193, 114, 61, 296, 229, 296, 296, 94, 383, 296, + 264, 296, 296, 296, 383, 271, 196, 273, 296, 278, + 288, 303, 296, 296, 213, 296, 296, 238, 239, 240, + 2, 457, 301, 192, 457, 296, 6, 53, 457, 441, + 296, 296, 105, 266, 296, 352, 207, 252, 208, 221, + 296, 296, 296, 296, 296, 296, 296, 13, 296, 296, + 296, 296, 296, 14, 296, 441, 428, 296, 441, 296, + 457, 296, 441, 281, 296, 296, 296, 28, 428, 296, + 303, 296, 296, 213, 296, 296, 238, 239, 240, 2, + 457, 301, 192, 457, 296, 6, 53, 457, 441, 296, + 296, 105, 266, 296, 380, 207, 252, 208, 296, 296, + 296, 296, 296, 296, 296, 296, 380, 296, 296, 296, + 296, 296, 380, 296, 441, 296, 296, 441, 296, 457, + 296, 441, 296, 296, 296, 297, 28, 296, 296, 231, + 232, 233, 125, 296, 296, 238, 239, 240, 1, 296, + 13, 296, 296, 296, 6, 53, 14, 296, 296, 296, + 105, 39, 40, 38, 207, 252, 208, 277, 296, 206, + 296, 296, 107, 296, 296, 188, 110, 60, 283, 284, + 285, 286, 94, 296, 296, 264, 296, 296, 296, 296, + 271, 196, 273, 296, 278, 288, 296, 296, 296, 296, + 296, 296, 277, 296, 206, 296, 296, 107, 296, 296, + 193, 97, 81, 277, 296, 206, 296, 94, 107, 296, + 264, 193, 98, 80, 296, 271, 196, 273, 94, 278, + 288, 264, 296, 296, 296, 296, 271, 196, 273, 296, + 278, 288, 277, 296, 206, 296, 296, 107, 296, 296, + 193, 114, 56, 296, 296, 296, 296, 94, 296, 296, + 264, 296, 296, 296, 296, 271, 196, 273, 296, 278, + 288, 296, 296, 277, 296, 206, 296, 296, 107, 296, + 296, 193, 114, 68, 277, 296, 206, 296, 94, 107, + 296, 264, 193, 97, 57, 296, 271, 196, 273, 94, + 278, 288, 264, 296, 296, 296, 296, 271, 196, 273, + 296, 278, 288, 277, 296, 206, 296, 296, 107, 296, + 296, 193, 114, 67, 296, 296, 296, 296, 94, 296, + 296, 264, 296, 296, 296, 296, 271, 196, 273, 296, + 278, 288, 296, 296, 277, 296, 206, 296, 296, 107, + 296, 296, 193, 114, 58, 277, 296, 206, 296, 94, + 107, 296, 264, 193, 114, 59, 296, 271, 196, 273, + 94, 278, 288, 264, 296, 296, 296, 296, 271, 196, + 273, 296, 278, 288, 277, 296, 206, 296, 296, 107, + 296, 296, 193, 114, 70, 296, 296, 296, 296, 94, + 296, 296, 264, 296, 296, 296, 296, 271, 196, 273, + 296, 278, 288, 296, 296, 277, 296, 206, 296, 296, + 107, 296, 296, 193, 114, 61, 277, 296, 206, 296, + 94, 107, 296, 264, 193, 114, 66, 296, 271, 196, + 273, 94, 278, 288, 264, 296, 296, 296, 296, 271, + 196, 273, 296, 278, 288, 277, 296, 206, 296, 296, + 107, 296, 296, 193, 114, 71, 296, 296, 296, 296, + 94, 296, 296, 264, 296, 296, 296, 296, 271, 196, + 273, 296, 278, 288, 296, 296, 277, 296, 206, 296, + 296, 107, 296, 296, 193, 114, 72, 277, 296, 206, + 296, 94, 107, 296, 264, 193, 114, 73, 296, 271, + 196, 273, 94, 278, 288, 264, 296, 296, 296, 296, + 271, 196, 273, 296, 278, 288, 277, 296, 206, 296, + 296, 107, 296, 296, 193, 114, 75, 296, 296, 296, + 296, 94, 296, 296, 264, 296, 296, 296, 296, 271, + 196, 273, 296, 278, 288, 296, 296, 277, 296, 206, + 296, 296, 107, 296, 296, 187, 114, 63, 277, 296, + 206, 296, 94, 107, 296, 264, 193, 114, 64, 296, + 271, 196, 273, 94, 278, 288, 264, 296, 296, 296, + 296, 271, 196, 273, 296, 278, 288, 277, 296, 206, + 296, 296, 107, 296, 296, 193, 114, 65, 296, 296, + 296, 296, 94, 296, 296, 264, 296, 296, 296, 296, + 271, 196, 273, 296, 278, 288, 296, 296, 277, 296, + 206, 296, 296, 107, 296, 296, 193, 114, 76, 277, + 296, 206, 296, 94, 107, 296, 264, 193, 114, 77, + 296, 271, 196, 273, 94, 278, 288, 264, 296, 296, + 296, 296, 271, 196, 273, 296, 278, 288, 277, 296, + 206, 296, 296, 107, 296, 296, 193, 114, 78, 296, + 296, 296, 296, 94, 296, 296, 264, 296, 296, 296, + 296, 271, 196, 273, 296, 278, 288, 296, 296, 277, + 296, 206, 296, 296, 107, 296, 296, 193, 114, 79, + 277, 296, 206, 296, 94, 107, 296, 264, 193, 114, + 46, 296, 271, 196, 273, 94, 278, 288, 264, 296, + 296, 296, 296, 271, 196, 273, 24, 278, 288, 277, + 296, 206, 296, 457, 107, 296, 457, 193, 114, 48, + 457, 441, 296, 296, 94, 266, 296, 264, 296, 296, + 296, 296, 271, 196, 273, 296, 278, 288, 296, 296, + 277, 296, 206, 296, 296, 107, 296, 441, 193, 126, + 441, 277, 457, 206, 441, 94, 107, 296, 296, 193, + 120, 296, 320, 271, 196, 273, 94, 278, 288, 296, + 296, 296, 296, 276, 271, 196, 273, 213, 278, 288, + 277, 296, 206, 296, 457, 107, 296, 457, 193, 124, + 3, 457, 441, 296, 296, 94, 266, 296, 296, 296, + 296, 296, 296, 271, 196, 273, 296, 278, 288, 296, + 296, 277, 296, 206, 296, 296, 107, 296, 441, 193, + 115, 441, 277, 457, 206, 441, 94, 107, 296, 296, + 193, 116, 296, 296, 271, 196, 273, 94, 278, 288, + 296, 296, 296, 296, 296, 271, 196, 273, 213, 278, + 288, 277, 296, 206, 296, 457, 107, 296, 457, 193, + 117, 33, 457, 441, 296, 296, 94, 266, 296, 296, + 296, 296, 296, 296, 271, 196, 273, 296, 278, 288, + 296, 296, 277, 296, 206, 296, 296, 107, 296, 441, + 193, 118, 441, 277, 457, 206, 441, 94, 107, 296, + 395, 193, 119, 296, 296, 271, 196, 273, 94, 278, + 288, 296, 296, 296, 296, 296, 271, 196, 273, 296, + 278, 288, 277, 103, 206, 296, 296, 107, 296, 296, + 193, 123, 428, 296, 395, 395, 395, 94, 296, 39, + 40, 38, 296, 296, 428, 271, 196, 273, 296, 278, + 288, 395, 395, 395, 395, 296, 283, 284, 285, 286, + 296, 140, 296, 318, 39, 40, 38, 296, 296, 296, + 296, 39, 40, 38, 296, 296, 296, 39, 40, 38, + 296, 283, 284, 285, 286, 295, 296, 296, 283, 284, + 285, 286, 282, 296, 283, 284, 285, 286, 177, 218, + 39, 40, 38, 296, 296, 296, 178, 296, 39, 40, + 38, 321, 296, 296, 296, 296, 296, 283, 284, 285, + 286, 39, 40, 38, 31, 283, 284, 285, 286, 39, + 40, 38, 296, 296, 39, 40, 38, 296, 283, 284, + 285, 286, 296, 296, 296, 296, 283, 284, 285, 286, + 296, 283, 284, 285, 286, 296, 296, 296, 39, 40, + 38, 457, 296, 296, 457, 296, 296, 296, 457, 441, + 296, 296, 296, 296, 296, 283, 284, 285, 286, 296, + 296, 296, 296, 296, 296, 296, 296, 296, 296, 296, + 296, 296, 296, 296, 296, 441, 296, 296, 441, 296, + 457, 296, 441, + ); + public static $yy_lookahead = array( + 9, 10, 11, 12, 65, 14, 67, 16, 80, 18, + 19, 65, 21, 67, 12, 24, 14, 13, 16, 28, + 29, 30, 91, 32, 20, 34, 22, 99, 37, 25, + 99, 40, 41, 42, 43, 31, 45, 33, 47, 35, + 49, 50, 51, 52, 105, 106, 17, 43, 57, 58, + 9, 10, 11, 12, 52, 14, 13, 16, 15, 18, + 19, 95, 21, 97, 98, 24, 61, 62, 25, 28, + 29, 30, 43, 32, 31, 34, 16, 34, 37, 50, + 1, 40, 41, 42, 43, 14, 45, 16, 47, 46, + 49, 50, 14, 52, 16, 84, 85, 86, 57, 58, + 9, 10, 11, 12, 72, 14, 14, 16, 48, 18, + 19, 15, 21, 17, 82, 24, 84, 85, 86, 28, + 29, 30, 65, 32, 67, 34, 34, 49, 37, 25, + 52, 40, 41, 42, 43, 31, 45, 17, 47, 27, + 49, 50, 46, 52, 52, 94, 34, 96, 57, 58, + 9, 10, 11, 12, 72, 14, 1, 16, 46, 18, + 19, 1, 21, 106, 82, 24, 84, 85, 86, 28, + 29, 30, 17, 32, 94, 34, 96, 91, 37, 72, + 1, 40, 41, 42, 43, 99, 45, 70, 47, 82, + 49, 50, 94, 52, 77, 78, 72, 80, 57, 58, + 9, 10, 11, 12, 72, 14, 82, 16, 101, 18, + 19, 15, 21, 17, 82, 24, 84, 85, 86, 28, + 29, 30, 6, 32, 8, 34, 97, 98, 37, 17, + 51, 40, 41, 42, 43, 72, 45, 80, 47, 76, + 49, 50, 46, 52, 70, 82, 1, 73, 57, 58, + 9, 10, 11, 12, 80, 14, 72, 16, 46, 18, + 19, 96, 21, 89, 101, 24, 82, 93, 69, 28, + 29, 30, 27, 32, 82, 34, 7, 8, 37, 20, + 96, 40, 41, 42, 43, 72, 45, 1, 47, 76, + 49, 50, 33, 52, 15, 82, 97, 98, 57, 58, + 9, 10, 11, 12, 12, 14, 14, 16, 16, 18, + 19, 25, 21, 79, 101, 24, 72, 31, 34, 28, + 29, 30, 43, 32, 32, 34, 82, 43, 37, 50, + 46, 40, 41, 42, 43, 51, 45, 72, 47, 101, + 49, 50, 76, 52, 52, 101, 13, 82, 57, 58, + 9, 10, 11, 12, 21, 14, 43, 16, 25, 18, + 19, 96, 21, 50, 31, 24, 70, 101, 102, 28, + 29, 30, 33, 32, 35, 34, 80, 44, 37, 1, + 2, 40, 41, 42, 43, 70, 45, 70, 47, 12, + 49, 50, 77, 52, 77, 80, 13, 80, 57, 58, + 9, 10, 11, 12, 21, 14, 43, 16, 25, 18, + 19, 34, 21, 50, 31, 24, 21, 69, 14, 28, + 29, 30, 76, 32, 25, 34, 95, 44, 37, 80, + 31, 40, 41, 42, 43, 33, 45, 35, 47, 44, + 49, 50, 94, 52, 36, 37, 38, 101, 57, 58, + 9, 10, 11, 12, 59, 14, 52, 16, 72, 18, + 19, 53, 54, 55, 56, 24, 72, 59, 82, 28, + 29, 30, 80, 32, 21, 34, 82, 72, 37, 97, + 98, 40, 41, 42, 43, 2, 45, 82, 47, 102, + 49, 50, 76, 52, 36, 37, 38, 44, 57, 58, + 9, 10, 11, 12, 51, 14, 34, 16, 14, 18, + 19, 53, 54, 55, 56, 24, 15, 101, 46, 28, + 29, 30, 21, 32, 94, 34, 63, 64, 37, 94, + 34, 40, 41, 42, 43, 98, 45, 76, 47, 94, + 49, 50, 46, 52, 70, 34, 52, 73, 57, 58, + 65, 66, 67, 68, 80, 70, 71, 46, 73, 74, + 75, 33, 101, 43, 33, 80, 35, 93, 83, 15, + 13, 51, 34, 88, 89, 90, 94, 92, 93, 51, + 81, 65, 66, 67, 68, 9, 70, 71, 12, 73, + 74, 75, 16, 36, 37, 38, 80, 43, 33, 83, + 35, 25, 81, 27, 88, 89, 90, 31, 92, 93, + 53, 54, 55, 56, 65, 64, 67, 68, 81, 70, + 71, 94, 73, 74, 75, 65, 94, 67, 7, 80, + 70, 13, 83, 73, 74, 75, 13, 88, 89, 90, + 80, 92, 93, 83, 1, 16, 21, 16, 88, 89, + 90, 9, 92, 93, 12, 16, 13, 65, 16, 67, + 16, 16, 70, 103, 104, 73, 74, 75, 25, 44, + 14, 16, 80, 43, 31, 83, 9, 39, 32, 12, + 88, 89, 90, 16, 92, 93, 32, 34, 16, 65, + 48, 67, 16, 16, 70, 103, 104, 73, 74, 75, + 65, 77, 67, 51, 80, 70, 49, 83, 73, 74, + 75, 49, 88, 89, 90, 80, 92, 93, 83, 9, + 51, 16, 12, 88, 89, 90, 16, 92, 93, 65, + 15, 67, 35, 9, 70, 100, 12, 73, 74, 75, + 16, 22, 107, 9, 80, 107, 12, 83, 107, 25, + 16, 107, 88, 89, 90, 31, 92, 93, 48, 23, + 65, 25, 67, 107, 100, 70, 107, 31, 73, 74, + 75, 107, 36, 37, 38, 80, 107, 14, 83, 16, + 107, 107, 48, 88, 89, 90, 107, 92, 93, 53, + 54, 55, 56, 65, 107, 67, 107, 9, 70, 104, + 12, 73, 74, 75, 16, 107, 107, 107, 80, 107, + 47, 83, 49, 107, 1, 52, 88, 89, 90, 107, + 92, 93, 65, 107, 67, 107, 13, 70, 100, 107, + 73, 74, 75, 107, 77, 107, 107, 80, 25, 107, + 83, 107, 107, 107, 31, 88, 89, 90, 107, 92, + 93, 3, 107, 107, 2, 107, 107, 9, 10, 11, + 12, 9, 14, 1, 12, 107, 18, 19, 16, 17, + 107, 107, 24, 21, 107, 13, 28, 29, 30, 17, + 107, 107, 107, 107, 107, 107, 107, 25, 107, 107, + 107, 107, 107, 31, 107, 43, 34, 107, 46, 107, + 48, 107, 50, 51, 107, 107, 58, 59, 46, 107, + 3, 107, 107, 2, 107, 107, 9, 10, 11, 12, + 9, 14, 1, 12, 107, 18, 19, 16, 17, 107, + 107, 24, 21, 107, 13, 28, 29, 30, 107, 107, + 107, 107, 107, 107, 107, 107, 25, 107, 107, 107, + 107, 107, 31, 107, 43, 107, 107, 46, 107, 48, + 107, 50, 107, 107, 107, 58, 59, 107, 107, 3, + 4, 5, 6, 107, 107, 9, 10, 11, 12, 107, + 25, 107, 107, 107, 18, 19, 31, 107, 107, 107, + 24, 36, 37, 38, 28, 29, 30, 65, 107, 67, + 107, 107, 70, 107, 107, 73, 74, 75, 53, 54, + 55, 56, 80, 107, 107, 83, 107, 107, 107, 107, + 88, 89, 90, 107, 92, 93, 107, 107, 107, 107, + 107, 107, 65, 107, 67, 107, 107, 70, 107, 107, + 73, 74, 75, 65, 107, 67, 107, 80, 70, 107, + 83, 73, 74, 75, 107, 88, 89, 90, 80, 92, + 93, 83, 107, 107, 107, 107, 88, 89, 90, 107, + 92, 93, 65, 107, 67, 107, 107, 70, 107, 107, + 73, 74, 75, 107, 107, 107, 107, 80, 107, 107, + 83, 107, 107, 107, 107, 88, 89, 90, 107, 92, + 93, 107, 107, 65, 107, 67, 107, 107, 70, 107, + 107, 73, 74, 75, 65, 107, 67, 107, 80, 70, + 107, 83, 73, 74, 75, 107, 88, 89, 90, 80, + 92, 93, 83, 107, 107, 107, 107, 88, 89, 90, + 107, 92, 93, 65, 107, 67, 107, 107, 70, 107, + 107, 73, 74, 75, 107, 107, 107, 107, 80, 107, + 107, 83, 107, 107, 107, 107, 88, 89, 90, 107, + 92, 93, 107, 107, 65, 107, 67, 107, 107, 70, + 107, 107, 73, 74, 75, 65, 107, 67, 107, 80, + 70, 107, 83, 73, 74, 75, 107, 88, 89, 90, + 80, 92, 93, 83, 107, 107, 107, 107, 88, 89, + 90, 107, 92, 93, 65, 107, 67, 107, 107, 70, + 107, 107, 73, 74, 75, 107, 107, 107, 107, 80, + 107, 107, 83, 107, 107, 107, 107, 88, 89, 90, + 107, 92, 93, 107, 107, 65, 107, 67, 107, 107, + 70, 107, 107, 73, 74, 75, 65, 107, 67, 107, + 80, 70, 107, 83, 73, 74, 75, 107, 88, 89, + 90, 80, 92, 93, 83, 107, 107, 107, 107, 88, + 89, 90, 107, 92, 93, 65, 107, 67, 107, 107, + 70, 107, 107, 73, 74, 75, 107, 107, 107, 107, + 80, 107, 107, 83, 107, 107, 107, 107, 88, 89, + 90, 107, 92, 93, 107, 107, 65, 107, 67, 107, + 107, 70, 107, 107, 73, 74, 75, 65, 107, 67, + 107, 80, 70, 107, 83, 73, 74, 75, 107, 88, + 89, 90, 80, 92, 93, 83, 107, 107, 107, 107, + 88, 89, 90, 107, 92, 93, 65, 107, 67, 107, + 107, 70, 107, 107, 73, 74, 75, 107, 107, 107, + 107, 80, 107, 107, 83, 107, 107, 107, 107, 88, + 89, 90, 107, 92, 93, 107, 107, 65, 107, 67, + 107, 107, 70, 107, 107, 73, 74, 75, 65, 107, + 67, 107, 80, 70, 107, 83, 73, 74, 75, 107, + 88, 89, 90, 80, 92, 93, 83, 107, 107, 107, + 107, 88, 89, 90, 107, 92, 93, 65, 107, 67, + 107, 107, 70, 107, 107, 73, 74, 75, 107, 107, + 107, 107, 80, 107, 107, 83, 107, 107, 107, 107, + 88, 89, 90, 107, 92, 93, 107, 107, 65, 107, + 67, 107, 107, 70, 107, 107, 73, 74, 75, 65, + 107, 67, 107, 80, 70, 107, 83, 73, 74, 75, + 107, 88, 89, 90, 80, 92, 93, 83, 107, 107, + 107, 107, 88, 89, 90, 107, 92, 93, 65, 107, + 67, 107, 107, 70, 107, 107, 73, 74, 75, 107, + 107, 107, 107, 80, 107, 107, 83, 107, 107, 107, + 107, 88, 89, 90, 107, 92, 93, 107, 107, 65, + 107, 67, 107, 107, 70, 107, 107, 73, 74, 75, + 65, 107, 67, 107, 80, 70, 107, 83, 73, 74, + 75, 107, 88, 89, 90, 80, 92, 93, 83, 107, + 107, 107, 107, 88, 89, 90, 2, 92, 93, 65, + 107, 67, 107, 9, 70, 107, 12, 73, 74, 75, + 16, 17, 107, 107, 80, 21, 107, 83, 107, 107, + 107, 107, 88, 89, 90, 107, 92, 93, 107, 107, + 65, 107, 67, 107, 107, 70, 107, 43, 73, 74, + 46, 65, 48, 67, 50, 80, 70, 107, 107, 73, + 74, 107, 87, 88, 89, 90, 80, 92, 93, 107, + 107, 107, 107, 87, 88, 89, 90, 2, 92, 93, + 65, 107, 67, 107, 9, 70, 107, 12, 73, 74, + 15, 16, 17, 107, 107, 80, 21, 107, 107, 107, + 107, 107, 107, 88, 89, 90, 107, 92, 93, 107, + 107, 65, 107, 67, 107, 107, 70, 107, 43, 73, + 74, 46, 65, 48, 67, 50, 80, 70, 107, 107, + 73, 74, 107, 107, 88, 89, 90, 80, 92, 93, + 107, 107, 107, 107, 107, 88, 89, 90, 2, 92, + 93, 65, 107, 67, 107, 9, 70, 107, 12, 73, + 74, 15, 16, 17, 107, 107, 80, 21, 107, 107, + 107, 107, 107, 107, 88, 89, 90, 107, 92, 93, + 107, 107, 65, 107, 67, 107, 107, 70, 107, 43, + 73, 74, 46, 65, 48, 67, 50, 80, 70, 107, + 2, 73, 74, 107, 107, 88, 89, 90, 80, 92, + 93, 107, 107, 107, 107, 107, 88, 89, 90, 107, + 92, 93, 65, 20, 67, 107, 107, 70, 107, 107, + 73, 74, 34, 107, 36, 37, 38, 80, 107, 36, + 37, 38, 107, 107, 46, 88, 89, 90, 107, 92, + 93, 53, 54, 55, 56, 107, 53, 54, 55, 56, + 107, 26, 107, 35, 36, 37, 38, 107, 107, 107, + 107, 36, 37, 38, 107, 107, 107, 36, 37, 38, + 107, 53, 54, 55, 56, 13, 107, 107, 53, 54, + 55, 56, 51, 107, 53, 54, 55, 56, 13, 35, + 36, 37, 38, 107, 107, 107, 13, 107, 36, 37, + 38, 13, 107, 107, 107, 107, 107, 53, 54, 55, + 56, 36, 37, 38, 2, 53, 54, 55, 56, 36, + 37, 38, 107, 107, 36, 37, 38, 107, 53, 54, + 55, 56, 107, 107, 107, 107, 53, 54, 55, 56, + 107, 53, 54, 55, 56, 107, 107, 107, 36, 37, + 38, 9, 107, 107, 12, 107, 107, 107, 16, 17, + 107, 107, 107, 107, 107, 53, 54, 55, 56, 107, + 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, + 107, 107, 107, 107, 107, 43, 107, 107, 46, 107, + 48, 107, 50, +); + const YY_SHIFT_USE_DFLT = -10; + const YY_SHIFT_MAX = 230; + public static $yy_shift_ofst = array( + -10, 41, 41, 91, 141, 141, 191, 91, 91, 141, + 91, 191, -9, 241, 91, 91, 91, 241, 91, 91, + 91, 91, 91, 291, 341, 91, 91, 91, 91, 91, + 91, 91, 91, 391, 91, 91, 91, 441, 491, 491, + 491, 491, 491, 491, 491, 491, 736, 955, 955, 763, + 848, 862, 78, 92, 286, 907, 1763, 1795, 557, 1788, + 1801, 1824, 1832, 408, 1845, 1853, 1882, 1858, 458, 458, + 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, + 458, 458, 458, 576, 724, 29, 96, 286, 286, 92, + 92, 378, 966, 1635, 642, 2, 643, 813, 921, 667, + 667, 196, 104, 404, 104, 399, 155, 212, 71, 71, + 179, 245, 104, 79, 79, 79, 79, 79, 79, 79, + 79, 120, 120, 160, 79, -10, -10, 852, 1706, 911, + 1564, 1912, 292, 710, 788, 279, 104, 104, 501, 104, + 494, 104, 494, 104, 313, 313, 104, 104, 104, 104, + 313, 377, 313, 313, 313, 363, 313, 363, 313, 104, + 104, 104, 104, 79, 483, 79, 79, 483, 79, 538, + 120, 120, 120, -10, -10, -10, -10, -10, -10, 1758, + 4, 43, 333, 383, 734, 284, 112, 395, 453, 216, + 269, 259, 60, 625, 472, 496, 511, 339, 402, 528, + 520, 531, 565, 554, 621, 618, 623, 629, 631, 639, + 644, 645, 656, 655, 630, 646, 654, 653, 638, 672, + 538, 676, 657, 662, 677, 652, 669, 705, 715, 697, + 719, +); + const YY_REDUCE_USE_DFLT = -73; + const YY_REDUCE_MAX = 178; + public static $yy_reduce_ofst = array( + 5, 485, 516, 549, 560, 592, 624, 635, 664, 695, + 728, 757, 932, 967, 978, 1007, 1038, 1049, 1078, 1109, + 1120, 1149, 1180, 1191, 1220, 1251, 1262, 1291, 1322, 1333, + 1362, 1393, 1404, 1433, 1464, 1475, 1504, 1535, 1546, 1575, + 1606, 1617, 1646, 1677, 1688, 1717, 32, 82, 132, 174, + -61, 163, 474, 117, 213, 57, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 184, 265, -34, 199, 107, 244, 315, + 317, 266, -54, 348, 51, -72, 346, 346, 346, 80, + 51, 129, 124, 296, 386, 394, 416, 129, -69, 86, + 346, 346, 405, 461, 346, 346, 346, 346, 346, 346, + 346, 129, 382, 346, 346, 463, 346, 98, 98, 98, + 98, 98, 157, 165, 98, 98, 192, 192, 234, 192, + 349, 192, 392, 192, 331, 331, 192, 192, 192, 192, + 331, 430, 331, 331, 331, 435, 331, 445, 331, 192, + 192, 192, 192, 238, 387, 238, 238, 387, 238, 482, + 437, 437, 437, 551, 499, 521, 537, 527, 532, +); + public static $yyExpectedTokens = array( + array(), + array(9, 10, 11, 12, 14, 16, 18, 19, 21, 24, 28, 29, 30, 32, 34, 37, 40, 41, 42, 43, 45, 47, 49, 50, 52, 57, 58, ), + array(9, 10, 11, 12, 14, 16, 18, 19, 21, 24, 28, 29, 30, 32, 34, 37, 40, 41, 42, 43, 45, 47, 49, 50, 52, 57, 58, ), + array(9, 10, 11, 12, 14, 16, 18, 19, 21, 24, 28, 29, 30, 32, 34, 37, 40, 41, 42, 43, 45, 47, 49, 50, 52, 57, 58, ), + array(9, 10, 11, 12, 14, 16, 18, 19, 21, 24, 28, 29, 30, 32, 34, 37, 40, 41, 42, 43, 45, 47, 49, 50, 52, 57, 58, ), + array(9, 10, 11, 12, 14, 16, 18, 19, 21, 24, 28, 29, 30, 32, 34, 37, 40, 41, 42, 43, 45, 47, 49, 50, 52, 57, 58, ), + array(9, 10, 11, 12, 14, 16, 18, 19, 21, 24, 28, 29, 30, 32, 34, 37, 40, 41, 42, 43, 45, 47, 49, 50, 52, 57, 58, ), + array(9, 10, 11, 12, 14, 16, 18, 19, 21, 24, 28, 29, 30, 32, 34, 37, 40, 41, 42, 43, 45, 47, 49, 50, 52, 57, 58, ), + array(9, 10, 11, 12, 14, 16, 18, 19, 21, 24, 28, 29, 30, 32, 34, 37, 40, 41, 42, 43, 45, 47, 49, 50, 52, 57, 58, ), + array(9, 10, 11, 12, 14, 16, 18, 19, 21, 24, 28, 29, 30, 32, 34, 37, 40, 41, 42, 43, 45, 47, 49, 50, 52, 57, 58, ), + array(9, 10, 11, 12, 14, 16, 18, 19, 21, 24, 28, 29, 30, 32, 34, 37, 40, 41, 42, 43, 45, 47, 49, 50, 52, 57, 58, ), + array(9, 10, 11, 12, 14, 16, 18, 19, 21, 24, 28, 29, 30, 32, 34, 37, 40, 41, 42, 43, 45, 47, 49, 50, 52, 57, 58, ), + array(9, 10, 11, 12, 14, 16, 18, 19, 21, 24, 28, 29, 30, 32, 34, 37, 40, 41, 42, 43, 45, 47, 49, 50, 51, 52, 57, 58, ), + array(9, 10, 11, 12, 14, 16, 18, 19, 21, 24, 28, 29, 30, 32, 34, 37, 40, 41, 42, 43, 45, 47, 49, 50, 52, 57, 58, ), + array(9, 10, 11, 12, 14, 16, 18, 19, 21, 24, 28, 29, 30, 32, 34, 37, 40, 41, 42, 43, 45, 47, 49, 50, 52, 57, 58, ), + array(9, 10, 11, 12, 14, 16, 18, 19, 21, 24, 28, 29, 30, 32, 34, 37, 40, 41, 42, 43, 45, 47, 49, 50, 52, 57, 58, ), + array(9, 10, 11, 12, 14, 16, 18, 19, 21, 24, 28, 29, 30, 32, 34, 37, 40, 41, 42, 43, 45, 47, 49, 50, 52, 57, 58, ), + array(9, 10, 11, 12, 14, 16, 18, 19, 21, 24, 28, 29, 30, 32, 34, 37, 40, 41, 42, 43, 45, 47, 49, 50, 52, 57, 58, ), + array(9, 10, 11, 12, 14, 16, 18, 19, 21, 24, 28, 29, 30, 32, 34, 37, 40, 41, 42, 43, 45, 47, 49, 50, 52, 57, 58, ), + array(9, 10, 11, 12, 14, 16, 18, 19, 21, 24, 28, 29, 30, 32, 34, 37, 40, 41, 42, 43, 45, 47, 49, 50, 52, 57, 58, ), + array(9, 10, 11, 12, 14, 16, 18, 19, 21, 24, 28, 29, 30, 32, 34, 37, 40, 41, 42, 43, 45, 47, 49, 50, 52, 57, 58, ), + array(9, 10, 11, 12, 14, 16, 18, 19, 21, 24, 28, 29, 30, 32, 34, 37, 40, 41, 42, 43, 45, 47, 49, 50, 52, 57, 58, ), + array(9, 10, 11, 12, 14, 16, 18, 19, 21, 24, 28, 29, 30, 32, 34, 37, 40, 41, 42, 43, 45, 47, 49, 50, 52, 57, 58, ), + array(9, 10, 11, 12, 14, 16, 18, 19, 21, 24, 28, 29, 30, 32, 34, 37, 40, 41, 42, 43, 45, 47, 49, 50, 52, 57, 58, ), + array(9, 10, 11, 12, 14, 16, 18, 19, 21, 24, 28, 29, 30, 32, 34, 37, 40, 41, 42, 43, 45, 47, 49, 50, 52, 57, 58, ), + array(9, 10, 11, 12, 14, 16, 18, 19, 21, 24, 28, 29, 30, 32, 34, 37, 40, 41, 42, 43, 45, 47, 49, 50, 52, 57, 58, ), + array(9, 10, 11, 12, 14, 16, 18, 19, 21, 24, 28, 29, 30, 32, 34, 37, 40, 41, 42, 43, 45, 47, 49, 50, 52, 57, 58, ), + array(9, 10, 11, 12, 14, 16, 18, 19, 21, 24, 28, 29, 30, 32, 34, 37, 40, 41, 42, 43, 45, 47, 49, 50, 52, 57, 58, ), + array(9, 10, 11, 12, 14, 16, 18, 19, 21, 24, 28, 29, 30, 32, 34, 37, 40, 41, 42, 43, 45, 47, 49, 50, 52, 57, 58, ), + array(9, 10, 11, 12, 14, 16, 18, 19, 21, 24, 28, 29, 30, 32, 34, 37, 40, 41, 42, 43, 45, 47, 49, 50, 52, 57, 58, ), + array(9, 10, 11, 12, 14, 16, 18, 19, 21, 24, 28, 29, 30, 32, 34, 37, 40, 41, 42, 43, 45, 47, 49, 50, 52, 57, 58, ), + array(9, 10, 11, 12, 14, 16, 18, 19, 21, 24, 28, 29, 30, 32, 34, 37, 40, 41, 42, 43, 45, 47, 49, 50, 52, 57, 58, ), + array(9, 10, 11, 12, 14, 16, 18, 19, 21, 24, 28, 29, 30, 32, 34, 37, 40, 41, 42, 43, 45, 47, 49, 50, 52, 57, 58, ), + array(9, 10, 11, 12, 14, 16, 18, 19, 21, 24, 28, 29, 30, 32, 34, 37, 40, 41, 42, 43, 45, 47, 49, 50, 52, 57, 58, ), + array(9, 10, 11, 12, 14, 16, 18, 19, 21, 24, 28, 29, 30, 32, 34, 37, 40, 41, 42, 43, 45, 47, 49, 50, 52, 57, 58, ), + array(9, 10, 11, 12, 14, 16, 18, 19, 21, 24, 28, 29, 30, 32, 34, 37, 40, 41, 42, 43, 45, 47, 49, 50, 52, 57, 58, ), + array(9, 10, 11, 12, 14, 16, 18, 19, 21, 24, 28, 29, 30, 32, 34, 37, 40, 41, 42, 43, 45, 47, 49, 50, 52, 57, 58, ), + array(9, 10, 11, 12, 14, 16, 18, 19, 24, 28, 29, 30, 32, 34, 37, 40, 41, 42, 43, 45, 47, 49, 50, 52, 57, 58, ), + array(9, 10, 11, 12, 14, 16, 18, 19, 24, 28, 29, 30, 32, 34, 37, 40, 41, 42, 43, 45, 47, 49, 50, 52, 57, 58, ), + array(9, 10, 11, 12, 14, 16, 18, 19, 24, 28, 29, 30, 32, 34, 37, 40, 41, 42, 43, 45, 47, 49, 50, 52, 57, 58, ), + array(9, 10, 11, 12, 14, 16, 18, 19, 24, 28, 29, 30, 32, 34, 37, 40, 41, 42, 43, 45, 47, 49, 50, 52, 57, 58, ), + array(9, 10, 11, 12, 14, 16, 18, 19, 24, 28, 29, 30, 32, 34, 37, 40, 41, 42, 43, 45, 47, 49, 50, 52, 57, 58, ), + array(9, 10, 11, 12, 14, 16, 18, 19, 24, 28, 29, 30, 32, 34, 37, 40, 41, 42, 43, 45, 47, 49, 50, 52, 57, 58, ), + array(9, 10, 11, 12, 14, 16, 18, 19, 24, 28, 29, 30, 32, 34, 37, 40, 41, 42, 43, 45, 47, 49, 50, 52, 57, 58, ), + array(9, 10, 11, 12, 14, 16, 18, 19, 24, 28, 29, 30, 32, 34, 37, 40, 41, 42, 43, 45, 47, 49, 50, 52, 57, 58, ), + array(9, 10, 11, 12, 14, 16, 18, 19, 24, 28, 29, 30, 32, 34, 37, 40, 41, 42, 43, 45, 47, 49, 50, 52, 57, 58, ), + array(23, 25, 31, 36, 37, 38, 53, 54, 55, 56, ), + array(25, 31, 36, 37, 38, 53, 54, 55, 56, ), + array(25, 31, 36, 37, 38, 53, 54, 55, 56, ), + array(14, 16, 47, 49, 52, ), + array(3, 9, 10, 11, 12, 14, 18, 19, 24, 28, 29, 30, 58, 59, ), + array(1, 13, 17, 25, 31, 34, 46, ), + array(14, 16, 49, 52, ), + array(14, 34, 52, ), + array(1, 25, 31, ), + array(3, 9, 10, 11, 12, 14, 18, 19, 24, 28, 29, 30, 58, 59, ), + array(20, 36, 37, 38, 53, 54, 55, 56, ), + array(26, 36, 37, 38, 53, 54, 55, 56, ), + array(13, 36, 37, 38, 53, 54, 55, 56, ), + array(35, 36, 37, 38, 53, 54, 55, 56, ), + array(36, 37, 38, 51, 53, 54, 55, 56, ), + array(35, 36, 37, 38, 53, 54, 55, 56, ), + array(13, 36, 37, 38, 53, 54, 55, 56, ), + array(36, 37, 38, 53, 54, 55, 56, 59, ), + array(13, 36, 37, 38, 53, 54, 55, 56, ), + array(13, 36, 37, 38, 53, 54, 55, 56, ), + array(2, 36, 37, 38, 53, 54, 55, 56, ), + array(13, 36, 37, 38, 53, 54, 55, 56, ), + array(36, 37, 38, 53, 54, 55, 56, ), + array(36, 37, 38, 53, 54, 55, 56, ), + array(36, 37, 38, 53, 54, 55, 56, ), + array(36, 37, 38, 53, 54, 55, 56, ), + array(36, 37, 38, 53, 54, 55, 56, ), + array(36, 37, 38, 53, 54, 55, 56, ), + array(36, 37, 38, 53, 54, 55, 56, ), + array(36, 37, 38, 53, 54, 55, 56, ), + array(36, 37, 38, 53, 54, 55, 56, ), + array(36, 37, 38, 53, 54, 55, 56, ), + array(36, 37, 38, 53, 54, 55, 56, ), + array(36, 37, 38, 53, 54, 55, 56, ), + array(36, 37, 38, 53, 54, 55, 56, ), + array(36, 37, 38, 53, 54, 55, 56, ), + array(36, 37, 38, 53, 54, 55, 56, ), + array(9, 12, 16, 25, 27, 31, ), + array(9, 12, 16, 25, 31, ), + array(17, 43, 50, ), + array(15, 17, 46, ), + array(1, 25, 31, ), + array(1, 25, 31, ), + array(14, 34, 52, ), + array(14, 34, 52, ), + array(1, 2, ), + array(3, 4, 5, 6, 9, 10, 11, 12, 18, 19, 24, 28, 29, 30, ), + array(2, 9, 12, 15, 16, 17, 21, 43, 46, 48, 50, ), + array(9, 12, 16, 48, ), + array(12, 14, 16, 52, ), + array(1, 13, 25, 31, ), + array(1, 13, 25, 31, ), + array(1, 13, 25, 31, ), + array(9, 12, 16, ), + array(9, 12, 16, ), + array(15, 17, 46, ), + array(25, 31, ), + array(14, 52, ), + array(25, 31, ), + array(25, 31, ), + array(1, 17, ), + array(17, 46, ), + array(14, 16, ), + array(14, 16, ), + array(1, 51, ), + array(1, 27, ), + array(25, 31, ), + array(1, ), + array(1, ), + array(1, ), + array(1, ), + array(1, ), + array(1, ), + array(1, ), + array(1, ), + array(17, ), + array(17, ), + array(1, ), + array(1, ), + array(), + array(), + array(2, 9, 12, 16, 17, 21, 43, 46, 48, 50, 51, ), + array(2, 9, 12, 15, 16, 17, 21, 43, 46, 48, 50, ), + array(2, 9, 12, 16, 17, 21, 43, 46, 48, 50, ), + array(2, 9, 12, 16, 17, 21, 43, 46, 48, 50, ), + array(9, 12, 16, 17, 43, 46, 48, 50, ), + array(12, 14, 16, 32, 52, ), + array(9, 12, 16, 48, ), + array(9, 12, 16, ), + array(15, 43, 50, ), + array(25, 31, ), + array(25, 31, ), + array(15, 21, ), + array(25, 31, ), + array(14, 52, ), + array(25, 31, ), + array(14, 52, ), + array(25, 31, ), + array(43, 50, ), + array(43, 50, ), + array(25, 31, ), + array(25, 31, ), + array(25, 31, ), + array(25, 31, ), + array(43, 50, ), + array(12, 34, ), + array(43, 50, ), + array(43, 50, ), + array(43, 50, ), + array(43, 50, ), + array(43, 50, ), + array(43, 50, ), + array(43, 50, ), + array(25, 31, ), + array(25, 31, ), + array(25, 31, ), + array(25, 31, ), + array(1, ), + array(2, ), + array(1, ), + array(1, ), + array(2, ), + array(1, ), + array(34, ), + array(17, ), + array(17, ), + array(17, ), + array(), + array(), + array(), + array(), + array(), + array(), + array(2, 34, 36, 37, 38, 46, 53, 54, 55, 56, ), + array(13, 20, 22, 25, 31, 33, 35, 43, ), + array(13, 15, 25, 31, 34, 46, ), + array(13, 21, 25, 31, 44, ), + array(13, 21, 25, 31, 44, ), + array(9, 12, 16, 48, ), + array(34, 43, 46, 51, ), + array(27, 34, 46, ), + array(21, 44, 59, ), + array(21, 44, 51, ), + array(6, 8, ), + array(7, 8, ), + array(20, 33, ), + array(16, 48, ), + array(21, 44, ), + array(34, 46, ), + array(34, 46, ), + array(34, 46, ), + array(33, 35, ), + array(33, 35, ), + array(33, 51, ), + array(43, 51, ), + array(33, 35, ), + array(33, 35, ), + array(15, 43, ), + array(7, ), + array(13, ), + array(13, ), + array(16, ), + array(16, ), + array(16, ), + array(16, ), + array(16, ), + array(14, ), + array(16, ), + array(43, ), + array(32, ), + array(32, ), + array(34, ), + array(39, ), + array(16, ), + array(34, ), + array(16, ), + array(49, ), + array(49, ), + array(16, ), + array(51, ), + array(51, ), + array(16, ), + array(15, ), + array(35, ), + array(22, ), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), + array(), +); + public static $yy_default = array( + 337, 514, 514, 514, 499, 499, 514, 476, 476, 514, + 476, 514, 514, 514, 514, 514, 514, 514, 514, 514, + 514, 514, 514, 514, 514, 514, 514, 514, 514, 514, + 514, 514, 514, 514, 514, 514, 514, 514, 514, 514, + 514, 514, 514, 514, 514, 514, 377, 356, 377, 514, + 514, 415, 514, 514, 377, 514, 514, 382, 514, 514, + 514, 514, 350, 514, 514, 514, 514, 514, 361, 475, + 399, 403, 474, 500, 502, 501, 404, 384, 388, 389, + 379, 382, 350, 377, 377, 489, 431, 377, 377, 514, + 514, 368, 327, 430, 441, 514, 391, 391, 391, 441, + 441, 431, 377, 514, 377, 377, 371, 431, 514, 514, + 391, 391, 358, 373, 391, 397, 406, 407, 408, 398, + 402, 431, 486, 406, 396, 335, 483, 430, 430, 430, + 430, 430, 514, 443, 441, 457, 347, 357, 514, 360, + 514, 365, 514, 366, 438, 439, 351, 353, 354, 355, + 467, 441, 466, 469, 468, 434, 435, 436, 437, 367, + 363, 364, 359, 369, 477, 372, 374, 478, 424, 441, + 463, 490, 487, 335, 482, 482, 482, 441, 441, 415, + 411, 415, 405, 405, 442, 415, 415, 405, 405, 333, + 514, 514, 514, 405, 415, 425, 514, 514, 514, 514, + 411, 514, 514, 411, 514, 514, 514, 514, 514, 514, + 514, 514, 514, 514, 411, 413, 514, 488, 417, 514, + 457, 514, 514, 514, 514, 514, 420, 514, 514, 514, + 385, 328, 329, 330, 331, 332, 334, 336, 338, 339, + 340, 341, 342, 343, 344, 346, 375, 376, 459, 460, + 461, 481, 370, 479, 480, 409, 418, 419, 428, 429, + 440, 444, 445, 446, 392, 393, 394, 395, 410, 412, + 414, 416, 420, 421, 422, 400, 401, 423, 426, 427, + 454, 452, 455, 491, 492, 493, 494, 432, 433, 465, + 458, 473, 345, 464, 510, 511, 503, 504, 505, 508, + 507, 509, 512, 513, 506, 496, 498, 497, 495, 470, + 453, 451, 448, 449, 450, 456, 471, 472, 417, 447, + 485, 462, 457, 378, 362, 386, 390, +); + const YYNOCODE = 108; + const YYSTACKDEPTH = 500; + const YYNSTATE = 327; + const YYNRULE = 187; + const YYERRORSYMBOL = 60; + const YYERRSYMDT = 'yy0'; + const YYFALLBACK = 0; + public static $yyFallback = array( + ); + public function Trace($TraceFILE, $zTracePrompt) + { + if (!$TraceFILE) { + $zTracePrompt = 0; + } elseif (!$zTracePrompt) { + $TraceFILE = 0; + } + $this->yyTraceFILE = $TraceFILE; + $this->yyTracePrompt = $zTracePrompt; + } + + public function PrintTrace() + { + $this->yyTraceFILE = fopen('php://output', 'w'); + $this->yyTracePrompt = '
'; + } + + public $yyTraceFILE; + public $yyTracePrompt; + public $yyidx; /* Index of top element in stack */ + public $yyerrcnt; /* Shifts left before out of the error */ + public $yystack = array(); /* The parser's stack */ + + public $yyTokenName = array( + '$', 'VERT', 'COLON', 'TEXT', + 'STRIPON', 'STRIPOFF', 'LITERALSTART', 'LITERALEND', + 'LITERAL', 'SIMPELOUTPUT', 'SIMPLETAG', 'SMARTYBLOCKCHILDPARENT', + 'LDEL', 'RDEL', 'DOLLARID', 'EQUAL', + 'ID', 'PTR', 'LDELIF', 'LDELFOR', + 'SEMICOLON', 'INCDEC', 'TO', 'STEP', + 'LDELFOREACH', 'SPACE', 'AS', 'APTR', + 'LDELSETFILTER', 'CLOSETAG', 'LDELSLASH', 'ATTR', + 'INTEGER', 'COMMA', 'OPENP', 'CLOSEP', + 'MATH', 'UNIMATH', 'ISIN', 'QMARK', + 'NOT', 'TYPECAST', 'HEX', 'DOT', + 'INSTANCEOF', 'SINGLEQUOTESTRING', 'DOUBLECOLON', 'NAMESPACE', + 'AT', 'HATCH', 'OPENB', 'CLOSEB', + 'DOLLAR', 'LOGOP', 'SLOGOP', 'TLOGOP', + 'SINGLECOND', 'ARRAYOPEN', 'QUOTE', 'BACKTICK', + 'error', 'start', 'template', 'literal_e2', + 'literal_e1', 'smartytag', 'tagbody', 'tag', + 'outattr', 'eqoutattr', 'varindexed', 'output', + 'attributes', 'variable', 'value', 'expr', + 'modifierlist', 'statement', 'statements', 'foraction', + 'varvar', 'modparameters', 'attribute', 'ternary', + 'tlop', 'lop', 'scond', 'array', + 'function', 'ns1', 'doublequoted_with_quotes', 'static_class_access', + 'arraydef', 'object', 'arrayindex', 'indexdef', + 'varvarele', 'objectchain', 'objectelement', 'method', + 'params', 'modifier', 'modparameter', 'arrayelements', + 'arrayelement', 'doublequoted', 'doublequotedcontent', + ); + + public static $yyRuleName = array( + 'start ::= template', + 'template ::= template TEXT', + 'template ::= template STRIPON', + 'template ::= template STRIPOFF', + 'template ::= template LITERALSTART literal_e2 LITERALEND', + 'literal_e2 ::= literal_e1 LITERALSTART literal_e1 LITERALEND', + 'literal_e2 ::= literal_e1', + 'literal_e1 ::= literal_e1 LITERAL', + 'literal_e1 ::=', + 'template ::= template smartytag', + 'template ::=', + 'smartytag ::= SIMPELOUTPUT', + 'smartytag ::= SIMPLETAG', + 'smartytag ::= SMARTYBLOCKCHILDPARENT', + 'smartytag ::= LDEL tagbody RDEL', + 'smartytag ::= tag RDEL', + 'tagbody ::= outattr', + 'tagbody ::= DOLLARID eqoutattr', + 'tagbody ::= varindexed eqoutattr', + 'eqoutattr ::= EQUAL outattr', + 'outattr ::= output attributes', + 'output ::= variable', + 'output ::= value', + 'output ::= expr', + 'tag ::= LDEL ID attributes', + 'tag ::= LDEL ID', + 'tag ::= LDEL ID modifierlist attributes', + 'tag ::= LDEL ID PTR ID attributes', + 'tag ::= LDEL ID PTR ID modifierlist attributes', + 'tag ::= LDELIF expr', + 'tag ::= LDELIF expr attributes', + 'tag ::= LDELIF statement', + 'tag ::= LDELIF statement attributes', + 'tag ::= LDELFOR statements SEMICOLON expr SEMICOLON varindexed foraction attributes', + 'foraction ::= EQUAL expr', + 'foraction ::= INCDEC', + 'tag ::= LDELFOR statement TO expr attributes', + 'tag ::= LDELFOR statement TO expr STEP expr attributes', + 'tag ::= LDELFOREACH SPACE expr AS varvar attributes', + 'tag ::= LDELFOREACH SPACE expr AS varvar APTR varvar attributes', + 'tag ::= LDELFOREACH attributes', + 'tag ::= LDELSETFILTER ID modparameters', + 'tag ::= LDELSETFILTER ID modparameters modifierlist', + 'smartytag ::= CLOSETAG', + 'tag ::= LDELSLASH ID', + 'tag ::= LDELSLASH ID modifierlist', + 'tag ::= LDELSLASH ID PTR ID', + 'tag ::= LDELSLASH ID PTR ID modifierlist', + 'attributes ::= attributes attribute', + 'attributes ::= attribute', + 'attributes ::=', + 'attribute ::= SPACE ID EQUAL ID', + 'attribute ::= ATTR expr', + 'attribute ::= ATTR value', + 'attribute ::= SPACE ID', + 'attribute ::= SPACE expr', + 'attribute ::= SPACE value', + 'attribute ::= SPACE INTEGER EQUAL expr', + 'statements ::= statement', + 'statements ::= statements COMMA statement', + 'statement ::= DOLLARID EQUAL INTEGER', + 'statement ::= DOLLARID EQUAL expr', + 'statement ::= varindexed EQUAL expr', + 'statement ::= OPENP statement CLOSEP', + 'expr ::= value', + 'expr ::= ternary', + 'expr ::= INCDEC DOLLARID', + 'expr ::= DOLLARID INCDEC', + 'expr ::= DOLLARID COLON ID', + 'expr ::= expr MATH value', + 'expr ::= expr UNIMATH value', + 'expr ::= expr tlop value', + 'expr ::= expr lop expr', + 'expr ::= expr scond', + 'expr ::= expr ISIN array', + 'expr ::= expr ISIN value', + 'ternary ::= OPENP expr CLOSEP QMARK DOLLARID COLON expr', + 'ternary ::= OPENP expr CLOSEP QMARK expr COLON expr', + 'value ::= variable', + 'value ::= UNIMATH value', + 'value ::= NOT value', + 'value ::= TYPECAST value', + 'value ::= variable INCDEC', + 'value ::= HEX', + 'value ::= INTEGER', + 'value ::= INTEGER DOT INTEGER', + 'value ::= INTEGER DOT', + 'value ::= DOT INTEGER', + 'value ::= ID', + 'value ::= function', + 'value ::= OPENP expr CLOSEP', + 'value ::= variable INSTANCEOF ns1', + 'value ::= variable INSTANCEOF variable', + 'value ::= SINGLEQUOTESTRING', + 'value ::= doublequoted_with_quotes', + 'value ::= varindexed DOUBLECOLON static_class_access', + 'value ::= smartytag', + 'value ::= value modifierlist', + 'value ::= NAMESPACE', + 'value ::= arraydef', + 'value ::= ns1 DOUBLECOLON static_class_access', + 'ns1 ::= ID', + 'ns1 ::= NAMESPACE', + 'variable ::= DOLLARID', + 'variable ::= varindexed', + 'variable ::= varvar AT ID', + 'variable ::= object', + 'variable ::= HATCH ID HATCH', + 'variable ::= HATCH ID HATCH arrayindex', + 'variable ::= HATCH variable HATCH', + 'variable ::= HATCH variable HATCH arrayindex', + 'varindexed ::= DOLLARID arrayindex', + 'varindexed ::= varvar arrayindex', + 'arrayindex ::= arrayindex indexdef', + 'arrayindex ::=', + 'indexdef ::= DOT DOLLARID', + 'indexdef ::= DOT varvar', + 'indexdef ::= DOT varvar AT ID', + 'indexdef ::= DOT ID', + 'indexdef ::= DOT INTEGER', + 'indexdef ::= DOT LDEL expr RDEL', + 'indexdef ::= OPENB ID CLOSEB', + 'indexdef ::= OPENB ID DOT ID CLOSEB', + 'indexdef ::= OPENB SINGLEQUOTESTRING CLOSEB', + 'indexdef ::= OPENB INTEGER CLOSEB', + 'indexdef ::= OPENB DOLLARID CLOSEB', + 'indexdef ::= OPENB variable CLOSEB', + 'indexdef ::= OPENB value CLOSEB', + 'indexdef ::= OPENB expr CLOSEB', + 'indexdef ::= OPENB CLOSEB', + 'varvar ::= DOLLARID', + 'varvar ::= DOLLAR', + 'varvar ::= varvar varvarele', + 'varvarele ::= ID', + 'varvarele ::= SIMPELOUTPUT', + 'varvarele ::= LDEL expr RDEL', + 'object ::= varindexed objectchain', + 'objectchain ::= objectelement', + 'objectchain ::= objectchain objectelement', + 'objectelement ::= PTR ID arrayindex', + 'objectelement ::= PTR varvar arrayindex', + 'objectelement ::= PTR LDEL expr RDEL arrayindex', + 'objectelement ::= PTR ID LDEL expr RDEL arrayindex', + 'objectelement ::= PTR method', + 'function ::= ns1 OPENP params CLOSEP', + 'method ::= ID OPENP params CLOSEP', + 'method ::= DOLLARID OPENP params CLOSEP', + 'params ::= params COMMA expr', + 'params ::= expr', + 'params ::=', + 'modifierlist ::= modifierlist modifier modparameters', + 'modifierlist ::= modifier modparameters', + 'modifier ::= VERT AT ID', + 'modifier ::= VERT ID', + 'modparameters ::= modparameters modparameter', + 'modparameters ::=', + 'modparameter ::= COLON value', + 'modparameter ::= COLON UNIMATH value', + 'modparameter ::= COLON array', + 'static_class_access ::= method', + 'static_class_access ::= method objectchain', + 'static_class_access ::= ID', + 'static_class_access ::= DOLLARID arrayindex', + 'static_class_access ::= DOLLARID arrayindex objectchain', + 'lop ::= LOGOP', + 'lop ::= SLOGOP', + 'tlop ::= TLOGOP', + 'scond ::= SINGLECOND', + 'arraydef ::= OPENB arrayelements CLOSEB', + 'arraydef ::= ARRAYOPEN arrayelements CLOSEP', + 'arrayelements ::= arrayelement', + 'arrayelements ::= arrayelements COMMA arrayelement', + 'arrayelements ::=', + 'arrayelement ::= value APTR expr', + 'arrayelement ::= ID APTR expr', + 'arrayelement ::= expr', + 'doublequoted_with_quotes ::= QUOTE QUOTE', + 'doublequoted_with_quotes ::= QUOTE doublequoted QUOTE', + 'doublequoted ::= doublequoted doublequotedcontent', + 'doublequoted ::= doublequotedcontent', + 'doublequotedcontent ::= BACKTICK variable BACKTICK', + 'doublequotedcontent ::= BACKTICK expr BACKTICK', + 'doublequotedcontent ::= DOLLARID', + 'doublequotedcontent ::= LDEL variable RDEL', + 'doublequotedcontent ::= LDEL expr RDEL', + 'doublequotedcontent ::= smartytag', + 'doublequotedcontent ::= TEXT', + ); + + public function tokenName($tokenType) + { + if ($tokenType === 0) { + return 'End of Input'; + } + if ($tokenType > 0 && $tokenType < count($this->yyTokenName)) { + return $this->yyTokenName[$tokenType]; + } else { + return 'Unknown'; + } + } + + public static function yy_destructor($yymajor, $yypminor) + { + switch ($yymajor) { + default: break; /* If no destructor action specified: do nothing */ + } + } + + public function yy_pop_parser_stack() + { + if (empty($this->yystack)) { + return; + } + $yytos = array_pop($this->yystack); + if ($this->yyTraceFILE && $this->yyidx >= 0) { + fwrite($this->yyTraceFILE, + $this->yyTracePrompt . 'Popping ' . $this->yyTokenName[$yytos->major] . + "\n"); + } + $yymajor = $yytos->major; + self::yy_destructor($yymajor, $yytos->minor); + $this->yyidx--; + + return $yymajor; + } + + public function __destruct() + { + while ($this->yystack !== Array()) { + $this->yy_pop_parser_stack(); + } + if (is_resource($this->yyTraceFILE)) { + fclose($this->yyTraceFILE); + } + } + + public function yy_get_expected_tokens($token) + { + static $res3 = array(); + static $res4 = array(); + $state = $this->yystack[$this->yyidx]->stateno; + $expected = self::$yyExpectedTokens[$state]; + if (isset($res3[$state][$token])) { + if ($res3[$state][$token]) { + return $expected; + } + } else { + if ($res3[$state][$token] = in_array($token, self::$yyExpectedTokens[$state], true)) { + return $expected; + } + } + $stack = $this->yystack; + $yyidx = $this->yyidx; + do { + $yyact = $this->yy_find_shift_action($token); + if ($yyact >= self::YYNSTATE && $yyact < self::YYNSTATE + self::YYNRULE) { + // reduce action + $done = 0; + do { + if ($done++ === 100) { + $this->yyidx = $yyidx; + $this->yystack = $stack; + // too much recursion prevents proper detection + // so give up + return array_unique($expected); + } + $yyruleno = $yyact - self::YYNSTATE; + $this->yyidx -= self::$yyRuleInfo[$yyruleno][1]; + $nextstate = $this->yy_find_reduce_action( + $this->yystack[$this->yyidx]->stateno, + self::$yyRuleInfo[$yyruleno][0]); + if (isset(self::$yyExpectedTokens[$nextstate])) { + $expected = array_merge($expected, self::$yyExpectedTokens[$nextstate]); + if (isset($res4[$nextstate][$token])) { + if ($res4[$nextstate][$token]) { + $this->yyidx = $yyidx; + $this->yystack = $stack; + return array_unique($expected); + } + } else { + if ($res4[$nextstate][$token] = in_array($token, self::$yyExpectedTokens[$nextstate], true)) { + $this->yyidx = $yyidx; + $this->yystack = $stack; + return array_unique($expected); + } + } + } + if ($nextstate < self::YYNSTATE) { + // we need to shift a non-terminal + $this->yyidx++; + $x = (object) ['stateno' => null, 'major' => null, 'minor' => null]; + $x->stateno = $nextstate; + $x->major = self::$yyRuleInfo[$yyruleno][0]; + $this->yystack[$this->yyidx] = $x; + continue 2; + } elseif ($nextstate === self::YYNSTATE + self::YYNRULE + 1) { + $this->yyidx = $yyidx; + $this->yystack = $stack; + // the last token was just ignored, we can't accept + // by ignoring input, this is in essence ignoring a + // syntax error! + return array_unique($expected); + } elseif ($nextstate === self::YY_NO_ACTION) { + $this->yyidx = $yyidx; + $this->yystack = $stack; + // input accepted, but not shifted (I guess) + return $expected; + } else { + $yyact = $nextstate; + } + } while (true); + } + break; + } while (true); + $this->yyidx = $yyidx; + $this->yystack = $stack; + + return array_unique($expected); + } + + public function yy_is_expected_token($token) + { + static $res = array(); + static $res2 = array(); + if ($token === 0) { + return true; // 0 is not part of this + } + $state = $this->yystack[$this->yyidx]->stateno; + if (isset($res[$state][$token])) { + if ($res[$state][$token]) { + return true; + } + } else { + if ($res[$state][$token] = in_array($token, self::$yyExpectedTokens[$state], true)) { + return true; + } + } + $stack = $this->yystack; + $yyidx = $this->yyidx; + do { + $yyact = $this->yy_find_shift_action($token); + if ($yyact >= self::YYNSTATE && $yyact < self::YYNSTATE + self::YYNRULE) { + // reduce action + $done = 0; + do { + if ($done++ === 100) { + $this->yyidx = $yyidx; + $this->yystack = $stack; + // too much recursion prevents proper detection + // so give up + return true; + } + $yyruleno = $yyact - self::YYNSTATE; + $this->yyidx -= self::$yyRuleInfo[$yyruleno][1]; + $nextstate = $this->yy_find_reduce_action( + $this->yystack[$this->yyidx]->stateno, + self::$yyRuleInfo[$yyruleno][0]); + if (isset($res2[$nextstate][$token])) { + if ($res2[$nextstate][$token]) { + $this->yyidx = $yyidx; + $this->yystack = $stack; + return true; + } + } else { + if ($res2[$nextstate][$token] = (isset(self::$yyExpectedTokens[$nextstate]) && in_array($token, self::$yyExpectedTokens[$nextstate], true))) { + $this->yyidx = $yyidx; + $this->yystack = $stack; + return true; + } + } + if ($nextstate < self::YYNSTATE) { + // we need to shift a non-terminal + $this->yyidx++; + $x = (object) ['stateno' => null, 'major' => null, 'minor' => null]; + $x->stateno = $nextstate; + $x->major = self::$yyRuleInfo[$yyruleno][0]; + $this->yystack[$this->yyidx] = $x; + continue 2; + } elseif ($nextstate === self::YYNSTATE + self::YYNRULE + 1) { + $this->yyidx = $yyidx; + $this->yystack = $stack; + if (!$token) { + // end of input: this is valid + return true; + } + // the last token was just ignored, we can't accept + // by ignoring input, this is in essence ignoring a + // syntax error! + return false; + } elseif ($nextstate === self::YY_NO_ACTION) { + $this->yyidx = $yyidx; + $this->yystack = $stack; + // input accepted, but not shifted (I guess) + return true; + } else { + $yyact = $nextstate; + } + } while (true); + } + break; + } while (true); + $this->yyidx = $yyidx; + $this->yystack = $stack; + + return true; + } + + public function yy_find_shift_action($iLookAhead) + { + $stateno = $this->yystack[$this->yyidx]->stateno; + + /* if ($this->yyidx < 0) return self::YY_NO_ACTION; */ + if (!isset(self::$yy_shift_ofst[$stateno])) { + // no shift actions + return self::$yy_default[$stateno]; + } + $i = self::$yy_shift_ofst[$stateno]; + if ($i === self::YY_SHIFT_USE_DFLT) { + return self::$yy_default[$stateno]; + } + if ($iLookAhead === self::YYNOCODE) { + return self::YY_NO_ACTION; + } + $i += $iLookAhead; + if ($i < 0 || $i >= self::YY_SZ_ACTTAB || + self::$yy_lookahead[$i] != $iLookAhead) { + if (count(self::$yyFallback) && $iLookAhead < count(self::$yyFallback) + && ($iFallback = self::$yyFallback[$iLookAhead]) != 0) { + if ($this->yyTraceFILE) { + fwrite($this->yyTraceFILE, $this->yyTracePrompt . 'FALLBACK ' . + $this->yyTokenName[$iLookAhead] . ' => ' . + $this->yyTokenName[$iFallback] . "\n"); + } + + return $this->yy_find_shift_action($iFallback); + } + + return self::$yy_default[$stateno]; + } else { + return self::$yy_action[$i]; + } + } + + public function yy_find_reduce_action($stateno, $iLookAhead) + { + /* $stateno = $this->yystack[$this->yyidx]->stateno; */ + + if (!isset(self::$yy_reduce_ofst[$stateno])) { + return self::$yy_default[$stateno]; + } + $i = self::$yy_reduce_ofst[$stateno]; + if ($i === self::YY_REDUCE_USE_DFLT) { + return self::$yy_default[$stateno]; + } + if ($iLookAhead === self::YYNOCODE) { + return self::YY_NO_ACTION; + } + $i += $iLookAhead; + if ($i < 0 || $i >= self::YY_SZ_ACTTAB || + self::$yy_lookahead[$i] != $iLookAhead) { + return self::$yy_default[$stateno]; + } else { + return self::$yy_action[$i]; + } + } + + public function yy_shift($yyNewState, $yyMajor, $yypMinor) + { + $this->yyidx++; + if ($this->yyidx >= self::YYSTACKDEPTH) { + $this->yyidx--; + if ($this->yyTraceFILE) { + fprintf($this->yyTraceFILE, "%sStack Overflow!\n", $this->yyTracePrompt); + } + while ($this->yyidx >= 0) { + $this->yy_pop_parser_stack(); + } +// line 232 "src/Parser/TemplateParser.y" + + $this->internalError = true; + $this->compiler->trigger_template_error('Stack overflow in template parser'); + + return; + } + $yytos = (object) ['stateno' => null, 'major' => null, 'minor' => null]; + $yytos->stateno = $yyNewState; + $yytos->major = $yyMajor; + $yytos->minor = $yypMinor; + $this->yystack[] = $yytos; + if ($this->yyTraceFILE && $this->yyidx > 0) { + fprintf($this->yyTraceFILE, "%sShift %d\n", $this->yyTracePrompt, + $yyNewState); + fprintf($this->yyTraceFILE, "%sStack:", $this->yyTracePrompt); + for ($i = 1; $i <= $this->yyidx; $i++) { + fprintf($this->yyTraceFILE, " %s", + $this->yyTokenName[$this->yystack[$i]->major]); + } + fwrite($this->yyTraceFILE,"\n"); + } + } + + public static $yyRuleInfo = array( + array( 0 => 61, 1 => 1 ), + array( 0 => 62, 1 => 2 ), + array( 0 => 62, 1 => 2 ), + array( 0 => 62, 1 => 2 ), + array( 0 => 62, 1 => 4 ), + array( 0 => 63, 1 => 4 ), + array( 0 => 63, 1 => 1 ), + array( 0 => 64, 1 => 2 ), + array( 0 => 64, 1 => 0 ), + array( 0 => 62, 1 => 2 ), + array( 0 => 62, 1 => 0 ), + array( 0 => 65, 1 => 1 ), + array( 0 => 65, 1 => 1 ), + array( 0 => 65, 1 => 1 ), + array( 0 => 65, 1 => 3 ), + array( 0 => 65, 1 => 2 ), + array( 0 => 66, 1 => 1 ), + array( 0 => 66, 1 => 2 ), + array( 0 => 66, 1 => 2 ), + array( 0 => 69, 1 => 2 ), + array( 0 => 68, 1 => 2 ), + array( 0 => 71, 1 => 1 ), + array( 0 => 71, 1 => 1 ), + array( 0 => 71, 1 => 1 ), + array( 0 => 67, 1 => 3 ), + array( 0 => 67, 1 => 2 ), + array( 0 => 67, 1 => 4 ), + array( 0 => 67, 1 => 5 ), + array( 0 => 67, 1 => 6 ), + array( 0 => 67, 1 => 2 ), + array( 0 => 67, 1 => 3 ), + array( 0 => 67, 1 => 2 ), + array( 0 => 67, 1 => 3 ), + array( 0 => 67, 1 => 8 ), + array( 0 => 79, 1 => 2 ), + array( 0 => 79, 1 => 1 ), + array( 0 => 67, 1 => 5 ), + array( 0 => 67, 1 => 7 ), + array( 0 => 67, 1 => 6 ), + array( 0 => 67, 1 => 8 ), + array( 0 => 67, 1 => 2 ), + array( 0 => 67, 1 => 3 ), + array( 0 => 67, 1 => 4 ), + array( 0 => 65, 1 => 1 ), + array( 0 => 67, 1 => 2 ), + array( 0 => 67, 1 => 3 ), + array( 0 => 67, 1 => 4 ), + array( 0 => 67, 1 => 5 ), + array( 0 => 72, 1 => 2 ), + array( 0 => 72, 1 => 1 ), + array( 0 => 72, 1 => 0 ), + array( 0 => 82, 1 => 4 ), + array( 0 => 82, 1 => 2 ), + array( 0 => 82, 1 => 2 ), + array( 0 => 82, 1 => 2 ), + array( 0 => 82, 1 => 2 ), + array( 0 => 82, 1 => 2 ), + array( 0 => 82, 1 => 4 ), + array( 0 => 78, 1 => 1 ), + array( 0 => 78, 1 => 3 ), + array( 0 => 77, 1 => 3 ), + array( 0 => 77, 1 => 3 ), + array( 0 => 77, 1 => 3 ), + array( 0 => 77, 1 => 3 ), + array( 0 => 75, 1 => 1 ), + array( 0 => 75, 1 => 1 ), + array( 0 => 75, 1 => 2 ), + array( 0 => 75, 1 => 2 ), + array( 0 => 75, 1 => 3 ), + array( 0 => 75, 1 => 3 ), + array( 0 => 75, 1 => 3 ), + array( 0 => 75, 1 => 3 ), + array( 0 => 75, 1 => 3 ), + array( 0 => 75, 1 => 2 ), + array( 0 => 75, 1 => 3 ), + array( 0 => 75, 1 => 3 ), + array( 0 => 83, 1 => 7 ), + array( 0 => 83, 1 => 7 ), + array( 0 => 74, 1 => 1 ), + array( 0 => 74, 1 => 2 ), + array( 0 => 74, 1 => 2 ), + array( 0 => 74, 1 => 2 ), + array( 0 => 74, 1 => 2 ), + array( 0 => 74, 1 => 1 ), + array( 0 => 74, 1 => 1 ), + array( 0 => 74, 1 => 3 ), + array( 0 => 74, 1 => 2 ), + array( 0 => 74, 1 => 2 ), + array( 0 => 74, 1 => 1 ), + array( 0 => 74, 1 => 1 ), + array( 0 => 74, 1 => 3 ), + array( 0 => 74, 1 => 3 ), + array( 0 => 74, 1 => 3 ), + array( 0 => 74, 1 => 1 ), + array( 0 => 74, 1 => 1 ), + array( 0 => 74, 1 => 3 ), + array( 0 => 74, 1 => 1 ), + array( 0 => 74, 1 => 2 ), + array( 0 => 74, 1 => 1 ), + array( 0 => 74, 1 => 1 ), + array( 0 => 74, 1 => 3 ), + array( 0 => 89, 1 => 1 ), + array( 0 => 89, 1 => 1 ), + array( 0 => 73, 1 => 1 ), + array( 0 => 73, 1 => 1 ), + array( 0 => 73, 1 => 3 ), + array( 0 => 73, 1 => 1 ), + array( 0 => 73, 1 => 3 ), + array( 0 => 73, 1 => 4 ), + array( 0 => 73, 1 => 3 ), + array( 0 => 73, 1 => 4 ), + array( 0 => 70, 1 => 2 ), + array( 0 => 70, 1 => 2 ), + array( 0 => 94, 1 => 2 ), + array( 0 => 94, 1 => 0 ), + array( 0 => 95, 1 => 2 ), + array( 0 => 95, 1 => 2 ), + array( 0 => 95, 1 => 4 ), + array( 0 => 95, 1 => 2 ), + array( 0 => 95, 1 => 2 ), + array( 0 => 95, 1 => 4 ), + array( 0 => 95, 1 => 3 ), + array( 0 => 95, 1 => 5 ), + array( 0 => 95, 1 => 3 ), + array( 0 => 95, 1 => 3 ), + array( 0 => 95, 1 => 3 ), + array( 0 => 95, 1 => 3 ), + array( 0 => 95, 1 => 3 ), + array( 0 => 95, 1 => 3 ), + array( 0 => 95, 1 => 2 ), + array( 0 => 80, 1 => 1 ), + array( 0 => 80, 1 => 1 ), + array( 0 => 80, 1 => 2 ), + array( 0 => 96, 1 => 1 ), + array( 0 => 96, 1 => 1 ), + array( 0 => 96, 1 => 3 ), + array( 0 => 93, 1 => 2 ), + array( 0 => 97, 1 => 1 ), + array( 0 => 97, 1 => 2 ), + array( 0 => 98, 1 => 3 ), + array( 0 => 98, 1 => 3 ), + array( 0 => 98, 1 => 5 ), + array( 0 => 98, 1 => 6 ), + array( 0 => 98, 1 => 2 ), + array( 0 => 88, 1 => 4 ), + array( 0 => 99, 1 => 4 ), + array( 0 => 99, 1 => 4 ), + array( 0 => 100, 1 => 3 ), + array( 0 => 100, 1 => 1 ), + array( 0 => 100, 1 => 0 ), + array( 0 => 76, 1 => 3 ), + array( 0 => 76, 1 => 2 ), + array( 0 => 101, 1 => 3 ), + array( 0 => 101, 1 => 2 ), + array( 0 => 81, 1 => 2 ), + array( 0 => 81, 1 => 0 ), + array( 0 => 102, 1 => 2 ), + array( 0 => 102, 1 => 3 ), + array( 0 => 102, 1 => 2 ), + array( 0 => 91, 1 => 1 ), + array( 0 => 91, 1 => 2 ), + array( 0 => 91, 1 => 1 ), + array( 0 => 91, 1 => 2 ), + array( 0 => 91, 1 => 3 ), + array( 0 => 85, 1 => 1 ), + array( 0 => 85, 1 => 1 ), + array( 0 => 84, 1 => 1 ), + array( 0 => 86, 1 => 1 ), + array( 0 => 92, 1 => 3 ), + array( 0 => 92, 1 => 3 ), + array( 0 => 103, 1 => 1 ), + array( 0 => 103, 1 => 3 ), + array( 0 => 103, 1 => 0 ), + array( 0 => 104, 1 => 3 ), + array( 0 => 104, 1 => 3 ), + array( 0 => 104, 1 => 1 ), + array( 0 => 90, 1 => 2 ), + array( 0 => 90, 1 => 3 ), + array( 0 => 105, 1 => 2 ), + array( 0 => 105, 1 => 1 ), + array( 0 => 106, 1 => 3 ), + array( 0 => 106, 1 => 3 ), + array( 0 => 106, 1 => 1 ), + array( 0 => 106, 1 => 3 ), + array( 0 => 106, 1 => 3 ), + array( 0 => 106, 1 => 1 ), + array( 0 => 106, 1 => 1 ), + ); + + public static $yyReduceMap = array( + 0 => 0, + 1 => 1, + 2 => 2, + 3 => 3, + 4 => 4, + 5 => 5, + 6 => 6, + 21 => 6, + 22 => 6, + 23 => 6, + 35 => 6, + 55 => 6, + 56 => 6, + 64 => 6, + 65 => 6, + 78 => 6, + 83 => 6, + 84 => 6, + 89 => 6, + 93 => 6, + 94 => 6, + 98 => 6, + 99 => 6, + 101 => 6, + 106 => 6, + 170 => 6, + 175 => 6, + 7 => 7, + 8 => 8, + 9 => 9, + 11 => 11, + 12 => 12, + 13 => 13, + 14 => 14, + 15 => 15, + 16 => 16, + 17 => 17, + 18 => 18, + 19 => 19, + 20 => 20, + 24 => 24, + 25 => 25, + 26 => 26, + 27 => 27, + 28 => 28, + 29 => 29, + 30 => 30, + 32 => 30, + 31 => 31, + 33 => 33, + 34 => 34, + 36 => 36, + 37 => 37, + 38 => 38, + 39 => 39, + 40 => 40, + 41 => 41, + 42 => 42, + 43 => 43, + 44 => 44, + 45 => 45, + 46 => 46, + 47 => 47, + 48 => 48, + 49 => 49, + 58 => 49, + 148 => 49, + 152 => 49, + 156 => 49, + 158 => 49, + 50 => 50, + 149 => 50, + 155 => 50, + 51 => 51, + 52 => 52, + 53 => 52, + 54 => 54, + 133 => 54, + 57 => 57, + 59 => 59, + 60 => 60, + 61 => 60, + 62 => 62, + 63 => 63, + 66 => 66, + 67 => 67, + 68 => 68, + 69 => 69, + 70 => 69, + 71 => 71, + 72 => 72, + 73 => 73, + 74 => 74, + 75 => 75, + 76 => 76, + 77 => 77, + 79 => 79, + 81 => 79, + 82 => 79, + 113 => 79, + 80 => 80, + 85 => 85, + 86 => 86, + 87 => 87, + 88 => 88, + 90 => 90, + 91 => 91, + 92 => 91, + 95 => 95, + 96 => 96, + 97 => 97, + 100 => 100, + 102 => 102, + 103 => 103, + 104 => 104, + 105 => 105, + 107 => 107, + 108 => 108, + 109 => 109, + 110 => 110, + 111 => 111, + 112 => 112, + 114 => 114, + 172 => 114, + 115 => 115, + 116 => 116, + 117 => 117, + 118 => 118, + 119 => 119, + 120 => 120, + 128 => 120, + 121 => 121, + 122 => 122, + 123 => 123, + 124 => 123, + 126 => 123, + 127 => 123, + 125 => 125, + 129 => 129, + 130 => 130, + 131 => 131, + 176 => 131, + 132 => 132, + 134 => 134, + 135 => 135, + 136 => 136, + 137 => 137, + 138 => 138, + 139 => 139, + 140 => 140, + 141 => 141, + 142 => 142, + 143 => 143, + 144 => 144, + 145 => 145, + 146 => 146, + 147 => 147, + 150 => 150, + 151 => 151, + 153 => 153, + 154 => 154, + 157 => 157, + 159 => 159, + 160 => 160, + 161 => 161, + 162 => 162, + 163 => 163, + 164 => 164, + 165 => 165, + 166 => 166, + 167 => 167, + 168 => 168, + 169 => 168, + 171 => 171, + 173 => 173, + 174 => 174, + 177 => 177, + 178 => 178, + 179 => 179, + 180 => 180, + 183 => 180, + 181 => 181, + 184 => 181, + 182 => 182, + 185 => 185, + 186 => 186, + ); +// line 245 "src/Parser/TemplateParser.y" + public function yy_r0(){ + $this->root_buffer->prepend_array($this, $this->template_prefix); + $this->root_buffer->append_array($this, $this->template_postfix); + $this->_retvalue = $this->root_buffer->to_smarty_php($this); + } +// line 252 "src/Parser/TemplateParser.y" + public function yy_r1(){ + $text = $this->yystack[ $this->yyidx + 0 ]->minor; + + if ((string)$text == '') { + $this->current_buffer->append_subtree($this, null); + } + + $this->current_buffer->append_subtree($this, new \Smarty\ParseTree\Text($text, $this->strip)); + } +// line 262 "src/Parser/TemplateParser.y" + public function yy_r2(){ + $this->strip = true; + } +// line 266 "src/Parser/TemplateParser.y" + public function yy_r3(){ + $this->strip = false; + } +// line 271 "src/Parser/TemplateParser.y" + public function yy_r4(){ + $this->current_buffer->append_subtree($this, new \Smarty\ParseTree\Text($this->yystack[$this->yyidx + -1]->minor)); + } +// line 276 "src/Parser/TemplateParser.y" + public function yy_r5(){ + $this->_retvalue = $this->yystack[$this->yyidx + -3]->minor.$this->yystack[$this->yyidx + -1]->minor; + } +// line 279 "src/Parser/TemplateParser.y" + public function yy_r6(){ + $this->_retvalue = $this->yystack[$this->yyidx + 0]->minor; + } +// line 283 "src/Parser/TemplateParser.y" + public function yy_r7(){ + $this->_retvalue = $this->yystack[$this->yyidx + -1]->minor.$this->yystack[$this->yyidx + 0]->minor; + + } +// line 288 "src/Parser/TemplateParser.y" + public function yy_r8(){ + $this->_retvalue = ''; + } +// line 292 "src/Parser/TemplateParser.y" + public function yy_r9(){ + if ($this->compiler->has_code) { + $this->current_buffer->append_subtree($this, $this->mergePrefixCode($this->yystack[$this->yyidx + 0]->minor)); + } + $this->compiler->has_variable_string = false; + $this->block_nesting_level = $this->compiler->getTagStackCount(); + } +// line 304 "src/Parser/TemplateParser.y" + public function yy_r11(){ + $var = trim(substr($this->yystack[$this->yyidx + 0]->minor, $this->compiler->getLdelLength(), -$this->compiler->getRdelLength()), ' $'); + $attributes = []; + if (preg_match('/^(.*)(\s+nocache)$/', $var, $match)) { + $attributes[] = 'nocache'; + $var = $match[1]; + } + $this->_retvalue = $this->compiler->compilePrintExpression($this->compiler->compileVariable('\''.$var.'\''), $attributes); + } +// line 315 "src/Parser/TemplateParser.y" + public function yy_r12(){ + $tag = trim(substr($this->yystack[$this->yyidx + 0]->minor, $this->compiler->getLdelLength(), -$this->compiler->getRdelLength())); + if ($tag == 'strip') { + $this->strip = true; + $this->_retvalue = null; + } else { + if (defined($tag)) { + if ($this->security) { + $this->security->isTrustedConstant($tag, $this->compiler); + } + $this->_retvalue = $this->compiler->compilePrintExpression($tag); + } else { + if (preg_match('/^(.*)(\s+nocache)$/', $tag, $match)) { + $this->_retvalue = $this->compiler->compileTag($match[1],array('\'nocache\'')); + } else { + $this->_retvalue = $this->compiler->compileTag($tag,array()); + } + } + } + } +// line 336 "src/Parser/TemplateParser.y" + public function yy_r13(){ + $j = strrpos($this->yystack[$this->yyidx + 0]->minor,'.'); + if ($this->yystack[$this->yyidx + 0]->minor[$j+1] == 'c') { + // {$smarty.block.child} + $this->_retvalue = $this->compiler->compileChildBlock(); + } else { + // {$smarty.block.parent} + $this->_retvalue = $this->compiler->compileParentBlock(); + } + } +// line 347 "src/Parser/TemplateParser.y" + public function yy_r14(){ + $this->_retvalue = $this->yystack[$this->yyidx + -1]->minor; + } +// line 351 "src/Parser/TemplateParser.y" + public function yy_r15(){ + $this->_retvalue = $this->yystack[$this->yyidx + -1]->minor; + } +// line 355 "src/Parser/TemplateParser.y" + public function yy_r16(){ + $this->_retvalue = $this->compiler->compilePrintExpression($this->yystack[$this->yyidx + 0]->minor[0], $this->yystack[$this->yyidx + 0]->minor[1]); + } +// line 364 "src/Parser/TemplateParser.y" + public function yy_r17(){ + $this->_retvalue = $this->compiler->compileTag('assign',array_merge(array(array('value'=>$this->yystack[$this->yyidx + 0]->minor[0]),array('var'=>'\''.substr($this->yystack[$this->yyidx + -1]->minor,1).'\'')),$this->yystack[$this->yyidx + 0]->minor[1])); + } +// line 368 "src/Parser/TemplateParser.y" + public function yy_r18(){ + $this->_retvalue = $this->compiler->compileTag('assign',array_merge(array(array('value'=>$this->yystack[$this->yyidx + 0]->minor[0]),array('var'=>$this->yystack[$this->yyidx + -1]->minor['var'])),$this->yystack[$this->yyidx + 0]->minor[1]),array('smarty_internal_index'=>$this->yystack[$this->yyidx + -1]->minor['smarty_internal_index'])); + } +// line 372 "src/Parser/TemplateParser.y" + public function yy_r19(){ + $this->_retvalue = $this->yystack[$this->yyidx + 0]->minor; + } +// line 376 "src/Parser/TemplateParser.y" + public function yy_r20(){ + $this->_retvalue = array($this->yystack[$this->yyidx + -1]->minor,$this->yystack[$this->yyidx + 0]->minor); + } +// line 391 "src/Parser/TemplateParser.y" + public function yy_r24(){ + if (defined($this->yystack[$this->yyidx + -1]->minor)) { + if ($this->security) { + $this->security->isTrustedConstant($this->yystack[$this->yyidx + -1]->minor, $this->compiler); + } + $this->_retvalue = $this->compiler->compilePrintExpression($this->yystack[$this->yyidx + -1]->minor, $this->yystack[$this->yyidx + 0]->minor); + } else { + $this->_retvalue = $this->compiler->compileTag($this->yystack[$this->yyidx + -1]->minor,$this->yystack[$this->yyidx + 0]->minor); + } + } +// line 401 "src/Parser/TemplateParser.y" + public function yy_r25(){ + if (defined($this->yystack[$this->yyidx + 0]->minor)) { + if ($this->security) { + $this->security->isTrustedConstant($this->yystack[$this->yyidx + 0]->minor, $this->compiler); + } + $this->_retvalue = $this->compiler->compilePrintExpression($this->yystack[$this->yyidx + 0]->minor); + } else { + $this->_retvalue = $this->compiler->compileTag($this->yystack[$this->yyidx + 0]->minor,array()); + } + } +// line 414 "src/Parser/TemplateParser.y" + public function yy_r26(){ + if (defined($this->yystack[$this->yyidx + -2]->minor)) { + if ($this->security) { + $this->security->isTrustedConstant($this->yystack[$this->yyidx + -2]->minor, $this->compiler); + } + $this->_retvalue = $this->compiler->compilePrintExpression($this->yystack[$this->yyidx + -2]->minor, $this->yystack[$this->yyidx + 0]->minor, $this->yystack[$this->yyidx + -1]->minor); + } else { + $this->_retvalue = $this->compiler->compileTag($this->yystack[$this->yyidx + -2]->minor,$this->yystack[$this->yyidx + 0]->minor, array('modifierlist'=>$this->yystack[$this->yyidx + -1]->minor)); + } + } +// line 426 "src/Parser/TemplateParser.y" + public function yy_r27(){ + $this->_retvalue = $this->compiler->compileTag($this->yystack[$this->yyidx + -3]->minor,$this->yystack[$this->yyidx + 0]->minor,array('object_method'=>$this->yystack[$this->yyidx + -1]->minor)); + } +// line 431 "src/Parser/TemplateParser.y" + public function yy_r28(){ + $this->_retvalue = $this->compiler->compileTag($this->yystack[$this->yyidx + -4]->minor,$this->yystack[$this->yyidx + 0]->minor,array('modifierlist'=>$this->yystack[$this->yyidx + -1]->minor, 'object_method'=>$this->yystack[$this->yyidx + -2]->minor)); + } +// line 436 "src/Parser/TemplateParser.y" + public function yy_r29(){ + $tag = trim(substr($this->yystack[$this->yyidx + -1]->minor,$this->compiler->getLdelLength())); + $this->_retvalue = $this->compiler->compileTag(($tag === 'else if')? 'elseif' : $tag,array(),array('if condition'=>$this->yystack[$this->yyidx + 0]->minor)); + } +// line 441 "src/Parser/TemplateParser.y" + public function yy_r30(){ + $tag = trim(substr($this->yystack[$this->yyidx + -2]->minor,$this->compiler->getLdelLength())); + $this->_retvalue = $this->compiler->compileTag(($tag === 'else if')? 'elseif' : $tag,$this->yystack[$this->yyidx + 0]->minor,array('if condition'=>$this->yystack[$this->yyidx + -1]->minor)); + } +// line 446 "src/Parser/TemplateParser.y" + public function yy_r31(){ + $tag = trim(substr($this->yystack[$this->yyidx + -1]->minor,$this->compiler->getLdelLength())); + $this->_retvalue = $this->compiler->compileTag(($tag === 'else if')? 'elseif' : $tag,array(),array('if condition'=>$this->yystack[$this->yyidx + 0]->minor)); + } +// line 457 "src/Parser/TemplateParser.y" + public function yy_r33(){ + $this->_retvalue = $this->compiler->compileTag('for',array_merge($this->yystack[$this->yyidx + 0]->minor,array(array('start'=>$this->yystack[$this->yyidx + -6]->minor),array('ifexp'=>$this->yystack[$this->yyidx + -4]->minor),array('var'=>$this->yystack[$this->yyidx + -2]->minor),array('step'=>$this->yystack[$this->yyidx + -1]->minor))),1); + } +// line 461 "src/Parser/TemplateParser.y" + public function yy_r34(){ + $this->_retvalue = '='.$this->yystack[$this->yyidx + 0]->minor; + } +// line 469 "src/Parser/TemplateParser.y" + public function yy_r36(){ + $this->_retvalue = $this->compiler->compileTag('for',array_merge($this->yystack[$this->yyidx + 0]->minor,array(array('start'=>$this->yystack[$this->yyidx + -3]->minor),array('to'=>$this->yystack[$this->yyidx + -1]->minor))),0); + } +// line 473 "src/Parser/TemplateParser.y" + public function yy_r37(){ + $this->_retvalue = $this->compiler->compileTag('for',array_merge($this->yystack[$this->yyidx + 0]->minor,array(array('start'=>$this->yystack[$this->yyidx + -5]->minor),array('to'=>$this->yystack[$this->yyidx + -3]->minor),array('step'=>$this->yystack[$this->yyidx + -1]->minor))),0); + } +// line 478 "src/Parser/TemplateParser.y" + public function yy_r38(){ + $this->_retvalue = $this->compiler->compileTag('foreach',array_merge($this->yystack[$this->yyidx + 0]->minor,array(array('from'=>$this->yystack[$this->yyidx + -3]->minor),array('item'=>$this->yystack[$this->yyidx + -1]->minor)))); + } +// line 482 "src/Parser/TemplateParser.y" + public function yy_r39(){ + $this->_retvalue = $this->compiler->compileTag('foreach',array_merge($this->yystack[$this->yyidx + 0]->minor,array(array('from'=>$this->yystack[$this->yyidx + -5]->minor),array('item'=>$this->yystack[$this->yyidx + -1]->minor),array('key'=>$this->yystack[$this->yyidx + -3]->minor)))); + } +// line 485 "src/Parser/TemplateParser.y" + public function yy_r40(){ + $this->_retvalue = $this->compiler->compileTag('foreach',$this->yystack[$this->yyidx + 0]->minor); + } +// line 490 "src/Parser/TemplateParser.y" + public function yy_r41(){ + $this->_retvalue = $this->compiler->compileTag('setfilter',array(),array('modifier_list'=>array(array_merge(array($this->yystack[$this->yyidx + -1]->minor),$this->yystack[$this->yyidx + 0]->minor)))); + } +// line 494 "src/Parser/TemplateParser.y" + public function yy_r42(){ + $this->_retvalue = $this->compiler->compileTag('setfilter',array(),array('modifier_list'=>array_merge(array(array_merge(array($this->yystack[$this->yyidx + -2]->minor),$this->yystack[$this->yyidx + -1]->minor)),$this->yystack[$this->yyidx + 0]->minor))); + } +// line 500 "src/Parser/TemplateParser.y" + public function yy_r43(){ + $tag = trim(substr($this->yystack[$this->yyidx + 0]->minor, $this->compiler->getLdelLength(), -$this->compiler->getRdelLength()), ' /'); + if ($tag === 'strip') { + $this->strip = false; + $this->_retvalue = null; + } else { + $this->_retvalue = $this->compiler->compileTag($tag.'close',array()); + } + } +// line 509 "src/Parser/TemplateParser.y" + public function yy_r44(){ + $this->_retvalue = $this->compiler->compileTag($this->yystack[$this->yyidx + 0]->minor.'close',array()); + } +// line 513 "src/Parser/TemplateParser.y" + public function yy_r45(){ + $this->_retvalue = $this->compiler->compileTag($this->yystack[$this->yyidx + -1]->minor.'close',array(),array('modifier_list'=>$this->yystack[$this->yyidx + 0]->minor)); + } +// line 518 "src/Parser/TemplateParser.y" + public function yy_r46(){ + $this->_retvalue = $this->compiler->compileTag($this->yystack[$this->yyidx + -2]->minor.'close',array(),array('object_method'=>$this->yystack[$this->yyidx + 0]->minor)); + } +// line 522 "src/Parser/TemplateParser.y" + public function yy_r47(){ + $this->_retvalue = $this->compiler->compileTag($this->yystack[$this->yyidx + -3]->minor.'close',array(),array('object_method'=>$this->yystack[$this->yyidx + -1]->minor, 'modifier_list'=>$this->yystack[$this->yyidx + 0]->minor)); + } +// line 530 "src/Parser/TemplateParser.y" + public function yy_r48(){ + $this->_retvalue = $this->yystack[$this->yyidx + -1]->minor; + $this->_retvalue[] = $this->yystack[$this->yyidx + 0]->minor; + } +// line 536 "src/Parser/TemplateParser.y" + public function yy_r49(){ + $this->_retvalue = array($this->yystack[$this->yyidx + 0]->minor); + } +// line 541 "src/Parser/TemplateParser.y" + public function yy_r50(){ + $this->_retvalue = array(); + } +// line 546 "src/Parser/TemplateParser.y" + public function yy_r51(){ + if (defined($this->yystack[$this->yyidx + 0]->minor)) { + if ($this->security) { + $this->security->isTrustedConstant($this->yystack[$this->yyidx + 0]->minor, $this->compiler); + } + $this->_retvalue = array($this->yystack[$this->yyidx + -2]->minor=>$this->yystack[$this->yyidx + 0]->minor); + } else { + $this->_retvalue = array($this->yystack[$this->yyidx + -2]->minor=>'\''.$this->yystack[$this->yyidx + 0]->minor.'\''); + } + } +// line 557 "src/Parser/TemplateParser.y" + public function yy_r52(){ + $this->_retvalue = array(trim($this->yystack[$this->yyidx + -1]->minor," =\n\r\t")=>$this->yystack[$this->yyidx + 0]->minor); + } +// line 565 "src/Parser/TemplateParser.y" + public function yy_r54(){ + $this->_retvalue = '\''.$this->yystack[$this->yyidx + 0]->minor.'\''; + } +// line 577 "src/Parser/TemplateParser.y" + public function yy_r57(){ + $this->_retvalue = array($this->yystack[$this->yyidx + -2]->minor=>$this->yystack[$this->yyidx + 0]->minor); + } +// line 590 "src/Parser/TemplateParser.y" + public function yy_r59(){ + $this->yystack[$this->yyidx + -2]->minor[]=$this->yystack[$this->yyidx + 0]->minor; + $this->_retvalue = $this->yystack[$this->yyidx + -2]->minor; + } +// line 595 "src/Parser/TemplateParser.y" + public function yy_r60(){ + $this->_retvalue = array('var' => '\''.substr($this->yystack[$this->yyidx + -2]->minor,1).'\'', 'value'=>$this->yystack[$this->yyidx + 0]->minor); + } +// line 602 "src/Parser/TemplateParser.y" + public function yy_r62(){ + $this->_retvalue = array('var' => $this->yystack[$this->yyidx + -2]->minor, 'value'=>$this->yystack[$this->yyidx + 0]->minor); + } +// line 606 "src/Parser/TemplateParser.y" + public function yy_r63(){ + $this->_retvalue = $this->yystack[$this->yyidx + -1]->minor; + } +// line 626 "src/Parser/TemplateParser.y" + public function yy_r66(){ + $this->_retvalue = '$_smarty_tpl->getVariable(\''. substr($this->yystack[$this->yyidx + 0]->minor,1) .'\')->preIncDec(\'' . $this->yystack[$this->yyidx + -1]->minor . '\')'; + } +// line 631 "src/Parser/TemplateParser.y" + public function yy_r67(){ + $this->_retvalue = '$_smarty_tpl->getVariable(\''. substr($this->yystack[$this->yyidx + -1]->minor,1) .'\')->postIncDec(\'' . $this->yystack[$this->yyidx + 0]->minor . '\')'; + } +// line 636 "src/Parser/TemplateParser.y" + public function yy_r68(){ + $this->_retvalue = '$_smarty_tpl->getStreamVariable(\''.substr($this->yystack[$this->yyidx + -2]->minor,1).'://' . $this->yystack[$this->yyidx + 0]->minor . '\')'; + } +// line 641 "src/Parser/TemplateParser.y" + public function yy_r69(){ + $this->_retvalue = $this->yystack[$this->yyidx + -2]->minor . trim($this->yystack[$this->yyidx + -1]->minor) . $this->yystack[$this->yyidx + 0]->minor; + } +// line 651 "src/Parser/TemplateParser.y" + public function yy_r71(){ + $this->_retvalue = $this->yystack[$this->yyidx + -1]->minor['pre']. $this->yystack[$this->yyidx + -2]->minor.$this->yystack[$this->yyidx + -1]->minor['op'].$this->yystack[$this->yyidx + 0]->minor .')'; + } +// line 655 "src/Parser/TemplateParser.y" + public function yy_r72(){ + $this->_retvalue = $this->yystack[$this->yyidx + -2]->minor.$this->yystack[$this->yyidx + -1]->minor.$this->yystack[$this->yyidx + 0]->minor; + } +// line 659 "src/Parser/TemplateParser.y" + public function yy_r73(){ + $this->_retvalue = $this->yystack[$this->yyidx + 0]->minor . $this->yystack[$this->yyidx + -1]->minor . ')'; + } +// line 663 "src/Parser/TemplateParser.y" + public function yy_r74(){ + $this->_retvalue = 'in_array('.$this->yystack[$this->yyidx + -2]->minor.','.$this->yystack[$this->yyidx + 0]->minor.')'; + } +// line 667 "src/Parser/TemplateParser.y" + public function yy_r75(){ + $this->_retvalue = 'in_array('.$this->yystack[$this->yyidx + -2]->minor.',(array)'.$this->yystack[$this->yyidx + 0]->minor.')'; + } +// line 675 "src/Parser/TemplateParser.y" + public function yy_r76(){ + $this->_retvalue = $this->yystack[$this->yyidx + -5]->minor.' ? '. $this->compiler->compileVariable('\''.substr($this->yystack[$this->yyidx + -2]->minor,1).'\'') . ' : '.$this->yystack[$this->yyidx + 0]->minor; + } +// line 679 "src/Parser/TemplateParser.y" + public function yy_r77(){ + $this->_retvalue = $this->yystack[$this->yyidx + -5]->minor.' ? '.$this->yystack[$this->yyidx + -2]->minor.' : '.$this->yystack[$this->yyidx + 0]->minor; + } +// line 689 "src/Parser/TemplateParser.y" + public function yy_r79(){ + $this->_retvalue = $this->yystack[$this->yyidx + -1]->minor.$this->yystack[$this->yyidx + 0]->minor; + } +// line 694 "src/Parser/TemplateParser.y" + public function yy_r80(){ + $this->_retvalue = '!'.$this->yystack[$this->yyidx + 0]->minor; + } +// line 715 "src/Parser/TemplateParser.y" + public function yy_r85(){ + $this->_retvalue = $this->yystack[$this->yyidx + -2]->minor.'.'.$this->yystack[$this->yyidx + 0]->minor; + } +// line 719 "src/Parser/TemplateParser.y" + public function yy_r86(){ + $this->_retvalue = $this->yystack[$this->yyidx + -1]->minor.'.'; + } +// line 723 "src/Parser/TemplateParser.y" + public function yy_r87(){ + $this->_retvalue = '.'.$this->yystack[$this->yyidx + 0]->minor; + } +// line 728 "src/Parser/TemplateParser.y" + public function yy_r88(){ + if (defined($this->yystack[$this->yyidx + 0]->minor)) { + if ($this->security) { + $this->security->isTrustedConstant($this->yystack[$this->yyidx + 0]->minor, $this->compiler); + } + $this->_retvalue = $this->yystack[$this->yyidx + 0]->minor; + } else { + $this->_retvalue = '\''.$this->yystack[$this->yyidx + 0]->minor.'\''; + } + } +// line 745 "src/Parser/TemplateParser.y" + public function yy_r90(){ + $this->_retvalue = '('. $this->yystack[$this->yyidx + -1]->minor .')'; + } +// line 749 "src/Parser/TemplateParser.y" + public function yy_r91(){ + $this->_retvalue = $this->yystack[$this->yyidx + -2]->minor.$this->yystack[$this->yyidx + -1]->minor.$this->yystack[$this->yyidx + 0]->minor; + } +// line 767 "src/Parser/TemplateParser.y" + public function yy_r95(){ + if ($this->security && $this->security->static_classes !== array()) { + $this->compiler->trigger_template_error('dynamic static class not allowed by security setting'); + } + $prefixVar = $this->compiler->getNewPrefixVariable(); + if ($this->yystack[$this->yyidx + -2]->minor['var'] === '\'smarty\'') { + $this->compiler->appendPrefixCode("compile(array(),$this->compiler,$this->yystack[$this->yyidx + -2]->minor['smarty_internal_index']).';?>'); + } else { + $this->compiler->appendPrefixCode("compiler->compileVariable($this->yystack[$this->yyidx + -2]->minor['var']).$this->yystack[$this->yyidx + -2]->minor['smarty_internal_index'].';?>'); + } + $this->_retvalue = $prefixVar .'::'.$this->yystack[$this->yyidx + 0]->minor[0].$this->yystack[$this->yyidx + 0]->minor[1]; + } +// line 781 "src/Parser/TemplateParser.y" + public function yy_r96(){ + $prefixVar = $this->compiler->getNewPrefixVariable(); + $tmp = $this->compiler->appendCode('', $this->yystack[$this->yyidx + 0]->minor); + $this->compiler->appendPrefixCode($this->compiler->appendCode($tmp, "")); + $this->_retvalue = $prefixVar; + } +// line 788 "src/Parser/TemplateParser.y" + public function yy_r97(){ + $this->_retvalue = $this->compiler->compileModifier($this->yystack[$this->yyidx + 0]->minor, $this->yystack[$this->yyidx + -1]->minor); + } +// line 801 "src/Parser/TemplateParser.y" + public function yy_r100(){ + if (!in_array(strtolower($this->yystack[$this->yyidx + -2]->minor), array('self', 'parent')) && (!$this->security || $this->security->isTrustedStaticClassAccess($this->yystack[$this->yyidx + -2]->minor, $this->yystack[$this->yyidx + 0]->minor, $this->compiler))) { + if (isset($this->smarty->registered_classes[$this->yystack[$this->yyidx + -2]->minor])) { + $this->_retvalue = $this->smarty->registered_classes[$this->yystack[$this->yyidx + -2]->minor].'::'.$this->yystack[$this->yyidx + 0]->minor[0].$this->yystack[$this->yyidx + 0]->minor[1]; + } else { + $this->_retvalue = $this->yystack[$this->yyidx + -2]->minor.'::'.$this->yystack[$this->yyidx + 0]->minor[0].$this->yystack[$this->yyidx + 0]->minor[1]; + } + } else { + $this->compiler->trigger_template_error ('static class \''.$this->yystack[$this->yyidx + -2]->minor.'\' is undefined or not allowed by security setting'); + } + } +// line 820 "src/Parser/TemplateParser.y" + public function yy_r102(){ + $this->_retvalue = $this->yystack[$this->yyidx + 0]->minor; + } +// line 831 "src/Parser/TemplateParser.y" + public function yy_r103(){ + $this->_retvalue = $this->compiler->compileVariable('\''.substr($this->yystack[$this->yyidx + 0]->minor,1).'\''); + } +// line 834 "src/Parser/TemplateParser.y" + public function yy_r104(){ + if ($this->yystack[$this->yyidx + 0]->minor['var'] === '\'smarty\'') { + $smarty_var = (new \Smarty\Compile\SpecialVariableCompiler())->compile(array(),$this->compiler,$this->yystack[$this->yyidx + 0]->minor['smarty_internal_index']); + $this->_retvalue = $smarty_var; + } else { + // used for array reset,next,prev,end,current + $this->last_variable = $this->yystack[$this->yyidx + 0]->minor['var']; + $this->last_index = $this->yystack[$this->yyidx + 0]->minor['smarty_internal_index']; + $this->_retvalue = $this->compiler->compileVariable($this->yystack[$this->yyidx + 0]->minor['var']).$this->yystack[$this->yyidx + 0]->minor['smarty_internal_index']; + } + } +// line 847 "src/Parser/TemplateParser.y" + public function yy_r105(){ + $this->_retvalue = '$_smarty_tpl->getVariable('. $this->yystack[$this->yyidx + -2]->minor .')->'.$this->yystack[$this->yyidx + 0]->minor; + } +// line 857 "src/Parser/TemplateParser.y" + public function yy_r107(){ + $this->_retvalue = $this->compiler->compileConfigVariable('\'' . $this->yystack[$this->yyidx + -1]->minor . '\''); + } +// line 861 "src/Parser/TemplateParser.y" + public function yy_r108(){ + $this->_retvalue = '(is_array($tmp = ' . $this->compiler->compileConfigVariable('\'' . $this->yystack[$this->yyidx + -2]->minor . '\'') . ') ? $tmp'.$this->yystack[$this->yyidx + 0]->minor.' :null)'; + } +// line 865 "src/Parser/TemplateParser.y" + public function yy_r109(){ + $this->_retvalue = $this->compiler->compileConfigVariable($this->yystack[$this->yyidx + -1]->minor); + } +// line 869 "src/Parser/TemplateParser.y" + public function yy_r110(){ + $this->_retvalue = '(is_array($tmp = ' . $this->compiler->compileConfigVariable($this->yystack[$this->yyidx + -2]->minor) . ') ? $tmp'.$this->yystack[$this->yyidx + 0]->minor.' : null)'; + } +// line 873 "src/Parser/TemplateParser.y" + public function yy_r111(){ + $this->_retvalue = array('var'=>'\''.substr($this->yystack[$this->yyidx + -1]->minor,1).'\'', 'smarty_internal_index'=>$this->yystack[$this->yyidx + 0]->minor); + } +// line 876 "src/Parser/TemplateParser.y" + public function yy_r112(){ + $this->_retvalue = array('var'=>$this->yystack[$this->yyidx + -1]->minor, 'smarty_internal_index'=>$this->yystack[$this->yyidx + 0]->minor); + } +// line 889 "src/Parser/TemplateParser.y" + public function yy_r114(){ + return; + } +// line 895 "src/Parser/TemplateParser.y" + public function yy_r115(){ + $this->_retvalue = '['.$this->compiler->compileVariable('\''.substr($this->yystack[$this->yyidx + 0]->minor,1).'\'').']'; + } +// line 898 "src/Parser/TemplateParser.y" + public function yy_r116(){ + $this->_retvalue = '['.$this->compiler->compileVariable($this->yystack[$this->yyidx + 0]->minor).']'; + } +// line 902 "src/Parser/TemplateParser.y" + public function yy_r117(){ + $this->_retvalue = '['.$this->compiler->compileVariable($this->yystack[$this->yyidx + -2]->minor).'->'.$this->yystack[$this->yyidx + 0]->minor.']'; + } +// line 906 "src/Parser/TemplateParser.y" + public function yy_r118(){ + $this->_retvalue = '[\''. $this->yystack[$this->yyidx + 0]->minor .'\']'; + } +// line 910 "src/Parser/TemplateParser.y" + public function yy_r119(){ + $this->_retvalue = '['. $this->yystack[$this->yyidx + 0]->minor .']'; + } +// line 915 "src/Parser/TemplateParser.y" + public function yy_r120(){ + $this->_retvalue = '['. $this->yystack[$this->yyidx + -1]->minor .']'; + } +// line 920 "src/Parser/TemplateParser.y" + public function yy_r121(){ + $this->_retvalue = '['.(new \Smarty\Compile\SpecialVariableCompiler())->compile(array(),$this->compiler,'[\'section\'][\''.$this->yystack[$this->yyidx + -1]->minor.'\'][\'index\']').']'; + } +// line 924 "src/Parser/TemplateParser.y" + public function yy_r122(){ + $this->_retvalue = '['.(new \Smarty\Compile\SpecialVariableCompiler())->compile(array(),$this->compiler,'[\'section\'][\''.$this->yystack[$this->yyidx + -3]->minor.'\'][\''.$this->yystack[$this->yyidx + -1]->minor.'\']').']'; + } +// line 927 "src/Parser/TemplateParser.y" + public function yy_r123(){ + $this->_retvalue = '['.$this->yystack[$this->yyidx + -1]->minor.']'; + } +// line 933 "src/Parser/TemplateParser.y" + public function yy_r125(){ + $this->_retvalue = '['.$this->compiler->compileVariable('\''.substr($this->yystack[$this->yyidx + -1]->minor,1).'\'').']'; + } +// line 949 "src/Parser/TemplateParser.y" + public function yy_r129(){ + $this->_retvalue = '[]'; + } +// line 959 "src/Parser/TemplateParser.y" + public function yy_r130(){ + $this->_retvalue = '\''.substr($this->yystack[$this->yyidx + 0]->minor,1).'\''; + } +// line 963 "src/Parser/TemplateParser.y" + public function yy_r131(){ + $this->_retvalue = '\'\''; + } +// line 968 "src/Parser/TemplateParser.y" + public function yy_r132(){ + $this->_retvalue = $this->yystack[$this->yyidx + -1]->minor.'.'.$this->yystack[$this->yyidx + 0]->minor; + } +// line 976 "src/Parser/TemplateParser.y" + public function yy_r134(){ + $var = trim(substr($this->yystack[$this->yyidx + 0]->minor, $this->compiler->getLdelLength(), -$this->compiler->getRdelLength()), ' $'); + $this->_retvalue = $this->compiler->compileVariable('\''.$var.'\''); + } +// line 982 "src/Parser/TemplateParser.y" + public function yy_r135(){ + $this->_retvalue = '('.$this->yystack[$this->yyidx + -1]->minor.')'; + } +// line 989 "src/Parser/TemplateParser.y" + public function yy_r136(){ + if ($this->yystack[$this->yyidx + -1]->minor['var'] === '\'smarty\'') { + $this->_retvalue = (new \Smarty\Compile\SpecialVariableCompiler())->compile(array(),$this->compiler,$this->yystack[$this->yyidx + -1]->minor['smarty_internal_index']).$this->yystack[$this->yyidx + 0]->minor; + } else { + $this->_retvalue = $this->compiler->compileVariable($this->yystack[$this->yyidx + -1]->minor['var']).$this->yystack[$this->yyidx + -1]->minor['smarty_internal_index'].$this->yystack[$this->yyidx + 0]->minor; + } + } +// line 998 "src/Parser/TemplateParser.y" + public function yy_r137(){ + $this->_retvalue = $this->yystack[$this->yyidx + 0]->minor; + } +// line 1003 "src/Parser/TemplateParser.y" + public function yy_r138(){ + $this->_retvalue = $this->yystack[$this->yyidx + -1]->minor.$this->yystack[$this->yyidx + 0]->minor; + } +// line 1008 "src/Parser/TemplateParser.y" + public function yy_r139(){ + if ($this->security && substr($this->yystack[$this->yyidx + -1]->minor,0,1) === '_') { + $this->compiler->trigger_template_error (self::ERR1); + } + $this->_retvalue = '->'.$this->yystack[$this->yyidx + -1]->minor.$this->yystack[$this->yyidx + 0]->minor; + } +// line 1015 "src/Parser/TemplateParser.y" + public function yy_r140(){ + if ($this->security) { + $this->compiler->trigger_template_error (self::ERR2); + } + $this->_retvalue = '->{'.$this->compiler->compileVariable($this->yystack[$this->yyidx + -1]->minor).$this->yystack[$this->yyidx + 0]->minor.'}'; + } +// line 1022 "src/Parser/TemplateParser.y" + public function yy_r141(){ + if ($this->security) { + $this->compiler->trigger_template_error (self::ERR2); + } + $this->_retvalue = '->{'.$this->yystack[$this->yyidx + -2]->minor.$this->yystack[$this->yyidx + 0]->minor.'}'; + } +// line 1029 "src/Parser/TemplateParser.y" + public function yy_r142(){ + if ($this->security) { + $this->compiler->trigger_template_error (self::ERR2); + } + $this->_retvalue = '->{\''.$this->yystack[$this->yyidx + -4]->minor.'\'.'.$this->yystack[$this->yyidx + -2]->minor.$this->yystack[$this->yyidx + 0]->minor.'}'; + } +// line 1037 "src/Parser/TemplateParser.y" + public function yy_r143(){ + $this->_retvalue = '->'.$this->yystack[$this->yyidx + 0]->minor; + } +// line 1045 "src/Parser/TemplateParser.y" + public function yy_r144(){ + $this->_retvalue = $this->compiler->compileFunctionCall($this->yystack[$this->yyidx + -3]->minor, $this->yystack[$this->yyidx + -1]->minor); + } +// line 1053 "src/Parser/TemplateParser.y" + public function yy_r145(){ + if ($this->security && substr($this->yystack[$this->yyidx + -3]->minor,0,1) === '_') { + $this->compiler->trigger_template_error (self::ERR1); + } + $this->_retvalue = $this->yystack[$this->yyidx + -3]->minor . '('. implode(',',$this->yystack[$this->yyidx + -1]->minor) .')'; + } +// line 1060 "src/Parser/TemplateParser.y" + public function yy_r146(){ + if ($this->security) { + $this->compiler->trigger_template_error (self::ERR2); + } + $prefixVar = $this->compiler->getNewPrefixVariable(); + $this->compiler->appendPrefixCode("compiler->compileVariable('\''.substr($this->yystack[$this->yyidx + -3]->minor,1).'\'').';?>'); + $this->_retvalue = $prefixVar .'('. implode(',',$this->yystack[$this->yyidx + -1]->minor) .')'; + } +// line 1071 "src/Parser/TemplateParser.y" + public function yy_r147(){ + $this->_retvalue = array_merge($this->yystack[$this->yyidx + -2]->minor,array($this->yystack[$this->yyidx + 0]->minor)); + } +// line 1088 "src/Parser/TemplateParser.y" + public function yy_r150(){ + $this->_retvalue = array_merge($this->yystack[$this->yyidx + -2]->minor,array(array_merge($this->yystack[$this->yyidx + -1]->minor,$this->yystack[$this->yyidx + 0]->minor))); + } +// line 1092 "src/Parser/TemplateParser.y" + public function yy_r151(){ + $this->_retvalue = array(array_merge($this->yystack[$this->yyidx + -1]->minor,$this->yystack[$this->yyidx + 0]->minor)); + } +// line 1100 "src/Parser/TemplateParser.y" + public function yy_r153(){ + $this->_retvalue = array($this->yystack[$this->yyidx + 0]->minor); + } +// line 1108 "src/Parser/TemplateParser.y" + public function yy_r154(){ + $this->_retvalue = array_merge($this->yystack[$this->yyidx + -1]->minor,$this->yystack[$this->yyidx + 0]->minor); + } +// line 1121 "src/Parser/TemplateParser.y" + public function yy_r157(){ + $this->_retvalue = array(trim($this->yystack[$this->yyidx + -1]->minor).$this->yystack[$this->yyidx + 0]->minor); + } +// line 1130 "src/Parser/TemplateParser.y" + public function yy_r159(){ + $this->_retvalue = array($this->yystack[$this->yyidx + 0]->minor, '', 'method'); + } +// line 1135 "src/Parser/TemplateParser.y" + public function yy_r160(){ + $this->_retvalue = array($this->yystack[$this->yyidx + -1]->minor, $this->yystack[$this->yyidx + 0]->minor, 'method'); + } +// line 1140 "src/Parser/TemplateParser.y" + public function yy_r161(){ + $this->_retvalue = array($this->yystack[$this->yyidx + 0]->minor, ''); + } +// line 1145 "src/Parser/TemplateParser.y" + public function yy_r162(){ + $this->_retvalue = array($this->yystack[$this->yyidx + -1]->minor, $this->yystack[$this->yyidx + 0]->minor, 'property'); + } +// line 1150 "src/Parser/TemplateParser.y" + public function yy_r163(){ + $this->_retvalue = array($this->yystack[$this->yyidx + -2]->minor, $this->yystack[$this->yyidx + -1]->minor.$this->yystack[$this->yyidx + 0]->minor, 'property'); + } +// line 1156 "src/Parser/TemplateParser.y" + public function yy_r164(){ + $this->_retvalue = ' '. trim($this->yystack[$this->yyidx + 0]->minor) . ' '; + } +// line 1160 "src/Parser/TemplateParser.y" + public function yy_r165(){ + static $lops = array( + 'eq' => ' == ', + 'ne' => ' != ', + 'neq' => ' != ', + 'gt' => ' > ', + 'ge' => ' >= ', + 'gte' => ' >= ', + 'lt' => ' < ', + 'le' => ' <= ', + 'lte' => ' <= ', + 'mod' => ' % ', + 'and' => ' && ', + 'or' => ' || ', + 'xor' => ' xor ', + ); + $op = strtolower(preg_replace('/\s*/', '', $this->yystack[$this->yyidx + 0]->minor)); + $this->_retvalue = $lops[$op]; + } +// line 1179 "src/Parser/TemplateParser.y" + public function yy_r166(){ + static $tlops = array( + 'isdivby' => array('op' => ' % ', 'pre' => '!('), + 'isnotdivby' => array('op' => ' % ', 'pre' => '('), + 'isevenby' => array('op' => ' / ', 'pre' => '!(1 & '), + 'isnotevenby' => array('op' => ' / ', 'pre' => '(1 & '), + 'isoddby' => array('op' => ' / ', 'pre' => '(1 & '), + 'isnotoddby' => array('op' => ' / ', 'pre' => '!(1 & '), + ); + $op = strtolower(preg_replace('/\s*/', '', $this->yystack[$this->yyidx + 0]->minor)); + $this->_retvalue = $tlops[$op]; + } +// line 1192 "src/Parser/TemplateParser.y" + public function yy_r167(){ + static $scond = array ( + 'iseven' => '!(1 & ', + 'isnoteven' => '(1 & ', + 'isodd' => '(1 & ', + 'isnotodd' => '!(1 & ', + ); + $op = strtolower(str_replace(' ', '', $this->yystack[$this->yyidx + 0]->minor)); + $this->_retvalue = $scond[$op]; + } +// line 1206 "src/Parser/TemplateParser.y" + public function yy_r168(){ + $this->_retvalue = 'array('.$this->yystack[$this->yyidx + -1]->minor.')'; + } +// line 1217 "src/Parser/TemplateParser.y" + public function yy_r171(){ + $this->_retvalue = $this->yystack[$this->yyidx + -2]->minor.','.$this->yystack[$this->yyidx + 0]->minor; + } +// line 1225 "src/Parser/TemplateParser.y" + public function yy_r173(){ + $this->_retvalue = $this->yystack[$this->yyidx + -2]->minor.'=>'.$this->yystack[$this->yyidx + 0]->minor; + } +// line 1229 "src/Parser/TemplateParser.y" + public function yy_r174(){ + $this->_retvalue = '\''.$this->yystack[$this->yyidx + -2]->minor.'\'=>'.$this->yystack[$this->yyidx + 0]->minor; + } +// line 1245 "src/Parser/TemplateParser.y" + public function yy_r177(){ + $this->compiler->leaveDoubleQuote(); + $this->_retvalue = $this->yystack[$this->yyidx + -1]->minor->to_smarty_php($this); + } +// line 1251 "src/Parser/TemplateParser.y" + public function yy_r178(){ + $this->yystack[$this->yyidx + -1]->minor->append_subtree($this, $this->yystack[$this->yyidx + 0]->minor); + $this->_retvalue = $this->yystack[$this->yyidx + -1]->minor; + } +// line 1256 "src/Parser/TemplateParser.y" + public function yy_r179(){ + $this->_retvalue = new Dq($this, $this->yystack[$this->yyidx + 0]->minor); + } +// line 1260 "src/Parser/TemplateParser.y" + public function yy_r180(){ + $this->_retvalue = new Code('(string)'.$this->yystack[$this->yyidx + -1]->minor); + } +// line 1264 "src/Parser/TemplateParser.y" + public function yy_r181(){ + $this->_retvalue = new Code('(string)('.$this->yystack[$this->yyidx + -1]->minor.')'); + } +// line 1268 "src/Parser/TemplateParser.y" + public function yy_r182(){ + $this->_retvalue = new Code('(string)$_smarty_tpl->getValue(\''. substr($this->yystack[$this->yyidx + 0]->minor,1) .'\')'); + } +// line 1280 "src/Parser/TemplateParser.y" + public function yy_r185(){ + $this->_retvalue = new Tag($this, $this->yystack[$this->yyidx + 0]->minor); + } +// line 1284 "src/Parser/TemplateParser.y" + public function yy_r186(){ + $this->_retvalue = new DqContent($this->yystack[$this->yyidx + 0]->minor); + } + + private $_retvalue; + + public function yy_reduce($yyruleno) + { + if ($this->yyTraceFILE && $yyruleno >= 0 + && $yyruleno < count(self::$yyRuleName)) { + fprintf($this->yyTraceFILE, "%sReduce (%d) [%s].\n", + $this->yyTracePrompt, $yyruleno, + self::$yyRuleName[$yyruleno]); + } + + $this->_retvalue = $yy_lefthand_side = null; + if (isset(self::$yyReduceMap[$yyruleno])) { + // call the action + $this->_retvalue = null; + $this->{'yy_r' . self::$yyReduceMap[$yyruleno]}(); + $yy_lefthand_side = $this->_retvalue; + } + $yygoto = self::$yyRuleInfo[$yyruleno][0]; + $yysize = self::$yyRuleInfo[$yyruleno][1]; + $this->yyidx -= $yysize; + for ($i = $yysize; $i; $i--) { + // pop all of the right-hand side parameters + array_pop($this->yystack); + } + $yyact = $this->yy_find_reduce_action($this->yystack[$this->yyidx]->stateno, $yygoto); + if ($yyact < self::YYNSTATE) { + if (!$this->yyTraceFILE && $yysize) { + $this->yyidx++; + $x = (object) ['stateno' => null, 'major' => null, 'minor' => null]; + $x->stateno = $yyact; + $x->major = $yygoto; + $x->minor = $yy_lefthand_side; + $this->yystack[$this->yyidx] = $x; + } else { + $this->yy_shift($yyact, $yygoto, $yy_lefthand_side); + } + } elseif ($yyact === self::YYNSTATE + self::YYNRULE + 1) { + $this->yy_accept(); + } + } + + public function yy_parse_failed() + { + if ($this->yyTraceFILE) { + fprintf($this->yyTraceFILE, "%sFail!\n", $this->yyTracePrompt); + } while ($this->yyidx >= 0) { + $this->yy_pop_parser_stack(); + } + } + + public function yy_syntax_error($yymajor, $TOKEN) + { +// line 225 "src/Parser/TemplateParser.y" + + $this->internalError = true; + $this->yymajor = $yymajor; + $this->compiler->trigger_template_error(); + } + + public function yy_accept() + { + if ($this->yyTraceFILE) { + fprintf($this->yyTraceFILE, "%sAccept!\n", $this->yyTracePrompt); + } while ($this->yyidx >= 0) { + $this->yy_pop_parser_stack(); + } +// line 218 "src/Parser/TemplateParser.y" + + $this->successful = !$this->internalError; + $this->internalError = false; + $this->retvalue = $this->_retvalue; + } + + public function doParse($yymajor, $yytokenvalue) + { + $yyerrorhit = 0; /* True if yymajor has invoked an error */ + + if ($this->yyidx === null || $this->yyidx < 0) { + $this->yyidx = 0; + $this->yyerrcnt = -1; + $x = (object) ['stateno' => null, 'major' => null, 'minor' => null]; + $x->stateno = 0; + $x->major = 0; + $this->yystack = array(); + $this->yystack[] = $x; + } + $yyendofinput = ($yymajor==0); + + if ($this->yyTraceFILE) { + fprintf($this->yyTraceFILE, "%sInput %s\n", + $this->yyTracePrompt, $this->yyTokenName[$yymajor]); + } + + do { + $yyact = $this->yy_find_shift_action($yymajor); + if ($yymajor < self::YYERRORSYMBOL && + !$this->yy_is_expected_token($yymajor)) { + // force a syntax error + $yyact = self::YY_ERROR_ACTION; + } + if ($yyact < self::YYNSTATE) { + $this->yy_shift($yyact, $yymajor, $yytokenvalue); + $this->yyerrcnt--; + if ($yyendofinput && $this->yyidx >= 0) { + $yymajor = 0; + } else { + $yymajor = self::YYNOCODE; + } + } elseif ($yyact < self::YYNSTATE + self::YYNRULE) { + $this->yy_reduce($yyact - self::YYNSTATE); + } elseif ($yyact === self::YY_ERROR_ACTION) { + if ($this->yyTraceFILE) { + fprintf($this->yyTraceFILE, "%sSyntax Error!\n", + $this->yyTracePrompt); + } + if (self::YYERRORSYMBOL) { + if ($this->yyerrcnt < 0) { + $this->yy_syntax_error($yymajor, $yytokenvalue); + } + $yymx = $this->yystack[$this->yyidx]->major; + if ($yymx === self::YYERRORSYMBOL || $yyerrorhit) { + if ($this->yyTraceFILE) { + fprintf($this->yyTraceFILE, "%sDiscard input token %s\n", + $this->yyTracePrompt, $this->yyTokenName[$yymajor]); + } + $this->yy_destructor($yymajor, $yytokenvalue); + $yymajor = self::YYNOCODE; + } else { + while ($this->yyidx >= 0 && + $yymx !== self::YYERRORSYMBOL && + ($yyact = $this->yy_find_shift_action(self::YYERRORSYMBOL)) >= self::YYNSTATE + ){ + $this->yy_pop_parser_stack(); + } + if ($this->yyidx < 0 || $yymajor==0) { + $this->yy_destructor($yymajor, $yytokenvalue); + $this->yy_parse_failed(); + $yymajor = self::YYNOCODE; + } elseif ($yymx !== self::YYERRORSYMBOL) { + $u2 = 0; + $this->yy_shift($yyact, self::YYERRORSYMBOL, $u2); + } + } + $this->yyerrcnt = 3; + $yyerrorhit = 1; + } else { + if ($this->yyerrcnt <= 0) { + $this->yy_syntax_error($yymajor, $yytokenvalue); + } + $this->yyerrcnt = 3; + $this->yy_destructor($yymajor, $yytokenvalue); + if ($yyendofinput) { + $this->yy_parse_failed(); + } + $yymajor = self::YYNOCODE; + } + } else { + $this->yy_accept(); + $yymajor = self::YYNOCODE; + } + } while ($yymajor !== self::YYNOCODE && $this->yyidx >= 0); + } +} +