PageRenderTime 53ms CodeModel.GetById 24ms RepoModel.GetById 0ms app.codeStats 1ms

/build/parsers/LexerGenerator/Regex/Lexer.php

https://gitlab.com/TouchyPunchy/brainy
PHP | 1020 lines | 870 code | 94 blank | 56 comment | 95 complexity | c1be273c2db7dec6d64f88080c0003e5 MD5 | raw file
  1. <?php
  2. require_once './LexerGenerator/Regex/Parser.php';
  3. class PHP_LexerGenerator_Regex_Lexer
  4. {
  5. const MATCHSTART = PHP_LexerGenerator_Regex_Parser::MATCHSTART;
  6. const MATCHEND = PHP_LexerGenerator_Regex_Parser::MATCHEND;
  7. const CONTROLCHAR = PHP_LexerGenerator_Regex_Parser::CONTROLCHAR;
  8. const OPENCHARCLASS = PHP_LexerGenerator_Regex_Parser::OPENCHARCLASS;
  9. const FULLSTOP = PHP_LexerGenerator_Regex_Parser::FULLSTOP;
  10. const TEXT = PHP_LexerGenerator_Regex_Parser::TEXT;
  11. const BACKREFERENCE = PHP_LexerGenerator_Regex_Parser::BACKREFERENCE;
  12. const OPENASSERTION = PHP_LexerGenerator_Regex_Parser::OPENASSERTION;
  13. const COULDBEBACKREF = PHP_LexerGenerator_Regex_Parser::COULDBEBACKREF;
  14. const NEGATE = PHP_LexerGenerator_Regex_Parser::NEGATE;
  15. const HYPHEN = PHP_LexerGenerator_Regex_Parser::HYPHEN;
  16. const CLOSECHARCLASS = PHP_LexerGenerator_Regex_Parser::CLOSECHARCLASS;
  17. const BAR = PHP_LexerGenerator_Regex_Parser::BAR;
  18. const MULTIPLIER = PHP_LexerGenerator_Regex_Parser::MULTIPLIER;
  19. const INTERNALOPTIONS = PHP_LexerGenerator_Regex_Parser::INTERNALOPTIONS;
  20. const COLON = PHP_LexerGenerator_Regex_Parser::COLON;
  21. const OPENPAREN = PHP_LexerGenerator_Regex_Parser::OPENPAREN;
  22. const CLOSEPAREN = PHP_LexerGenerator_Regex_Parser::CLOSEPAREN;
  23. const PATTERNNAME = PHP_LexerGenerator_Regex_Parser::PATTERNNAME;
  24. const POSITIVELOOKBEHIND = PHP_LexerGenerator_Regex_Parser::POSITIVELOOKBEHIND;
  25. const NEGATIVELOOKBEHIND = PHP_LexerGenerator_Regex_Parser::NEGATIVELOOKBEHIND;
  26. const POSITIVELOOKAHEAD = PHP_LexerGenerator_Regex_Parser::POSITIVELOOKAHEAD;
  27. const NEGATIVELOOKAHEAD = PHP_LexerGenerator_Regex_Parser::NEGATIVELOOKAHEAD;
  28. const ONCEONLY = PHP_LexerGenerator_Regex_Parser::ONCEONLY;
  29. const COMMENT = PHP_LexerGenerator_Regex_Parser::COMMENT;
  30. const RECUR = PHP_LexerGenerator_Regex_Parser::RECUR;
  31. const ESCAPEDBACKSLASH = PHP_LexerGenerator_Regex_Parser::ESCAPEDBACKSLASH;
  32. private $input;
  33. private $N;
  34. public $token;
  35. public $value;
  36. public $line;
  37. public function __construct($data)
  38. {
  39. $this->input = $data;
  40. $this->N = 0;
  41. }
  42. public function reset($data, $line)
  43. {
  44. $this->input = $data;
  45. $this->N = 0;
  46. // passed in from parent parser
  47. $this->line = $line;
  48. $this->yybegin(self::INITIAL);
  49. }
  50. private $_yy_state = 1;
  51. private $_yy_stack = array();
  52. public function yylex()
  53. {
  54. return $this->{'yylex' . $this->_yy_state}();
  55. }
  56. public function yypushstate($state)
  57. {
  58. array_push($this->_yy_stack, $this->_yy_state);
  59. $this->_yy_state = $state;
  60. }
  61. public function yypopstate()
  62. {
  63. $this->_yy_state = array_pop($this->_yy_stack);
  64. }
  65. public function yybegin($state)
  66. {
  67. $this->_yy_state = $state;
  68. }
  69. public function yylex1()
  70. {
  71. $tokenMap = array (
  72. 1 => 0,
  73. 2 => 0,
  74. 3 => 0,
  75. 4 => 0,
  76. 5 => 0,
  77. 6 => 0,
  78. 7 => 0,
  79. 8 => 0,
  80. 9 => 0,
  81. 10 => 0,
  82. 11 => 0,
  83. 12 => 0,
  84. 13 => 0,
  85. 14 => 0,
  86. 15 => 0,
  87. 16 => 0,
  88. 17 => 0,
  89. 18 => 0,
  90. 19 => 0,
  91. 20 => 0,
  92. 21 => 0,
  93. 22 => 0,
  94. 23 => 0,
  95. );
  96. if ($this->N >= strlen($this->input)) {
  97. return false; // end of input
  98. }
  99. $yy_global_pattern = '/\G(\\\\\\\\)|\G([^[\\\\^$.|()?*+{}]+)|\G(\\\\[][{}*.^$|?()+])|\G(\\[)|\G(\\|)|\G(\\\\[frnt]|\\\\x[0-9a-fA-F][0-9a-fA-F]?|\\\\[0-7][0-7][0-7]|\\\\x\\{[0-9a-fA-F]+\\})|\G(\\\\[0-9][0-9])|\G(\\\\[abBGcedDsSwW0C]|\\\\c\\\\)|\G(\\^)|\G(\\\\A)|\G(\\))|\G(\\$)|\G(\\*\\?|\\+\\?|[*?+]|\\{[0-9]+\\}|\\{[0-9]+,\\}|\\{[0-9]+,[0-9]+\\})|\G(\\\\[zZ])|\G(\\(\\?)|\G(\\()|\G(\\.)|\G(\\\\[1-9])|\G(\\\\p\\{\\^?..?\\}|\\\\P\\{..?\\}|\\\\X)|\G(\\\\p\\{C[cfnos]?|L[lmotu]?|M[cen]?|N[dlo]?|P[cdefios]?|S[ckmo]?|Z[lps]?\\})|\G(\\\\p\\{\\^C[cfnos]?|L[lmotu]?|M[cen]?|N[dlo]?|P[cdefios]?|S[ckmo]?|Z[lps]?\\})|\G(\\\\p[CLMNPSZ])|\G(\\\\)/';
  100. do {
  101. if (preg_match($yy_global_pattern,$this->input, $yymatches, null, $this->N)) {
  102. $yysubmatches = $yymatches;
  103. $yymatches = array_filter($yymatches, 'strlen'); // remove empty sub-patterns
  104. if (!count($yymatches)) {
  105. throw new Exception('Error: lexing failed because a rule matched' .
  106. ' an empty string. Input "' . substr($this->input,
  107. $this->N, 5) . '... state INITIAL');
  108. }
  109. next($yymatches); // skip global match
  110. $this->token = key($yymatches); // token number
  111. if ($tokenMap[$this->token]) {
  112. // extract sub-patterns for passing to lex function
  113. $yysubmatches = array_slice($yysubmatches, $this->token + 1,
  114. $tokenMap[$this->token]);
  115. } else {
  116. $yysubmatches = array();
  117. }
  118. $this->value = current($yymatches); // token value
  119. $r = $this->{'yy_r1_' . $this->token}($yysubmatches);
  120. if ($r === null) {
  121. $this->N += strlen($this->value);
  122. $this->line += substr_count($this->value, "\n");
  123. // accept this token
  124. return true;
  125. } elseif ($r === true) {
  126. // we have changed state
  127. // process this token in the new state
  128. return $this->yylex();
  129. } elseif ($r === false) {
  130. $this->N += strlen($this->value);
  131. $this->line += substr_count($this->value, "\n");
  132. if ($this->N >= strlen($this->input)) {
  133. return false; // end of input
  134. }
  135. // skip this token
  136. continue;
  137. } else {
  138. $yy_yymore_patterns = array(
  139. 1 => array(0, "\G([^[\\\\^$.|()?*+{}]+)|\G(\\\\[][{}*.^$|?()+])|\G(\\[)|\G(\\|)|\G(\\\\[frnt]|\\\\x[0-9a-fA-F][0-9a-fA-F]?|\\\\[0-7][0-7][0-7]|\\\\x\\{[0-9a-fA-F]+\\})|\G(\\\\[0-9][0-9])|\G(\\\\[abBGcedDsSwW0C]|\\\\c\\\\)|\G(\\^)|\G(\\\\A)|\G(\\))|\G(\\$)|\G(\\*\\?|\\+\\?|[*?+]|\\{[0-9]+\\}|\\{[0-9]+,\\}|\\{[0-9]+,[0-9]+\\})|\G(\\\\[zZ])|\G(\\(\\?)|\G(\\()|\G(\\.)|\G(\\\\[1-9])|\G(\\\\p\\{\\^?..?\\}|\\\\P\\{..?\\}|\\\\X)|\G(\\\\p\\{C[cfnos]?|L[lmotu]?|M[cen]?|N[dlo]?|P[cdefios]?|S[ckmo]?|Z[lps]?\\})|\G(\\\\p\\{\\^C[cfnos]?|L[lmotu]?|M[cen]?|N[dlo]?|P[cdefios]?|S[ckmo]?|Z[lps]?\\})|\G(\\\\p[CLMNPSZ])|\G(\\\\)"),
  140. 2 => array(0, "\G(\\\\[][{}*.^$|?()+])|\G(\\[)|\G(\\|)|\G(\\\\[frnt]|\\\\x[0-9a-fA-F][0-9a-fA-F]?|\\\\[0-7][0-7][0-7]|\\\\x\\{[0-9a-fA-F]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\{C[cfnos]?|L[lmotu]?|M[cen]?|N[dlo]?|P[cdefios]?|S[ckmo]?|Z[lps]?\\})|\G(\\\\p\\{\\^C[cfnos]?|L[lmotu]?|M[cen]?|N[dlo]?|P[cdefios]?|S[ckmo]?|Z[lps]?\\})|\G(\\\\p[CLMNPSZ])|\G(\\\\)"),
  153. 15 => array(0, "\G(\\()|\G(\\.)|\G(\\\\[1-9])|\G(\\\\p\\{\\^?..?\\}|\\\\P\\{..?\\}|\\\\X)|\G(\\\\p\\{C[cfnos]?|L[lmotu]?|M[cen]?|N[dlo]?|P[cdefios]?|S[ckmo]?|Z[lps]?\\})|\G(\\\\p\\{\\^C[cfnos]?|L[lmotu]?|M[cen]?|N[dlo]?|P[cdefios]?|S[ckmo]?|Z[lps]?\\})|\G(\\\\p[CLMNPSZ])|\G(\\\\)"),
  154. 16 => array(0, "\G(\\.)|\G(\\\\[1-9])|\G(\\\\p\\{\\^?..?\\}|\\\\P\\{..?\\}|\\\\X)|\G(\\\\p\\{C[cfnos]?|L[lmotu]?|M[cen]?|N[dlo]?|P[cdefios]?|S[ckmo]?|Z[lps]?\\})|\G(\\\\p\\{\\^C[cfnos]?|L[lmotu]?|M[cen]?|N[dlo]?|P[cdefios]?|S[ckmo]?|Z[lps]?\\})|\G(\\\\p[CLMNPSZ])|\G(\\\\)"),
  155. 17 => array(0, "\G(\\\\[1-9])|\G(\\\\p\\{\\^?..?\\}|\\\\P\\{..?\\}|\\\\X)|\G(\\\\p\\{C[cfnos]?|L[lmotu]?|M[cen]?|N[dlo]?|P[cdefios]?|S[ckmo]?|Z[lps]?\\})|\G(\\\\p\\{\\^C[cfnos]?|L[lmotu]?|M[cen]?|N[dlo]?|P[cdefios]?|S[ckmo]?|Z[lps]?\\})|\G(\\\\p[CLMNPSZ])|\G(\\\\)"),
  156. 18 => array(0, "\G(\\\\p\\{\\^?..?\\}|\\\\P\\{..?\\}|\\\\X)|\G(\\\\p\\{C[cfnos]?|L[lmotu]?|M[cen]?|N[dlo]?|P[cdefios]?|S[ckmo]?|Z[lps]?\\})|\G(\\\\p\\{\\^C[cfnos]?|L[lmotu]?|M[cen]?|N[dlo]?|P[cdefios]?|S[ckmo]?|Z[lps]?\\})|\G(\\\\p[CLMNPSZ])|\G(\\\\)"),
  157. 19 => array(0, "\G(\\\\p\\{C[cfnos]?|L[lmotu]?|M[cen]?|N[dlo]?|P[cdefios]?|S[ckmo]?|Z[lps]?\\})|\G(\\\\p\\{\\^C[cfnos]?|L[lmotu]?|M[cen]?|N[dlo]?|P[cdefios]?|S[ckmo]?|Z[lps]?\\})|\G(\\\\p[CLMNPSZ])|\G(\\\\)"),
  158. 20 => array(0, "\G(\\\\p\\{\\^C[cfnos]?|L[lmotu]?|M[cen]?|N[dlo]?|P[cdefios]?|S[ckmo]?|Z[lps]?\\})|\G(\\\\p[CLMNPSZ])|\G(\\\\)"),
  159. 21 => array(0, "\G(\\\\p[CLMNPSZ])|\G(\\\\)"),
  160. 22 => array(0, "\G(\\\\)"),
  161. 23 => array(0, ""),
  162. );
  163. // yymore is needed
  164. do {
  165. if (!strlen($yy_yymore_patterns[$this->token][1])) {
  166. throw new Exception('cannot do yymore for the last token');
  167. }
  168. $yysubmatches = array();
  169. if (preg_match('/' . $yy_yymore_patterns[$this->token][1] . '/',
  170. $this->input, $yymatches, null, $this->N)) {
  171. $yysubmatches = $yymatches;
  172. $yymatches = array_filter($yymatches, 'strlen'); // remove empty sub-patterns
  173. next($yymatches); // skip global match
  174. $this->token += key($yymatches) + $yy_yymore_patterns[$this->token][0]; // token number
  175. $this->value = current($yymatches); // token value
  176. $this->line = substr_count($this->value, "\n");
  177. if ($tokenMap[$this->token]) {
  178. // extract sub-patterns for passing to lex function
  179. $yysubmatches = array_slice($yysubmatches, $this->token + 1,
  180. $tokenMap[$this->token]);
  181. } else {
  182. $yysubmatches = array();
  183. }
  184. }
  185. $r = $this->{'yy_r1_' . $this->token}($yysubmatches);
  186. } while ($r !== null && !is_bool($r));
  187. if ($r === true) {
  188. // we have changed state
  189. // process this token in the new state
  190. return $this->yylex();
  191. } elseif ($r === false) {
  192. $this->N += strlen($this->value);
  193. $this->line += substr_count($this->value, "\n");
  194. if ($this->N >= strlen($this->input)) {
  195. return false; // end of input
  196. }
  197. // skip this token
  198. continue;
  199. } else {
  200. // accept
  201. $this->N += strlen($this->value);
  202. $this->line += substr_count($this->value, "\n");
  203. return true;
  204. }
  205. }
  206. } else {
  207. throw new Exception('Unexpected input at line' . $this->line .
  208. ': ' . $this->input[$this->N]);
  209. }
  210. break;
  211. } while (true);
  212. } // end function
  213. const INITIAL = 1;
  214. public function yy_r1_1($yy_subpatterns)
  215. {
  216. $this->token = self::ESCAPEDBACKSLASH;
  217. }
  218. public function yy_r1_2($yy_subpatterns)
  219. {
  220. $this->token = self::TEXT;
  221. }
  222. public function yy_r1_3($yy_subpatterns)
  223. {
  224. $this->token = self::CONTROLCHAR;
  225. }
  226. public function yy_r1_4($yy_subpatterns)
  227. {
  228. $this->token = self::OPENCHARCLASS;
  229. $this->yybegin(self::CHARACTERCLASSSTART);
  230. }
  231. public function yy_r1_5($yy_subpatterns)
  232. {
  233. $this->token = self::BAR;
  234. }
  235. public function yy_r1_6($yy_subpatterns)
  236. {
  237. $this->token = self::TEXT;
  238. }
  239. public function yy_r1_7($yy_subpatterns)
  240. {
  241. $this->token = self::COULDBEBACKREF;
  242. }
  243. public function yy_r1_8($yy_subpatterns)
  244. {
  245. $this->token = self::CONTROLCHAR;
  246. }
  247. public function yy_r1_9($yy_subpatterns)
  248. {
  249. $this->token = self::MATCHSTART;
  250. }
  251. public function yy_r1_10($yy_subpatterns)
  252. {
  253. $this->token = self::MATCHSTART;
  254. }
  255. public function yy_r1_11($yy_subpatterns)
  256. {
  257. $this->token = self::CLOSEPAREN;
  258. $this->yybegin(self::INITIAL);
  259. }
  260. public function yy_r1_12($yy_subpatterns)
  261. {
  262. $this->token = self::MATCHEND;
  263. }
  264. public function yy_r1_13($yy_subpatterns)
  265. {
  266. $this->token = self::MULTIPLIER;
  267. }
  268. public function yy_r1_14($yy_subpatterns)
  269. {
  270. $this->token = self::MATCHEND;
  271. }
  272. public function yy_r1_15($yy_subpatterns)
  273. {
  274. $this->token = self::OPENASSERTION;
  275. $this->yybegin(self::ASSERTION);
  276. }
  277. public function yy_r1_16($yy_subpatterns)
  278. {
  279. $this->token = self::OPENPAREN;
  280. }
  281. public function yy_r1_17($yy_subpatterns)
  282. {
  283. $this->token = self::FULLSTOP;
  284. }
  285. public function yy_r1_18($yy_subpatterns)
  286. {
  287. $this->token = self::BACKREFERENCE;
  288. }
  289. public function yy_r1_19($yy_subpatterns)
  290. {
  291. $this->token = self::CONTROLCHAR;
  292. }
  293. public function yy_r1_20($yy_subpatterns)
  294. {
  295. $this->token = self::CONTROLCHAR;
  296. }
  297. public function yy_r1_21($yy_subpatterns)
  298. {
  299. $this->token = self::CONTROLCHAR;
  300. }
  301. public function yy_r1_22($yy_subpatterns)
  302. {
  303. $this->token = self::CONTROLCHAR;
  304. }
  305. public function yy_r1_23($yy_subpatterns)
  306. {
  307. return false;
  308. }
  309. public function yylex2()
  310. {
  311. $tokenMap = array (
  312. 1 => 0,
  313. 2 => 0,
  314. 3 => 0,
  315. );
  316. if ($this->N >= strlen($this->input)) {
  317. return false; // end of input
  318. }
  319. $yy_global_pattern = '/\G(\\^)|\G(\\])|\G(.)/';
  320. do {
  321. if (preg_match($yy_global_pattern,$this->input, $yymatches, null, $this->N)) {
  322. $yysubmatches = $yymatches;
  323. $yymatches = array_filter($yymatches, 'strlen'); // remove empty sub-patterns
  324. if (!count($yymatches)) {
  325. throw new Exception('Error: lexing failed because a rule matched' .
  326. ' an empty string. Input "' . substr($this->input,
  327. $this->N, 5) . '... state CHARACTERCLASSSTART');
  328. }
  329. next($yymatches); // skip global match
  330. $this->token = key($yymatches); // token number
  331. if ($tokenMap[$this->token]) {
  332. // extract sub-patterns for passing to lex function
  333. $yysubmatches = array_slice($yysubmatches, $this->token + 1,
  334. $tokenMap[$this->token]);
  335. } else {
  336. $yysubmatches = array();
  337. }
  338. $this->value = current($yymatches); // token value
  339. $r = $this->{'yy_r2_' . $this->token}($yysubmatches);
  340. if ($r === null) {
  341. $this->N += strlen($this->value);
  342. $this->line += substr_count($this->value, "\n");
  343. // accept this token
  344. return true;
  345. } elseif ($r === true) {
  346. // we have changed state
  347. // process this token in the new state
  348. return $this->yylex();
  349. } elseif ($r === false) {
  350. $this->N += strlen($this->value);
  351. $this->line += substr_count($this->value, "\n");
  352. if ($this->N >= strlen($this->input)) {
  353. return false; // end of input
  354. }
  355. // skip this token
  356. continue;
  357. } else {
  358. $yy_yymore_patterns = array(
  359. 1 => array(0, "\G(\\])|\G(.)"),
  360. 2 => array(0, "\G(.)"),
  361. 3 => array(0, ""),
  362. );
  363. // yymore is needed
  364. do {
  365. if (!strlen($yy_yymore_patterns[$this->token][1])) {
  366. throw new Exception('cannot do yymore for the last token');
  367. }
  368. $yysubmatches = array();
  369. if (preg_match('/' . $yy_yymore_patterns[$this->token][1] . '/',
  370. $this->input, $yymatches, null, $this->N)) {
  371. $yysubmatches = $yymatches;
  372. $yymatches = array_filter($yymatches, 'strlen'); // remove empty sub-patterns
  373. next($yymatches); // skip global match
  374. $this->token += key($yymatches) + $yy_yymore_patterns[$this->token][0]; // token number
  375. $this->value = current($yymatches); // token value
  376. $this->line = substr_count($this->value, "\n");
  377. if ($tokenMap[$this->token]) {
  378. // extract sub-patterns for passing to lex function
  379. $yysubmatches = array_slice($yysubmatches, $this->token + 1,
  380. $tokenMap[$this->token]);
  381. } else {
  382. $yysubmatches = array();
  383. }
  384. }
  385. $r = $this->{'yy_r2_' . $this->token}($yysubmatches);
  386. } while ($r !== null && !is_bool($r));
  387. if ($r === true) {
  388. // we have changed state
  389. // process this token in the new state
  390. return $this->yylex();
  391. } elseif ($r === false) {
  392. $this->N += strlen($this->value);
  393. $this->line += substr_count($this->value, "\n");
  394. if ($this->N >= strlen($this->input)) {
  395. return false; // end of input
  396. }
  397. // skip this token
  398. continue;
  399. } else {
  400. // accept
  401. $this->N += strlen($this->value);
  402. $this->line += substr_count($this->value, "\n");
  403. return true;
  404. }
  405. }
  406. } else {
  407. throw new Exception('Unexpected input at line' . $this->line .
  408. ': ' . $this->input[$this->N]);
  409. }
  410. break;
  411. } while (true);
  412. } // end function
  413. const CHARACTERCLASSSTART = 2;
  414. public function yy_r2_1($yy_subpatterns)
  415. {
  416. $this->token = self::NEGATE;
  417. }
  418. public function yy_r2_2($yy_subpatterns)
  419. {
  420. $this->yybegin(self::CHARACTERCLASS);
  421. $this->token = self::TEXT;
  422. }
  423. public function yy_r2_3($yy_subpatterns)
  424. {
  425. $this->yybegin(self::CHARACTERCLASS);
  426. return true;
  427. }
  428. public function yylex3()
  429. {
  430. $tokenMap = array (
  431. 1 => 0,
  432. 2 => 0,
  433. 3 => 0,
  434. 4 => 0,
  435. 5 => 0,
  436. 6 => 0,
  437. 7 => 0,
  438. 8 => 0,
  439. 9 => 0,
  440. 10 => 0,
  441. 11 => 0,
  442. );
  443. if ($this->N >= strlen($this->input)) {
  444. return false; // end of input
  445. }
  446. $yy_global_pattern = '/\G(\\\\\\\\)|\G(\\])|\G(\\\\[frnt]|\\\\x[0-9a-fA-F][0-9a-fA-F]?|\\\\[0-7][0-7][0-7]|\\\\x\\{[0-9a-fA-F]+\\})|\G(\\\\[bacedDsSwW0C]|\\\\c\\\\|\\\\x\\{[0-9a-fA-F]+\\}|\\\\[0-7][0-7][0-7]|\\\\x[0-9a-fA-F][0-9a-fA-F]?)|\G(\\\\[0-9][0-9])|\G(\\\\[1-9])|\G(\\\\[]\.\-\^])|\G(-(?!]))|\G([^\-\\\\])|\G(\\\\)|\G(.)/';
  447. do {
  448. if (preg_match($yy_global_pattern,$this->input, $yymatches, null, $this->N)) {
  449. $yysubmatches = $yymatches;
  450. $yymatches = array_filter($yymatches, 'strlen'); // remove empty sub-patterns
  451. if (!count($yymatches)) {
  452. throw new Exception('Error: lexing failed because a rule matched' .
  453. ' an empty string. Input "' . substr($this->input,
  454. $this->N, 5) . '... state CHARACTERCLASS');
  455. }
  456. next($yymatches); // skip global match
  457. $this->token = key($yymatches); // token number
  458. if ($tokenMap[$this->token]) {
  459. // extract sub-patterns for passing to lex function
  460. $yysubmatches = array_slice($yysubmatches, $this->token + 1,
  461. $tokenMap[$this->token]);
  462. } else {
  463. $yysubmatches = array();
  464. }
  465. $this->value = current($yymatches); // token value
  466. $r = $this->{'yy_r3_' . $this->token}($yysubmatches);
  467. if ($r === null) {
  468. $this->N += strlen($this->value);
  469. $this->line += substr_count($this->value, "\n");
  470. // accept this token
  471. return true;
  472. } elseif ($r === true) {
  473. // we have changed state
  474. // process this token in the new state
  475. return $this->yylex();
  476. } elseif ($r === false) {
  477. $this->N += strlen($this->value);
  478. $this->line += substr_count($this->value, "\n");
  479. if ($this->N >= strlen($this->input)) {
  480. return false; // end of input
  481. }
  482. // skip this token
  483. continue;
  484. } else {
  485. $yy_yymore_patterns = array(
  486. 1 => array(0, "\G(\\])|\G(\\\\[frnt]|\\\\x[0-9a-fA-F][0-9a-fA-F]?|\\\\[0-7][0-7][0-7]|\\\\x\\{[0-9a-fA-F]+\\})|\G(\\\\[bacedDsSwW0C]|\\\\c\\\\|\\\\x\\{[0-9a-fA-F]+\\}|\\\\[0-7][0-7][0-7]|\\\\x[0-9a-fA-F][0-9a-fA-F]?)|\G(\\\\[0-9][0-9])|\G(\\\\[1-9])|\G(\\\\[]\.\-\^])|\G(-(?!]))|\G([^\-\\\\])|\G(\\\\)|\G(.)"),
  487. 2 => array(0, "\G(\\\\[frnt]|\\\\x[0-9a-fA-F][0-9a-fA-F]?|\\\\[0-7][0-7][0-7]|\\\\x\\{[0-9a-fA-F]+\\})|\G(\\\\[bacedDsSwW0C]|\\\\c\\\\|\\\\x\\{[0-9a-fA-F]+\\}|\\\\[0-7][0-7][0-7]|\\\\x[0-9a-fA-F][0-9a-fA-F]?)|\G(\\\\[0-9][0-9])|\G(\\\\[1-9])|\G(\\\\[]\.\-\^])|\G(-(?!]))|\G([^\-\\\\])|\G(\\\\)|\G(.)"),
  488. 3 => array(0, "\G(\\\\[bacedDsSwW0C]|\\\\c\\\\|\\\\x\\{[0-9a-fA-F]+\\}|\\\\[0-7][0-7][0-7]|\\\\x[0-9a-fA-F][0-9a-fA-F]?)|\G(\\\\[0-9][0-9])|\G(\\\\[1-9])|\G(\\\\[]\.\-\^])|\G(-(?!]))|\G([^\-\\\\])|\G(\\\\)|\G(.)"),
  489. 4 => array(0, "\G(\\\\[0-9][0-9])|\G(\\\\[1-9])|\G(\\\\[]\.\-\^])|\G(-(?!]))|\G([^\-\\\\])|\G(\\\\)|\G(.)"),
  490. 5 => array(0, "\G(\\\\[1-9])|\G(\\\\[]\.\-\^])|\G(-(?!]))|\G([^\-\\\\])|\G(\\\\)|\G(.)"),
  491. 6 => array(0, "\G(\\\\[]\.\-\^])|\G(-(?!]))|\G([^\-\\\\])|\G(\\\\)|\G(.)"),
  492. 7 => array(0, "\G(-(?!]))|\G([^\-\\\\])|\G(\\\\)|\G(.)"),
  493. 8 => array(0, "\G([^\-\\\\])|\G(\\\\)|\G(.)"),
  494. 9 => array(0, "\G(\\\\)|\G(.)"),
  495. 10 => array(0, "\G(.)"),
  496. 11 => array(0, ""),
  497. );
  498. // yymore is needed
  499. do {
  500. if (!strlen($yy_yymore_patterns[$this->token][1])) {
  501. throw new Exception('cannot do yymore for the last token');
  502. }
  503. $yysubmatches = array();
  504. if (preg_match('/' . $yy_yymore_patterns[$this->token][1] . '/',
  505. $this->input, $yymatches, null, $this->N)) {
  506. $yysubmatches = $yymatches;
  507. $yymatches = array_filter($yymatches, 'strlen'); // remove empty sub-patterns
  508. next($yymatches); // skip global match
  509. $this->token += key($yymatches) + $yy_yymore_patterns[$this->token][0]; // token number
  510. $this->value = current($yymatches); // token value
  511. $this->line = substr_count($this->value, "\n");
  512. if ($tokenMap[$this->token]) {
  513. // extract sub-patterns for passing to lex function
  514. $yysubmatches = array_slice($yysubmatches, $this->token + 1,
  515. $tokenMap[$this->token]);
  516. } else {
  517. $yysubmatches = array();
  518. }
  519. }
  520. $r = $this->{'yy_r3_' . $this->token}($yysubmatches);
  521. } while ($r !== null && !is_bool($r));
  522. if ($r === true) {
  523. // we have changed state
  524. // process this token in the new state
  525. return $this->yylex();
  526. } elseif ($r === false) {
  527. $this->N += strlen($this->value);
  528. $this->line += substr_count($this->value, "\n");
  529. if ($this->N >= strlen($this->input)) {
  530. return false; // end of input
  531. }
  532. // skip this token
  533. continue;
  534. } else {
  535. // accept
  536. $this->N += strlen($this->value);
  537. $this->line += substr_count($this->value, "\n");
  538. return true;
  539. }
  540. }
  541. } else {
  542. throw new Exception('Unexpected input at line' . $this->line .
  543. ': ' . $this->input[$this->N]);
  544. }
  545. break;
  546. } while (true);
  547. } // end function
  548. const CHARACTERCLASS = 3;
  549. public function yy_r3_1($yy_subpatterns)
  550. {
  551. $this->token = self::ESCAPEDBACKSLASH;
  552. }
  553. public function yy_r3_2($yy_subpatterns)
  554. {
  555. $this->yybegin(self::INITIAL);
  556. $this->token = self::CLOSECHARCLASS;
  557. }
  558. public function yy_r3_3($yy_subpatterns)
  559. {
  560. $this->token = self::TEXT;
  561. }
  562. public function yy_r3_4($yy_subpatterns)
  563. {
  564. $this->token = self::TEXT;
  565. }
  566. public function yy_r3_5($yy_subpatterns)
  567. {
  568. $this->token = self::COULDBEBACKREF;
  569. }
  570. public function yy_r3_6($yy_subpatterns)
  571. {
  572. $this->token = self::BACKREFERENCE;
  573. }
  574. public function yy_r3_7($yy_subpatterns)
  575. {
  576. $this->token = self::TEXT;
  577. }
  578. public function yy_r3_8($yy_subpatterns)
  579. {
  580. $this->token = self::HYPHEN;
  581. $this->yybegin(self::RANGE);
  582. }
  583. public function yy_r3_9($yy_subpatterns)
  584. {
  585. $this->token = self::TEXT;
  586. }
  587. public function yy_r3_10($yy_subpatterns)
  588. {
  589. return false; // ignore escaping of normal text
  590. }
  591. public function yy_r3_11($yy_subpatterns)
  592. {
  593. $this->token = self::TEXT;
  594. }
  595. public function yylex4()
  596. {
  597. $tokenMap = array (
  598. 1 => 0,
  599. 2 => 0,
  600. 3 => 0,
  601. 4 => 0,
  602. 5 => 0,
  603. 6 => 0,
  604. 7 => 0,
  605. );
  606. if ($this->N >= strlen($this->input)) {
  607. return false; // end of input
  608. }
  609. $yy_global_pattern = '/\G(\\\\\\\\)|\G(\\\\\\])|\G(\\\\[bacedDsSwW0C]|\\\\c\\\\|\\\\x\\{[0-9a-fA-F]+\\}|\\\\[0-7][0-7][0-7]|\\\\x[0-9a-fA-F][0-9a-fA-F]?)|\G(\\\\[0-9][0-9])|\G(\\\\[1-9])|\G([^\-\\\\])|\G(\\\\)/';
  610. do {
  611. if (preg_match($yy_global_pattern,$this->input, $yymatches, null, $this->N)) {
  612. $yysubmatches = $yymatches;
  613. $yymatches = array_filter($yymatches, 'strlen'); // remove empty sub-patterns
  614. if (!count($yymatches)) {
  615. throw new Exception('Error: lexing failed because a rule matched' .
  616. ' an empty string. Input "' . substr($this->input,
  617. $this->N, 5) . '... state RANGE');
  618. }
  619. next($yymatches); // skip global match
  620. $this->token = key($yymatches); // token number
  621. if ($tokenMap[$this->token]) {
  622. // extract sub-patterns for passing to lex function
  623. $yysubmatches = array_slice($yysubmatches, $this->token + 1,
  624. $tokenMap[$this->token]);
  625. } else {
  626. $yysubmatches = array();
  627. }
  628. $this->value = current($yymatches); // token value
  629. $r = $this->{'yy_r4_' . $this->token}($yysubmatches);
  630. if ($r === null) {
  631. $this->N += strlen($this->value);
  632. $this->line += substr_count($this->value, "\n");
  633. // accept this token
  634. return true;
  635. } elseif ($r === true) {
  636. // we have changed state
  637. // process this token in the new state
  638. return $this->yylex();
  639. } elseif ($r === false) {
  640. $this->N += strlen($this->value);
  641. $this->line += substr_count($this->value, "\n");
  642. if ($this->N >= strlen($this->input)) {
  643. return false; // end of input
  644. }
  645. // skip this token
  646. continue;
  647. } else {
  648. $yy_yymore_patterns = array(
  649. 1 => array(0, "\G(\\\\\\])|\G(\\\\[bacedDsSwW0C]|\\\\c\\\\|\\\\x\\{[0-9a-fA-F]+\\}|\\\\[0-7][0-7][0-7]|\\\\x[0-9a-fA-F][0-9a-fA-F]?)|\G(\\\\[0-9][0-9])|\G(\\\\[1-9])|\G([^\-\\\\])|\G(\\\\)"),
  650. 2 => array(0, "\G(\\\\[bacedDsSwW0C]|\\\\c\\\\|\\\\x\\{[0-9a-fA-F]+\\}|\\\\[0-7][0-7][0-7]|\\\\x[0-9a-fA-F][0-9a-fA-F]?)|\G(\\\\[0-9][0-9])|\G(\\\\[1-9])|\G([^\-\\\\])|\G(\\\\)"),
  651. 3 => array(0, "\G(\\\\[0-9][0-9])|\G(\\\\[1-9])|\G([^\-\\\\])|\G(\\\\)"),
  652. 4 => array(0, "\G(\\\\[1-9])|\G([^\-\\\\])|\G(\\\\)"),
  653. 5 => array(0, "\G([^\-\\\\])|\G(\\\\)"),
  654. 6 => array(0, "\G(\\\\)"),
  655. 7 => array(0, ""),
  656. );
  657. // yymore is needed
  658. do {
  659. if (!strlen($yy_yymore_patterns[$this->token][1])) {
  660. throw new Exception('cannot do yymore for the last token');
  661. }
  662. $yysubmatches = array();
  663. if (preg_match('/' . $yy_yymore_patterns[$this->token][1] . '/',
  664. $this->input, $yymatches, null, $this->N)) {
  665. $yysubmatches = $yymatches;
  666. $yymatches = array_filter($yymatches, 'strlen'); // remove empty sub-patterns
  667. next($yymatches); // skip global match
  668. $this->token += key($yymatches) + $yy_yymore_patterns[$this->token][0]; // token number
  669. $this->value = current($yymatches); // token value
  670. $this->line = substr_count($this->value, "\n");
  671. if ($tokenMap[$this->token]) {
  672. // extract sub-patterns for passing to lex function
  673. $yysubmatches = array_slice($yysubmatches, $this->token + 1,
  674. $tokenMap[$this->token]);
  675. } else {
  676. $yysubmatches = array();
  677. }
  678. }
  679. $r = $this->{'yy_r4_' . $this->token}($yysubmatches);
  680. } while ($r !== null && !is_bool($r));
  681. if ($r === true) {
  682. // we have changed state
  683. // process this token in the new state
  684. return $this->yylex();
  685. } elseif ($r === false) {
  686. $this->N += strlen($this->value);
  687. $this->line += substr_count($this->value, "\n");
  688. if ($this->N >= strlen($this->input)) {
  689. return false; // end of input
  690. }
  691. // skip this token
  692. continue;
  693. } else {
  694. // accept
  695. $this->N += strlen($this->value);
  696. $this->line += substr_count($this->value, "\n");
  697. return true;
  698. }
  699. }
  700. } else {
  701. throw new Exception('Unexpected input at line' . $this->line .
  702. ': ' . $this->input[$this->N]);
  703. }
  704. break;
  705. } while (true);
  706. } // end function
  707. const RANGE = 4;
  708. public function yy_r4_1($yy_subpatterns)
  709. {
  710. $this->token = self::ESCAPEDBACKSLASH;
  711. }
  712. public function yy_r4_2($yy_subpatterns)
  713. {
  714. $this->token = self::TEXT;
  715. $this->yybegin(self::CHARACTERCLASS);
  716. }
  717. public function yy_r4_3($yy_subpatterns)
  718. {
  719. $this->token = self::TEXT;
  720. $this->yybegin(self::CHARACTERCLASS);
  721. }
  722. public function yy_r4_4($yy_subpatterns)
  723. {
  724. $this->token = self::COULDBEBACKREF;
  725. }
  726. public function yy_r4_5($yy_subpatterns)
  727. {
  728. $this->token = self::BACKREFERENCE;
  729. }
  730. public function yy_r4_6($yy_subpatterns)
  731. {
  732. $this->token = self::TEXT;
  733. $this->yybegin(self::CHARACTERCLASS);
  734. }
  735. public function yy_r4_7($yy_subpatterns)
  736. {
  737. return false; // ignore escaping of normal text
  738. }
  739. public function yylex5()
  740. {
  741. $tokenMap = array (
  742. 1 => 0,
  743. 2 => 0,
  744. 3 => 0,
  745. 4 => 0,
  746. 5 => 0,
  747. 6 => 0,
  748. 7 => 0,
  749. 8 => 0,
  750. 9 => 0,
  751. 10 => 0,
  752. 11 => 0,
  753. 12 => 0,
  754. 13 => 0,
  755. );
  756. if ($this->N >= strlen($this->input)) {
  757. return false; // end of input
  758. }
  759. $yy_global_pattern = '/\G([imsxUX]+-[imsxUX]+|[imsxUX]+|-[imsxUX]+)|\G(:)|\G(\\))|\G(P<[^>]+>)|\G(<=)|\G(<!)|\G(=)|\G(!)|\G(>)|\G(\\(\\?)|\G(#[^)]+)|\G(R)|\G(.)/';
  760. do {
  761. if (preg_match($yy_global_pattern,$this->input, $yymatches, null, $this->N)) {
  762. $yysubmatches = $yymatches;
  763. $yymatches = array_filter($yymatches, 'strlen'); // remove empty sub-patterns
  764. if (!count($yymatches)) {
  765. throw new Exception('Error: lexing failed because a rule matched' .
  766. ' an empty string. Input "' . substr($this->input,
  767. $this->N, 5) . '... state ASSERTION');
  768. }
  769. next($yymatches); // skip global match
  770. $this->token = key($yymatches); // token number
  771. if ($tokenMap[$this->token]) {
  772. // extract sub-patterns for passing to lex function
  773. $yysubmatches = array_slice($yysubmatches, $this->token + 1,
  774. $tokenMap[$this->token]);
  775. } else {
  776. $yysubmatches = array();
  777. }
  778. $this->value = current($yymatches); // token value
  779. $r = $this->{'yy_r5_' . $this->token}($yysubmatches);
  780. if ($r === null) {
  781. $this->N += strlen($this->value);
  782. $this->line += substr_count($this->value, "\n");
  783. // accept this token
  784. return true;
  785. } elseif ($r === true) {
  786. // we have changed state
  787. // process this token in the new state
  788. return $this->yylex();
  789. } elseif ($r === false) {
  790. $this->N += strlen($this->value);
  791. $this->line += substr_count($this->value, "\n");
  792. if ($this->N >= strlen($this->input)) {
  793. return false; // end of input
  794. }
  795. // skip this token
  796. continue;
  797. } else {
  798. $yy_yymore_patterns = array(
  799. 1 => array(0, "\G(:)|\G(\\))|\G(P<[^>]+>)|\G(<=)|\G(<!)|\G(=)|\G(!)|\G(>)|\G(\\(\\?)|\G(#[^)]+)|\G(R)|\G(.)"),
  800. 2 => array(0, "\G(\\))|\G(P<[^>]+>)|\G(<=)|\G(<!)|\G(=)|\G(!)|\G(>)|\G(\\(\\?)|\G(#[^)]+)|\G(R)|\G(.)"),
  801. 3 => array(0, "\G(P<[^>]+>)|\G(<=)|\G(<!)|\G(=)|\G(!)|\G(>)|\G(\\(\\?)|\G(#[^)]+)|\G(R)|\G(.)"),
  802. 4 => array(0, "\G(<=)|\G(<!)|\G(=)|\G(!)|\G(>)|\G(\\(\\?)|\G(#[^)]+)|\G(R)|\G(.)"),
  803. 5 => array(0, "\G(<!)|\G(=)|\G(!)|\G(>)|\G(\\(\\?)|\G(#[^)]+)|\G(R)|\G(.)"),
  804. 6 => array(0, "\G(=)|\G(!)|\G(>)|\G(\\(\\?)|\G(#[^)]+)|\G(R)|\G(.)"),
  805. 7 => array(0, "\G(!)|\G(>)|\G(\\(\\?)|\G(#[^)]+)|\G(R)|\G(.)"),
  806. 8 => array(0, "\G(>)|\G(\\(\\?)|\G(#[^)]+)|\G(R)|\G(.)"),
  807. 9 => array(0, "\G(\\(\\?)|\G(#[^)]+)|\G(R)|\G(.)"),
  808. 10 => array(0, "\G(#[^)]+)|\G(R)|\G(.)"),
  809. 11 => array(0, "\G(R)|\G(.)"),
  810. 12 => array(0, "\G(.)"),
  811. 13 => array(0, ""),
  812. );
  813. // yymore is needed
  814. do {
  815. if (!strlen($yy_yymore_patterns[$this->token][1])) {
  816. throw new Exception('cannot do yymore for the last token');
  817. }
  818. $yysubmatches = array();
  819. if (preg_match('/' . $yy_yymore_patterns[$this->token][1] . '/',
  820. $this->input, $yymatches, null, $this->N)) {
  821. $yysubmatches = $yymatches;
  822. $yymatches = array_filter($yymatches, 'strlen'); // remove empty sub-patterns
  823. next($yymatches); // skip global match
  824. $this->token += key($yymatches) + $yy_yymore_patterns[$this->token][0]; // token number
  825. $this->value = current($yymatches); // token value
  826. $this->line = substr_count($this->value, "\n");
  827. if ($tokenMap[$this->token]) {
  828. // extract sub-patterns for passing to lex function
  829. $yysubmatches = array_slice($yysubmatches, $this->token + 1,
  830. $tokenMap[$this->token]);
  831. } else {
  832. $yysubmatches = array();
  833. }
  834. }
  835. $r = $this->{'yy_r5_' . $this->token}($yysubmatches);
  836. } while ($r !== null && !is_bool($r));
  837. if ($r === true) {
  838. // we have changed state
  839. // process this token in the new state
  840. return $this->yylex();
  841. } elseif ($r === false) {
  842. $this->N += strlen($this->value);
  843. $this->line += substr_count($this->value, "\n");
  844. if ($this->N >= strlen($this->input)) {
  845. return false; // end of input
  846. }
  847. // skip this token
  848. continue;
  849. } else {
  850. // accept
  851. $this->N += strlen($this->value);
  852. $this->line += substr_count($this->value, "\n");
  853. return true;
  854. }
  855. }
  856. } else {
  857. throw new Exception('Unexpected input at line' . $this->line .
  858. ': ' . $this->input[$this->N]);
  859. }
  860. break;
  861. } while (true);
  862. } // end function
  863. const ASSERTION = 5;
  864. public function yy_r5_1($yy_subpatterns)
  865. {
  866. $this->token = self::INTERNALOPTIONS;
  867. }
  868. public function yy_r5_2($yy_subpatterns)
  869. {
  870. $this->token = self::COLON;
  871. $this->yybegin(self::INITIAL);
  872. }
  873. public function yy_r5_3($yy_subpatterns)
  874. {
  875. $this->token = self::CLOSEPAREN;
  876. $this->yybegin(self::INITIAL);
  877. }
  878. public function yy_r5_4($yy_subpatterns)
  879. {
  880. $this->token = self::PATTERNNAME;
  881. $this->yybegin(self::INITIAL);
  882. }
  883. public function yy_r5_5($yy_subpatterns)
  884. {
  885. $this->token = self::POSITIVELOOKBEHIND;
  886. $this->yybegin(self::INITIAL);
  887. }
  888. public function yy_r5_6($yy_subpatterns)
  889. {
  890. $this->token = self::NEGATIVELOOKBEHIND;
  891. $this->yybegin(self::INITIAL);
  892. }
  893. public function yy_r5_7($yy_subpatterns)
  894. {
  895. $this->token = self::POSITIVELOOKAHEAD;
  896. $this->yybegin(self::INITIAL);
  897. }
  898. public function yy_r5_8($yy_subpatterns)
  899. {
  900. $this->token = self::NEGATIVELOOKAHEAD;
  901. $this->yybegin(self::INITIAL);
  902. }
  903. public function yy_r5_9($yy_subpatterns)
  904. {
  905. $this->token = self::ONCEONLY;
  906. $this->yybegin(self::INITIAL);
  907. }
  908. public function yy_r5_10($yy_subpatterns)
  909. {
  910. $this->token = self::OPENASSERTION;
  911. }
  912. public function yy_r5_11($yy_subpatterns)
  913. {
  914. $this->token = self::COMMENT;
  915. $this->yybegin(self::INITIAL);
  916. }
  917. public function yy_r5_12($yy_subpatterns)
  918. {
  919. $this->token = self::RECUR;
  920. }
  921. public function yy_r5_13($yy_subpatterns)
  922. {
  923. $this->yybegin(self::INITIAL);
  924. return true;
  925. }
  926. }