phpDocumentor PHP_LexerGenerator
[ class tree: PHP_LexerGenerator ] [ index: PHP_LexerGenerator ] [ all elements ]

Source for file Lexer.php

Documentation is available at Lexer.php

  1. <?php
  2. require_once dirname(__FILE__'/Parser.php';
  3. {
  4.     const MATCHSTART PHP_LexerGenerator_Regex_Parser::MATCHSTART;
  5.     const MATCHEND PHP_LexerGenerator_Regex_Parser::MATCHEND;
  6.     const CONTROLCHAR PHP_LexerGenerator_Regex_Parser::CONTROLCHAR;
  7.     const OPENCHARCLASS PHP_LexerGenerator_Regex_Parser::OPENCHARCLASS;
  8.     const FULLSTOP PHP_LexerGenerator_Regex_Parser::FULLSTOP;
  9.     const TEXT PHP_LexerGenerator_Regex_Parser::TEXT;
  10.     const BACKREFERENCE PHP_LexerGenerator_Regex_Parser::BACKREFERENCE;
  11.     const OPENASSERTION PHP_LexerGenerator_Regex_Parser::OPENASSERTION;
  12.     const COULDBEBACKREF PHP_LexerGenerator_Regex_Parser::COULDBEBACKREF;
  13.     const NEGATE PHP_LexerGenerator_Regex_Parser::NEGATE;
  14.     const HYPHEN PHP_LexerGenerator_Regex_Parser::HYPHEN;
  15.     const CLOSECHARCLASS PHP_LexerGenerator_Regex_Parser::CLOSECHARCLASS;
  16.     const BAR PHP_LexerGenerator_Regex_Parser::BAR;
  17.     const MULTIPLIER PHP_LexerGenerator_Regex_Parser::MULTIPLIER;
  18.     const INTERNALOPTIONS PHP_LexerGenerator_Regex_Parser::INTERNALOPTIONS;
  19.     const COLON PHP_LexerGenerator_Regex_Parser::COLON;
  20.     const OPENPAREN PHP_LexerGenerator_Regex_Parser::OPENPAREN;
  21.     const CLOSEPAREN PHP_LexerGenerator_Regex_Parser::CLOSEPAREN;
  22.     const PATTERNNAME PHP_LexerGenerator_Regex_Parser::PATTERNNAME;
  23.     const POSITIVELOOKBEHIND PHP_LexerGenerator_Regex_Parser::POSITIVELOOKBEHIND;
  24.     const NEGATIVELOOKBEHIND PHP_LexerGenerator_Regex_Parser::NEGATIVELOOKBEHIND;
  25.     const POSITIVELOOKAHEAD PHP_LexerGenerator_Regex_Parser::POSITIVELOOKAHEAD;
  26.     const NEGATIVELOOKAHEAD PHP_LexerGenerator_Regex_Parser::NEGATIVELOOKAHEAD;
  27.     const ONCEONLY PHP_LexerGenerator_Regex_Parser::ONCEONLY;
  28.     const COMMENT PHP_LexerGenerator_Regex_Parser::COMMENT;
  29.     const RECUR PHP_LexerGenerator_Regex_Parser::RECUR;
  30.     const ESCAPEDBACKSLASH PHP_LexerGenerator_Regex_Parser::ESCAPEDBACKSLASH;
  31.     private $input;
  32.     private $N;
  33.     public $token;
  34.     public $value;
  35.     public $line;
  36.  
  37.     function __construct($data)
  38.     {
  39.         $this->input $data;
  40.         $this->0;
  41.     }
  42.  
  43.     function reset($data)
  44.     {
  45.         $this->input $data;
  46.         $this->0;
  47.         $this->yybegin(self::INITIAL);
  48.     }
  49.  
  50.  
  51.     private $_yy_state 1;
  52.     private $_yy_stack array();
  53.  
  54.     function yylex()
  55.     {
  56.         return $this->{'yylex' $this->_yy_state}();
  57.     }
  58.  
  59.     function yypushstate($state)
  60.     {
  61.         array_push($this->_yy_stack$this->_yy_state);
  62.         $this->_yy_state $state;
  63.     }
  64.  
  65.     function yypopstate()
  66.     {
  67.         $this->_yy_state array_pop($this->_yy_stack);
  68.     }
  69.  
  70.     function yybegin($state)
  71.     {
  72.         $this->_yy_state $state;
  73.     }
  74.  
  75.  
  76.  
  77.     function yylex1()
  78.     {
  79.         $tokenMap array (
  80.               => 0,
  81.               => 0,
  82.               => 0,
  83.               => 0,
  84.               => 0,
  85.               => 0,
  86.               => 0,
  87.               => 0,
  88.               => 0,
  89.               10 => 0,
  90.               11 => 0,
  91.               12 => 0,
  92.               13 => 0,
  93.               14 => 0,
  94.               15 => 0,
  95.               16 => 0,
  96.               17 => 0,
  97.               18 => 0,
  98.               19 => 0,
  99.               20 => 0,
  100.               21 => 0,
  101.               22 => 0,
  102.               23 => 0,
  103.             );
  104.         if ($this->>= strlen($this->input)) {
  105.             return false// end of input
  106.         }
  107.         $yy_global_pattern "/^(\\\\\\\\)|^([^[\\\\^$.|()?*+{}]+)|^(\\\\[][{}*.^$|?()+])|^(\\[)|^(\\|)|^(\\\\[0-9][0-9])|^(\\\\[frnt]|\\\\x[0-9a-fA-F][0-9a-fA-F]?|\\\\[0-7][0-7][0-7]|\\\\x\\{[0-9a-fA-F]+\\})|^(\\\\[abBGcedDsSwW0C])|^(\\^)|^(\\\\A)|^(\\))|^(\\$)|^([*?+]|\\{[0-9]+\\}|\\{[0-9]+,\\}|\\{[0-9]+,[0-9]+\\})|^(\\\\[zZ])|^(\\(\\?)|^(\\()|^(\\.)|^(\\\\[1-9])|^(\\\\p\\{\\^?..?\\}|\\\\P\\{..?\\}|\\\\X)|^(\\\\p\\{C[cfnos]?|L[lmotu]?|M[cen]?|N[dlo]?|P[cdefios]?|S[ckmo]?|Z[lps]?\\})|^(\\\\p\\{\\^C[cfnos]?|L[lmotu]?|M[cen]?|N[dlo]?|P[cdefios]?|S[ckmo]?|Z[lps]?\\})|^(\\\\p[CLMNPSZ])|^(\\\\)/";
  108.  
  109.         do {
  110.             if (preg_match($yy_global_patternsubstr($this->input$this->N)$yymatches)) {
  111.                 $yysubmatches $yymatches;
  112.                 $yymatches array_filter($yymatches'strlen')// remove empty sub-patterns
  113.                 if (!count($yymatches)) {
  114.                     throw new Exception('Error: lexing failed because a rule matched' .
  115.                         'an empty string.  Input "' substr($this->input,
  116.                         $this->N5'... state INITIAL');
  117.                 }
  118.                 next($yymatches)// skip global match
  119.                 $this->token = key($yymatches)// token number
  120.                 if ($tokenMap[$this->token]{
  121.                     // extract sub-patterns for passing to lex function
  122.                     $yysubmatches array_slice($yysubmatches$this->token + 1,
  123.                         $tokenMap[$this->token]);
  124.                 else {
  125.                     $yysubmatches array();
  126.                 }
  127.                 $this->value = current($yymatches)// token value
  128.                 $r $this->{'yy_r1_' $this->token}($yysubmatches);
  129.                 if ($r === null{
  130.                     $this->+= strlen($this->value);
  131.                     $this->line += substr_count("\n"$this->value);
  132.                     // accept this token
  133.                     return true;
  134.                 elseif ($r === true{
  135.                     // we have changed state
  136.                     // process this token in the new state
  137.                     return $this->yylex();
  138.                 elseif ($r === false{
  139.                     $this->+= strlen($this->value);
  140.                     $this->line += substr_count("\n"$this->value);
  141.                     if ($this->>= strlen($this->input)) {
  142.                         return false// end of input
  143.                     }
  144.                     // skip this token
  145.                     continue;
  146.                 else {                    $yy_yymore_patterns array(
  147.         => "^([^[\\\\^$.|()?*+{}]+)|^(\\\\[][{}*.^$|?()+])|^(\\[)|^(\\|)|^(\\\\[0-9][0-9])|^(\\\\[frnt]|\\\\x[0-9a-fA-F][0-9a-fA-F]?|\\\\[0-7][0-7][0-7]|\\\\x\\{[0-9a-fA-F]+\\})|^(\\\\[abBGcedDsSwW0C])|^(\\^)|^(\\\\A)|^(\\))|^(\\$)|^([*?+]|\\{[0-9]+\\}|\\{[0-9]+,\\}|\\{[0-9]+,[0-9]+\\})|^(\\\\[zZ])|^(\\(\\?)|^(\\()|^(\\.)|^(\\\\[1-9])|^(\\\\p\\{\\^?..?\\}|\\\\P\\{..?\\}|\\\\X)|^(\\\\p\\{C[cfnos]?|L[lmotu]?|M[cen]?|N[dlo]?|P[cdefios]?|S[ckmo]?|Z[lps]?\\})|^(\\\\p\\{\\^C[cfnos]?|L[lmotu]?|M[cen]?|N[dlo]?|P[cdefios]?|S[ckmo]?|Z[lps]?\\})|^(\\\\p[CLMNPSZ])|^(\\\\)",
  148.         => "^(\\\\[][{}*.^$|?()+])|^(\\[)|^(\\|)|^(\\\\[0-9][0-9])|^(\\\\[frnt]|\\\\x[0-9a-fA-F][0-9a-fA-F]?|\\\\[0-7][0-7][0-7]|\\\\x\\{[0-9a-fA-F]+\\})|^(\\\\[abBGcedDsSwW0C])|^(\\^)|^(\\\\A)|^(\\))|^(\\$)|^([*?+]|\\{[0-9]+\\}|\\{[0-9]+,\\}|\\{[0-9]+,[0-9]+\\})|^(\\\\[zZ])|^(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nos]?|L[lmotu]?|M[cen]?|N[dlo]?|P[cdefios]?|S[ckmo]?|Z[lps]?\\})|^(\\\\p[CLMNPSZ])|^(\\\\)",
  153.         => "^(\\\\[abBGcedDsSwW0C])|^(\\^)|^(\\\\A)|^(\\))|^(\\$)|^([*?+]|\\{[0-9]+\\}|\\{[0-9]+,\\}|\\{[0-9]+,[0-9]+\\})|^(\\\\[zZ])|^(\\(\\?)|^(\\()|^(\\.)|^(\\\\[1-9])|^(\\\\p\\{\\^?..?\\}|\\\\P\\{..?\\}|\\\\X)|^(\\\\p\\{C[cfnos]?|L[lmotu]?|M[cen]?|N[dlo]?|P[cdefios]?|S[ckmo]?|Z[lps]?\\})|^(\\\\p\\{\\^C[cfnos]?|L[lmotu]?|M[cen]?|N[dlo]?|P[cdefios]?|S[ckmo]?|Z[lps]?\\})|^(\\\\p[CLMNPSZ])|^(\\\\)",
  154.         => "^(\\^)|^(\\\\A)|^(\\))|^(\\$)|^([*?+]|\\{[0-9]+\\}|\\{[0-9]+,\\}|\\{[0-9]+,[0-9]+\\})|^(\\\\[zZ])|^(\\(\\?)|^(\\()|^(\\.)|^(\\\\[1-9])|^(\\\\p\\{\\^?..?\\}|\\\\P\\{..?\\}|\\\\X)|^(\\\\p\\{C[cfnos]?|L[lmotu]?|M[cen]?|N[dlo]?|P[cdefios]?|S[ckmo]?|Z[lps]?\\})|^(\\\\p\\{\\^C[cfnos]?|L[lmotu]?|M[cen]?|N[dlo]?|P[cdefios]?|S[ckmo]?|Z[lps]?\\})|^(\\\\p[CLMNPSZ])|^(\\\\)",
  155.         => "^(\\\\A)|^(\\))|^(\\$)|^([*?+]|\\{[0-9]+\\}|\\{[0-9]+,\\}|\\{[0-9]+,[0-9]+\\})|^(\\\\[zZ])|^(\\(\\?)|^(\\()|^(\\.)|^(\\\\[1-9])|^(\\\\p\\{\\^?..?\\}|\\\\P\\{..?\\}|\\\\X)|^(\\\\p\\{C[cfnos]?|L[lmotu]?|M[cen]?|N[dlo]?|P[cdefios]?|S[ckmo]?|Z[lps]?\\})|^(\\\\p\\{\\^C[cfnos]?|L[lmotu]?|M[cen]?|N[dlo]?|P[cdefios]?|S[ckmo]?|Z[lps]?\\})|^(\\\\p[CLMNPSZ])|^(\\\\)",
  156.         10 => "^(\\))|^(\\$)|^([*?+]|\\{[0-9]+\\}|\\{[0-9]+,\\}|\\{[0-9]+,[0-9]+\\})|^(\\\\[zZ])|^(\\(\\?)|^(\\()|^(\\.)|^(\\\\[1-9])|^(\\\\p\\{\\^?..?\\}|\\\\P\\{..?\\}|\\\\X)|^(\\\\p\\{C[cfnos]?|L[lmotu]?|M[cen]?|N[dlo]?|P[cdefios]?|S[ckmo]?|Z[lps]?\\})|^(\\\\p\\{\\^C[cfnos]?|L[lmotu]?|M[cen]?|N[dlo]?|P[cdefios]?|S[ckmo]?|Z[lps]?\\})|^(\\\\p[CLMNPSZ])|^(\\\\)",
  157.         11 => "^(\\$)|^([*?+]|\\{[0-9]+\\}|\\{[0-9]+,\\}|\\{[0-9]+,[0-9]+\\})|^(\\\\[zZ])|^(\\(\\?)|^(\\()|^(\\.)|^(\\\\[1-9])|^(\\\\p\\{\\^?..?\\}|\\\\P\\{..?\\}|\\\\X)|^(\\\\p\\{C[cfnos]?|L[lmotu]?|M[cen]?|N[dlo]?|P[cdefios]?|S[ckmo]?|Z[lps]?\\})|^(\\\\p\\{\\^C[cfnos]?|L[lmotu]?|M[cen]?|N[dlo]?|P[cdefios]?|S[ckmo]?|Z[lps]?\\})|^(\\\\p[CLMNPSZ])|^(\\\\)",
  158.         12 => "^([*?+]|\\{[0-9]+\\}|\\{[0-9]+,\\}|\\{[0-9]+,[0-9]+\\})|^(\\\\[zZ])|^(\\(\\?)|^(\\()|^(\\.)|^(\\\\[1-9])|^(\\\\p\\{\\^?..?\\}|\\\\P\\{..?\\}|\\\\X)|^(\\\\p\\{C[cfnos]?|L[lmotu]?|M[cen]?|N[dlo]?|P[cdefios]?|S[ckmo]?|Z[lps]?\\})|^(\\\\p\\{\\^C[cfnos]?|L[lmotu]?|M[cen]?|N[dlo]?|P[cdefios]?|S[ckmo]?|Z[lps]?\\})|^(\\\\p[CLMNPSZ])|^(\\\\)",
  159.         13 => "^(\\\\[zZ])|^(\\(\\?)|^(\\()|^(\\.)|^(\\\\[1-9])|^(\\\\p\\{\\^?..?\\}|\\\\P\\{..?\\}|\\\\X)|^(\\\\p\\{C[cfnos]?|L[lmotu]?|M[cen]?|N[dlo]?|P[cdefios]?|S[ckmo]?|Z[lps]?\\})|^(\\\\p\\{\\^C[cfnos]?|L[lmotu]?|M[cen]?|N[dlo]?|P[cdefios]?|S[ckmo]?|Z[lps]?\\})|^(\\\\p[CLMNPSZ])|^(\\\\)",
  160.         14 => "^(\\(\\?)|^(\\()|^(\\.)|^(\\\\[1-9])|^(\\\\p\\{\\^?..?\\}|\\\\P\\{..?\\}|\\\\X)|^(\\\\p\\{C[cfnos]?|L[lmotu]?|M[cen]?|N[dlo]?|P[cdefios]?|S[ckmo]?|Z[lps]?\\})|^(\\\\p\\{\\^C[cfnos]?|L[lmotu]?|M[cen]?|N[dlo]?|P[cdefios]?|S[ckmo]?|Z[lps]?\\})|^(\\\\p[CLMNPSZ])|^(\\\\)",
  161.         15 => "^(\\()|^(\\.)|^(\\\\[1-9])|^(\\\\p\\{\\^?..?\\}|\\\\P\\{..?\\}|\\\\X)|^(\\\\p\\{C[cfnos]?|L[lmotu]?|M[cen]?|N[dlo]?|P[cdefios]?|S[ckmo]?|Z[lps]?\\})|^(\\\\p\\{\\^C[cfnos]?|L[lmotu]?|M[cen]?|N[dlo]?|P[cdefios]?|S[ckmo]?|Z[lps]?\\})|^(\\\\p[CLMNPSZ])|^(\\\\)",
  162.         16 => "^(\\.)|^(\\\\[1-9])|^(\\\\p\\{\\^?..?\\}|\\\\P\\{..?\\}|\\\\X)|^(\\\\p\\{C[cfnos]?|L[lmotu]?|M[cen]?|N[dlo]?|P[cdefios]?|S[ckmo]?|Z[lps]?\\})|^(\\\\p\\{\\^C[cfnos]?|L[lmotu]?|M[cen]?|N[dlo]?|P[cdefios]?|S[ckmo]?|Z[lps]?\\})|^(\\\\p[CLMNPSZ])|^(\\\\)",
  163.         17 => "^(\\\\[1-9])|^(\\\\p\\{\\^?..?\\}|\\\\P\\{..?\\}|\\\\X)|^(\\\\p\\{C[cfnos]?|L[lmotu]?|M[cen]?|N[dlo]?|P[cdefios]?|S[ckmo]?|Z[lps]?\\})|^(\\\\p\\{\\^C[cfnos]?|L[lmotu]?|M[cen]?|N[dlo]?|P[cdefios]?|S[ckmo]?|Z[lps]?\\})|^(\\\\p[CLMNPSZ])|^(\\\\)",
  164.         18 => "^(\\\\p\\{\\^?..?\\}|\\\\P\\{..?\\}|\\\\X)|^(\\\\p\\{C[cfnos]?|L[lmotu]?|M[cen]?|N[dlo]?|P[cdefios]?|S[ckmo]?|Z[lps]?\\})|^(\\\\p\\{\\^C[cfnos]?|L[lmotu]?|M[cen]?|N[dlo]?|P[cdefios]?|S[ckmo]?|Z[lps]?\\})|^(\\\\p[CLMNPSZ])|^(\\\\)",
  165.         19 => "^(\\\\p\\{C[cfnos]?|L[lmotu]?|M[cen]?|N[dlo]?|P[cdefios]?|S[ckmo]?|Z[lps]?\\})|^(\\\\p\\{\\^C[cfnos]?|L[lmotu]?|M[cen]?|N[dlo]?|P[cdefios]?|S[ckmo]?|Z[lps]?\\})|^(\\\\p[CLMNPSZ])|^(\\\\)",
  166.         20 => "^(\\\\p\\{\\^C[cfnos]?|L[lmotu]?|M[cen]?|N[dlo]?|P[cdefios]?|S[ckmo]?|Z[lps]?\\})|^(\\\\p[CLMNPSZ])|^(\\\\)",
  167.         21 => "^(\\\\p[CLMNPSZ])|^(\\\\)",
  168.         22 => "^(\\\\)",
  169.         23 => "",
  170.     );
  171.  
  172.                     // yymore is needed
  173.                     do {
  174.                         if (!strlen($yy_yymore_patterns[$this->token])) {
  175.                             throw new Exception('cannot do yymore for the last token');
  176.                         }
  177.                         if (preg_match($yy_yymore_patterns[$this->token],
  178.                               substr($this->input$this->N)$yymatches)) {
  179.                             $yymatches array_filter($yymatches'strlen')// remove empty sub-patterns
  180.                             next($yymatches)// skip global match
  181.                             $this->token = key($yymatches)// token number
  182.                             $this->value = current($yymatches)// token value
  183.                             $this->line = substr_count("\n"$this->value);
  184.                         }
  185.                     while ($this->{'yy_r1_' $this->token}(!== null);
  186.                     // accept
  187.                     $this->+= strlen($this->value);
  188.                     $this->line += substr_count("\n"$this->value);
  189.                     return true;
  190.                 }
  191.             else {
  192.                 throw new Exception('Unexpected input at line' $this->line .
  193.                     ': ' $this->input[$this->N]);
  194.             }
  195.             break;
  196.         while (true);
  197.     // end function
  198.  
  199.  
  200.     
  201.  
  202.  
  203.     const INITIAL 1;
  204.     function yy_r1_1($yy_subpatterns)
  205.     {
  206.  
  207.     $this->token = self::ESCAPEDBACKSLASH;
  208.     }
  209.     function yy_r1_2($yy_subpatterns)
  210.     {
  211.  
  212.     $this->token = self::TEXT;
  213.     }
  214.     function yy_r1_3($yy_subpatterns)
  215.     {
  216.  
  217.     $this->token = self::CONTROLCHAR;
  218.     }
  219.     function yy_r1_4($yy_subpatterns)
  220.     {
  221.  
  222.     $this->token = self::OPENCHARCLASS;
  223.     $this->yybegin(self::CHARACTERCLASSSTART);
  224.     }
  225.     function yy_r1_5($yy_subpatterns)
  226.     {
  227.  
  228.     $this->token = self::BAR;
  229.     }
  230.     function yy_r1_6($yy_subpatterns)
  231.     {
  232.  
  233.     $this->token = self::COULDBEBACKREF;
  234.     }
  235.     function yy_r1_7($yy_subpatterns)
  236.     {
  237.  
  238.     $this->token = self::TEXT;
  239.     }
  240.     function yy_r1_8($yy_subpatterns)
  241.     {
  242.  
  243.     $this->token = self::CONTROLCHAR;
  244.     }
  245.     function yy_r1_9($yy_subpatterns)
  246.     {
  247.  
  248.     $this->token = self::MATCHSTART;
  249.     }
  250.     function yy_r1_10($yy_subpatterns)
  251.     {
  252.  
  253.     $this->token = self::MATCHSTART;
  254.     }
  255.     function yy_r1_11($yy_subpatterns)
  256.     {
  257.  
  258.     $this->token = self::CLOSEPAREN;
  259.     $this->yybegin(self::INITIAL);
  260.     }
  261.     function yy_r1_12($yy_subpatterns)
  262.     {
  263.  
  264.     $this->token = self::MATCHEND;
  265.     }
  266.     function yy_r1_13($yy_subpatterns)
  267.     {
  268.  
  269.     $this->token = self::MULTIPLIER;
  270.     }
  271.     function yy_r1_14($yy_subpatterns)
  272.     {
  273.  
  274.     $this->token = self::MATCHEND;
  275.     }
  276.     function yy_r1_15($yy_subpatterns)
  277.     {
  278.  
  279.     $this->token = self::OPENASSERTION;
  280.     $this->yybegin(self::ASSERTION);
  281.     }
  282.     function yy_r1_16($yy_subpatterns)
  283.     {
  284.  
  285.     $this->token = self::OPENPAREN;
  286.     }
  287.     function yy_r1_17($yy_subpatterns)
  288.     {
  289.  
  290.     $this->token = self::FULLSTOP;
  291.     }
  292.     function yy_r1_18($yy_subpatterns)
  293.     {
  294.  
  295.     $this->token = self::BACKREFERENCE;
  296.     }
  297.     function yy_r1_19($yy_subpatterns)
  298.     {
  299.  
  300.     $this->token = self::