oql-parser.php 78 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954
  1. <?php
  2. /* Driver template for the PHP_OQLParser_rGenerator parser generator. (PHP port of LEMON)
  3. */
  4. /**
  5. * This can be used to store both the string representation of
  6. * a token, and any useful meta-data associated with the token.
  7. *
  8. * meta-data should be stored as an array
  9. */
  10. class OQLParser_yyToken implements ArrayAccess
  11. {
  12. public $string = '';
  13. public $metadata = array();
  14. function __construct($s, $m = array())
  15. {
  16. if ($s instanceof OQLParser_yyToken) {
  17. $this->string = $s->string;
  18. $this->metadata = $s->metadata;
  19. } else {
  20. $this->string = (string) $s;
  21. if ($m instanceof OQLParser_yyToken) {
  22. $this->metadata = $m->metadata;
  23. } elseif (is_array($m)) {
  24. $this->metadata = $m;
  25. }
  26. }
  27. }
  28. function __toString()
  29. {
  30. return $this->string;
  31. }
  32. function offsetExists($offset)
  33. {
  34. return isset($this->metadata[$offset]);
  35. }
  36. function offsetGet($offset)
  37. {
  38. return $this->metadata[$offset];
  39. }
  40. function offsetSet($offset, $value)
  41. {
  42. if ($offset === null) {
  43. if (isset($value[0])) {
  44. $x = ($value instanceof OQLParser_yyToken) ?
  45. $value->metadata : $value;
  46. $this->metadata = array_merge($this->metadata, $x);
  47. return;
  48. }
  49. $offset = count($this->metadata);
  50. }
  51. if ($value === null) {
  52. return;
  53. }
  54. if ($value instanceof OQLParser_yyToken) {
  55. if ($value->metadata) {
  56. $this->metadata[$offset] = $value->metadata;
  57. }
  58. } elseif ($value) {
  59. $this->metadata[$offset] = $value;
  60. }
  61. }
  62. function offsetUnset($offset)
  63. {
  64. unset($this->metadata[$offset]);
  65. }
  66. }
  67. /** The following structure represents a single element of the
  68. * parser's stack. Information stored includes:
  69. *
  70. * + The state number for the parser at this level of the stack.
  71. *
  72. * + The value of the token stored at this level of the stack.
  73. * (In other words, the "major" token.)
  74. *
  75. * + The semantic value stored at this level of the stack. This is
  76. * the information used by the action routines in the grammar.
  77. * It is sometimes called the "minor" token.
  78. */
  79. class OQLParser_yyStackEntry
  80. {
  81. public $stateno; /* The state-number */
  82. public $major; /* The major token value. This is the code
  83. ** number for the token at this stack level */
  84. public $minor; /* The user-supplied minor token value. This
  85. ** is the value of the token */
  86. };
  87. // code external to the class is included here
  88. // declare_class is output here
  89. #line 24 "..\oql-parser.y"
  90. class OQLParserRaw#line 102 "..\oql-parser.php"
  91. {
  92. /* First off, code is included which follows the "include_class" declaration
  93. ** in the input file. */
  94. /* Next is all token values, as class constants
  95. */
  96. /*
  97. ** These constants (all generated automatically by the parser generator)
  98. ** specify the various kinds of tokens (terminals) that the parser
  99. ** understands.
  100. **
  101. ** Each symbol here is a terminal symbol in the grammar.
  102. */
  103. const UNION = 1;
  104. const SELECT = 2;
  105. const AS_ALIAS = 3;
  106. const FROM = 4;
  107. const COMA = 5;
  108. const WHERE = 6;
  109. const JOIN = 7;
  110. const ON = 8;
  111. const EQ = 9;
  112. const BELOW = 10;
  113. const BELOW_STRICT = 11;
  114. const NOT_BELOW = 12;
  115. const NOT_BELOW_STRICT = 13;
  116. const ABOVE = 14;
  117. const ABOVE_STRICT = 15;
  118. const NOT_ABOVE = 16;
  119. const NOT_ABOVE_STRICT = 17;
  120. const PAR_OPEN = 18;
  121. const PAR_CLOSE = 19;
  122. const INTERVAL = 20;
  123. const F_SECOND = 21;
  124. const F_MINUTE = 22;
  125. const F_HOUR = 23;
  126. const F_DAY = 24;
  127. const F_MONTH = 25;
  128. const F_YEAR = 26;
  129. const DOT = 27;
  130. const VARNAME = 28;
  131. const NAME = 29;
  132. const NUMVAL = 30;
  133. const MATH_MINUS = 31;
  134. const HEXVAL = 32;
  135. const STRVAL = 33;
  136. const REGEXP = 34;
  137. const NOT_EQ = 35;
  138. const LOG_AND = 36;
  139. const LOG_OR = 37;
  140. const MATH_DIV = 38;
  141. const MATH_MULT = 39;
  142. const MATH_PLUS = 40;
  143. const GT = 41;
  144. const LT = 42;
  145. const GE = 43;
  146. const LE = 44;
  147. const LIKE = 45;
  148. const NOT_LIKE = 46;
  149. const BITWISE_LEFT_SHIFT = 47;
  150. const BITWISE_RIGHT_SHIFT = 48;
  151. const BITWISE_AND = 49;
  152. const BITWISE_OR = 50;
  153. const BITWISE_XOR = 51;
  154. const IN = 52;
  155. const NOT_IN = 53;
  156. const F_IF = 54;
  157. const F_ELT = 55;
  158. const F_COALESCE = 56;
  159. const F_ISNULL = 57;
  160. const F_CONCAT = 58;
  161. const F_SUBSTR = 59;
  162. const F_TRIM = 60;
  163. const F_DATE = 61;
  164. const F_DATE_FORMAT = 62;
  165. const F_CURRENT_DATE = 63;
  166. const F_NOW = 64;
  167. const F_TIME = 65;
  168. const F_TO_DAYS = 66;
  169. const F_FROM_DAYS = 67;
  170. const F_DATE_ADD = 68;
  171. const F_DATE_SUB = 69;
  172. const F_ROUND = 70;
  173. const F_FLOOR = 71;
  174. const F_INET_ATON = 72;
  175. const F_INET_NTOA = 73;
  176. const YY_NO_ACTION = 290;
  177. const YY_ACCEPT_ACTION = 289;
  178. const YY_ERROR_ACTION = 288;
  179. /* Next are that tables used to determine what action to take based on the
  180. ** current state and lookahead token. These tables are used to implement
  181. ** functions that take a state number and lookahead value and return an
  182. ** action integer.
  183. **
  184. ** Suppose the action integer is N. Then the action is determined as
  185. ** follows
  186. **
  187. ** 0 <= N < self::YYNSTATE Shift N. That is,
  188. ** push the lookahead
  189. ** token onto the stack
  190. ** and goto state N.
  191. **
  192. ** self::YYNSTATE <= N < self::YYNSTATE+self::YYNRULE Reduce by rule N-YYNSTATE.
  193. **
  194. ** N == self::YYNSTATE+self::YYNRULE A syntax error has occurred.
  195. **
  196. ** N == self::YYNSTATE+self::YYNRULE+1 The parser accepts its
  197. ** input. (and concludes parsing)
  198. **
  199. ** N == self::YYNSTATE+self::YYNRULE+2 No such action. Denotes unused
  200. ** slots in the yy_action[] table.
  201. **
  202. ** The action table is constructed as a single large static array $yy_action.
  203. ** Given state S and lookahead X, the action is computed as
  204. **
  205. ** self::$yy_action[self::$yy_shift_ofst[S] + X ]
  206. **
  207. ** If the index value self::$yy_shift_ofst[S]+X is out of range or if the value
  208. ** self::$yy_lookahead[self::$yy_shift_ofst[S]+X] is not equal to X or if
  209. ** self::$yy_shift_ofst[S] is equal to self::YY_SHIFT_USE_DFLT, it means that
  210. ** the action is not in the table and that self::$yy_default[S] should be used instead.
  211. **
  212. ** The formula above is for computing the action when the lookahead is
  213. ** a terminal symbol. If the lookahead is a non-terminal (as occurs after
  214. ** a reduce action) then the static $yy_reduce_ofst array is used in place of
  215. ** the static $yy_shift_ofst array and self::YY_REDUCE_USE_DFLT is used in place of
  216. ** self::YY_SHIFT_USE_DFLT.
  217. **
  218. ** The following are the tables generated in this section:
  219. **
  220. ** self::$yy_action A single table containing all actions.
  221. ** self::$yy_lookahead A table containing the lookahead for each entry in
  222. ** yy_action. Used to detect hash collisions.
  223. ** self::$yy_shift_ofst For each state, the offset into self::$yy_action for
  224. ** shifting terminals.
  225. ** self::$yy_reduce_ofst For each state, the offset into self::$yy_action for
  226. ** shifting non-terminals after a reduce.
  227. ** self::$yy_default Default action for each state.
  228. */
  229. const YY_SZ_ACTTAB = 549;
  230. static public $yy_action = array(
  231. /* 0 */ 7, 30, 6, 66, 60, 4, 153, 152, 155, 98,
  232. /* 10 */ 107, 106, 105, 65, 101, 102, 25, 22, 23, 21,
  233. /* 20 */ 19, 27, 26, 28, 24, 162, 151, 43, 177, 177,
  234. /* 30 */ 80, 41, 62, 85, 150, 140, 103, 108, 109, 114,
  235. /* 40 */ 115, 113, 112, 110, 111, 133, 134, 157, 158, 156,
  236. /* 50 */ 154, 159, 160, 165, 166, 164, 20, 121, 125, 3,
  237. /* 60 */ 68, 70, 69, 75, 99, 93, 142, 66, 76, 64,
  238. /* 70 */ 119, 120, 7, 79, 50, 122, 121, 42, 153, 152,
  239. /* 80 */ 155, 139, 107, 106, 105, 65, 101, 102, 149, 119,
  240. /* 90 */ 120, 137, 143, 121, 132, 130, 62, 148, 147, 100,
  241. /* 100 */ 146, 144, 145, 167, 61, 116, 119, 120, 103, 108,
  242. /* 110 */ 109, 114, 115, 113, 112, 110, 111, 133, 134, 157,
  243. /* 120 */ 158, 156, 154, 159, 160, 165, 166, 164, 7, 106,
  244. /* 130 */ 11, 66, 9, 80, 153, 152, 155, 81, 107, 106,
  245. /* 140 */ 105, 65, 101, 102, 163, 161, 72, 8, 10, 88,
  246. /* 150 */ 78, 1, 46, 38, 44, 104, 54, 51, 41, 42,
  247. /* 160 */ 62, 118, 135, 136, 103, 108, 109, 114, 115, 113,
  248. /* 170 */ 112, 110, 111, 133, 134, 157, 158, 156, 154, 159,
  249. /* 180 */ 160, 165, 166, 164, 289, 138, 67, 86, 66, 39,
  250. /* 190 */ 87, 58, 37, 45, 126, 34, 48, 131, 124, 63,
  251. /* 200 */ 13, 40, 66, 17, 230, 15, 12, 36, 97, 2,
  252. /* 210 */ 47, 55, 41, 129, 127, 128, 117, 62, 66, 80,
  253. /* 220 */ 80, 80, 80, 123, 126, 31, 48, 131, 124, 63,
  254. /* 230 */ 59, 62, 237, 17, 91, 15, 20, 36, 73, 80,
  255. /* 240 */ 237, 92, 237, 129, 127, 128, 117, 62, 66, 237,
  256. /* 250 */ 94, 74, 237, 42, 126, 31, 48, 131, 124, 63,
  257. /* 260 */ 237, 237, 66, 17, 66, 15, 66, 36, 83, 95,
  258. /* 270 */ 56, 77, 82, 129, 127, 128, 117, 62, 141, 66,
  259. /* 280 */ 237, 237, 237, 237, 237, 126, 34, 48, 131, 124,
  260. /* 290 */ 63, 62, 237, 62, 17, 62, 15, 52, 36, 5,
  261. /* 300 */ 42, 237, 237, 237, 129, 127, 128, 117, 62, 66,
  262. /* 310 */ 237, 8, 237, 71, 237, 126, 32, 48, 131, 124,
  263. /* 320 */ 63, 237, 237, 66, 17, 118, 15, 53, 36, 89,
  264. /* 330 */ 42, 57, 237, 237, 129, 127, 128, 117, 62, 66,
  265. /* 340 */ 237, 237, 237, 237, 237, 126, 16, 48, 131, 124,
  266. /* 350 */ 63, 237, 62, 66, 17, 237, 15, 237, 36, 90,
  267. /* 360 */ 237, 237, 237, 237, 129, 127, 128, 117, 62, 66,
  268. /* 370 */ 237, 237, 237, 237, 237, 126, 29, 48, 131, 124,
  269. /* 380 */ 63, 237, 62, 237, 17, 237, 15, 237, 36, 237,
  270. /* 390 */ 237, 237, 237, 237, 129, 127, 128, 117, 62, 66,
  271. /* 400 */ 237, 237, 237, 237, 237, 126, 33, 48, 131, 124,
  272. /* 410 */ 63, 237, 237, 237, 17, 237, 15, 237, 36, 237,
  273. /* 420 */ 237, 237, 237, 237, 129, 127, 128, 117, 62, 66,
  274. /* 430 */ 237, 237, 237, 237, 237, 126, 237, 48, 131, 124,
  275. /* 440 */ 63, 237, 237, 237, 17, 237, 15, 237, 35, 237,
  276. /* 450 */ 237, 237, 237, 237, 129, 127, 128, 117, 62, 66,
  277. /* 460 */ 237, 237, 237, 237, 237, 126, 237, 48, 131, 124,
  278. /* 470 */ 63, 237, 237, 237, 17, 237, 14, 66, 237, 237,
  279. /* 480 */ 237, 237, 84, 56, 129, 127, 128, 117, 62, 66,
  280. /* 490 */ 237, 237, 237, 237, 237, 126, 237, 48, 131, 124,
  281. /* 500 */ 63, 237, 237, 237, 18, 66, 62, 237, 237, 237,
  282. /* 510 */ 237, 96, 237, 237, 129, 127, 128, 117, 62, 66,
  283. /* 520 */ 237, 237, 237, 237, 237, 126, 237, 49, 131, 124,
  284. /* 530 */ 63, 237, 237, 237, 62, 237, 237, 237, 237, 237,
  285. /* 540 */ 237, 237, 237, 237, 129, 127, 128, 117, 62,
  286. );
  287. static public $yy_lookahead = array(
  288. /* 0 */ 18, 79, 20, 79, 82, 6, 24, 25, 26, 85,
  289. /* 10 */ 28, 29, 30, 31, 32, 33, 9, 10, 11, 12,
  290. /* 20 */ 13, 14, 15, 16, 17, 38, 39, 3, 4, 5,
  291. /* 30 */ 108, 7, 108, 81, 47, 48, 54, 55, 56, 57,
  292. /* 40 */ 58, 59, 60, 61, 62, 63, 64, 65, 66, 67,
  293. /* 50 */ 68, 69, 70, 71, 72, 73, 2, 37, 93, 18,
  294. /* 60 */ 21, 22, 23, 24, 25, 26, 9, 79, 76, 77,
  295. /* 70 */ 50, 51, 18, 85, 80, 19, 37, 83, 24, 25,
  296. /* 80 */ 26, 81, 28, 29, 30, 31, 32, 33, 31, 50,
  297. /* 90 */ 51, 34, 35, 37, 52, 53, 108, 40, 41, 42,
  298. /* 100 */ 43, 44, 45, 46, 79, 108, 50, 51, 54, 55,
  299. /* 110 */ 56, 57, 58, 59, 60, 61, 62, 63, 64, 65,
  300. /* 120 */ 66, 67, 68, 69, 70, 71, 72, 73, 18, 29,
  301. /* 130 */ 95, 79, 99, 108, 24, 25, 26, 85, 28, 29,
  302. /* 140 */ 30, 31, 32, 33, 109, 110, 113, 100, 97, 81,
  303. /* 150 */ 103, 18, 4, 5, 3, 30, 80, 27, 7, 83,
  304. /* 160 */ 108, 114, 111, 112, 54, 55, 56, 57, 58, 59,
  305. /* 170 */ 60, 61, 62, 63, 64, 65, 66, 67, 68, 69,
  306. /* 180 */ 70, 71, 72, 73, 75, 76, 77, 78, 79, 1,
  307. /* 190 */ 79, 79, 79, 79, 85, 86, 87, 88, 89, 90,
  308. /* 200 */ 8, 3, 79, 94, 27, 96, 8, 98, 85, 5,
  309. /* 210 */ 79, 92, 7, 104, 105, 106, 107, 108, 79, 108,
  310. /* 220 */ 108, 108, 108, 19, 85, 86, 87, 88, 89, 90,
  311. /* 230 */ 91, 108, 115, 94, 81, 96, 2, 98, 36, 108,
  312. /* 240 */ 115, 102, 115, 104, 105, 106, 107, 108, 79, 115,
  313. /* 250 */ 80, 49, 115, 83, 85, 86, 87, 88, 89, 90,
  314. /* 260 */ 115, 115, 79, 94, 79, 96, 79, 98, 85, 84,
  315. /* 270 */ 85, 102, 85, 104, 105, 106, 107, 108, 78, 79,
  316. /* 280 */ 115, 115, 115, 115, 115, 85, 86, 87, 88, 89,
  317. /* 290 */ 90, 108, 115, 108, 94, 108, 96, 80, 98, 5,
  318. /* 300 */ 83, 115, 115, 115, 104, 105, 106, 107, 108, 79,
  319. /* 310 */ 115, 100, 115, 19, 115, 85, 86, 87, 88, 89,
  320. /* 320 */ 90, 115, 115, 79, 94, 114, 96, 80, 98, 85,
  321. /* 330 */ 83, 101, 115, 115, 104, 105, 106, 107, 108, 79,
  322. /* 340 */ 115, 115, 115, 115, 115, 85, 86, 87, 88, 89,
  323. /* 350 */ 90, 115, 108, 79, 94, 115, 96, 115, 98, 85,
  324. /* 360 */ 115, 115, 115, 115, 104, 105, 106, 107, 108, 79,
  325. /* 370 */ 115, 115, 115, 115, 115, 85, 86, 87, 88, 89,
  326. /* 380 */ 90, 115, 108, 115, 94, 115, 96, 115, 98, 115,
  327. /* 390 */ 115, 115, 115, 115, 104, 105, 106, 107, 108, 79,
  328. /* 400 */ 115, 115, 115, 115, 115, 85, 86, 87, 88, 89,
  329. /* 410 */ 90, 115, 115, 115, 94, 115, 96, 115, 98, 115,
  330. /* 420 */ 115, 115, 115, 115, 104, 105, 106, 107, 108, 79,
  331. /* 430 */ 115, 115, 115, 115, 115, 85, 115, 87, 88, 89,
  332. /* 440 */ 90, 115, 115, 115, 94, 115, 96, 115, 98, 115,
  333. /* 450 */ 115, 115, 115, 115, 104, 105, 106, 107, 108, 79,
  334. /* 460 */ 115, 115, 115, 115, 115, 85, 115, 87, 88, 89,
  335. /* 470 */ 90, 115, 115, 115, 94, 115, 96, 79, 115, 115,
  336. /* 480 */ 115, 115, 84, 85, 104, 105, 106, 107, 108, 79,
  337. /* 490 */ 115, 115, 115, 115, 115, 85, 115, 87, 88, 89,
  338. /* 500 */ 90, 115, 115, 115, 94, 79, 108, 115, 115, 115,
  339. /* 510 */ 115, 85, 115, 115, 104, 105, 106, 107, 108, 79,
  340. /* 520 */ 115, 115, 115, 115, 115, 85, 115, 87, 88, 89,
  341. /* 530 */ 90, 115, 115, 115, 108, 115, 115, 115, 115, 115,
  342. /* 540 */ 115, 115, 115, 115, 104, 105, 106, 107, 108,
  343. );
  344. const YY_SHIFT_USE_DFLT = -19;
  345. const YY_SHIFT_MAX = 67;
  346. static public $yy_shift_ofst = array(
  347. /* 0 */ 54, -18, -18, 110, 110, 110, 110, 110, 110, 110,
  348. /* 10 */ 110, 110, 100, 100, 57, 57, 39, -13, -13, 100,
  349. /* 20 */ 100, 100, 100, 100, 100, 100, 100, 100, 100, 56,
  350. /* 30 */ 24, 20, 20, 20, 20, 202, 202, 151, 100, 234,
  351. /* 40 */ 100, 100, 205, 100, 100, 205, 100, 205, 42, 42,
  352. /* 50 */ -1, 100, -1, -1, -1, 41, 7, 294, 198, 204,
  353. /* 60 */ 148, 192, 177, 133, 188, 125, 130, 188,
  354. );
  355. const YY_REDUCE_USE_DFLT = -79;
  356. const YY_REDUCE_MAX = 55;
  357. static public $yy_reduce_ofst = array(
  358. /* 0 */ 109, 139, 169, 230, 200, 320, 260, 290, 350, 380,
  359. /* 10 */ 410, 440, 398, 185, 51, 51, 47, 35, 35, 274,
  360. /* 20 */ -78, 426, -12, 123, 52, -76, 183, 244, 187, 211,
  361. /* 30 */ 247, 211, 211, 211, 211, 33, 33, 76, 111, -8,
  362. /* 40 */ 25, 112, 170, 131, 114, 217, 113, -6, 119, 119,
  363. /* 50 */ 153, -3, 68, 0, -48, -35,
  364. );
  365. static public $yyExpectedTokens = array(
  366. /* 0 */ array(2, 18, 24, 25, 26, 28, 29, 30, 31, 32, 33, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, ),
  367. /* 1 */ array(18, 20, 24, 25, 26, 28, 29, 30, 31, 32, 33, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, ),
  368. /* 2 */ array(18, 20, 24, 25, 26, 28, 29, 30, 31, 32, 33, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, ),
  369. /* 3 */ array(18, 24, 25, 26, 28, 29, 30, 31, 32, 33, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, ),
  370. /* 4 */ array(18, 24, 25, 26, 28, 29, 30, 31, 32, 33, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, ),
  371. /* 5 */ array(18, 24, 25, 26, 28, 29, 30, 31, 32, 33, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, ),
  372. /* 6 */ array(18, 24, 25, 26, 28, 29, 30, 31, 32, 33, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, ),
  373. /* 7 */ array(18, 24, 25, 26, 28, 29, 30, 31, 32, 33, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, ),
  374. /* 8 */ array(18, 24, 25, 26, 28, 29, 30, 31, 32, 33, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, ),
  375. /* 9 */ array(18, 24, 25, 26, 28, 29, 30, 31, 32, 33, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, ),
  376. /* 10 */ array(18, 24, 25, 26, 28, 29, 30, 31, 32, 33, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, ),
  377. /* 11 */ array(18, 24, 25, 26, 28, 29, 30, 31, 32, 33, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, ),
  378. /* 12 */ array(29, ),
  379. /* 13 */ array(29, ),
  380. /* 14 */ array(9, 31, 34, 35, 40, 41, 42, 43, 44, 45, 46, ),
  381. /* 15 */ array(9, 31, 34, 35, 40, 41, 42, 43, 44, 45, 46, ),
  382. /* 16 */ array(21, 22, 23, 24, 25, 26, 37, 50, 51, ),
  383. /* 17 */ array(38, 39, 47, 48, ),
  384. /* 18 */ array(38, 39, 47, 48, ),
  385. /* 19 */ array(29, ),
  386. /* 20 */ array(29, ),
  387. /* 21 */ array(29, ),
  388. /* 22 */ array(29, ),
  389. /* 23 */ array(29, ),
  390. /* 24 */ array(29, ),
  391. /* 25 */ array(29, ),
  392. /* 26 */ array(29, ),
  393. /* 27 */ array(29, ),
  394. /* 28 */ array(29, ),
  395. /* 29 */ array(19, 37, 50, 51, ),
  396. /* 30 */ array(3, 4, 5, 7, ),
  397. /* 31 */ array(37, 50, 51, ),
  398. /* 32 */ array(37, 50, 51, ),
  399. /* 33 */ array(37, 50, 51, ),
  400. /* 34 */ array(37, 50, 51, ),
  401. /* 35 */ array(36, 49, ),
  402. /* 36 */ array(36, 49, ),
  403. /* 37 */ array(3, 7, ),
  404. /* 38 */ array(29, ),
  405. /* 39 */ array(2, ),
  406. /* 40 */ array(29, ),
  407. /* 41 */ array(29, ),
  408. /* 42 */ array(7, ),
  409. /* 43 */ array(29, ),
  410. /* 44 */ array(29, ),
  411. /* 45 */ array(7, ),
  412. /* 46 */ array(29, ),
  413. /* 47 */ array(7, ),
  414. /* 48 */ array(52, 53, ),
  415. /* 49 */ array(52, 53, ),
  416. /* 50 */ array(6, ),
  417. /* 51 */ array(29, ),
  418. /* 52 */ array(6, ),
  419. /* 53 */ array(6, ),
  420. /* 54 */ array(6, ),
  421. /* 55 */ array(18, ),
  422. /* 56 */ array(9, 10, 11, 12, 13, 14, 15, 16, 17, ),
  423. /* 57 */ array(5, 19, ),
  424. /* 58 */ array(3, 8, ),
  425. /* 59 */ array(5, 19, ),
  426. /* 60 */ array(4, 5, ),
  427. /* 61 */ array(8, ),
  428. /* 62 */ array(27, ),
  429. /* 63 */ array(18, ),
  430. /* 64 */ array(1, ),
  431. /* 65 */ array(30, ),
  432. /* 66 */ array(27, ),
  433. /* 67 */ array(1, ),
  434. /* 68 */ array(),
  435. /* 69 */ array(),
  436. /* 70 */ array(),
  437. /* 71 */ array(),
  438. /* 72 */ array(),
  439. /* 73 */ array(),
  440. /* 74 */ array(),
  441. /* 75 */ array(),
  442. /* 76 */ array(),
  443. /* 77 */ array(),
  444. /* 78 */ array(),
  445. /* 79 */ array(),
  446. /* 80 */ array(),
  447. /* 81 */ array(),
  448. /* 82 */ array(),
  449. /* 83 */ array(),
  450. /* 84 */ array(),
  451. /* 85 */ array(),
  452. /* 86 */ array(),
  453. /* 87 */ array(),
  454. /* 88 */ array(),
  455. /* 89 */ array(),
  456. /* 90 */ array(),
  457. /* 91 */ array(),
  458. /* 92 */ array(),
  459. /* 93 */ array(),
  460. /* 94 */ array(),
  461. /* 95 */ array(),
  462. /* 96 */ array(),
  463. /* 97 */ array(),
  464. /* 98 */ array(),
  465. /* 99 */ array(),
  466. /* 100 */ array(),
  467. /* 101 */ array(),
  468. /* 102 */ array(),
  469. /* 103 */ array(),
  470. /* 104 */ array(),
  471. /* 105 */ array(),
  472. /* 106 */ array(),
  473. /* 107 */ array(),
  474. /* 108 */ array(),
  475. /* 109 */ array(),
  476. /* 110 */ array(),
  477. /* 111 */ array(),
  478. /* 112 */ array(),
  479. /* 113 */ array(),
  480. /* 114 */ array(),
  481. /* 115 */ array(),
  482. /* 116 */ array(),
  483. /* 117 */ array(),
  484. /* 118 */ array(),
  485. /* 119 */ array(),
  486. /* 120 */ array(),
  487. /* 121 */ array(),
  488. /* 122 */ array(),
  489. /* 123 */ array(),
  490. /* 124 */ array(),
  491. /* 125 */ array(),
  492. /* 126 */ array(),
  493. /* 127 */ array(),
  494. /* 128 */ array(),
  495. /* 129 */ array(),
  496. /* 130 */ array(),
  497. /* 131 */ array(),
  498. /* 132 */ array(),
  499. /* 133 */ array(),
  500. /* 134 */ array(),
  501. /* 135 */ array(),
  502. /* 136 */ array(),
  503. /* 137 */ array(),
  504. /* 138 */ array(),
  505. /* 139 */ array(),
  506. /* 140 */ array(),
  507. /* 141 */ array(),
  508. /* 142 */ array(),
  509. /* 143 */ array(),
  510. /* 144 */ array(),
  511. /* 145 */ array(),
  512. /* 146 */ array(),
  513. /* 147 */ array(),
  514. /* 148 */ array(),
  515. /* 149 */ array(),
  516. /* 150 */ array(),
  517. /* 151 */ array(),
  518. /* 152 */ array(),
  519. /* 153 */ array(),
  520. /* 154 */ array(),
  521. /* 155 */ array(),
  522. /* 156 */ array(),
  523. /* 157 */ array(),
  524. /* 158 */ array(),
  525. /* 159 */ array(),
  526. /* 160 */ array(),
  527. /* 161 */ array(),
  528. /* 162 */ array(),
  529. /* 163 */ array(),
  530. /* 164 */ array(),
  531. /* 165 */ array(),
  532. /* 166 */ array(),
  533. /* 167 */ array(),
  534. );
  535. static public $yy_default = array(
  536. /* 0 */ 288, 213, 288, 288, 288, 288, 288, 288, 288, 288,
  537. /* 10 */ 288, 288, 288, 288, 207, 206, 288, 204, 205, 288,
  538. /* 20 */ 288, 288, 288, 288, 288, 288, 288, 288, 288, 288,
  539. /* 30 */ 183, 216, 211, 212, 195, 209, 208, 183, 288, 288,
  540. /* 40 */ 288, 288, 182, 288, 288, 183, 288, 183, 202, 203,
  541. /* 50 */ 180, 288, 180, 180, 180, 288, 288, 288, 288, 288,
  542. /* 60 */ 288, 288, 228, 288, 171, 288, 288, 169, 218, 220,
  543. /* 70 */ 219, 210, 245, 244, 260, 221, 172, 215, 217, 187,
  544. /* 80 */ 230, 194, 193, 192, 185, 175, 170, 178, 176, 191,
  545. /* 90 */ 190, 174, 214, 223, 181, 184, 189, 188, 186, 222,
  546. /* 100 */ 253, 235, 236, 265, 234, 233, 232, 231, 266, 267,
  547. /* 110 */ 272, 273, 271, 270, 268, 269, 229, 227, 247, 261,
  548. /* 120 */ 262, 246, 200, 199, 198, 201, 197, 225, 226, 224,
  549. /* 130 */ 264, 196, 263, 274, 275, 239, 240, 241, 168, 173,
  550. /* 140 */ 259, 179, 242, 243, 255, 256, 254, 252, 250, 251,
  551. /* 150 */ 258, 249, 280, 281, 282, 279, 278, 276, 277, 283,
  552. /* 160 */ 284, 238, 248, 237, 287, 285, 286, 257,
  553. );
  554. /* The next thing included is series of defines which control
  555. ** various aspects of the generated parser.
  556. ** self::YYNOCODE is a number which corresponds
  557. ** to no legal terminal or nonterminal number. This
  558. ** number is used to fill in empty slots of the hash
  559. ** table.
  560. ** self::YYFALLBACK If defined, this indicates that one or more tokens
  561. ** have fall-back values which should be used if the
  562. ** original value of the token will not parse.
  563. ** self::YYSTACKDEPTH is the maximum depth of the parser's stack.
  564. ** self::YYNSTATE the combined number of states.
  565. ** self::YYNRULE the number of rules in the grammar
  566. ** self::YYERRORSYMBOL is the code number of the error symbol. If not
  567. ** defined, then do no error processing.
  568. */
  569. const YYNOCODE = 116;
  570. const YYSTACKDEPTH = 100;
  571. const YYNSTATE = 168;
  572. const YYNRULE = 120;
  573. const YYERRORSYMBOL = 74;
  574. const YYERRSYMDT = 'yy0';
  575. const YYFALLBACK = 0;
  576. /** The next table maps tokens into fallback tokens. If a construct
  577. * like the following:
  578. *
  579. * %fallback ID X Y Z.
  580. *
  581. * appears in the grammer, then ID becomes a fallback token for X, Y,
  582. * and Z. Whenever one of the tokens X, Y, or Z is input to the parser
  583. * but it does not parse, the type of the token is changed to ID and
  584. * the parse is retried before an error is thrown.
  585. */
  586. static public $yyFallback = array(
  587. );
  588. /**
  589. * Turn parser tracing on by giving a stream to which to write the trace
  590. * and a prompt to preface each trace message. Tracing is turned off
  591. * by making either argument NULL
  592. *
  593. * Inputs:
  594. *
  595. * - A stream resource to which trace output should be written.
  596. * If NULL, then tracing is turned off.
  597. * - A prefix string written at the beginning of every
  598. * line of trace output. If NULL, then tracing is
  599. * turned off.
  600. *
  601. * Outputs:
  602. *
  603. * - None.
  604. * @param resource
  605. * @param string
  606. */
  607. static function Trace($TraceFILE, $zTracePrompt)
  608. {
  609. if (!$TraceFILE) {
  610. $zTracePrompt = 0;
  611. } elseif (!$zTracePrompt) {
  612. $TraceFILE = 0;
  613. }
  614. self::$yyTraceFILE = $TraceFILE;
  615. self::$yyTracePrompt = $zTracePrompt;
  616. }
  617. /**
  618. * Output debug information to output (php://output stream)
  619. */
  620. static function PrintTrace()
  621. {
  622. self::$yyTraceFILE = fopen('php://output', 'w');
  623. self::$yyTracePrompt = '';
  624. }
  625. /**
  626. * @var resource|0
  627. */
  628. static public $yyTraceFILE;
  629. /**
  630. * String to prepend to debug output
  631. * @var string|0
  632. */
  633. static public $yyTracePrompt;
  634. /**
  635. * @var int
  636. */
  637. public $yyidx = -1; /* Index of top element in stack */
  638. /**
  639. * @var int
  640. */
  641. public $yyerrcnt; /* Shifts left before out of the error */
  642. /**
  643. * @var array
  644. */
  645. public $yystack = array(); /* The parser's stack */
  646. /**
  647. * For tracing shifts, the names of all terminals and nonterminals
  648. * are required. The following table supplies these names
  649. * @var array
  650. */
  651. static public $yyTokenName = array(
  652. '$', 'UNION', 'SELECT', 'AS_ALIAS',
  653. 'FROM', 'COMA', 'WHERE', 'JOIN',
  654. 'ON', 'EQ', 'BELOW', 'BELOW_STRICT',
  655. 'NOT_BELOW', 'NOT_BELOW_STRICT', 'ABOVE', 'ABOVE_STRICT',
  656. 'NOT_ABOVE', 'NOT_ABOVE_STRICT', 'PAR_OPEN', 'PAR_CLOSE',
  657. 'INTERVAL', 'F_SECOND', 'F_MINUTE', 'F_HOUR',
  658. 'F_DAY', 'F_MONTH', 'F_YEAR', 'DOT',
  659. 'VARNAME', 'NAME', 'NUMVAL', 'MATH_MINUS',
  660. 'HEXVAL', 'STRVAL', 'REGEXP', 'NOT_EQ',
  661. 'LOG_AND', 'LOG_OR', 'MATH_DIV', 'MATH_MULT',
  662. 'MATH_PLUS', 'GT', 'LT', 'GE',
  663. 'LE', 'LIKE', 'NOT_LIKE', 'BITWISE_LEFT_SHIFT',
  664. 'BITWISE_RIGHT_SHIFT', 'BITWISE_AND', 'BITWISE_OR', 'BITWISE_XOR',
  665. 'IN', 'NOT_IN', 'F_IF', 'F_ELT',
  666. 'F_COALESCE', 'F_ISNULL', 'F_CONCAT', 'F_SUBSTR',
  667. 'F_TRIM', 'F_DATE', 'F_DATE_FORMAT', 'F_CURRENT_DATE',
  668. 'F_NOW', 'F_TIME', 'F_TO_DAYS', 'F_FROM_DAYS',
  669. 'F_DATE_ADD', 'F_DATE_SUB', 'F_ROUND', 'F_FLOOR',
  670. 'F_INET_ATON', 'F_INET_NTOA', 'error', 'result',
  671. 'union', 'query', 'condition', 'class_name',
  672. 'join_statement', 'where_statement', 'class_list', 'join_item',
  673. 'join_condition', 'field_id', 'expression_prio4', 'expression_basic',
  674. 'scalar', 'var_name', 'func_name', 'arg_list',
  675. 'list_operator', 'list', 'expression_prio1', 'operator1',
  676. 'expression_prio2', 'operator2', 'expression_prio3', 'operator3',
  677. 'operator4', 'list_items', 'argument', 'interval_unit',
  678. 'num_scalar', 'str_scalar', 'num_value', 'str_value',
  679. 'name', 'num_operator1', 'bitwise_operator1', 'num_operator2',
  680. 'str_operator', 'bitwise_operator3', 'bitwise_operator4',
  681. );
  682. /**
  683. * For tracing reduce actions, the names of all rules are required.
  684. * @var array
  685. */
  686. static public $yyRuleName = array(
  687. /* 0 */ "result ::= union",
  688. /* 1 */ "result ::= query",
  689. /* 2 */ "result ::= condition",
  690. /* 3 */ "union ::= query UNION query",
  691. /* 4 */ "union ::= query UNION union",
  692. /* 5 */ "query ::= SELECT class_name join_statement where_statement",
  693. /* 6 */ "query ::= SELECT class_name AS_ALIAS class_name join_statement where_statement",
  694. /* 7 */ "query ::= SELECT class_list FROM class_name join_statement where_statement",
  695. /* 8 */ "query ::= SELECT class_list FROM class_name AS_ALIAS class_name join_statement where_statement",
  696. /* 9 */ "class_list ::= class_name",
  697. /* 10 */ "class_list ::= class_list COMA class_name",
  698. /* 11 */ "where_statement ::= WHERE condition",
  699. /* 12 */ "where_statement ::=",
  700. /* 13 */ "join_statement ::= join_item join_statement",
  701. /* 14 */ "join_statement ::= join_item",
  702. /* 15 */ "join_statement ::=",
  703. /* 16 */ "join_item ::= JOIN class_name AS_ALIAS class_name ON join_condition",
  704. /* 17 */ "join_item ::= JOIN class_name ON join_condition",
  705. /* 18 */ "join_condition ::= field_id EQ field_id",
  706. /* 19 */ "join_condition ::= field_id BELOW field_id",
  707. /* 20 */ "join_condition ::= field_id BELOW_STRICT field_id",
  708. /* 21 */ "join_condition ::= field_id NOT_BELOW field_id",
  709. /* 22 */ "join_condition ::= field_id NOT_BELOW_STRICT field_id",
  710. /* 23 */ "join_condition ::= field_id ABOVE field_id",
  711. /* 24 */ "join_condition ::= field_id ABOVE_STRICT field_id",
  712. /* 25 */ "join_condition ::= field_id NOT_ABOVE field_id",
  713. /* 26 */ "join_condition ::= field_id NOT_ABOVE_STRICT field_id",
  714. /* 27 */ "condition ::= expression_prio4",
  715. /* 28 */ "expression_basic ::= scalar",
  716. /* 29 */ "expression_basic ::= field_id",
  717. /* 30 */ "expression_basic ::= var_name",
  718. /* 31 */ "expression_basic ::= func_name PAR_OPEN arg_list PAR_CLOSE",
  719. /* 32 */ "expression_basic ::= PAR_OPEN expression_prio4 PAR_CLOSE",
  720. /* 33 */ "expression_basic ::= expression_basic list_operator list",
  721. /* 34 */ "expression_prio1 ::= expression_basic",
  722. /* 35 */ "expression_prio1 ::= expression_prio1 operator1 expression_basic",
  723. /* 36 */ "expression_prio2 ::= expression_prio1",
  724. /* 37 */ "expression_prio2 ::= expression_prio2 operator2 expression_prio1",
  725. /* 38 */ "expression_prio3 ::= expression_prio2",
  726. /* 39 */ "expression_prio3 ::= expression_prio3 operator3 expression_prio2",
  727. /* 40 */ "expression_prio4 ::= expression_prio3",
  728. /* 41 */ "expression_prio4 ::= expression_prio4 operator4 expression_prio3",
  729. /* 42 */ "list ::= PAR_OPEN list_items PAR_CLOSE",
  730. /* 43 */ "list_items ::= expression_prio4",
  731. /* 44 */ "list_items ::= list_items COMA expression_prio4",
  732. /* 45 */ "arg_list ::=",
  733. /* 46 */ "arg_list ::= argument",
  734. /* 47 */ "arg_list ::= arg_list COMA argument",
  735. /* 48 */ "argument ::= expression_prio4",
  736. /* 49 */ "argument ::= INTERVAL expression_prio4 interval_unit",
  737. /* 50 */ "interval_unit ::= F_SECOND",
  738. /* 51 */ "interval_unit ::= F_MINUTE",
  739. /* 52 */ "interval_unit ::= F_HOUR",
  740. /* 53 */ "interval_unit ::= F_DAY",
  741. /* 54 */ "interval_unit ::= F_MONTH",
  742. /* 55 */ "interval_unit ::= F_YEAR",
  743. /* 56 */ "scalar ::= num_scalar",
  744. /* 57 */ "scalar ::= str_scalar",
  745. /* 58 */ "num_scalar ::= num_value",
  746. /* 59 */ "str_scalar ::= str_value",
  747. /* 60 */ "field_id ::= name",
  748. /* 61 */ "field_id ::= class_name DOT name",
  749. /* 62 */ "class_name ::= name",
  750. /* 63 */ "var_name ::= VARNAME",
  751. /* 64 */ "name ::= NAME",
  752. /* 65 */ "num_value ::= NUMVAL",
  753. /* 66 */ "num_value ::= MATH_MINUS NUMVAL",
  754. /* 67 */ "num_value ::= HEXVAL",
  755. /* 68 */ "str_value ::= STRVAL",
  756. /* 69 */ "operator1 ::= num_operator1",
  757. /* 70 */ "operator1 ::= bitwise_operator1",
  758. /* 71 */ "operator2 ::= num_operator2",
  759. /* 72 */ "operator2 ::= str_operator",
  760. /* 73 */ "operator2 ::= REGEXP",
  761. /* 74 */ "operator2 ::= EQ",
  762. /* 75 */ "operator2 ::= NOT_EQ",
  763. /* 76 */ "operator3 ::= LOG_AND",
  764. /* 77 */ "operator3 ::= bitwise_operator3",
  765. /* 78 */ "operator4 ::= LOG_OR",
  766. /* 79 */ "operator4 ::= bitwise_operator4",
  767. /* 80 */ "num_operator1 ::= MATH_DIV",
  768. /* 81 */ "num_operator1 ::= MATH_MULT",
  769. /* 82 */ "num_operator2 ::= MATH_PLUS",
  770. /* 83 */ "num_operator2 ::= MATH_MINUS",
  771. /* 84 */ "num_operator2 ::= GT",
  772. /* 85 */ "num_operator2 ::= LT",
  773. /* 86 */ "num_operator2 ::= GE",
  774. /* 87 */ "num_operator2 ::= LE",
  775. /* 88 */ "str_operator ::= LIKE",
  776. /* 89 */ "str_operator ::= NOT_LIKE",
  777. /* 90 */ "bitwise_operator1 ::= BITWISE_LEFT_SHIFT",
  778. /* 91 */ "bitwise_operator1 ::= BITWISE_RIGHT_SHIFT",
  779. /* 92 */ "bitwise_operator3 ::= BITWISE_AND",
  780. /* 93 */ "bitwise_operator4 ::= BITWISE_OR",
  781. /* 94 */ "bitwise_operator4 ::= BITWISE_XOR",
  782. /* 95 */ "list_operator ::= IN",
  783. /* 96 */ "list_operator ::= NOT_IN",
  784. /* 97 */ "func_name ::= F_IF",
  785. /* 98 */ "func_name ::= F_ELT",
  786. /* 99 */ "func_name ::= F_COALESCE",
  787. /* 100 */ "func_name ::= F_ISNULL",
  788. /* 101 */ "func_name ::= F_CONCAT",
  789. /* 102 */ "func_name ::= F_SUBSTR",
  790. /* 103 */ "func_name ::= F_TRIM",
  791. /* 104 */ "func_name ::= F_DATE",
  792. /* 105 */ "func_name ::= F_DATE_FORMAT",
  793. /* 106 */ "func_name ::= F_CURRENT_DATE",
  794. /* 107 */ "func_name ::= F_NOW",
  795. /* 108 */ "func_name ::= F_TIME",
  796. /* 109 */ "func_name ::= F_TO_DAYS",
  797. /* 110 */ "func_name ::= F_FROM_DAYS",
  798. /* 111 */ "func_name ::= F_YEAR",
  799. /* 112 */ "func_name ::= F_MONTH",
  800. /* 113 */ "func_name ::= F_DAY",
  801. /* 114 */ "func_name ::= F_DATE_ADD",
  802. /* 115 */ "func_name ::= F_DATE_SUB",
  803. /* 116 */ "func_name ::= F_ROUND",
  804. /* 117 */ "func_name ::= F_FLOOR",
  805. /* 118 */ "func_name ::= F_INET_ATON",
  806. /* 119 */ "func_name ::= F_INET_NTOA",
  807. );
  808. /**
  809. * This function returns the symbolic name associated with a token
  810. * value.
  811. * @param int
  812. * @return string
  813. */
  814. function tokenName($tokenType)
  815. {
  816. if ($tokenType === 0) {
  817. return 'End of Input';
  818. }
  819. if ($tokenType > 0 && $tokenType < count(self::$yyTokenName)) {
  820. return self::$yyTokenName[$tokenType];
  821. } else {
  822. return "Unknown";
  823. }
  824. }
  825. /**
  826. * The following function deletes the value associated with a
  827. * symbol. The symbol can be either a terminal or nonterminal.
  828. * @param int the symbol code
  829. * @param mixed the symbol's value
  830. */
  831. static function yy_destructor($yymajor, $yypminor)
  832. {
  833. switch ($yymajor) {
  834. /* Here is inserted the actions which take place when a
  835. ** terminal or non-terminal is destroyed. This can happen
  836. ** when the symbol is popped from the stack during a
  837. ** reduce or during error processing or when a parser is
  838. ** being destroyed before it is finished parsing.
  839. **
  840. ** Note: during a reduce, the only symbols destroyed are those
  841. ** which appear on the RHS of the rule, but which are not used
  842. ** inside the C code.
  843. */
  844. default: break; /* If no destructor action specified: do nothing */
  845. }
  846. }
  847. /**
  848. * Pop the parser's stack once.
  849. *
  850. * If there is a destructor routine associated with the token which
  851. * is popped from the stack, then call it.
  852. *
  853. * Return the major token number for the symbol popped.
  854. * @param OQLParser_yyParser
  855. * @return int
  856. */
  857. function yy_pop_parser_stack()
  858. {
  859. if (!count($this->yystack)) {
  860. return;
  861. }
  862. $yytos = array_pop($this->yystack);
  863. if (self::$yyTraceFILE && $this->yyidx >= 0) {
  864. fwrite(self::$yyTraceFILE,
  865. self::$yyTracePrompt . 'Popping ' . self::$yyTokenName[$yytos->major] .
  866. "\n");
  867. }
  868. $yymajor = $yytos->major;
  869. self::yy_destructor($yymajor, $yytos->minor);
  870. $this->yyidx--;
  871. return $yymajor;
  872. }
  873. /**
  874. * Deallocate and destroy a parser. Destructors are all called for
  875. * all stack elements before shutting the parser down.
  876. */
  877. function __destruct()
  878. {
  879. while ($this->yyidx >= 0) {
  880. $this->yy_pop_parser_stack();
  881. }
  882. if (is_resource(self::$yyTraceFILE)) {
  883. fclose(self::$yyTraceFILE);
  884. }
  885. }
  886. /**
  887. * Based on the current state and parser stack, get a list of all
  888. * possible lookahead tokens
  889. * @param int
  890. * @return array
  891. */
  892. function yy_get_expected_tokens($token)
  893. {
  894. $state = $this->yystack[$this->yyidx]->stateno;
  895. $expected = self::$yyExpectedTokens[$state];
  896. if (in_array($token, self::$yyExpectedTokens[$state], true)) {
  897. return $expected;
  898. }
  899. $stack = $this->yystack;
  900. $yyidx = $this->yyidx;
  901. do {
  902. $yyact = $this->yy_find_shift_action($token);
  903. if ($yyact >= self::YYNSTATE && $yyact < self::YYNSTATE + self::YYNRULE) {
  904. // reduce action
  905. $done = 0;
  906. do {
  907. if ($done++ == 100) {
  908. $this->yyidx = $yyidx;
  909. $this->yystack = $stack;
  910. // too much recursion prevents proper detection
  911. // so give up
  912. return array_unique($expected);
  913. }
  914. $yyruleno = $yyact - self::YYNSTATE;
  915. $this->yyidx -= self::$yyRuleInfo[$yyruleno]['rhs'];
  916. $nextstate = $this->yy_find_reduce_action(
  917. $this->yystack[$this->yyidx]->stateno,
  918. self::$yyRuleInfo[$yyruleno]['lhs']);
  919. if (isset(self::$yyExpectedTokens[$nextstate])) {
  920. $expected += self::$yyExpectedTokens[$nextstate];
  921. if (in_array($token,
  922. self::$yyExpectedTokens[$nextstate], true)) {
  923. $this->yyidx = $yyidx;
  924. $this->yystack = $stack;
  925. return array_unique($expected);
  926. }
  927. }
  928. if ($nextstate < self::YYNSTATE) {
  929. // we need to shift a non-terminal
  930. $this->yyidx++;
  931. $x = new OQLParser_yyStackEntry;
  932. $x->stateno = $nextstate;
  933. $x->major = self::$yyRuleInfo[$yyruleno]['lhs'];
  934. $this->yystack[$this->yyidx] = $x;
  935. continue 2;
  936. } elseif ($nextstate == self::YYNSTATE + self::YYNRULE + 1) {
  937. $this->yyidx = $yyidx;
  938. $this->yystack = $stack;
  939. // the last token was just ignored, we can't accept
  940. // by ignoring input, this is in essence ignoring a
  941. // syntax error!
  942. return array_unique($expected);
  943. } elseif ($nextstate === self::YY_NO_ACTION) {
  944. $this->yyidx = $yyidx;
  945. $this->yystack = $stack;
  946. // input accepted, but not shifted (I guess)
  947. return $expected;
  948. } else {
  949. $yyact = $nextstate;
  950. }
  951. } while (true);
  952. }
  953. break;
  954. } while (true);
  955. return array_unique($expected);
  956. }
  957. /**
  958. * Based on the parser state and current parser stack, determine whether
  959. * the lookahead token is possible.
  960. *
  961. * The parser will convert the token value to an error token if not. This
  962. * catches some unusual edge cases where the parser would fail.
  963. * @param int
  964. * @return bool
  965. */
  966. function yy_is_expected_token($token)
  967. {
  968. if ($token === 0) {
  969. return true; // 0 is not part of this
  970. }
  971. $state = $this->yystack[$this->yyidx]->stateno;
  972. if (in_array($token, self::$yyExpectedTokens[$state], true)) {
  973. return true;
  974. }
  975. $stack = $this->yystack;
  976. $yyidx = $this->yyidx;
  977. do {
  978. $yyact = $this->yy_find_shift_action($token);
  979. if ($yyact >= self::YYNSTATE && $yyact < self::YYNSTATE + self::YYNRULE) {
  980. // reduce action
  981. $done = 0;
  982. do {
  983. if ($done++ == 100) {
  984. $this->yyidx = $yyidx;
  985. $this->yystack = $stack;
  986. // too much recursion prevents proper detection
  987. // so give up
  988. return true;
  989. }
  990. $yyruleno = $yyact - self::YYNSTATE;
  991. $this->yyidx -= self::$yyRuleInfo[$yyruleno]['rhs'];
  992. $nextstate = $this->yy_find_reduce_action(
  993. $this->yystack[$this->yyidx]->stateno,
  994. self::$yyRuleInfo[$yyruleno]['lhs']);
  995. if (isset(self::$yyExpectedTokens[$nextstate]) &&
  996. in_array($token, self::$yyExpectedTokens[$nextstate], true)) {
  997. $this->yyidx = $yyidx;
  998. $this->yystack = $stack;
  999. return true;
  1000. }
  1001. if ($nextstate < self::YYNSTATE) {
  1002. // we need to shift a non-terminal
  1003. $this->yyidx++;
  1004. $x = new OQLParser_yyStackEntry;
  1005. $x->stateno = $nextstate;
  1006. $x->major = self::$yyRuleInfo[$yyruleno]['lhs'];
  1007. $this->yystack[$this->yyidx] = $x;
  1008. continue 2;
  1009. } elseif ($nextstate == self::YYNSTATE + self::YYNRULE + 1) {
  1010. $this->yyidx = $yyidx;
  1011. $this->yystack = $stack;
  1012. if (!$token) {
  1013. // end of input: this is valid
  1014. return true;
  1015. }
  1016. // the last token was just ignored, we can't accept
  1017. // by ignoring input, this is in essence ignoring a
  1018. // syntax error!
  1019. return false;
  1020. } elseif ($nextstate === self::YY_NO_ACTION) {
  1021. $this->yyidx = $yyidx;
  1022. $this->yystack = $stack;
  1023. // input accepted, but not shifted (I guess)
  1024. return true;
  1025. } else {
  1026. $yyact = $nextstate;
  1027. }
  1028. } while (true);
  1029. }
  1030. break;
  1031. } while (true);
  1032. $this->yyidx = $yyidx;
  1033. $this->yystack = $stack;
  1034. return true;
  1035. }
  1036. /**
  1037. * Find the appropriate action for a parser given the terminal
  1038. * look-ahead token iLookAhead.
  1039. *
  1040. * If the look-ahead token is YYNOCODE, then check to see if the action is
  1041. * independent of the look-ahead. If it is, return the action, otherwise
  1042. * return YY_NO_ACTION.
  1043. * @param int The look-ahead token
  1044. */
  1045. function yy_find_shift_action($iLookAhead)
  1046. {
  1047. $stateno = $this->yystack[$this->yyidx]->stateno;
  1048. /* if ($this->yyidx < 0) return self::YY_NO_ACTION; */
  1049. if (!isset(self::$yy_shift_ofst[$stateno])) {
  1050. // no shift actions
  1051. return self::$yy_default[$stateno];
  1052. }
  1053. $i = self::$yy_shift_ofst[$stateno];
  1054. if ($i === self::YY_SHIFT_USE_DFLT) {
  1055. return self::$yy_default[$stateno];
  1056. }
  1057. if ($iLookAhead == self::YYNOCODE) {
  1058. return self::YY_NO_ACTION;
  1059. }
  1060. $i += $iLookAhead;
  1061. if ($i < 0 || $i >= self::YY_SZ_ACTTAB ||
  1062. self::$yy_lookahead[$i] != $iLookAhead) {
  1063. if (count(self::$yyFallback) && $iLookAhead < count(self::$yyFallback)
  1064. && ($iFallback = self::$yyFallback[$iLookAhead]) != 0) {
  1065. if (self::$yyTraceFILE) {
  1066. fwrite(self::$yyTraceFILE, self::$yyTracePrompt . "FALLBACK " .
  1067. self::$yyTokenName[$iLookAhead] . " => " .
  1068. self::$yyTokenName[$iFallback] . "\n");
  1069. }
  1070. return $this->yy_find_shift_action($iFallback);
  1071. }
  1072. return self::$yy_default[$stateno];
  1073. } else {
  1074. return self::$yy_action[$i];
  1075. }
  1076. }
  1077. /**
  1078. * Find the appropriate action for a parser given the non-terminal
  1079. * look-ahead token $iLookAhead.
  1080. *
  1081. * If the look-ahead token is self::YYNOCODE, then check to see if the action is
  1082. * independent of the look-ahead. If it is, return the action, otherwise
  1083. * return self::YY_NO_ACTION.
  1084. * @param int Current state number
  1085. * @param int The look-ahead token
  1086. */
  1087. function yy_find_reduce_action($stateno, $iLookAhead)
  1088. {
  1089. /* $stateno = $this->yystack[$this->yyidx]->stateno; */
  1090. if (!isset(self::$yy_reduce_ofst[$stateno])) {
  1091. return self::$yy_default[$stateno];
  1092. }
  1093. $i = self::$yy_reduce_ofst[$stateno];
  1094. if ($i == self::YY_REDUCE_USE_DFLT) {
  1095. return self::$yy_default[$stateno];
  1096. }
  1097. if ($iLookAhead == self::YYNOCODE) {
  1098. return self::YY_NO_ACTION;
  1099. }
  1100. $i += $iLookAhead;
  1101. if ($i < 0 || $i >= self::YY_SZ_ACTTAB ||
  1102. self::$yy_lookahead[$i] != $iLookAhead) {
  1103. return self::$yy_default[$stateno];
  1104. } else {
  1105. return self::$yy_action[$i];
  1106. }
  1107. }
  1108. /**
  1109. * Perform a shift action.
  1110. * @param int The new state to shift in
  1111. * @param int The major token to shift in
  1112. * @param mixed the minor token to shift in
  1113. */
  1114. function yy_shift($yyNewState, $yyMajor, $yypMinor)
  1115. {
  1116. $this->yyidx++;
  1117. if ($this->yyidx >= self::YYSTACKDEPTH) {
  1118. $this->yyidx--;
  1119. if (self::$yyTraceFILE) {
  1120. fprintf(self::$yyTraceFILE, "%sStack Overflow!\n", self::$yyTracePrompt);
  1121. }
  1122. while ($this->yyidx >= 0) {
  1123. $this->yy_pop_parser_stack();
  1124. }
  1125. /* Here code is inserted which will execute if the parser
  1126. ** stack ever overflows */
  1127. return;
  1128. }
  1129. $yytos = new OQLParser_yyStackEntry;
  1130. $yytos->stateno = $yyNewState;
  1131. $yytos->major = $yyMajor;
  1132. $yytos->minor = $yypMinor;
  1133. array_push($this->yystack, $yytos);
  1134. if (self::$yyTraceFILE && $this->yyidx > 0) {
  1135. fprintf(self::$yyTraceFILE, "%sShift %d\n", self::$yyTracePrompt,
  1136. $yyNewState);
  1137. fprintf(self::$yyTraceFILE, "%sStack:", self::$yyTracePrompt);
  1138. for ($i = 1; $i <= $this->yyidx; $i++) {
  1139. fprintf(self::$yyTraceFILE, " %s",
  1140. self::$yyTokenName[$this->yystack[$i]->major]);
  1141. }
  1142. fwrite(self::$yyTraceFILE,"\n");
  1143. }
  1144. }
  1145. /**
  1146. * The following table contains information about every rule that
  1147. * is used during the reduce.
  1148. *
  1149. * <pre>
  1150. * array(
  1151. * array(
  1152. * int $lhs; Symbol on the left-hand side of the rule
  1153. * int $nrhs; Number of right-hand side symbols in the rule
  1154. * ),...
  1155. * );
  1156. * </pre>
  1157. */
  1158. static public $yyRuleInfo = array(
  1159. array( 'lhs' => 75, 'rhs' => 1 ),
  1160. array( 'lhs' => 75, 'rhs' => 1 ),
  1161. array( 'lhs' => 75, 'rhs' => 1 ),
  1162. array( 'lhs' => 76, 'rhs' => 3 ),
  1163. array( 'lhs' => 76, 'rhs' => 3 ),
  1164. array( 'lhs' => 77, 'rhs' => 4 ),
  1165. array( 'lhs' => 77, 'rhs' => 6 ),
  1166. array( 'lhs' => 77, 'rhs' => 6 ),
  1167. array( 'lhs' => 77, 'rhs' => 8 ),
  1168. array( 'lhs' => 82, 'rhs' => 1 ),
  1169. array( 'lhs' => 82, 'rhs' => 3 ),
  1170. array( 'lhs' => 81, 'rhs' => 2 ),
  1171. array( 'lhs' => 81, 'rhs' => 0 ),
  1172. array( 'lhs' => 80, 'rhs' => 2 ),
  1173. array( 'lhs' => 80, 'rhs' => 1 ),
  1174. array( 'lhs' => 80, 'rhs' => 0 ),
  1175. array( 'lhs' => 83, 'rhs' => 6 ),
  1176. array( 'lhs' => 83, 'rhs' => 4 ),
  1177. array( 'lhs' => 84, 'rhs' => 3 ),
  1178. array( 'lhs' => 84, 'rhs' => 3 ),
  1179. array( 'lhs' => 84, 'rhs' => 3 ),
  1180. array( 'lhs' => 84, 'rhs' => 3 ),
  1181. array( 'lhs' => 84, 'rhs' => 3 ),
  1182. array( 'lhs' => 84, 'rhs' => 3 ),
  1183. array( 'lhs' => 84, 'rhs' => 3 ),
  1184. array( 'lhs' => 84, 'rhs' => 3 ),
  1185. array( 'lhs' => 84, 'rhs' => 3 ),
  1186. array( 'lhs' => 78, 'rhs' => 1 ),
  1187. array( 'lhs' => 87, 'rhs' => 1 ),
  1188. array( 'lhs' => 87, 'rhs' => 1 ),
  1189. array( 'lhs' => 87, 'rhs' => 1 ),
  1190. array( 'lhs' => 87, 'rhs' => 4 ),
  1191. array( 'lhs' => 87, 'rhs' => 3 ),
  1192. array( 'lhs' => 87, 'rhs' => 3 ),
  1193. array( 'lhs' => 94, 'rhs' => 1 ),
  1194. array( 'lhs' => 94, 'rhs' => 3 ),
  1195. array( 'lhs' => 96, 'rhs' => 1 ),
  1196. array( 'lhs' => 96, 'rhs' => 3 ),
  1197. array( 'lhs' => 98, 'rhs' => 1 ),
  1198. array( 'lhs' => 98, 'rhs' => 3 ),
  1199. array( 'lhs' => 86, 'rhs' => 1 ),
  1200. array( 'lhs' => 86, 'rhs' => 3 ),
  1201. array( 'lhs' => 93, 'rhs' => 3 ),
  1202. array( 'lhs' => 101, 'rhs' => 1 ),
  1203. array( 'lhs' => 101, 'rhs' => 3 ),
  1204. array( 'lhs' => 91, 'rhs' => 0 ),
  1205. array( 'lhs' => 91, 'rhs' => 1 ),
  1206. array( 'lhs' => 91, 'rhs' => 3 ),
  1207. array( 'lhs' => 102, 'rhs' => 1 ),
  1208. array( 'lhs' => 102, 'rhs' => 3 ),
  1209. array( 'lhs' => 103, 'rhs' => 1 ),
  1210. array( 'lhs' => 103, 'rhs' => 1 ),
  1211. array( 'lhs' => 103, 'rhs' => 1 ),
  1212. array( 'lhs' => 103, 'rhs' => 1 ),
  1213. array( 'lhs' => 103, 'rhs' => 1 ),
  1214. array( 'lhs' => 103, 'rhs' => 1 ),
  1215. array( 'lhs' => 88, 'rhs' => 1 ),
  1216. array( 'lhs' => 88, 'rhs' => 1 ),
  1217. array( 'lhs' => 104, 'rhs' => 1 ),
  1218. array( 'lhs' => 105, 'rhs' => 1 ),
  1219. array( 'lhs' => 85, 'rhs' => 1 ),
  1220. array( 'lhs' => 85, 'rhs' => 3 ),
  1221. array( 'lhs' => 79, 'rhs' => 1 ),
  1222. array( 'lhs' => 89, 'rhs' => 1 ),
  1223. array( 'lhs' => 108, 'rhs' => 1 ),
  1224. array( 'lhs' => 106, 'rhs' => 1 ),
  1225. array( 'lhs' => 106, 'rhs' => 2 ),
  1226. array( 'lhs' => 106, 'rhs' => 1 ),
  1227. array( 'lhs' => 107, 'rhs' => 1 ),
  1228. array( 'lhs' => 95, 'rhs' => 1 ),
  1229. array( 'lhs' => 95, 'rhs' => 1 ),
  1230. array( 'lhs' => 97, 'rhs' => 1 ),
  1231. array( 'lhs' => 97, 'rhs' => 1 ),
  1232. array( 'lhs' => 97, 'rhs' => 1 ),
  1233. array( 'lhs' => 97, 'rhs' => 1 ),
  1234. array( 'lhs' => 97, 'rhs' => 1 ),
  1235. array( 'lhs' => 99, 'rhs' => 1 ),
  1236. array( 'lhs' => 99, 'rhs' => 1 ),
  1237. array( 'lhs' => 100, 'rhs' => 1 ),
  1238. array( 'lhs' => 100, 'rhs' => 1 ),
  1239. array( 'lhs' => 109, 'rhs' => 1 ),
  1240. array( 'lhs' => 109, 'rhs' => 1 ),
  1241. array( 'lhs' => 111, 'rhs' => 1 ),
  1242. array( 'lhs' => 111, 'rhs' => 1 ),
  1243. array( 'lhs' => 111, 'rhs' => 1 ),
  1244. array( 'lhs' => 111, 'rhs' => 1 ),
  1245. array( 'lhs' => 111, 'rhs' => 1 ),
  1246. array( 'lhs' => 111, 'rhs' => 1 ),
  1247. array( 'lhs' => 112, 'rhs' => 1 ),
  1248. array( 'lhs' => 112, 'rhs' => 1 ),
  1249. array( 'lhs' => 110, 'rhs' => 1 ),
  1250. array( 'lhs' => 110, 'rhs' => 1 ),
  1251. array( 'lhs' => 113, 'rhs' => 1 ),
  1252. array( 'lhs' => 114, 'rhs' => 1 ),
  1253. array( 'lhs' => 114, 'rhs' => 1 ),
  1254. array( 'lhs' => 92, 'rhs' => 1 ),
  1255. array( 'lhs' => 92, 'rhs' => 1 ),
  1256. array( 'lhs' => 90, 'rhs' => 1 ),
  1257. array( 'lhs' => 90, 'rhs' => 1 ),
  1258. array( 'lhs' => 90, 'rhs' => 1 ),
  1259. array( 'lhs' => 90, 'rhs' => 1 ),
  1260. array( 'lhs' => 90, 'rhs' => 1 ),
  1261. array( 'lhs' => 90, 'rhs' => 1 ),
  1262. array( 'lhs' => 90, 'rhs' => 1 ),
  1263. array( 'lhs' => 90, 'rhs' => 1 ),
  1264. array( 'lhs' => 90, 'rhs' => 1 ),
  1265. array( 'lhs' => 90, 'rhs' => 1 ),
  1266. array( 'lhs' => 90, 'rhs' => 1 ),
  1267. array( 'lhs' => 90, 'rhs' => 1 ),
  1268. array( 'lhs' => 90, 'rhs' => 1 ),
  1269. array( 'lhs' => 90, 'rhs' => 1 ),
  1270. array( 'lhs' => 90, 'rhs' => 1 ),
  1271. array( 'lhs' => 90, 'rhs' => 1 ),
  1272. array( 'lhs' => 90, 'rhs' => 1 ),
  1273. array( 'lhs' => 90, 'rhs' => 1 ),
  1274. array( 'lhs' => 90, 'rhs' => 1 ),
  1275. array( 'lhs' => 90, 'rhs' => 1 ),
  1276. array( 'lhs' => 90, 'rhs' => 1 ),
  1277. array( 'lhs' => 90, 'rhs' => 1 ),
  1278. array( 'lhs' => 90, 'rhs' => 1 ),
  1279. );
  1280. /**
  1281. * The following table contains a mapping of reduce action to method name
  1282. * that handles the reduction.
  1283. *
  1284. * If a rule is not set, it has no handler.
  1285. */
  1286. static public $yyReduceMap = array(
  1287. 0 => 0,
  1288. 1 => 0,
  1289. 2 => 0,
  1290. 3 => 3,
  1291. 4 => 3,
  1292. 5 => 5,
  1293. 6 => 6,
  1294. 7 => 7,
  1295. 8 => 8,
  1296. 9 => 9,
  1297. 43 => 9,
  1298. 46 => 9,
  1299. 10 => 10,
  1300. 44 => 10,
  1301. 47 => 10,
  1302. 11 => 11,
  1303. 12 => 12,
  1304. 15 => 12,
  1305. 13 => 13,
  1306. 14 => 14,
  1307. 16 => 16,
  1308. 17 => 17,
  1309. 18 => 18,
  1310. 19 => 19,
  1311. 20 => 20,
  1312. 21 => 21,
  1313. 22 => 22,
  1314. 23 => 23,
  1315. 24 => 24,
  1316. 25 => 25,
  1317. 26 => 26,
  1318. 27 => 27,
  1319. 28 => 27,
  1320. 29 => 27,
  1321. 30 => 27,
  1322. 34 => 27,
  1323. 36 => 27,
  1324. 38 => 27,
  1325. 40 => 27,
  1326. 48 => 27,
  1327. 50 => 27,
  1328. 51 => 27,
  1329. 52 => 27,
  1330. 53 => 27,
  1331. 54 => 27,
  1332. 55 => 27,
  1333. 56 => 27,
  1334. 57 => 27,
  1335. 31 => 31,
  1336. 32 => 32,
  1337. 33 => 33,
  1338. 35 => 33,
  1339. 37 => 33,
  1340. 39 => 33,
  1341. 41 => 33,
  1342. 42 => 42,
  1343. 45 => 45,
  1344. 49 => 49,
  1345. 58 => 58,
  1346. 59 => 58,
  1347. 60 => 60,
  1348. 61 => 61,
  1349. 62 => 62,
  1350. 97 => 62,
  1351. 98 => 62,
  1352. 99 => 62,
  1353. 100 => 62,
  1354. 101 => 62,
  1355. 102 => 62,
  1356. 103 => 62,
  1357. 104 => 62,
  1358. 105 => 62,
  1359. 106 => 62,
  1360. 107 => 62,
  1361. 108 => 62,
  1362. 109 => 62,
  1363. 110 => 62,
  1364. 111 => 62,
  1365. 112 => 62,
  1366. 113 => 62,
  1367. 114 => 62,
  1368. 115 => 62,
  1369. 116 => 62,
  1370. 117 => 62,
  1371. 118 => 62,
  1372. 119 => 62,
  1373. 63 => 63,
  1374. 64 => 64,
  1375. 65 => 65,
  1376. 66 => 66,
  1377. 67 => 67,
  1378. 68 => 68,
  1379. 69 => 69,
  1380. 70 => 69,
  1381. 71 => 69,
  1382. 72 => 69,
  1383. 73 => 69,
  1384. 74 => 69,
  1385. 75 => 69,
  1386. 76 => 69,
  1387. 77 => 69,
  1388. 78 => 69,
  1389. 79 => 69,
  1390. 80 => 69,
  1391. 81 => 69,
  1392. 82 => 69,
  1393. 83 => 69,
  1394. 84 => 69,
  1395. 85 => 69,
  1396. 86 => 69,
  1397. 87 => 69,
  1398. 88 => 69,
  1399. 89 => 69,
  1400. 90 => 69,
  1401. 91 => 69,
  1402. 92 => 69,
  1403. 93 => 69,
  1404. 94 => 69,
  1405. 95 => 69,
  1406. 96 => 69,
  1407. );
  1408. /* Beginning here are the reduction cases. A typical example
  1409. ** follows:
  1410. ** #line <lineno> <grammarfile>
  1411. ** function yy_r0($yymsp){ ... } // User supplied code
  1412. ** #line <lineno> <thisfile>
  1413. */
  1414. #line 29 "..\oql-parser.y"
  1415. function yy_r0(){ $this->my_result = $this->yystack[$this->yyidx + 0]->minor; }
  1416. #line 1449 "..\oql-parser.php"
  1417. #line 33 "..\oql-parser.y"
  1418. function yy_r3(){
  1419. $this->_retvalue = new OqlUnionQuery($this->yystack[$this->yyidx + -2]->minor, $this->yystack[$this->yyidx + 0]->minor);
  1420. }
  1421. #line 1454 "..\oql-parser.php"
  1422. #line 40 "..\oql-parser.y"
  1423. function yy_r5(){
  1424. $this->_retvalue = new OqlObjectQuery($this->yystack[$this->yyidx + -2]->minor, $this->yystack[$this->yyidx + -2]->minor, $this->yystack[$this->yyidx + 0]->minor, $this->yystack[$this->yyidx + -1]->minor, array($this->yystack[$this->yyidx + -2]->minor));
  1425. }
  1426. #line 1459 "..\oql-parser.php"
  1427. #line 43 "..\oql-parser.y"
  1428. function yy_r6(){
  1429. $this->_retvalue = new OqlObjectQuery($this->yystack[$this->yyidx + -4]->minor, $this->yystack[$this->yyidx + -2]->minor, $this->yystack[$this->yyidx + 0]->minor, $this->yystack[$this->yyidx + -1]->minor, array($this->yystack[$this->yyidx + -2]->minor));
  1430. }
  1431. #line 1464 "..\oql-parser.php"
  1432. #line 47 "..\oql-parser.y"
  1433. function yy_r7(){
  1434. $this->_retvalue = new OqlObjectQuery($this->yystack[$this->yyidx + -2]->minor, $this->yystack[$this->yyidx + -2]->minor, $this->yystack[$this->yyidx + 0]->minor, $this->yystack[$this->yyidx + -1]->minor, $this->yystack[$this->yyidx + -4]->minor);
  1435. }
  1436. #line 1469 "..\oql-parser.php"
  1437. #line 50 "..\oql-parser.y"
  1438. function yy_r8(){
  1439. $this->_retvalue = new OqlObjectQuery($this->yystack[$this->yyidx + -4]->minor, $this->yystack[$this->yyidx + -2]->minor, $this->yystack[$this->yyidx + 0]->minor, $this->yystack[$this->yyidx + -1]->minor, $this->yystack[$this->yyidx + -6]->minor);
  1440. }
  1441. #line 1474 "..\oql-parser.php"
  1442. #line 55 "..\oql-parser.y"
  1443. function yy_r9(){
  1444. $this->_retvalue = array($this->yystack[$this->yyidx + 0]->minor);
  1445. }
  1446. #line 1479 "..\oql-parser.php"
  1447. #line 58 "..\oql-parser.y"
  1448. function yy_r10(){
  1449. array_push($this->yystack[$this->yyidx + -2]->minor, $this->yystack[$this->yyidx + 0]->minor);
  1450. $this->_retvalue = $this->yystack[$this->yyidx + -2]->minor;
  1451. }
  1452. #line 1485 "..\oql-parser.php"
  1453. #line 63 "..\oql-parser.y"
  1454. function yy_r11(){ $this->_retvalue = $this->yystack[$this->yyidx + 0]->minor; }
  1455. #line 1488 "..\oql-parser.php"
  1456. #line 64 "..\oql-parser.y"
  1457. function yy_r12(){ $this->_retvalue = null; }
  1458. #line 1491 "..\oql-parser.php"
  1459. #line 66 "..\oql-parser.y"
  1460. function yy_r13(){
  1461. // insert the join statement on top of the existing list
  1462. array_unshift($this->yystack[$this->yyidx + 0]->minor, $this->yystack[$this->yyidx + -1]->minor);
  1463. // and return the updated array
  1464. $this->_retvalue = $this->yystack[$this->yyidx + 0]->minor;
  1465. }
  1466. #line 1499 "..\oql-parser.php"
  1467. #line 72 "..\oql-parser.y"
  1468. function yy_r14(){
  1469. $this->_retvalue = Array($this->yystack[$this->yyidx + 0]->minor);
  1470. }
  1471. #line 1504 "..\oql-parser.php"
  1472. #line 78 "..\oql-parser.y"
  1473. function yy_r16(){
  1474. // create an array with one single item
  1475. $this->_retvalue = new OqlJoinSpec($this->yystack[$this->yyidx + -4]->minor, $this->yystack[$this->yyidx + -2]->minor, $this->yystack[$this->yyidx + 0]->minor);
  1476. }
  1477. #line 1510 "..\oql-parser.php"
  1478. #line 83 "..\oql-parser.y"
  1479. function yy_r17(){
  1480. // create an array with one single item
  1481. $this->_retvalue = new OqlJoinSpec($this->yystack[$this->yyidx + -2]->minor, $this->yystack[$this->yyidx + -2]->minor, $this->yystack[$this->yyidx + 0]->minor);
  1482. }
  1483. #line 1516 "..\oql-parser.php"
  1484. #line 88 "..\oql-parser.y"
  1485. function yy_r18(){ $this->_retvalue = new BinaryOqlExpression($this->yystack[$this->yyidx + -2]->minor, '=', $this->yystack[$this->yyidx + 0]->minor); }
  1486. #line 1519 "..\oql-parser.php"
  1487. #line 89 "..\oql-parser.y"
  1488. function yy_r19(){ $this->_retvalue = new BinaryOqlExpression($this->yystack[$this->yyidx + -2]->minor, 'BELOW', $this->yystack[$this->yyidx + 0]->minor); }
  1489. #line 1522 "..\oql-parser.php"
  1490. #line 90 "..\oql-parser.y"
  1491. function yy_r20(){ $this->_retvalue = new BinaryOqlExpression($this->yystack[$this->yyidx + -2]->minor, 'BELOW_STRICT', $this->yystack[$this->yyidx + 0]->minor); }
  1492. #line 1525 "..\oql-parser.php"
  1493. #line 91 "..\oql-parser.y"
  1494. function yy_r21(){ $this->_retvalue = new BinaryOqlExpression($this->yystack[$this->yyidx + -2]->minor, 'NOT_BELOW', $this->yystack[$this->yyidx + 0]->minor); }
  1495. #line 1528 "..\oql-parser.php"
  1496. #line 92 "..\oql-parser.y"
  1497. function yy_r22(){ $this->_retvalue = new BinaryOqlExpression($this->yystack[$this->yyidx + -2]->minor, 'NOT_BELOW_STRICT', $this->yystack[$this->yyidx + 0]->minor); }
  1498. #line 1531 "..\oql-parser.php"
  1499. #line 93 "..\oql-parser.y"
  1500. function yy_r23(){ $this->_retvalue = new BinaryOqlExpression($this->yystack[$this->yyidx + -2]->minor, 'ABOVE', $this->yystack[$this->yyidx + 0]->minor); }
  1501. #line 1534 "..\oql-parser.php"
  1502. #line 94 "..\oql-parser.y"
  1503. function yy_r24(){ $this->_retvalue = new BinaryOqlExpression($this->yystack[$this->yyidx + -2]->minor, 'ABOVE_STRICT', $this->yystack[$this->yyidx + 0]->minor); }
  1504. #line 1537 "..\oql-parser.php"
  1505. #line 95 "..\oql-parser.y"
  1506. function yy_r25(){ $this->_retvalue = new BinaryOqlExpression($this->yystack[$this->yyidx + -2]->minor, 'NOT_ABOVE', $this->yystack[$this->yyidx + 0]->minor); }
  1507. #line 1540 "..\oql-parser.php"
  1508. #line 96 "..\oql-parser.y"
  1509. function yy_r26(){ $this->_retvalue = new BinaryOqlExpression($this->yystack[$this->yyidx + -2]->minor, 'NOT_ABOVE_STRICT', $this->yystack[$this->yyidx + 0]->minor); }
  1510. #line 1543 "..\oql-parser.php"
  1511. #line 98 "..\oql-parser.y"
  1512. function yy_r27(){ $this->_retvalue = $this->yystack[$this->yyidx + 0]->minor; }
  1513. #line 1546 "..\oql-parser.php"
  1514. #line 103 "..\oql-parser.y"
  1515. function yy_r31(){ $this->_retvalue = new FunctionOqlExpression($this->yystack[$this->yyidx + -3]->minor, $this->yystack[$this->yyidx + -1]->minor); }
  1516. #line 1549 "..\oql-parser.php"
  1517. #line 104 "..\oql-parser.y"
  1518. function yy_r32(){ $this->_retvalue = $this->yystack[$this->yyidx + -1]->minor; }
  1519. #line 1552 "..\oql-parser.php"
  1520. #line 105 "..\oql-parser.y"
  1521. function yy_r33(){ $this->_retvalue = new BinaryOqlExpression($this->yystack[$this->yyidx + -2]->minor, $this->yystack[$this->yyidx + -1]->minor, $this->yystack[$this->yyidx + 0]->minor); }
  1522. #line 1555 "..\oql-parser.php"
  1523. #line 120 "..\oql-parser.y"
  1524. function yy_r42(){
  1525. $this->_retvalue = new ListOqlExpression($this->yystack[$this->yyidx + -1]->minor);
  1526. }
  1527. #line 1560 "..\oql-parser.php"
  1528. #line 131 "..\oql-parser.y"
  1529. function yy_r45(){
  1530. $this->_retvalue = array();
  1531. }
  1532. #line 1565 "..\oql-parser.php"
  1533. #line 142 "..\oql-parser.y"
  1534. function yy_r49(){ $this->_retvalue = new IntervalOqlExpression($this->yystack[$this->yyidx + -1]->minor, $this->yystack[$this->yyidx + 0]->minor); }
  1535. #line 1568 "..\oql-parser.php"
  1536. #line 154 "..\oql-parser.y"
  1537. function yy_r58(){ $this->_retvalue = new ScalarOqlExpression($this->yystack[$this->yyidx + 0]->minor); }
  1538. #line 1571 "..\oql-parser.php"
  1539. #line 157 "..\oql-parser.y"
  1540. function yy_r60(){ $this->_retvalue = new FieldOqlExpression($this->yystack[$this->yyidx + 0]->minor); }
  1541. #line 1574 "..\oql-parser.php"
  1542. #line 158 "..\oql-parser.y"
  1543. function yy_r61(){ $this->_retvalue = new FieldOqlExpression($this->yystack[$this->yyidx + 0]->minor, $this->yystack[$this->yyidx + -2]->minor); }
  1544. #line 1577 "..\oql-parser.php"
  1545. #line 159 "..\oql-parser.y"
  1546. function yy_r62(){ $this->_retvalue=$this->yystack[$this->yyidx + 0]->minor; }
  1547. #line 1580 "..\oql-parser.php"
  1548. #line 162 "..\oql-parser.y"
  1549. function yy_r63(){ $this->_retvalue = new VariableOqlExpression(substr($this->yystack[$this->yyidx + 0]->minor, 1)); }
  1550. #line 1583 "..\oql-parser.php"
  1551. #line 164 "..\oql-parser.y"
  1552. function yy_r64(){
  1553. if ($this->yystack[$this->yyidx + 0]->minor[0] == '`')
  1554. {
  1555. $name = substr($this->yystack[$this->yyidx + 0]->minor, 1, strlen($this->yystack[$this->yyidx + 0]->minor) - 2);
  1556. }
  1557. else
  1558. {
  1559. $name = $this->yystack[$this->yyidx + 0]->minor;
  1560. }
  1561. $this->_retvalue = new OqlName($name, $this->m_iColPrev);
  1562. }
  1563. #line 1596 "..\oql-parser.php"
  1564. #line 175 "..\oql-parser.y"
  1565. function yy_r65(){$this->_retvalue=(int)$this->yystack[$this->yyidx + 0]->minor; }
  1566. #line 1599 "..\oql-parser.php"
  1567. #line 176 "..\oql-parser.y"
  1568. function yy_r66(){$this->_retvalue=(int)-$this->yystack[$this->yyidx + 0]->minor; }
  1569. #line 1602 "..\oql-parser.php"
  1570. #line 177 "..\oql-parser.y"
  1571. function yy_r67(){$this->_retvalue=new OqlHexValue($this->yystack[$this->yyidx + 0]->minor); }
  1572. #line 1605 "..\oql-parser.php"
  1573. #line 178 "..\oql-parser.y"
  1574. function yy_r68(){$this->_retvalue=stripslashes(substr($this->yystack[$this->yyidx + 0]->minor, 1, strlen($this->yystack[$this->yyidx + 0]->minor) - 2)); }
  1575. #line 1608 "..\oql-parser.php"
  1576. #line 181 "..\oql-parser.y"
  1577. function yy_r69(){$this->_retvalue=$this->yystack[$this->yyidx + 0]->minor; }
  1578. #line 1611 "..\oql-parser.php"
  1579. /**
  1580. * placeholder for the left hand side in a reduce operation.
  1581. *
  1582. * For a parser with a rule like this:
  1583. * <pre>
  1584. * rule(A) ::= B. { A = 1; }
  1585. * </pre>
  1586. *
  1587. * The parser will translate to something like:
  1588. *
  1589. * <code>
  1590. * function yy_r0(){$this->_retvalue = 1;}
  1591. * </code>
  1592. */
  1593. private $_retvalue;
  1594. /**
  1595. * Perform a reduce action and the shift that must immediately
  1596. * follow the reduce.
  1597. *
  1598. * For a rule such as:
  1599. *
  1600. * <pre>
  1601. * A ::= B blah C. { dosomething(); }
  1602. * </pre>
  1603. *
  1604. * This function will first call the action, if any, ("dosomething();" in our
  1605. * example), and then it will pop three states from the stack,
  1606. * one for each entry on the right-hand side of the expression
  1607. * (B, blah, and C in our example rule), and then push the result of the action
  1608. * back on to the stack with the resulting state reduced to (as described in the .out
  1609. * file)
  1610. * @param int Number of the rule by which to reduce
  1611. */
  1612. function yy_reduce($yyruleno)
  1613. {
  1614. //int $yygoto; /* The next state */
  1615. //int $yyact; /* The next action */
  1616. //mixed $yygotominor; /* The LHS of the rule reduced */
  1617. //OQLParser_yyStackEntry $yymsp; /* The top of the parser's stack */
  1618. //int $yysize; /* Amount to pop the stack */
  1619. $yymsp = $this->yystack[$this->yyidx];
  1620. if (self::$yyTraceFILE && $yyruleno >= 0
  1621. && $yyruleno < count(self::$yyRuleName)) {
  1622. fprintf(self::$yyTraceFILE, "%sReduce (%d) [%s].\n",
  1623. self::$yyTracePrompt, $yyruleno,
  1624. self::$yyRuleName[$yyruleno]);
  1625. }
  1626. $this->_retvalue = $yy_lefthand_side = null;
  1627. if (array_key_exists($yyruleno, self::$yyReduceMap)) {
  1628. // call the action
  1629. $this->_retvalue = null;
  1630. $this->{'yy_r' . self::$yyReduceMap[$yyruleno]}();
  1631. $yy_lefthand_side = $this->_retvalue;
  1632. }
  1633. $yygoto = self::$yyRuleInfo[$yyruleno]['lhs'];
  1634. $yysize = self::$yyRuleInfo[$yyruleno]['rhs'];
  1635. $this->yyidx -= $yysize;
  1636. for ($i = $yysize; $i; $i--) {
  1637. // pop all of the right-hand side parameters
  1638. array_pop($this->yystack);
  1639. }
  1640. $yyact = $this->yy_find_reduce_action($this->yystack[$this->yyidx]->stateno, $yygoto);
  1641. if ($yyact < self::YYNSTATE) {
  1642. /* If we are not debugging and the reduce action popped at least
  1643. ** one element off the stack, then we can push the new element back
  1644. ** onto the stack here, and skip the stack overflow test in yy_shift().
  1645. ** That gives a significant speed improvement. */
  1646. if (!self::$yyTraceFILE && $yysize) {
  1647. $this->yyidx++;
  1648. $x = new OQLParser_yyStackEntry;
  1649. $x->stateno = $yyact;
  1650. $x->major = $yygoto;
  1651. $x->minor = $yy_lefthand_side;
  1652. $this->yystack[$this->yyidx] = $x;
  1653. } else {
  1654. $this->yy_shift($yyact, $yygoto, $yy_lefthand_side);
  1655. }
  1656. } elseif ($yyact == self::YYNSTATE + self::YYNRULE + 1) {
  1657. $this->yy_accept();
  1658. }
  1659. }
  1660. /**
  1661. * The following code executes when the parse fails
  1662. *
  1663. * Code from %parse_fail is inserted here
  1664. */
  1665. function yy_parse_failed()
  1666. {
  1667. if (self::$yyTraceFILE) {
  1668. fprintf(self::$yyTraceFILE, "%sFail!\n", self::$yyTracePrompt);
  1669. }
  1670. while ($this->yyidx >= 0) {
  1671. $this->yy_pop_parser_stack();
  1672. }
  1673. /* Here code is inserted which will be executed whenever the
  1674. ** parser fails */
  1675. }
  1676. /**
  1677. * The following code executes when a syntax error first occurs.
  1678. *
  1679. * %syntax_error code is inserted here
  1680. * @param int The major type of the error token
  1681. * @param mixed The minor type of the error token
  1682. */
  1683. function yy_syntax_error($yymajor, $TOKEN)
  1684. {
  1685. #line 25 "..\oql-parser.y"
  1686. throw new OQLParserException($this->m_sSourceQuery, $this->m_iLine, $this->m_iCol, $this->tokenName($yymajor), $TOKEN);
  1687. #line 1727 "..\oql-parser.php"
  1688. }
  1689. /**
  1690. * The following is executed when the parser accepts
  1691. *
  1692. * %parse_accept code is inserted here
  1693. */
  1694. function yy_accept()
  1695. {
  1696. if (self::$yyTraceFILE) {
  1697. fprintf(self::$yyTraceFILE, "%sAccept!\n", self::$yyTracePrompt);
  1698. }
  1699. while ($this->yyidx >= 0) {
  1700. $stack = $this->yy_pop_parser_stack();
  1701. }
  1702. /* Here code is inserted which will be executed whenever the
  1703. ** parser accepts */
  1704. }
  1705. /**
  1706. * The main parser program.
  1707. *
  1708. * The first argument is the major token number. The second is
  1709. * the token value string as scanned from the input.
  1710. *
  1711. * @param int $yymajor the token number
  1712. * @param mixed $yytokenvalue the token value
  1713. * @param mixed ... any extra arguments that should be passed to handlers
  1714. *
  1715. * @return void
  1716. */
  1717. function doParse($yymajor, $yytokenvalue)
  1718. {
  1719. // $yyact; /* The parser action. */
  1720. // $yyendofinput; /* True if we are at the end of input */
  1721. $yyerrorhit = 0; /* True if yymajor has invoked an error */
  1722. /* (re)initialize the parser, if necessary */
  1723. if ($this->yyidx === null || $this->yyidx < 0) {
  1724. /* if ($yymajor == 0) return; // not sure why this was here... */
  1725. $this->yyidx = 0;
  1726. $this->yyerrcnt = -1;
  1727. $x = new OQLParser_yyStackEntry;
  1728. $x->stateno = 0;
  1729. $x->major = 0;
  1730. $this->yystack = array();
  1731. array_push($this->yystack, $x);
  1732. }
  1733. $yyendofinput = ($yymajor==0);
  1734. if (self::$yyTraceFILE) {
  1735. fprintf(
  1736. self::$yyTraceFILE,
  1737. "%sInput %s\n",
  1738. self::$yyTracePrompt,
  1739. self::$yyTokenName[$yymajor]
  1740. );
  1741. }
  1742. do {
  1743. $yyact = $this->yy_find_shift_action($yymajor);
  1744. if ($yymajor < self::YYERRORSYMBOL
  1745. && !$this->yy_is_expected_token($yymajor)
  1746. ) {
  1747. // force a syntax error
  1748. $yyact = self::YY_ERROR_ACTION;
  1749. }
  1750. if ($yyact < self::YYNSTATE) {
  1751. $this->yy_shift($yyact, $yymajor, $yytokenvalue);
  1752. $this->yyerrcnt--;
  1753. if ($yyendofinput && $this->yyidx >= 0) {
  1754. $yymajor = 0;
  1755. } else {
  1756. $yymajor = self::YYNOCODE;
  1757. }
  1758. } elseif ($yyact < self::YYNSTATE + self::YYNRULE) {
  1759. $this->yy_reduce($yyact - self::YYNSTATE);
  1760. } elseif ($yyact == self::YY_ERROR_ACTION) {
  1761. if (self::$yyTraceFILE) {
  1762. fprintf(
  1763. self::$yyTraceFILE,
  1764. "%sSyntax Error!\n",
  1765. self::$yyTracePrompt
  1766. );
  1767. }
  1768. if (self::YYERRORSYMBOL) {
  1769. /* A syntax error has occurred.
  1770. ** The response to an error depends upon whether or not the
  1771. ** grammar defines an error token "ERROR".
  1772. **
  1773. ** This is what we do if the grammar does define ERROR:
  1774. **
  1775. ** * Call the %syntax_error function.
  1776. **
  1777. ** * Begin popping the stack until we enter a state where
  1778. ** it is legal to shift the error symbol, then shift
  1779. ** the error symbol.
  1780. **
  1781. ** * Set the error count to three.
  1782. **
  1783. ** * Begin accepting and shifting new tokens. No new error
  1784. ** processing will occur until three tokens have been
  1785. ** shifted successfully.
  1786. **
  1787. */
  1788. if ($this->yyerrcnt < 0) {
  1789. $this->yy_syntax_error($yymajor, $yytokenvalue);
  1790. }
  1791. $yymx = $this->yystack[$this->yyidx]->major;
  1792. if ($yymx == self::YYERRORSYMBOL || $yyerrorhit ) {
  1793. if (self::$yyTraceFILE) {
  1794. fprintf(
  1795. self::$yyTraceFILE,
  1796. "%sDiscard input token %s\n",
  1797. self::$yyTracePrompt,
  1798. self::$yyTokenName[$yymajor]
  1799. );
  1800. }
  1801. $this->yy_destructor($yymajor, $yytokenvalue);
  1802. $yymajor = self::YYNOCODE;
  1803. } else {
  1804. while ($this->yyidx >= 0
  1805. && $yymx != self::YYERRORSYMBOL
  1806. && ($yyact = $this->yy_find_shift_action(self::YYERRORSYMBOL)) >= self::YYNSTATE
  1807. ) {
  1808. $this->yy_pop_parser_stack();
  1809. }
  1810. if ($this->yyidx < 0 || $yymajor==0) {
  1811. $this->yy_destructor($yymajor, $yytokenvalue);
  1812. $this->yy_parse_failed();
  1813. $yymajor = self::YYNOCODE;
  1814. } elseif ($yymx != self::YYERRORSYMBOL) {
  1815. $u2 = 0;
  1816. $this->yy_shift($yyact, self::YYERRORSYMBOL, $u2);
  1817. }
  1818. }
  1819. $this->yyerrcnt = 3;
  1820. $yyerrorhit = 1;
  1821. } else {
  1822. /* YYERRORSYMBOL is not defined */
  1823. /* This is what we do if the grammar does not define ERROR:
  1824. **
  1825. ** * Report an error message, and throw away the input token.
  1826. **
  1827. ** * If the input token is $, then fail the parse.
  1828. **
  1829. ** As before, subsequent error messages are suppressed until
  1830. ** three input tokens have been successfully shifted.
  1831. */
  1832. if ($this->yyerrcnt <= 0) {
  1833. $this->yy_syntax_error($yymajor, $yytokenvalue);
  1834. }
  1835. $this->yyerrcnt = 3;
  1836. $this->yy_destructor($yymajor, $yytokenvalue);
  1837. if ($yyendofinput) {
  1838. $this->yy_parse_failed();
  1839. }
  1840. $yymajor = self::YYNOCODE;
  1841. }
  1842. } else {
  1843. $this->yy_accept();
  1844. $yymajor = self::YYNOCODE;
  1845. }
  1846. } while ($yymajor != self::YYNOCODE && $this->yyidx >= 0);
  1847. }
  1848. }
  1849. #line 239 "..\oql-parser.y"
  1850. class OQLParserException extends OQLException
  1851. {
  1852. public function __construct($sInput, $iLine, $iCol, $sTokenName, $sTokenValue)
  1853. {
  1854. $sIssue = "Unexpected token $sTokenName";
  1855. parent::__construct($sIssue, $sInput, $iLine, $iCol, $sTokenValue);
  1856. }
  1857. }
  1858. class OQLParser extends OQLParserRaw
  1859. {
  1860. // dirty, but working for us (no other mean to get the final result :-(
  1861. protected $my_result;
  1862. public function GetResult()
  1863. {
  1864. return $this->my_result;
  1865. }
  1866. // More info on the source query and the current position while parsing it
  1867. // Data used when an exception is raised
  1868. protected $m_iLine; // still not used
  1869. protected $m_iCol;
  1870. protected $m_iColPrev; // this is the interesting one, because the parser will reduce on the next token
  1871. protected $m_sSourceQuery;
  1872. public function __construct($sQuery)
  1873. {
  1874. $this->m_iLine = 0;
  1875. $this->m_iCol = 0;
  1876. $this->m_iColPrev = 0;
  1877. $this->m_sSourceQuery = $sQuery;
  1878. // no constructor - parent::__construct();
  1879. }
  1880. public function doParse($token, $value, $iCurrPosition = 0)
  1881. {
  1882. $this->m_iColPrev = $this->m_iCol;
  1883. $this->m_iCol = $iCurrPosition;
  1884. return parent::DoParse($token, $value);
  1885. }
  1886. public function doFinish()
  1887. {
  1888. $this->doParse(0, 0);
  1889. return $this->my_result;
  1890. }
  1891. public function __destruct()
  1892. {
  1893. // Bug in the original destructor, causing an infinite loop !
  1894. // This is a real issue when a fatal error occurs on the first token (the error could not be seen)
  1895. if (is_null($this->yyidx))
  1896. {
  1897. $this->yyidx = -1;
  1898. }
  1899. parent::__destruct();
  1900. }
  1901. }
  1902. #line 1960 "..\oql-parser.php"