oql-parser.php 77 KB

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