home *** CD-ROM | disk | FTP | other *** search
/ Cricao de Sites - 650 Layouts Prontos / WebMasters.iso / Servidores / xampp-win32-1.6.7-installer.exe / php / PEAR / Text / Highlighter / PYTHON.php < prev    next >
Encoding:
PHP Script  |  2008-07-02  |  19.9 KB  |  647 lines

  1. <?php
  2. /**
  3.  * Auto-generated class. PYTHON syntax highlighting 
  4.  *
  5.  * PHP version 4 and 5
  6.  *
  7.  * LICENSE: This source file is subject to version 3.0 of the PHP license
  8.  * that is available through the world-wide-web at the following URI:
  9.  * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
  10.  * the PHP License and are unable to obtain it through the web, please
  11.  * send a note to license@php.net so we can mail you a copy immediately.
  12.  *
  13.  * @copyright  2004-2006 Andrey Demenev
  14.  * @license    http://www.php.net/license/3_0.txt  PHP License
  15.  * @link       http://pear.php.net/package/Text_Highlighter
  16.  * @category   Text
  17.  * @package    Text_Highlighter
  18.  * @version    generated from: : python.xml,v 1.1 2007/06/03 02:35:28 ssttoo Exp 
  19.  * @author Andrey Demenev <demenev@gmail.com>
  20.  *
  21.  */
  22.  
  23. /**
  24.  * @ignore
  25.  */
  26.  
  27. require_once 'Text/Highlighter.php';
  28.  
  29. /**
  30.  * Auto-generated class. PYTHON syntax highlighting
  31.  *
  32.  * @author Andrey Demenev <demenev@gmail.com>
  33.  * @category   Text
  34.  * @package    Text_Highlighter
  35.  * @copyright  2004-2006 Andrey Demenev
  36.  * @license    http://www.php.net/license/3_0.txt  PHP License
  37.  * @version    Release: 0.7.1
  38.  * @link       http://pear.php.net/package/Text_Highlighter
  39.  */
  40. class  Text_Highlighter_PYTHON extends Text_Highlighter
  41. {
  42.     var $_language = 'python';
  43.  
  44.     /**
  45.      * PHP4 Compatible Constructor
  46.      *
  47.      * @param array  $options
  48.      * @access public
  49.      */
  50.     function Text_Highlighter_PYTHON($options=array())
  51.     {
  52.         $this->__construct($options);
  53.     }
  54.  
  55.  
  56.     /**
  57.      *  Constructor
  58.      *
  59.      * @param array  $options
  60.      * @access public
  61.      */
  62.     function __construct($options=array())
  63.     {
  64.  
  65.         $this->_options = $options;
  66.         $this->_regs = array (
  67.             -1 => '/((?i)\'\'\')|((?i)""")|((?i)")|((?i)\')|((?i)\\()|((?i)\\[)|((?i)[a-z_]\\w*(?=\\s*\\())|((?i)[a-z_]\\w*)|((?i)((\\d+|((\\d*\\.\\d+)|(\\d+\\.\\d*)))[eE][+-]?\\d+))|((?i)((\\d*\\.\\d+)|(\\d+\\.\\d*)|(\\d+))j)|((?i)(\\d*\\.\\d+)|(\\d+\\.\\d*))|((?i)\\d+l?|\\b0l?\\b)|((?i)0[xX][\\da-f]+l?)|((?i)0[0-7]+l?)|((?i)#.+)/',
  68.             0 => '/((?i)\\\\.)/',
  69.             1 => '/((?i)\\\\.)/',
  70.             2 => '/((?i)\\\\.)/',
  71.             3 => '/((?i)\\\\.)/',
  72.             4 => '/((?i)\'\'\')|((?i)""")|((?i)")|((?i)\')|((?i)\\()|((?i)\\[)|((?i)[a-z_]\\w*(?=\\s*\\())|((?i)[a-z_]\\w*)|((?i)((\\d+|((\\d*\\.\\d+)|(\\d+\\.\\d*)))[eE][+-]?\\d+))|((?i)((\\d*\\.\\d+)|(\\d+\\.\\d*)|(\\d+))j)|((?i)(\\d*\\.\\d+)|(\\d+\\.\\d*))|((?i)\\d+l?|\\b0l?\\b)|((?i)0[xX][\\da-f]+l?)|((?i)0[0-7]+l?)|((?i)#.+)/',
  73.             5 => '/((?i)\'\'\')|((?i)""")|((?i)")|((?i)\')|((?i)\\()|((?i)\\[)|((?i)[a-z_]\\w*(?=\\s*\\())|((?i)[a-z_]\\w*)|((?i)((\\d+|((\\d*\\.\\d+)|(\\d+\\.\\d*)))[eE][+-]?\\d+))|((?i)((\\d*\\.\\d+)|(\\d+\\.\\d*)|(\\d+))j)|((?i)(\\d*\\.\\d+)|(\\d+\\.\\d*))|((?i)\\d+l?|\\b0l?\\b)|((?i)0[xX][\\da-f]+l?)|((?i)0[0-7]+l?)|((?i)#.+)/',
  74.         );
  75.         $this->_counts = array (
  76.             -1 => 
  77.             array (
  78.                 0 => 0,
  79.                 1 => 0,
  80.                 2 => 0,
  81.                 3 => 0,
  82.                 4 => 0,
  83.                 5 => 0,
  84.                 6 => 0,
  85.                 7 => 0,
  86.                 8 => 5,
  87.                 9 => 4,
  88.                 10 => 2,
  89.                 11 => 0,
  90.                 12 => 0,
  91.                 13 => 0,
  92.                 14 => 0,
  93.             ),
  94.             0 => 
  95.             array (
  96.                 0 => 0,
  97.             ),
  98.             1 => 
  99.             array (
  100.                 0 => 0,
  101.             ),
  102.             2 => 
  103.             array (
  104.                 0 => 0,
  105.             ),
  106.             3 => 
  107.             array (
  108.                 0 => 0,
  109.             ),
  110.             4 => 
  111.             array (
  112.                 0 => 0,
  113.                 1 => 0,
  114.                 2 => 0,
  115.                 3 => 0,
  116.                 4 => 0,
  117.                 5 => 0,
  118.                 6 => 0,
  119.                 7 => 0,
  120.                 8 => 5,
  121.                 9 => 4,
  122.                 10 => 2,
  123.                 11 => 0,
  124.                 12 => 0,
  125.                 13 => 0,
  126.                 14 => 0,
  127.             ),
  128.             5 => 
  129.             array (
  130.                 0 => 0,
  131.                 1 => 0,
  132.                 2 => 0,
  133.                 3 => 0,
  134.                 4 => 0,
  135.                 5 => 0,
  136.                 6 => 0,
  137.                 7 => 0,
  138.                 8 => 5,
  139.                 9 => 4,
  140.                 10 => 2,
  141.                 11 => 0,
  142.                 12 => 0,
  143.                 13 => 0,
  144.                 14 => 0,
  145.             ),
  146.         );
  147.         $this->_delim = array (
  148.             -1 => 
  149.             array (
  150.                 0 => 'quotes',
  151.                 1 => 'quotes',
  152.                 2 => 'quotes',
  153.                 3 => 'quotes',
  154.                 4 => 'brackets',
  155.                 5 => 'brackets',
  156.                 6 => '',
  157.                 7 => '',
  158.                 8 => '',
  159.                 9 => '',
  160.                 10 => '',
  161.                 11 => '',
  162.                 12 => '',
  163.                 13 => '',
  164.                 14 => '',
  165.             ),
  166.             0 => 
  167.             array (
  168.                 0 => '',
  169.             ),
  170.             1 => 
  171.             array (
  172.                 0 => '',
  173.             ),
  174.             2 => 
  175.             array (
  176.                 0 => '',
  177.             ),
  178.             3 => 
  179.             array (
  180.                 0 => '',
  181.             ),
  182.             4 => 
  183.             array (
  184.                 0 => 'quotes',
  185.                 1 => 'quotes',
  186.                 2 => 'quotes',
  187.                 3 => 'quotes',
  188.                 4 => 'brackets',
  189.                 5 => 'brackets',
  190.                 6 => '',
  191.                 7 => '',
  192.                 8 => '',
  193.                 9 => '',
  194.                 10 => '',
  195.                 11 => '',
  196.                 12 => '',
  197.                 13 => '',
  198.                 14 => '',
  199.             ),
  200.             5 => 
  201.             array (
  202.                 0 => 'quotes',
  203.                 1 => 'quotes',
  204.                 2 => 'quotes',
  205.                 3 => 'quotes',
  206.                 4 => 'brackets',
  207.                 5 => 'brackets',
  208.                 6 => '',
  209.                 7 => '',
  210.                 8 => '',
  211.                 9 => '',
  212.                 10 => '',
  213.                 11 => '',
  214.                 12 => '',
  215.                 13 => '',
  216.                 14 => '',
  217.             ),
  218.         );
  219.         $this->_inner = array (
  220.             -1 => 
  221.             array (
  222.                 0 => 'string',
  223.                 1 => 'string',
  224.                 2 => 'string',
  225.                 3 => 'string',
  226.                 4 => 'code',
  227.                 5 => 'code',
  228.                 6 => 'identifier',
  229.                 7 => 'identifier',
  230.                 8 => 'number',
  231.                 9 => 'number',
  232.                 10 => 'number',
  233.                 11 => 'number',
  234.                 12 => 'number',
  235.                 13 => 'number',
  236.                 14 => 'comment',
  237.             ),
  238.             0 => 
  239.             array (
  240.                 0 => 'special',
  241.             ),
  242.             1 => 
  243.             array (
  244.                 0 => 'special',
  245.             ),
  246.             2 => 
  247.             array (
  248.                 0 => 'special',
  249.             ),
  250.             3 => 
  251.             array (
  252.                 0 => 'special',
  253.             ),
  254.             4 => 
  255.             array (
  256.                 0 => 'string',
  257.                 1 => 'string',
  258.                 2 => 'string',
  259.                 3 => 'string',
  260.                 4 => 'code',
  261.                 5 => 'code',
  262.                 6 => 'identifier',
  263.                 7 => 'identifier',
  264.                 8 => 'number',
  265.                 9 => 'number',
  266.                 10 => 'number',
  267.                 11 => 'number',
  268.                 12 => 'number',
  269.                 13 => 'number',
  270.                 14 => 'comment',
  271.             ),
  272.             5 => 
  273.             array (
  274.                 0 => 'string',
  275.                 1 => 'string',
  276.                 2 => 'string',
  277.                 3 => 'string',
  278.                 4 => 'code',
  279.                 5 => 'code',
  280.                 6 => 'identifier',
  281.                 7 => 'identifier',
  282.                 8 => 'number',
  283.                 9 => 'number',
  284.                 10 => 'number',
  285.                 11 => 'number',
  286.                 12 => 'number',
  287.                 13 => 'number',
  288.                 14 => 'comment',
  289.             ),
  290.         );
  291.         $this->_end = array (
  292.             0 => '/(?i)\'\'\'/',
  293.             1 => '/(?i)"""/',
  294.             2 => '/(?i)"/',
  295.             3 => '/(?i)\'/',
  296.             4 => '/(?i)\\)/',
  297.             5 => '/(?i)\\]/',
  298.         );
  299.         $this->_states = array (
  300.             -1 => 
  301.             array (
  302.                 0 => 0,
  303.                 1 => 1,
  304.                 2 => 2,
  305.                 3 => 3,
  306.                 4 => 4,
  307.                 5 => 5,
  308.                 6 => -1,
  309.                 7 => -1,
  310.                 8 => -1,
  311.                 9 => -1,
  312.                 10 => -1,
  313.                 11 => -1,
  314.                 12 => -1,
  315.                 13 => -1,
  316.                 14 => -1,
  317.             ),
  318.             0 => 
  319.             array (
  320.                 0 => -1,
  321.             ),
  322.             1 => 
  323.             array (
  324.                 0 => -1,
  325.             ),
  326.             2 => 
  327.             array (
  328.                 0 => -1,
  329.             ),
  330.             3 => 
  331.             array (
  332.                 0 => -1,
  333.             ),
  334.             4 => 
  335.             array (
  336.                 0 => 0,
  337.                 1 => 1,
  338.                 2 => 2,
  339.                 3 => 3,
  340.                 4 => 4,
  341.                 5 => 5,
  342.                 6 => -1,
  343.                 7 => -1,
  344.                 8 => -1,
  345.                 9 => -1,
  346.                 10 => -1,
  347.                 11 => -1,
  348.                 12 => -1,
  349.                 13 => -1,
  350.                 14 => -1,
  351.             ),
  352.             5 => 
  353.             array (
  354.                 0 => 0,
  355.                 1 => 1,
  356.                 2 => 2,
  357.                 3 => 3,
  358.                 4 => 4,
  359.                 5 => 5,
  360.                 6 => -1,
  361.                 7 => -1,
  362.                 8 => -1,
  363.                 9 => -1,
  364.                 10 => -1,
  365.                 11 => -1,
  366.                 12 => -1,
  367.                 13 => -1,
  368.                 14 => -1,
  369.             ),
  370.         );
  371.         $this->_keywords = array (
  372.             -1 => 
  373.             array (
  374.                 0 => -1,
  375.                 1 => -1,
  376.                 2 => -1,
  377.                 3 => -1,
  378.                 4 => -1,
  379.                 5 => -1,
  380.                 6 => 
  381.                 array (
  382.                     'builtin' => '/^(__import__|abs|apply|basestring|bool|buffer|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|min|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|round|setattr|slice|staticmethod|sum|super|str|tuple|type|unichr|unicode|vars|xrange|zip)$/',
  383.                 ),
  384.                 7 => 
  385.                 array (
  386.                     'reserved' => '/^(and|del|for|is|raise|assert|elif|from|lambda|return|break|else|global|not|try|class|except|if|or|while|continue|exec|import|pass|yield|def|finally|in|print|False|True|None|NotImplemented|Ellipsis|Exception|SystemExit|StopIteration|StandardError|KeyboardInterrupt|ImportError|EnvironmentError|IOError|OSError|WindowsError|EOFError|RuntimeError|NotImplementedError|NameError|UnboundLocalError|AttributeError|SyntaxError|IndentationError|TabError|TypeError|AssertionError|LookupError|IndexError|KeyError|ArithmeticError|OverflowError|ZeroDivisionError|FloatingPointError|ValueError|UnicodeError|UnicodeEncodeError|UnicodeDecodeError|UnicodeTranslateError|ReferenceError|SystemError|MemoryError|Warning|UserWarning|DeprecationWarning|PendingDeprecationWarning|SyntaxWarning|OverflowWarning|RuntimeWarning|FutureWarning)$/',
  387.                 ),
  388.                 8 => 
  389.                 array (
  390.                 ),
  391.                 9 => 
  392.                 array (
  393.                 ),
  394.                 10 => 
  395.                 array (
  396.                 ),
  397.                 11 => 
  398.                 array (
  399.                 ),
  400.                 12 => 
  401.                 array (
  402.                 ),
  403.                 13 => 
  404.                 array (
  405.                 ),
  406.                 14 => 
  407.                 array (
  408.                 ),
  409.             ),
  410.             0 => 
  411.             array (
  412.                 0 => 
  413.                 array (
  414.                 ),
  415.             ),
  416.             1 => 
  417.             array (
  418.                 0 => 
  419.                 array (
  420.                 ),
  421.             ),
  422.             2 => 
  423.             array (
  424.                 0 => 
  425.                 array (
  426.                 ),
  427.             ),
  428.             3 => 
  429.             array (
  430.                 0 => 
  431.                 array (
  432.                 ),
  433.             ),
  434.             4 => 
  435.             array (
  436.                 0 => -1,
  437.                 1 => -1,
  438.                 2 => -1,
  439.                 3 => -1,
  440.                 4 => -1,
  441.                 5 => -1,
  442.                 6 => 
  443.                 array (
  444.                     'builtin' => '/^(__import__|abs|apply|basestring|bool|buffer|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|min|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|round|setattr|slice|staticmethod|sum|super|str|tuple|type|unichr|unicode|vars|xrange|zip)$/',
  445.                 ),
  446.                 7 => 
  447.                 array (
  448.                     'reserved' => '/^(and|del|for|is|raise|assert|elif|from|lambda|return|break|else|global|not|try|class|except|if|or|while|continue|exec|import|pass|yield|def|finally|in|print|False|True|None|NotImplemented|Ellipsis|Exception|SystemExit|StopIteration|StandardError|KeyboardInterrupt|ImportError|EnvironmentError|IOError|OSError|WindowsError|EOFError|RuntimeError|NotImplementedError|NameError|UnboundLocalError|AttributeError|SyntaxError|IndentationError|TabError|TypeError|AssertionError|LookupError|IndexError|KeyError|ArithmeticError|OverflowError|ZeroDivisionError|FloatingPointError|ValueError|UnicodeError|UnicodeEncodeError|UnicodeDecodeError|UnicodeTranslateError|ReferenceError|SystemError|MemoryError|Warning|UserWarning|DeprecationWarning|PendingDeprecationWarning|SyntaxWarning|OverflowWarning|RuntimeWarning|FutureWarning)$/',
  449.                 ),
  450.                 8 => 
  451.                 array (
  452.                 ),
  453.                 9 => 
  454.                 array (
  455.                 ),
  456.                 10 => 
  457.                 array (
  458.                 ),
  459.                 11 => 
  460.                 array (
  461.                 ),
  462.                 12 => 
  463.                 array (
  464.                 ),
  465.                 13 => 
  466.                 array (
  467.                 ),
  468.                 14 => 
  469.                 array (
  470.                 ),
  471.             ),
  472.             5 => 
  473.             array (
  474.                 0 => -1,
  475.                 1 => -1,
  476.                 2 => -1,
  477.                 3 => -1,
  478.                 4 => -1,
  479.                 5 => -1,
  480.                 6 => 
  481.                 array (
  482.                     'builtin' => '/^(__import__|abs|apply|basestring|bool|buffer|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|min|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|round|setattr|slice|staticmethod|sum|super|str|tuple|type|unichr|unicode|vars|xrange|zip)$/',
  483.                 ),
  484.                 7 => 
  485.                 array (
  486.                     'reserved' => '/^(and|del|for|is|raise|assert|elif|from|lambda|return|break|else|global|not|try|class|except|if|or|while|continue|exec|import|pass|yield|def|finally|in|print|False|True|None|NotImplemented|Ellipsis|Exception|SystemExit|StopIteration|StandardError|KeyboardInterrupt|ImportError|EnvironmentError|IOError|OSError|WindowsError|EOFError|RuntimeError|NotImplementedError|NameError|UnboundLocalError|AttributeError|SyntaxError|IndentationError|TabError|TypeError|AssertionError|LookupError|IndexError|KeyError|ArithmeticError|OverflowError|ZeroDivisionError|FloatingPointError|ValueError|UnicodeError|UnicodeEncodeError|UnicodeDecodeError|UnicodeTranslateError|ReferenceError|SystemError|MemoryError|Warning|UserWarning|DeprecationWarning|PendingDeprecationWarning|SyntaxWarning|OverflowWarning|RuntimeWarning|FutureWarning)$/',
  487.                 ),
  488.                 8 => 
  489.                 array (
  490.                 ),
  491.                 9 => 
  492.                 array (
  493.                 ),
  494.                 10 => 
  495.                 array (
  496.                 ),
  497.                 11 => 
  498.                 array (
  499.                 ),
  500.                 12 => 
  501.                 array (
  502.                 ),
  503.                 13 => 
  504.                 array (
  505.                 ),
  506.                 14 => 
  507.                 array (
  508.                 ),
  509.             ),
  510.         );
  511.         $this->_parts = array (
  512.             0 => 
  513.             array (
  514.                 0 => NULL,
  515.             ),
  516.             1 => 
  517.             array (
  518.                 0 => NULL,
  519.             ),
  520.             2 => 
  521.             array (
  522.                 0 => NULL,
  523.             ),
  524.             3 => 
  525.             array (
  526.                 0 => NULL,
  527.             ),
  528.             4 => 
  529.             array (
  530.                 0 => NULL,
  531.                 1 => NULL,
  532.                 2 => NULL,
  533.                 3 => NULL,
  534.                 4 => NULL,
  535.                 5 => NULL,
  536.                 6 => NULL,
  537.                 7 => NULL,
  538.                 8 => NULL,
  539.                 9 => NULL,
  540.                 10 => NULL,
  541.                 11 => NULL,
  542.                 12 => NULL,
  543.                 13 => NULL,
  544.                 14 => NULL,
  545.             ),
  546.             5 => 
  547.             array (
  548.                 0 => NULL,
  549.                 1 => NULL,
  550.                 2 => NULL,
  551.                 3 => NULL,
  552.                 4 => NULL,
  553.                 5 => NULL,
  554.                 6 => NULL,
  555.                 7 => NULL,
  556.                 8 => NULL,
  557.                 9 => NULL,
  558.                 10 => NULL,
  559.                 11 => NULL,
  560.                 12 => NULL,
  561.                 13 => NULL,
  562.                 14 => NULL,
  563.             ),
  564.         );
  565.         $this->_subst = array (
  566.             -1 => 
  567.             array (
  568.                 0 => false,
  569.                 1 => false,
  570.                 2 => false,
  571.                 3 => false,
  572.                 4 => false,
  573.                 5 => false,
  574.                 6 => false,
  575.                 7 => false,
  576.                 8 => false,
  577.                 9 => false,
  578.                 10 => false,
  579.                 11 => false,
  580.                 12 => false,
  581.                 13 => false,
  582.                 14 => false,
  583.             ),
  584.             0 => 
  585.             array (
  586.                 0 => false,
  587.             ),
  588.             1 => 
  589.             array (
  590.                 0 => false,
  591.             ),
  592.             2 => 
  593.             array (
  594.                 0 => false,
  595.             ),
  596.             3 => 
  597.             array (
  598.                 0 => false,
  599.             ),
  600.             4 => 
  601.             array (
  602.                 0 => false,
  603.                 1 => false,
  604.                 2 => false,
  605.                 3 => false,
  606.                 4 => false,
  607.                 5 => false,
  608.                 6 => false,
  609.                 7 => false,
  610.                 8 => false,
  611.                 9 => false,
  612.                 10 => false,
  613.                 11 => false,
  614.                 12 => false,
  615.                 13 => false,
  616.                 14 => false,
  617.             ),
  618.             5 => 
  619.             array (
  620.                 0 => false,
  621.                 1 => false,
  622.                 2 => false,
  623.                 3 => false,
  624.                 4 => false,
  625.                 5 => false,
  626.                 6 => false,
  627.                 7 => false,
  628.                 8 => false,
  629.                 9 => false,
  630.                 10 => false,
  631.                 11 => false,
  632.                 12 => false,
  633.                 13 => false,
  634.                 14 => false,
  635.             ),
  636.         );
  637.         $this->_conditions = array (
  638.         );
  639.         $this->_kwmap = array (
  640.             'builtin' => 'builtin',
  641.             'reserved' => 'reserved',
  642.         );
  643.         $this->_defClass = 'code';
  644.         $this->_checkDefines();
  645.     }
  646.     
  647. }