PYTHON.php 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629
  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. * Auto-generated class. PYTHON syntax highlighting
  24. *
  25. * @author Andrey Demenev <demenev@gmail.com>
  26. * @category Text
  27. * @package Text_Highlighter
  28. * @copyright 2004-2006 Andrey Demenev
  29. * @license http://www.php.net/license/3_0.txt PHP License
  30. * @version Release: 0.7.1
  31. * @link http://pear.php.net/package/Text_Highlighter
  32. */
  33. class Text_Highlighter_PYTHON extends Text_Highlighter
  34. {
  35. var $_language = 'python';
  36. /**
  37. * Constructor
  38. *
  39. * @param array $options
  40. * @access public
  41. */
  42. function __construct($options=array())
  43. {
  44. $this->_options = $options;
  45. $this->_regs = array (
  46. -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)#.+)/',
  47. 0 => '/((?i)\\\\.)/',
  48. 1 => '/((?i)\\\\.)/',
  49. 2 => '/((?i)\\\\.)/',
  50. 3 => '/((?i)\\\\.)/',
  51. 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)#.+)/',
  52. 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)#.+)/',
  53. );
  54. $this->_counts = array (
  55. -1 =>
  56. array (
  57. 0 => 0,
  58. 1 => 0,
  59. 2 => 0,
  60. 3 => 0,
  61. 4 => 0,
  62. 5 => 0,
  63. 6 => 0,
  64. 7 => 0,
  65. 8 => 5,
  66. 9 => 4,
  67. 10 => 2,
  68. 11 => 0,
  69. 12 => 0,
  70. 13 => 0,
  71. 14 => 0,
  72. ),
  73. 0 =>
  74. array (
  75. 0 => 0,
  76. ),
  77. 1 =>
  78. array (
  79. 0 => 0,
  80. ),
  81. 2 =>
  82. array (
  83. 0 => 0,
  84. ),
  85. 3 =>
  86. array (
  87. 0 => 0,
  88. ),
  89. 4 =>
  90. array (
  91. 0 => 0,
  92. 1 => 0,
  93. 2 => 0,
  94. 3 => 0,
  95. 4 => 0,
  96. 5 => 0,
  97. 6 => 0,
  98. 7 => 0,
  99. 8 => 5,
  100. 9 => 4,
  101. 10 => 2,
  102. 11 => 0,
  103. 12 => 0,
  104. 13 => 0,
  105. 14 => 0,
  106. ),
  107. 5 =>
  108. array (
  109. 0 => 0,
  110. 1 => 0,
  111. 2 => 0,
  112. 3 => 0,
  113. 4 => 0,
  114. 5 => 0,
  115. 6 => 0,
  116. 7 => 0,
  117. 8 => 5,
  118. 9 => 4,
  119. 10 => 2,
  120. 11 => 0,
  121. 12 => 0,
  122. 13 => 0,
  123. 14 => 0,
  124. ),
  125. );
  126. $this->_delim = array (
  127. -1 =>
  128. array (
  129. 0 => 'quotes',
  130. 1 => 'quotes',
  131. 2 => 'quotes',
  132. 3 => 'quotes',
  133. 4 => 'brackets',
  134. 5 => 'brackets',
  135. 6 => '',
  136. 7 => '',
  137. 8 => '',
  138. 9 => '',
  139. 10 => '',
  140. 11 => '',
  141. 12 => '',
  142. 13 => '',
  143. 14 => '',
  144. ),
  145. 0 =>
  146. array (
  147. 0 => '',
  148. ),
  149. 1 =>
  150. array (
  151. 0 => '',
  152. ),
  153. 2 =>
  154. array (
  155. 0 => '',
  156. ),
  157. 3 =>
  158. array (
  159. 0 => '',
  160. ),
  161. 4 =>
  162. array (
  163. 0 => 'quotes',
  164. 1 => 'quotes',
  165. 2 => 'quotes',
  166. 3 => 'quotes',
  167. 4 => 'brackets',
  168. 5 => 'brackets',
  169. 6 => '',
  170. 7 => '',
  171. 8 => '',
  172. 9 => '',
  173. 10 => '',
  174. 11 => '',
  175. 12 => '',
  176. 13 => '',
  177. 14 => '',
  178. ),
  179. 5 =>
  180. array (
  181. 0 => 'quotes',
  182. 1 => 'quotes',
  183. 2 => 'quotes',
  184. 3 => 'quotes',
  185. 4 => 'brackets',
  186. 5 => 'brackets',
  187. 6 => '',
  188. 7 => '',
  189. 8 => '',
  190. 9 => '',
  191. 10 => '',
  192. 11 => '',
  193. 12 => '',
  194. 13 => '',
  195. 14 => '',
  196. ),
  197. );
  198. $this->_inner = array (
  199. -1 =>
  200. array (
  201. 0 => 'string',
  202. 1 => 'string',
  203. 2 => 'string',
  204. 3 => 'string',
  205. 4 => 'code',
  206. 5 => 'code',
  207. 6 => 'identifier',
  208. 7 => 'identifier',
  209. 8 => 'number',
  210. 9 => 'number',
  211. 10 => 'number',
  212. 11 => 'number',
  213. 12 => 'number',
  214. 13 => 'number',
  215. 14 => 'comment',
  216. ),
  217. 0 =>
  218. array (
  219. 0 => 'special',
  220. ),
  221. 1 =>
  222. array (
  223. 0 => 'special',
  224. ),
  225. 2 =>
  226. array (
  227. 0 => 'special',
  228. ),
  229. 3 =>
  230. array (
  231. 0 => 'special',
  232. ),
  233. 4 =>
  234. array (
  235. 0 => 'string',
  236. 1 => 'string',
  237. 2 => 'string',
  238. 3 => 'string',
  239. 4 => 'code',
  240. 5 => 'code',
  241. 6 => 'identifier',
  242. 7 => 'identifier',
  243. 8 => 'number',
  244. 9 => 'number',
  245. 10 => 'number',
  246. 11 => 'number',
  247. 12 => 'number',
  248. 13 => 'number',
  249. 14 => 'comment',
  250. ),
  251. 5 =>
  252. array (
  253. 0 => 'string',
  254. 1 => 'string',
  255. 2 => 'string',
  256. 3 => 'string',
  257. 4 => 'code',
  258. 5 => 'code',
  259. 6 => 'identifier',
  260. 7 => 'identifier',
  261. 8 => 'number',
  262. 9 => 'number',
  263. 10 => 'number',
  264. 11 => 'number',
  265. 12 => 'number',
  266. 13 => 'number',
  267. 14 => 'comment',
  268. ),
  269. );
  270. $this->_end = array (
  271. 0 => '/(?i)\'\'\'/',
  272. 1 => '/(?i)"""/',
  273. 2 => '/(?i)"/',
  274. 3 => '/(?i)\'/',
  275. 4 => '/(?i)\\)/',
  276. 5 => '/(?i)\\]/',
  277. );
  278. $this->_states = array (
  279. -1 =>
  280. array (
  281. 0 => 0,
  282. 1 => 1,
  283. 2 => 2,
  284. 3 => 3,
  285. 4 => 4,
  286. 5 => 5,
  287. 6 => -1,
  288. 7 => -1,
  289. 8 => -1,
  290. 9 => -1,
  291. 10 => -1,
  292. 11 => -1,
  293. 12 => -1,
  294. 13 => -1,
  295. 14 => -1,
  296. ),
  297. 0 =>
  298. array (
  299. 0 => -1,
  300. ),
  301. 1 =>
  302. array (
  303. 0 => -1,
  304. ),
  305. 2 =>
  306. array (
  307. 0 => -1,
  308. ),
  309. 3 =>
  310. array (
  311. 0 => -1,
  312. ),
  313. 4 =>
  314. array (
  315. 0 => 0,
  316. 1 => 1,
  317. 2 => 2,
  318. 3 => 3,
  319. 4 => 4,
  320. 5 => 5,
  321. 6 => -1,
  322. 7 => -1,
  323. 8 => -1,
  324. 9 => -1,
  325. 10 => -1,
  326. 11 => -1,
  327. 12 => -1,
  328. 13 => -1,
  329. 14 => -1,
  330. ),
  331. 5 =>
  332. array (
  333. 0 => 0,
  334. 1 => 1,
  335. 2 => 2,
  336. 3 => 3,
  337. 4 => 4,
  338. 5 => 5,
  339. 6 => -1,
  340. 7 => -1,
  341. 8 => -1,
  342. 9 => -1,
  343. 10 => -1,
  344. 11 => -1,
  345. 12 => -1,
  346. 13 => -1,
  347. 14 => -1,
  348. ),
  349. );
  350. $this->_keywords = array (
  351. -1 =>
  352. array (
  353. 0 => -1,
  354. 1 => -1,
  355. 2 => -1,
  356. 3 => -1,
  357. 4 => -1,
  358. 5 => -1,
  359. 6 =>
  360. array (
  361. '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)$/',
  362. ),
  363. 7 =>
  364. array (
  365. '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)$/',
  366. ),
  367. 8 =>
  368. array (
  369. ),
  370. 9 =>
  371. array (
  372. ),
  373. 10 =>
  374. array (
  375. ),
  376. 11 =>
  377. array (
  378. ),
  379. 12 =>
  380. array (
  381. ),
  382. 13 =>
  383. array (
  384. ),
  385. 14 =>
  386. array (
  387. ),
  388. ),
  389. 0 =>
  390. array (
  391. 0 =>
  392. array (
  393. ),
  394. ),
  395. 1 =>
  396. array (
  397. 0 =>
  398. array (
  399. ),
  400. ),
  401. 2 =>
  402. array (
  403. 0 =>
  404. array (
  405. ),
  406. ),
  407. 3 =>
  408. array (
  409. 0 =>
  410. array (
  411. ),
  412. ),
  413. 4 =>
  414. array (
  415. 0 => -1,
  416. 1 => -1,
  417. 2 => -1,
  418. 3 => -1,
  419. 4 => -1,
  420. 5 => -1,
  421. 6 =>
  422. array (
  423. '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)$/',
  424. ),
  425. 7 =>
  426. array (
  427. '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)$/',
  428. ),
  429. 8 =>
  430. array (
  431. ),
  432. 9 =>
  433. array (
  434. ),
  435. 10 =>
  436. array (
  437. ),
  438. 11 =>
  439. array (
  440. ),
  441. 12 =>
  442. array (
  443. ),
  444. 13 =>
  445. array (
  446. ),
  447. 14 =>
  448. array (
  449. ),
  450. ),
  451. 5 =>
  452. array (
  453. 0 => -1,
  454. 1 => -1,
  455. 2 => -1,
  456. 3 => -1,
  457. 4 => -1,
  458. 5 => -1,
  459. 6 =>
  460. array (
  461. '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)$/',
  462. ),
  463. 7 =>
  464. array (
  465. '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)$/',
  466. ),
  467. 8 =>
  468. array (
  469. ),
  470. 9 =>
  471. array (
  472. ),
  473. 10 =>
  474. array (
  475. ),
  476. 11 =>
  477. array (
  478. ),
  479. 12 =>
  480. array (
  481. ),
  482. 13 =>
  483. array (
  484. ),
  485. 14 =>
  486. array (
  487. ),
  488. ),
  489. );
  490. $this->_parts = array (
  491. 0 =>
  492. array (
  493. 0 => NULL,
  494. ),
  495. 1 =>
  496. array (
  497. 0 => NULL,
  498. ),
  499. 2 =>
  500. array (
  501. 0 => NULL,
  502. ),
  503. 3 =>
  504. array (
  505. 0 => NULL,
  506. ),
  507. 4 =>
  508. array (
  509. 0 => NULL,
  510. 1 => NULL,
  511. 2 => NULL,
  512. 3 => NULL,
  513. 4 => NULL,
  514. 5 => NULL,
  515. 6 => NULL,
  516. 7 => NULL,
  517. 8 => NULL,
  518. 9 => NULL,
  519. 10 => NULL,
  520. 11 => NULL,
  521. 12 => NULL,
  522. 13 => NULL,
  523. 14 => NULL,
  524. ),
  525. 5 =>
  526. array (
  527. 0 => NULL,
  528. 1 => NULL,
  529. 2 => NULL,
  530. 3 => NULL,
  531. 4 => NULL,
  532. 5 => NULL,
  533. 6 => NULL,
  534. 7 => NULL,
  535. 8 => NULL,
  536. 9 => NULL,
  537. 10 => NULL,
  538. 11 => NULL,
  539. 12 => NULL,
  540. 13 => NULL,
  541. 14 => NULL,
  542. ),
  543. );
  544. $this->_subst = array (
  545. -1 =>
  546. array (
  547. 0 => false,
  548. 1 => false,
  549. 2 => false,
  550. 3 => false,
  551. 4 => false,
  552. 5 => false,
  553. 6 => false,
  554. 7 => false,
  555. 8 => false,
  556. 9 => false,
  557. 10 => false,
  558. 11 => false,
  559. 12 => false,
  560. 13 => false,
  561. 14 => false,
  562. ),
  563. 0 =>
  564. array (
  565. 0 => false,
  566. ),
  567. 1 =>
  568. array (
  569. 0 => false,
  570. ),
  571. 2 =>
  572. array (
  573. 0 => false,
  574. ),
  575. 3 =>
  576. array (
  577. 0 => false,
  578. ),
  579. 4 =>
  580. array (
  581. 0 => false,
  582. 1 => false,
  583. 2 => false,
  584. 3 => false,
  585. 4 => false,
  586. 5 => false,
  587. 6 => false,
  588. 7 => false,
  589. 8 => false,
  590. 9 => false,
  591. 10 => false,
  592. 11 => false,
  593. 12 => false,
  594. 13 => false,
  595. 14 => false,
  596. ),
  597. 5 =>
  598. array (
  599. 0 => false,
  600. 1 => false,
  601. 2 => false,
  602. 3 => false,
  603. 4 => false,
  604. 5 => false,
  605. 6 => false,
  606. 7 => false,
  607. 8 => false,
  608. 9 => false,
  609. 10 => false,
  610. 11 => false,
  611. 12 => false,
  612. 13 => false,
  613. 14 => false,
  614. ),
  615. );
  616. $this->_conditions = array (
  617. );
  618. $this->_kwmap = array (
  619. 'builtin' => 'builtin',
  620. 'reserved' => 'reserved',
  621. );
  622. $this->_defClass = 'code';
  623. $this->_checkDefines();
  624. }
  625. }