From e3123c04273b26a354efbf7aa4dd41bc4bb0af6b Mon Sep 17 00:00:00 2001 From: Uwe Tews Date: Sat, 16 May 2015 16:33:50 +0200 Subject: - improvement higher compilation speed by modified lexer/parser generator at "smarty/smarty-lexer" --- lexer/smarty_internal_configfilelexer.plex | 13 ++++++++ lexer/smarty_internal_templatelexer.plex | 48 ++++++++++++++++-------------- 2 files changed, 38 insertions(+), 23 deletions(-) (limited to 'lexer') diff --git a/lexer/smarty_internal_configfilelexer.plex b/lexer/smarty_internal_configfilelexer.plex index 78552c11..94196be5 100644 --- a/lexer/smarty_internal_configfilelexer.plex +++ b/lexer/smarty_internal_configfilelexer.plex @@ -91,6 +91,19 @@ class Smarty_Internal_Configfilelexer * @var array */ public $state_name = array(1 => 'START', 2 => 'VALUE', 3 => 'NAKED_STRING_VALUE', 4 => 'COMMENT', 5 => 'SECTION', 6 => 'TRIPPLE'); + + /** + * storage for assembled token patterns + * + * @var sring + */ + 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 * diff --git a/lexer/smarty_internal_templatelexer.plex b/lexer/smarty_internal_templatelexer.plex index 6bbf1ddb..e062a7bf 100644 --- a/lexer/smarty_internal_templatelexer.plex +++ b/lexer/smarty_internal_templatelexer.plex @@ -132,26 +132,29 @@ class Smarty_Internal_Templatelexer * * @var array */ - public $state_name = array(1 => 'TEXT', 2 => 'SMARTY', 3 => 'LITERAL', 4 => 'DOUBLEQUOTEDSTRING', 5 => 'CHILDBODY'); + public $state_name = array(1 => 'TEXT', 2 => 'SMARTY', 3 => 'LITERAL', 4 => 'DOUBLEQUOTEDSTRING', + 5 => 'CHILDBODY', 6 => 'CHILDBLOCK', 7 => 'CHILDLITERAL'); + + /** + * storage for assembled token patterns + * + * @var sring + */ + 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; + private $yy_global_pattern7 = null; + /** * token names * * @var array */ - public $smarty_token_names = array( // Text for parser error messages - 'IDENTITY' => '===', - 'NONEIDENTITY' => '!==', - 'EQUALS' => '==', - 'NOTEQUALS' => '!=', - 'GREATEREQUAL' => '(>=,ge)', - 'LESSEQUAL' => '(<=,le)', - 'GREATERTHAN' => '(>,gt)', - 'LESSTHAN' => '(<,lt)', - 'MOD' => '(%,mod)', + public $smarty_token_names = array( // Text for parser error messages 'NOT' => '(!,not)', - 'LAND' => '(&&,and)', - 'LOR' => '(||,or)', - 'LXOR' => 'xor', 'OPENP' => '(', 'CLOSEP' => ')', 'OPENB' => '[', @@ -172,22 +175,21 @@ class Smarty_Internal_Templatelexer 'HATCH' => '#', 'QUOTE' => '"', 'BACKTICK' => '`', - 'VERT' => '|', + 'VERT' => '"|" modifier', 'DOT' => '.', 'COMMA' => '","', - 'ANDSYM' => '"&"', 'QMARK' => '"?"', - 'ID' => 'identifier', + 'ID' => 'id, name', 'TEXT' => 'text', - 'FAKEPHPSTARTTAG' => 'Fake PHP start tag', - 'PHPSTARTTAG' => 'PHP start tag', - 'PHPENDTAG' => 'PHP end tag', - 'LITERALSTART' => 'Literal start', - 'LITERALEND' => 'Literal end', - 'LDELSLASH' => 'closing tag', + 'LDELSLASH' => '{/..} closing tag', + 'LDEL' => '{...} Smarty tag', 'COMMENT' => 'comment', 'AS' => 'as', 'TO' => 'to', + 'PHP' => '" '"<", "==" ... logical operator', + 'TLOGOP' => '"lt", "eq" ... logical operator; "is div by" ... if condition', + 'SCOND' => '"is even" ... if condition', ); /** -- cgit v1.3