/peg/peg-go.go

http://github.com/feyeleanor/RubyGoLightly · Go · 802 lines · 776 code · 25 blank · 1 comment · 154 complexity · eff5de682a7fd7894a894143b127b86e MD5 · raw file

  1. /* A recursive-descent parser generated by peg 0.1.0 */
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4. #include <string.h>
  5. #define YYRULECOUNT 32
  6. #ifndef YY_VARIABLE
  7. #define YY_VARIABLE(T) static T
  8. #endif
  9. #ifndef YY_LOCAL
  10. #define YY_LOCAL(T) static T
  11. #endif
  12. #ifndef YY_ACTION
  13. #define YY_ACTION(T) static T
  14. #endif
  15. #ifndef YY_RULE
  16. #define YY_RULE(T) static T
  17. #endif
  18. #ifndef YY_PARSE
  19. #define YY_PARSE(T) T
  20. #endif
  21. #ifndef YYPARSE
  22. #define YYPARSE yyparse
  23. #endif
  24. #ifndef YYPARSEFROM
  25. #define YYPARSEFROM yyparsefrom
  26. #endif
  27. #ifndef YY_INPUT
  28. #define YY_INPUT(buf, result, max_size) \
  29. { \
  30. int yyc= getchar(); \
  31. result= (EOF == yyc) ? 0 : (*(buf)= yyc, 1); \
  32. yyprintf((stderr, "<%c>", yyc)); \
  33. }
  34. #endif
  35. #ifndef YY_BEGIN
  36. #define YY_BEGIN ( yybegin= yypos, 1)
  37. #endif
  38. #ifndef YY_END
  39. #define YY_END ( yyend= yypos, 1)
  40. #endif
  41. #ifdef YY_DEBUG
  42. # define yyprintf(args) fprintf args
  43. #else
  44. # define yyprintf(args)
  45. #endif
  46. #ifndef YYSTYPE
  47. #define YYSTYPE int
  48. #endif
  49. #ifndef YY_PART
  50. typedef void (*yyaction)(char *yytext, int yyleng);
  51. typedef struct _yythunk { int begin, end; yyaction action; struct _yythunk *next; } yythunk;
  52. YY_VARIABLE(char * ) yybuf= 0;
  53. YY_VARIABLE(int ) yybuflen= 0;
  54. YY_VARIABLE(int ) yypos= 0;
  55. YY_VARIABLE(int ) yylimit= 0;
  56. YY_VARIABLE(char * ) yytext= 0;
  57. YY_VARIABLE(int ) yytextlen= 0;
  58. YY_VARIABLE(int ) yybegin= 0;
  59. YY_VARIABLE(int ) yyend= 0;
  60. YY_VARIABLE(int ) yytextmax= 0;
  61. YY_VARIABLE(yythunk *) yythunks= 0;
  62. YY_VARIABLE(int ) yythunkslen= 0;
  63. YY_VARIABLE(int ) yythunkpos= 0;
  64. YY_VARIABLE(YYSTYPE ) yy;
  65. YY_VARIABLE(YYSTYPE *) yyval= 0;
  66. YY_VARIABLE(YYSTYPE *) yyvals= 0;
  67. YY_VARIABLE(int ) yyvalslen= 0;
  68. YY_LOCAL(int) yyrefill(void)
  69. {
  70. int yyn;
  71. if (yybuflen - yypos < 512)
  72. {
  73. yybuflen *= 2;
  74. yybuf= realloc(yybuf, yybuflen);
  75. }
  76. int c= getc(input);
  77. if ('\n' == c || '\r' == c) ++lineNumber;
  78. yyn= (EOF == c) ? 0 : (*(yybuf + yypos)= c, 1);
  79. if (!yyn) return 0;
  80. yylimit += yyn;
  81. return 1;
  82. }
  83. YY_LOCAL(int) yymatchDot(void)
  84. {
  85. if (yypos >= yylimit && !yyrefill()) return 0;
  86. ++yypos;
  87. return 1;
  88. }
  89. YY_LOCAL(int) yymatchChar(int c)
  90. {
  91. if (yypos >= yylimit && !yyrefill()) return 0;
  92. if (yybuf[yypos] == c)
  93. {
  94. ++yypos;
  95. yyprintf((stderr, " ok yymatchChar(%c) @ %s\n", c, yybuf+yypos));
  96. return 1;
  97. }
  98. yyprintf((stderr, " fail yymatchChar(%c) @ %s\n", c, yybuf+yypos));
  99. return 0;
  100. }
  101. YY_LOCAL(int) yymatchString(char *s)
  102. {
  103. int yysav= yypos;
  104. while (*s)
  105. {
  106. if (yypos >= yylimit && !yyrefill()) return 0;
  107. if (yybuf[yypos] != *s)
  108. {
  109. yypos= yysav;
  110. return 0;
  111. }
  112. ++s;
  113. ++yypos;
  114. }
  115. return 1;
  116. }
  117. YY_LOCAL(int) yymatchClass(unsigned char *bits)
  118. {
  119. int c;
  120. if (yypos >= yylimit && !yyrefill()) return 0;
  121. c= yybuf[yypos];
  122. if (bits[c >> 3] & (1 << (c & 7)))
  123. {
  124. ++yypos;
  125. yyprintf((stderr, " ok yymatchClass @ %s\n", yybuf+yypos));
  126. return 1;
  127. }
  128. yyprintf((stderr, " fail yymatchClass @ %s\n", yybuf+yypos));
  129. return 0;
  130. }
  131. YY_LOCAL(void) yyDo(yyaction action, int begin, int end)
  132. {
  133. if (yythunkpos >= yythunkslen)
  134. {
  135. yythunkslen *= 2;
  136. yythunks= realloc(yythunks, sizeof(yythunk) * yythunkslen);
  137. }
  138. yythunks[yythunkpos].begin= begin;
  139. yythunks[yythunkpos].end= end;
  140. yythunks[yythunkpos].action= action;
  141. ++yythunkpos;
  142. }
  143. YY_LOCAL(int) yyText(int begin, int end)
  144. {
  145. int yyleng= end - begin;
  146. if (yyleng <= 0)
  147. yyleng= 0;
  148. else
  149. {
  150. if (yytextlen < (yyleng - 1))
  151. {
  152. yytextlen *= 2;
  153. yytext= realloc(yytext, yytextlen);
  154. }
  155. memcpy(yytext, yybuf + begin, yyleng);
  156. }
  157. yytext[yyleng]= '\0';
  158. return yyleng;
  159. }
  160. YY_LOCAL(void) yyDone(void)
  161. {
  162. int pos;
  163. for (pos= 0; pos < yythunkpos; ++pos)
  164. {
  165. yythunk *thunk= &yythunks[pos];
  166. int yyleng= thunk->end ? yyText(thunk->begin, thunk->end) : thunk->begin;
  167. yyprintf((stderr, "DO [%d] %p %s\n", pos, thunk->action, yytext));
  168. thunk->action(yytext, yyleng);
  169. }
  170. yythunkpos= 0;
  171. }
  172. YY_LOCAL(void) yyCommit()
  173. {
  174. if ((yylimit -= yypos))
  175. {
  176. memmove(yybuf, yybuf + yypos, yylimit);
  177. }
  178. yybegin -= yypos;
  179. yyend -= yypos;
  180. yypos= yythunkpos= 0;
  181. }
  182. YY_LOCAL(int) yyAccept(int tp0)
  183. {
  184. if (tp0)
  185. {
  186. fprintf(stderr, "accept denied at %d\n", tp0);
  187. return 0;
  188. }
  189. else
  190. {
  191. yyDone();
  192. yyCommit();
  193. }
  194. return 1;
  195. }
  196. YY_LOCAL(void) yyPush(char *text, int count) { yyval += count; }
  197. YY_LOCAL(void) yyPop(char *text, int count) { yyval -= count; }
  198. YY_LOCAL(void) yySet(char *text, int count) { yyval[count]= yy; }
  199. #endif /* YY_PART */
  200. #define YYACCEPT yyAccept(yythunkpos0)
  201. YY_RULE(int) yy_EndOfLine(); /* 32 */
  202. YY_RULE(int) yy_Comment(); /* 31 */
  203. YY_RULE(int) yy_Space(); /* 30 */
  204. YY_RULE(int) yy_Range(); /* 29 */
  205. YY_RULE(int) yy_Char(); /* 28 */
  206. YY_RULE(int) yy_IdentCont(); /* 27 */
  207. YY_RULE(int) yy_IdentStart(); /* 26 */
  208. YY_RULE(int) yy_END(); /* 25 */
  209. YY_RULE(int) yy_BEGIN(); /* 24 */
  210. YY_RULE(int) yy_DOT(); /* 23 */
  211. YY_RULE(int) yy_Class(); /* 22 */
  212. YY_RULE(int) yy_Literal(); /* 21 */
  213. YY_RULE(int) yy_CLOSE(); /* 20 */
  214. YY_RULE(int) yy_OPEN(); /* 19 */
  215. YY_RULE(int) yy_PLUS(); /* 18 */
  216. YY_RULE(int) yy_STAR(); /* 17 */
  217. YY_RULE(int) yy_QUESTION(); /* 16 */
  218. YY_RULE(int) yy_Primary(); /* 15 */
  219. YY_RULE(int) yy_NOT(); /* 14 */
  220. YY_RULE(int) yy_Suffix(); /* 13 */
  221. YY_RULE(int) yy_Action(); /* 12 */
  222. YY_RULE(int) yy_AND(); /* 11 */
  223. YY_RULE(int) yy_Prefix(); /* 10 */
  224. YY_RULE(int) yy_SLASH(); /* 9 */
  225. YY_RULE(int) yy_Sequence(); /* 8 */
  226. YY_RULE(int) yy_Expression(); /* 7 */
  227. YY_RULE(int) yy_LEFTARROW(); /* 6 */
  228. YY_RULE(int) yy_Identifier(); /* 5 */
  229. YY_RULE(int) yy_EndOfFile(); /* 4 */
  230. YY_RULE(int) yy_Definition(); /* 3 */
  231. YY_RULE(int) yy_Spacing(); /* 2 */
  232. YY_RULE(int) yy_Grammar(); /* 1 */
  233. YY_ACTION(void) yy_7_Primary(char *yytext, int yyleng)
  234. {
  235. yyprintf((stderr, "do yy_7_Primary\n"));
  236. push(Predicate{text: "YY_END"}); ;
  237. }
  238. YY_ACTION(void) yy_6_Primary(char *yytext, int yyleng)
  239. {
  240. yyprintf((stderr, "do yy_6_Primary\n"));
  241. push(Predicate{text: "YY_BEGIN"}); ;
  242. }
  243. YY_ACTION(void) yy_5_Primary(char *yytext, int yyleng)
  244. {
  245. yyprintf((stderr, "do yy_5_Primary\n"));
  246. push(makeAction(yytext)); ;
  247. }
  248. YY_ACTION(void) yy_4_Primary(char *yytext, int yyleng)
  249. {
  250. yyprintf((stderr, "do yy_4_Primary\n"));
  251. push(Dot{}); ;
  252. }
  253. YY_ACTION(void) yy_3_Primary(char *yytext, int yyleng)
  254. {
  255. yyprintf((stderr, "do yy_3_Primary\n"));
  256. push(Class{cclass: yytext}); ;
  257. }
  258. YY_ACTION(void) yy_2_Primary(char *yytext, int yyleng)
  259. {
  260. yyprintf((stderr, "do yy_2_Primary\n"));
  261. push(String{value: yytext}); ;
  262. }
  263. YY_ACTION(void) yy_1_Primary(char *yytext, int yyleng)
  264. {
  265. yyprintf((stderr, "do yy_1_Primary\n"));
  266. push(Name{used: true, variable: nil, rule: findRule(yytext)}); ;
  267. }
  268. YY_ACTION(void) yy_3_Suffix(char *yytext, int yyleng)
  269. {
  270. yyprintf((stderr, "do yy_3_Suffix\n"));
  271. push(Plus{element: pop()}); ;
  272. }
  273. YY_ACTION(void) yy_2_Suffix(char *yytext, int yyleng)
  274. {
  275. yyprintf((stderr, "do yy_2_Suffix\n"));
  276. push(Star{element: pop()}); ;
  277. }
  278. YY_ACTION(void) yy_1_Suffix(char *yytext, int yyleng)
  279. {
  280. yyprintf((stderr, "do yy_1_Suffix\n"));
  281. push(Query{element: pop()}); ;
  282. }
  283. YY_ACTION(void) yy_3_Prefix(char *yytext, int yyleng)
  284. {
  285. yyprintf((stderr, "do yy_3_Prefix\n"));
  286. push(PeekNot{element: pop()}); ;
  287. }
  288. YY_ACTION(void) yy_2_Prefix(char *yytext, int yyleng)
  289. {
  290. yyprintf((stderr, "do yy_2_Prefix\n"));
  291. push(PeekFor{element: pop()}); ;
  292. }
  293. YY_ACTION(void) yy_1_Prefix(char *yytext, int yyleng)
  294. {
  295. yyprintf((stderr, "do yy_1_Prefix\n"));
  296. push(Predicate{text: yytext}); ;
  297. }
  298. YY_ACTION(void) yy_2_Sequence(char *yytext, int yyleng)
  299. {
  300. yyprintf((stderr, "do yy_2_Sequence\n"));
  301. push(Predicate{text: "1"}); ;
  302. }
  303. YY_ACTION(void) yy_1_Sequence(char *yytext, int yyleng)
  304. {
  305. yyprintf((stderr, "do yy_1_Sequence\n"));
  306. Node *f= pop(); push(Sequence_append(pop(), f)); ;
  307. }
  308. YY_ACTION(void) yy_1_Expression(char *yytext, int yyleng)
  309. {
  310. yyprintf((stderr, "do yy_1_Expression\n"));
  311. Node *f= pop(); push(Alternate_append(pop(), f)); ;
  312. }
  313. YY_ACTION(void) yy_2_Definition(char *yytext, int yyleng)
  314. {
  315. yyprintf((stderr, "do yy_2_Definition\n"));
  316. Node *e= pop(); Rule_setExpression(pop(), e); ;
  317. }
  318. YY_ACTION(void) yy_1_Definition(char *yytext, int yyleng)
  319. {
  320. yyprintf((stderr, "do yy_1_Definition\n"));
  321. if (push(beginRule(findRule(yytext)))->rule.expression) fprintf(stderr, "rule '%s' redefined\n", yytext); ;
  322. }
  323. YY_RULE(int) yy_EndOfLine()
  324. { int yypos0= yypos, yythunkpos0= yythunkpos;
  325. yyprintf((stderr, "%s\n", "EndOfLine"));
  326. { int yypos2= yypos, yythunkpos2= yythunkpos; if (!yymatchString("\r\n")) goto l3; goto l2;
  327. l3:; yypos= yypos2; yythunkpos= yythunkpos2; if (!yymatchChar('\n')) goto l4; goto l2;
  328. l4:; yypos= yypos2; yythunkpos= yythunkpos2; if (!yymatchChar('\r')) goto l1;
  329. }
  330. l2:;
  331. yyprintf((stderr, " ok %s @ %s\n", "EndOfLine", yybuf+yypos));
  332. return 1;
  333. l1:; yypos= yypos0; yythunkpos= yythunkpos0;
  334. yyprintf((stderr, " fail %s @ %s\n", "EndOfLine", yybuf+yypos));
  335. return 0;
  336. }
  337. YY_RULE(int) yy_Comment()
  338. { int yypos0= yypos, yythunkpos0= yythunkpos;
  339. yyprintf((stderr, "%s\n", "Comment")); if (!yymatchChar('#')) goto l5;
  340. l6:;
  341. { int yypos7= yypos, yythunkpos7= yythunkpos;
  342. { int yypos8= yypos, yythunkpos8= yythunkpos; if (!yy_EndOfLine()) goto l8; goto l7;
  343. l8:; yypos= yypos8; yythunkpos= yythunkpos8;
  344. } if (!yymatchDot()) goto l7; goto l6;
  345. l7:; yypos= yypos7; yythunkpos= yythunkpos7;
  346. } if (!yy_EndOfLine()) goto l5;
  347. yyprintf((stderr, " ok %s @ %s\n", "Comment", yybuf+yypos));
  348. return 1;
  349. l5:; yypos= yypos0; yythunkpos= yythunkpos0;
  350. yyprintf((stderr, " fail %s @ %s\n", "Comment", yybuf+yypos));
  351. return 0;
  352. }
  353. YY_RULE(int) yy_Space()
  354. { int yypos0= yypos, yythunkpos0= yythunkpos;
  355. yyprintf((stderr, "%s\n", "Space"));
  356. { int yypos10= yypos, yythunkpos10= yythunkpos; if (!yymatchChar(' ')) goto l11; goto l10;
  357. l11:; yypos= yypos10; yythunkpos= yythunkpos10; if (!yymatchChar('\t')) goto l12; goto l10;
  358. l12:; yypos= yypos10; yythunkpos= yythunkpos10; if (!yy_EndOfLine()) goto l9;
  359. }
  360. l10:;
  361. yyprintf((stderr, " ok %s @ %s\n", "Space", yybuf+yypos));
  362. return 1;
  363. l9:; yypos= yypos0; yythunkpos= yythunkpos0;
  364. yyprintf((stderr, " fail %s @ %s\n", "Space", yybuf+yypos));
  365. return 0;
  366. }
  367. YY_RULE(int) yy_Range()
  368. { int yypos0= yypos, yythunkpos0= yythunkpos;
  369. yyprintf((stderr, "%s\n", "Range"));
  370. { int yypos14= yypos, yythunkpos14= yythunkpos; if (!yy_Char()) goto l15; if (!yymatchChar('-')) goto l15; if (!yy_Char()) goto l15; goto l14;
  371. l15:; yypos= yypos14; yythunkpos= yythunkpos14; if (!yy_Char()) goto l13;
  372. }
  373. l14:;
  374. yyprintf((stderr, " ok %s @ %s\n", "Range", yybuf+yypos));
  375. return 1;
  376. l13:; yypos= yypos0; yythunkpos= yythunkpos0;
  377. yyprintf((stderr, " fail %s @ %s\n", "Range", yybuf+yypos));
  378. return 0;
  379. }
  380. YY_RULE(int) yy_Char()
  381. { int yypos0= yypos, yythunkpos0= yythunkpos;
  382. yyprintf((stderr, "%s\n", "Char"));
  383. { int yypos17= yypos, yythunkpos17= yythunkpos; if (!yymatchChar('\\')) goto l18; if (!yymatchClass((unsigned char *)"\000\000\000\000\204\000\000\000\000\000\000\070\146\100\124\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l18; goto l17;
  384. l18:; yypos= yypos17; yythunkpos= yythunkpos17; if (!yymatchChar('\\')) goto l19; if (!yymatchClass((unsigned char *)"\000\000\000\000\000\000\017\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l19; if (!yymatchClass((unsigned char *)"\000\000\000\000\000\000\377\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l19; if (!yymatchClass((unsigned char *)"\000\000\000\000\000\000\377\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l19; goto l17;
  385. l19:; yypos= yypos17; yythunkpos= yythunkpos17; if (!yymatchChar('\\')) goto l20; if (!yymatchClass((unsigned char *)"\000\000\000\000\000\000\377\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l20;
  386. { int yypos21= yypos, yythunkpos21= yythunkpos; if (!yymatchClass((unsigned char *)"\000\000\000\000\000\000\377\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l21; goto l22;
  387. l21:; yypos= yypos21; yythunkpos= yythunkpos21;
  388. }
  389. l22:; goto l17;
  390. l20:; yypos= yypos17; yythunkpos= yythunkpos17; if (!yymatchChar('\\')) goto l23; if (!yymatchChar('-')) goto l23; goto l17;
  391. l23:; yypos= yypos17; yythunkpos= yythunkpos17;
  392. { int yypos24= yypos, yythunkpos24= yythunkpos; if (!yymatchChar('\\')) goto l24; goto l16;
  393. l24:; yypos= yypos24; yythunkpos= yythunkpos24;
  394. } if (!yymatchDot()) goto l16;
  395. }
  396. l17:;
  397. yyprintf((stderr, " ok %s @ %s\n", "Char", yybuf+yypos));
  398. return 1;
  399. l16:; yypos= yypos0; yythunkpos= yythunkpos0;
  400. yyprintf((stderr, " fail %s @ %s\n", "Char", yybuf+yypos));
  401. return 0;
  402. }
  403. YY_RULE(int) yy_IdentCont()
  404. { int yypos0= yypos, yythunkpos0= yythunkpos;
  405. yyprintf((stderr, "%s\n", "IdentCont"));
  406. { int yypos26= yypos, yythunkpos26= yythunkpos; if (!yy_IdentStart()) goto l27; goto l26;
  407. l27:; yypos= yypos26; yythunkpos= yythunkpos26; if (!yymatchClass((unsigned char *)"\000\000\000\000\000\000\377\003\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l25;
  408. }
  409. l26:;
  410. yyprintf((stderr, " ok %s @ %s\n", "IdentCont", yybuf+yypos));
  411. return 1;
  412. l25:; yypos= yypos0; yythunkpos= yythunkpos0;
  413. yyprintf((stderr, " fail %s @ %s\n", "IdentCont", yybuf+yypos));
  414. return 0;
  415. }
  416. YY_RULE(int) yy_IdentStart()
  417. { int yypos0= yypos, yythunkpos0= yythunkpos;
  418. yyprintf((stderr, "%s\n", "IdentStart")); if (!yymatchClass((unsigned char *)"\000\000\000\000\000\000\000\000\376\377\377\207\376\377\377\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l28;
  419. yyprintf((stderr, " ok %s @ %s\n", "IdentStart", yybuf+yypos));
  420. return 1;
  421. l28:; yypos= yypos0; yythunkpos= yythunkpos0;
  422. yyprintf((stderr, " fail %s @ %s\n", "IdentStart", yybuf+yypos));
  423. return 0;
  424. }
  425. YY_RULE(int) yy_END()
  426. { int yypos0= yypos, yythunkpos0= yythunkpos;
  427. yyprintf((stderr, "%s\n", "END")); if (!yymatchChar('>')) goto l29; if (!yy_Spacing()) goto l29;
  428. yyprintf((stderr, " ok %s @ %s\n", "END", yybuf+yypos));
  429. return 1;
  430. l29:; yypos= yypos0; yythunkpos= yythunkpos0;
  431. yyprintf((stderr, " fail %s @ %s\n", "END", yybuf+yypos));
  432. return 0;
  433. }
  434. YY_RULE(int) yy_BEGIN()
  435. { int yypos0= yypos, yythunkpos0= yythunkpos;
  436. yyprintf((stderr, "%s\n", "BEGIN")); if (!yymatchChar('<')) goto l30; if (!yy_Spacing()) goto l30;
  437. yyprintf((stderr, " ok %s @ %s\n", "BEGIN", yybuf+yypos));
  438. return 1;
  439. l30:; yypos= yypos0; yythunkpos= yythunkpos0;
  440. yyprintf((stderr, " fail %s @ %s\n", "BEGIN", yybuf+yypos));
  441. return 0;
  442. }
  443. YY_RULE(int) yy_DOT()
  444. { int yypos0= yypos, yythunkpos0= yythunkpos;
  445. yyprintf((stderr, "%s\n", "DOT")); if (!yymatchChar('.')) goto l31; if (!yy_Spacing()) goto l31;
  446. yyprintf((stderr, " ok %s @ %s\n", "DOT", yybuf+yypos));
  447. return 1;
  448. l31:; yypos= yypos0; yythunkpos= yythunkpos0;
  449. yyprintf((stderr, " fail %s @ %s\n", "DOT", yybuf+yypos));
  450. return 0;
  451. }
  452. YY_RULE(int) yy_Class()
  453. { int yypos0= yypos, yythunkpos0= yythunkpos;
  454. yyprintf((stderr, "%s\n", "Class")); if (!yymatchChar('[')) goto l32; yyText(yybegin, yyend); if (!(YY_BEGIN)) goto l32;
  455. l33:;
  456. { int yypos34= yypos, yythunkpos34= yythunkpos;
  457. { int yypos35= yypos, yythunkpos35= yythunkpos; if (!yymatchChar(']')) goto l35; goto l34;
  458. l35:; yypos= yypos35; yythunkpos= yythunkpos35;
  459. } if (!yy_Range()) goto l34; goto l33;
  460. l34:; yypos= yypos34; yythunkpos= yythunkpos34;
  461. } yyText(yybegin, yyend); if (!(YY_END)) goto l32; if (!yymatchChar(']')) goto l32; if (!yy_Spacing()) goto l32;
  462. yyprintf((stderr, " ok %s @ %s\n", "Class", yybuf+yypos));
  463. return 1;
  464. l32:; yypos= yypos0; yythunkpos= yythunkpos0;
  465. yyprintf((stderr, " fail %s @ %s\n", "Class", yybuf+yypos));
  466. return 0;
  467. }
  468. YY_RULE(int) yy_Literal()
  469. { int yypos0= yypos, yythunkpos0= yythunkpos;
  470. yyprintf((stderr, "%s\n", "Literal"));
  471. { int yypos37= yypos, yythunkpos37= yythunkpos; if (!yymatchClass((unsigned char *)"\000\000\000\000\200\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l38; yyText(yybegin, yyend); if (!(YY_BEGIN)) goto l38;
  472. l39:;
  473. { int yypos40= yypos, yythunkpos40= yythunkpos;
  474. { int yypos41= yypos, yythunkpos41= yythunkpos; if (!yymatchClass((unsigned char *)"\000\000\000\000\200\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l41; goto l40;
  475. l41:; yypos= yypos41; yythunkpos= yythunkpos41;
  476. } if (!yy_Char()) goto l40; goto l39;
  477. l40:; yypos= yypos40; yythunkpos= yythunkpos40;
  478. } yyText(yybegin, yyend); if (!(YY_END)) goto l38; if (!yymatchClass((unsigned char *)"\000\000\000\000\200\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l38; if (!yy_Spacing()) goto l38; goto l37;
  479. l38:; yypos= yypos37; yythunkpos= yythunkpos37; if (!yymatchClass((unsigned char *)"\000\000\000\000\004\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l36; yyText(yybegin, yyend); if (!(YY_BEGIN)) goto l36;
  480. l42:;
  481. { int yypos43= yypos, yythunkpos43= yythunkpos;
  482. { int yypos44= yypos, yythunkpos44= yythunkpos; if (!yymatchClass((unsigned char *)"\000\000\000\000\004\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l44; goto l43;
  483. l44:; yypos= yypos44; yythunkpos= yythunkpos44;
  484. } if (!yy_Char()) goto l43; goto l42;
  485. l43:; yypos= yypos43; yythunkpos= yythunkpos43;
  486. } yyText(yybegin, yyend); if (!(YY_END)) goto l36; if (!yymatchClass((unsigned char *)"\000\000\000\000\004\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l36; if (!yy_Spacing()) goto l36;
  487. }
  488. l37:;
  489. yyprintf((stderr, " ok %s @ %s\n", "Literal", yybuf+yypos));
  490. return 1;
  491. l36:; yypos= yypos0; yythunkpos= yythunkpos0;
  492. yyprintf((stderr, " fail %s @ %s\n", "Literal", yybuf+yypos));
  493. return 0;
  494. }
  495. YY_RULE(int) yy_CLOSE()
  496. { int yypos0= yypos, yythunkpos0= yythunkpos;
  497. yyprintf((stderr, "%s\n", "CLOSE")); if (!yymatchChar(')')) goto l45; if (!yy_Spacing()) goto l45;
  498. yyprintf((stderr, " ok %s @ %s\n", "CLOSE", yybuf+yypos));
  499. return 1;
  500. l45:; yypos= yypos0; yythunkpos= yythunkpos0;
  501. yyprintf((stderr, " fail %s @ %s\n", "CLOSE", yybuf+yypos));
  502. return 0;
  503. }
  504. YY_RULE(int) yy_OPEN()
  505. { int yypos0= yypos, yythunkpos0= yythunkpos;
  506. yyprintf((stderr, "%s\n", "OPEN")); if (!yymatchChar('(')) goto l46; if (!yy_Spacing()) goto l46;
  507. yyprintf((stderr, " ok %s @ %s\n", "OPEN", yybuf+yypos));
  508. return 1;
  509. l46:; yypos= yypos0; yythunkpos= yythunkpos0;
  510. yyprintf((stderr, " fail %s @ %s\n", "OPEN", yybuf+yypos));
  511. return 0;
  512. }
  513. YY_RULE(int) yy_PLUS()
  514. { int yypos0= yypos, yythunkpos0= yythunkpos;
  515. yyprintf((stderr, "%s\n", "PLUS")); if (!yymatchChar('+')) goto l47; if (!yy_Spacing()) goto l47;
  516. yyprintf((stderr, " ok %s @ %s\n", "PLUS", yybuf+yypos));
  517. return 1;
  518. l47:; yypos= yypos0; yythunkpos= yythunkpos0;
  519. yyprintf((stderr, " fail %s @ %s\n", "PLUS", yybuf+yypos));
  520. return 0;
  521. }
  522. YY_RULE(int) yy_STAR()
  523. { int yypos0= yypos, yythunkpos0= yythunkpos;
  524. yyprintf((stderr, "%s\n", "STAR")); if (!yymatchChar('*')) goto l48; if (!yy_Spacing()) goto l48;
  525. yyprintf((stderr, " ok %s @ %s\n", "STAR", yybuf+yypos));
  526. return 1;
  527. l48:; yypos= yypos0; yythunkpos= yythunkpos0;
  528. yyprintf((stderr, " fail %s @ %s\n", "STAR", yybuf+yypos));
  529. return 0;
  530. }
  531. YY_RULE(int) yy_QUESTION()
  532. { int yypos0= yypos, yythunkpos0= yythunkpos;
  533. yyprintf((stderr, "%s\n", "QUESTION")); if (!yymatchChar('?')) goto l49; if (!yy_Spacing()) goto l49;
  534. yyprintf((stderr, " ok %s @ %s\n", "QUESTION", yybuf+yypos));
  535. return 1;
  536. l49:; yypos= yypos0; yythunkpos= yythunkpos0;
  537. yyprintf((stderr, " fail %s @ %s\n", "QUESTION", yybuf+yypos));
  538. return 0;
  539. }
  540. YY_RULE(int) yy_Primary()
  541. { int yypos0= yypos, yythunkpos0= yythunkpos;
  542. yyprintf((stderr, "%s\n", "Primary"));
  543. { int yypos51= yypos, yythunkpos51= yythunkpos; if (!yy_Identifier()) goto l52;
  544. { int yypos53= yypos, yythunkpos53= yythunkpos; if (!yy_LEFTARROW()) goto l53; goto l52;
  545. l53:; yypos= yypos53; yythunkpos= yythunkpos53;
  546. } yyDo(yy_1_Primary, yybegin, yyend); goto l51;
  547. l52:; yypos= yypos51; yythunkpos= yythunkpos51; if (!yy_OPEN()) goto l54; if (!yy_Expression()) goto l54; if (!yy_CLOSE()) goto l54; goto l51;
  548. l54:; yypos= yypos51; yythunkpos= yythunkpos51; if (!yy_Literal()) goto l55; yyDo(yy_2_Primary, yybegin, yyend); goto l51;
  549. l55:; yypos= yypos51; yythunkpos= yythunkpos51; if (!yy_Class()) goto l56; yyDo(yy_3_Primary, yybegin, yyend); goto l51;
  550. l56:; yypos= yypos51; yythunkpos= yythunkpos51; if (!yy_DOT()) goto l57; yyDo(yy_4_Primary, yybegin, yyend); goto l51;
  551. l57:; yypos= yypos51; yythunkpos= yythunkpos51; if (!yy_Action()) goto l58; yyDo(yy_5_Primary, yybegin, yyend); goto l51;
  552. l58:; yypos= yypos51; yythunkpos= yythunkpos51; if (!yy_BEGIN()) goto l59; yyDo(yy_6_Primary, yybegin, yyend); goto l51;
  553. l59:; yypos= yypos51; yythunkpos= yythunkpos51; if (!yy_END()) goto l50; yyDo(yy_7_Primary, yybegin, yyend);
  554. }
  555. l51:;
  556. yyprintf((stderr, " ok %s @ %s\n", "Primary", yybuf+yypos));
  557. return 1;
  558. l50:; yypos= yypos0; yythunkpos= yythunkpos0;
  559. yyprintf((stderr, " fail %s @ %s\n", "Primary", yybuf+yypos));
  560. return 0;
  561. }
  562. YY_RULE(int) yy_NOT()
  563. { int yypos0= yypos, yythunkpos0= yythunkpos;
  564. yyprintf((stderr, "%s\n", "NOT")); if (!yymatchChar('!')) goto l60; if (!yy_Spacing()) goto l60;
  565. yyprintf((stderr, " ok %s @ %s\n", "NOT", yybuf+yypos));
  566. return 1;
  567. l60:; yypos= yypos0; yythunkpos= yythunkpos0;
  568. yyprintf((stderr, " fail %s @ %s\n", "NOT", yybuf+yypos));
  569. return 0;
  570. }
  571. YY_RULE(int) yy_Suffix()
  572. { int yypos0= yypos, yythunkpos0= yythunkpos;
  573. yyprintf((stderr, "%s\n", "Suffix")); if (!yy_Primary()) goto l61;
  574. { int yypos62= yypos, yythunkpos62= yythunkpos;
  575. { int yypos64= yypos, yythunkpos64= yythunkpos; if (!yy_QUESTION()) goto l65; yyDo(yy_1_Suffix, yybegin, yyend); goto l64;
  576. l65:; yypos= yypos64; yythunkpos= yythunkpos64; if (!yy_STAR()) goto l66; yyDo(yy_2_Suffix, yybegin, yyend); goto l64;
  577. l66:; yypos= yypos64; yythunkpos= yythunkpos64; if (!yy_PLUS()) goto l62; yyDo(yy_3_Suffix, yybegin, yyend);
  578. }
  579. l64:; goto l63;
  580. l62:; yypos= yypos62; yythunkpos= yythunkpos62;
  581. }
  582. l63:;
  583. yyprintf((stderr, " ok %s @ %s\n", "Suffix", yybuf+yypos));
  584. return 1;
  585. l61:; yypos= yypos0; yythunkpos= yythunkpos0;
  586. yyprintf((stderr, " fail %s @ %s\n", "Suffix", yybuf+yypos));
  587. return 0;
  588. }
  589. YY_RULE(int) yy_Action()
  590. { int yypos0= yypos, yythunkpos0= yythunkpos;
  591. yyprintf((stderr, "%s\n", "Action")); if (!yymatchChar('{')) goto l67; yyText(yybegin, yyend); if (!(YY_BEGIN)) goto l67;
  592. l68:;
  593. { int yypos69= yypos, yythunkpos69= yythunkpos; if (!yymatchClass((unsigned char *)"\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\337\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377")) goto l69; goto l68;
  594. l69:; yypos= yypos69; yythunkpos= yythunkpos69;
  595. } yyText(yybegin, yyend); if (!(YY_END)) goto l67; if (!yymatchChar('}')) goto l67; if (!yy_Spacing()) goto l67;
  596. yyprintf((stderr, " ok %s @ %s\n", "Action", yybuf+yypos));
  597. return 1;
  598. l67:; yypos= yypos0; yythunkpos= yythunkpos0;
  599. yyprintf((stderr, " fail %s @ %s\n", "Action", yybuf+yypos));
  600. return 0;
  601. }
  602. YY_RULE(int) yy_AND()
  603. { int yypos0= yypos, yythunkpos0= yythunkpos;
  604. yyprintf((stderr, "%s\n", "AND")); if (!yymatchChar('&')) goto l70; if (!yy_Spacing()) goto l70;
  605. yyprintf((stderr, " ok %s @ %s\n", "AND", yybuf+yypos));
  606. return 1;
  607. l70:; yypos= yypos0; yythunkpos= yythunkpos0;
  608. yyprintf((stderr, " fail %s @ %s\n", "AND", yybuf+yypos));
  609. return 0;
  610. }
  611. YY_RULE(int) yy_Prefix()
  612. { int yypos0= yypos, yythunkpos0= yythunkpos;
  613. yyprintf((stderr, "%s\n", "Prefix"));
  614. { int yypos72= yypos, yythunkpos72= yythunkpos; if (!yy_AND()) goto l73; if (!yy_Action()) goto l73; yyDo(yy_1_Prefix, yybegin, yyend); goto l72;
  615. l73:; yypos= yypos72; yythunkpos= yythunkpos72; if (!yy_AND()) goto l74; if (!yy_Suffix()) goto l74; yyDo(yy_2_Prefix, yybegin, yyend); goto l72;
  616. l74:; yypos= yypos72; yythunkpos= yythunkpos72; if (!yy_NOT()) goto l75; if (!yy_Suffix()) goto l75; yyDo(yy_3_Prefix, yybegin, yyend); goto l72;
  617. l75:; yypos= yypos72; yythunkpos= yythunkpos72; if (!yy_Suffix()) goto l71;
  618. }
  619. l72:;
  620. yyprintf((stderr, " ok %s @ %s\n", "Prefix", yybuf+yypos));
  621. return 1;
  622. l71:; yypos= yypos0; yythunkpos= yythunkpos0;
  623. yyprintf((stderr, " fail %s @ %s\n", "Prefix", yybuf+yypos));
  624. return 0;
  625. }
  626. YY_RULE(int) yy_SLASH()
  627. { int yypos0= yypos, yythunkpos0= yythunkpos;
  628. yyprintf((stderr, "%s\n", "SLASH")); if (!yymatchChar('/')) goto l76; if (!yy_Spacing()) goto l76;
  629. yyprintf((stderr, " ok %s @ %s\n", "SLASH", yybuf+yypos));
  630. return 1;
  631. l76:; yypos= yypos0; yythunkpos= yythunkpos0;
  632. yyprintf((stderr, " fail %s @ %s\n", "SLASH", yybuf+yypos));
  633. return 0;
  634. }
  635. YY_RULE(int) yy_Sequence()
  636. { int yypos0= yypos, yythunkpos0= yythunkpos;
  637. yyprintf((stderr, "%s\n", "Sequence"));
  638. { int yypos78= yypos, yythunkpos78= yythunkpos; if (!yy_Prefix()) goto l79;
  639. l80:;
  640. { int yypos81= yypos, yythunkpos81= yythunkpos; if (!yy_Prefix()) goto l81; yyDo(yy_1_Sequence, yybegin, yyend); goto l80;
  641. l81:; yypos= yypos81; yythunkpos= yythunkpos81;
  642. } goto l78;
  643. l79:; yypos= yypos78; yythunkpos= yythunkpos78; yyDo(yy_2_Sequence, yybegin, yyend);
  644. }
  645. l78:;
  646. yyprintf((stderr, " ok %s @ %s\n", "Sequence", yybuf+yypos));
  647. return 1;
  648. l77:; yypos= yypos0; yythunkpos= yythunkpos0;
  649. yyprintf((stderr, " fail %s @ %s\n", "Sequence", yybuf+yypos));
  650. return 0;
  651. }
  652. YY_RULE(int) yy_Expression()
  653. { int yypos0= yypos, yythunkpos0= yythunkpos;
  654. yyprintf((stderr, "%s\n", "Expression")); if (!yy_Sequence()) goto l82;
  655. l83:;
  656. { int yypos84= yypos, yythunkpos84= yythunkpos; if (!yy_SLASH()) goto l84; if (!yy_Sequence()) goto l84; yyDo(yy_1_Expression, yybegin, yyend); goto l83;
  657. l84:; yypos= yypos84; yythunkpos= yythunkpos84;
  658. }
  659. yyprintf((stderr, " ok %s @ %s\n", "Expression", yybuf+yypos));
  660. return 1;
  661. l82:; yypos= yypos0; yythunkpos= yythunkpos0;
  662. yyprintf((stderr, " fail %s @ %s\n", "Expression", yybuf+yypos));
  663. return 0;
  664. }
  665. YY_RULE(int) yy_LEFTARROW()
  666. { int yypos0= yypos, yythunkpos0= yythunkpos;
  667. yyprintf((stderr, "%s\n", "LEFTARROW")); if (!yymatchString("<-")) goto l85; if (!yy_Spacing()) goto l85;
  668. yyprintf((stderr, " ok %s @ %s\n", "LEFTARROW", yybuf+yypos));
  669. return 1;
  670. l85:; yypos= yypos0; yythunkpos= yythunkpos0;
  671. yyprintf((stderr, " fail %s @ %s\n", "LEFTARROW", yybuf+yypos));
  672. return 0;
  673. }
  674. YY_RULE(int) yy_Identifier()
  675. { int yypos0= yypos, yythunkpos0= yythunkpos;
  676. yyprintf((stderr, "%s\n", "Identifier")); yyText(yybegin, yyend); if (!(YY_BEGIN)) goto l86; if (!yy_IdentStart()) goto l86;
  677. l87:;
  678. { int yypos88= yypos, yythunkpos88= yythunkpos; if (!yy_IdentCont()) goto l88; goto l87;
  679. l88:; yypos= yypos88; yythunkpos= yythunkpos88;
  680. } yyText(yybegin, yyend); if (!(YY_END)) goto l86; if (!yy_Spacing()) goto l86;
  681. yyprintf((stderr, " ok %s @ %s\n", "Identifier", yybuf+yypos));
  682. return 1;
  683. l86:; yypos= yypos0; yythunkpos= yythunkpos0;
  684. yyprintf((stderr, " fail %s @ %s\n", "Identifier", yybuf+yypos));
  685. return 0;
  686. }
  687. YY_RULE(int) yy_EndOfFile()
  688. { int yypos0= yypos, yythunkpos0= yythunkpos;
  689. yyprintf((stderr, "%s\n", "EndOfFile"));
  690. { int yypos90= yypos, yythunkpos90= yythunkpos; if (!yymatchDot()) goto l90; goto l89;
  691. l90:; yypos= yypos90; yythunkpos= yythunkpos90;
  692. }
  693. yyprintf((stderr, " ok %s @ %s\n", "EndOfFile", yybuf+yypos));
  694. return 1;
  695. l89:; yypos= yypos0; yythunkpos= yythunkpos0;
  696. yyprintf((stderr, " fail %s @ %s\n", "EndOfFile", yybuf+yypos));
  697. return 0;
  698. }
  699. YY_RULE(int) yy_Definition()
  700. { int yypos0= yypos, yythunkpos0= yythunkpos;
  701. yyprintf((stderr, "%s\n", "Definition")); if (!yy_Identifier()) goto l91; yyDo(yy_1_Definition, yybegin, yyend); if (!yy_LEFTARROW()) goto l91; if (!yy_Expression()) goto l91; yyDo(yy_2_Definition, yybegin, yyend); yyText(yybegin, yyend); if (!( YYACCEPT )) goto l91;
  702. yyprintf((stderr, " ok %s @ %s\n", "Definition", yybuf+yypos));
  703. return 1;
  704. l91:; yypos= yypos0; yythunkpos= yythunkpos0;
  705. yyprintf((stderr, " fail %s @ %s\n", "Definition", yybuf+yypos));
  706. return 0;
  707. }
  708. YY_RULE(int) yy_Spacing()
  709. {
  710. yyprintf((stderr, "%s\n", "Spacing"));
  711. l93:;
  712. { int yypos94= yypos, yythunkpos94= yythunkpos;
  713. { int yypos95= yypos, yythunkpos95= yythunkpos; if (!yy_Space()) goto l96; goto l95;
  714. l96:; yypos= yypos95; yythunkpos= yythunkpos95; if (!yy_Comment()) goto l94;
  715. }
  716. l95:; goto l93;
  717. l94:; yypos= yypos94; yythunkpos= yythunkpos94;
  718. }
  719. yyprintf((stderr, " ok %s @ %s\n", "Spacing", yybuf+yypos));
  720. return 1;
  721. }
  722. YY_RULE(int) yy_Grammar()
  723. { int yypos0= yypos, yythunkpos0= yythunkpos;
  724. yyprintf((stderr, "%s\n", "Grammar")); if (!yy_Spacing()) goto l97; if (!yy_Definition()) goto l97;
  725. l98:;
  726. { int yypos99= yypos, yythunkpos99= yythunkpos; if (!yy_Definition()) goto l99; goto l98;
  727. l99:; yypos= yypos99; yythunkpos= yythunkpos99;
  728. } if (!yy_EndOfFile()) goto l97;
  729. yyprintf((stderr, " ok %s @ %s\n", "Grammar", yybuf+yypos));
  730. return 1;
  731. l97:; yypos= yypos0; yythunkpos= yythunkpos0;
  732. yyprintf((stderr, " fail %s @ %s\n", "Grammar", yybuf+yypos));
  733. return 0;
  734. }
  735. #ifndef YY_PART
  736. typedef int (*yyrule)();
  737. YY_PARSE(int) YYPARSEFROM(yyrule yystart)
  738. {
  739. int yyok;
  740. if (!yybuflen)
  741. {
  742. yybuflen= 1024;
  743. yybuf= malloc(yybuflen);
  744. yytextlen= 1024;
  745. yytext= malloc(yytextlen);
  746. yythunkslen= 32;
  747. yythunks= malloc(sizeof(yythunk) * yythunkslen);
  748. yyvalslen= 32;
  749. yyvals= malloc(sizeof(YYSTYPE) * yyvalslen);
  750. yybegin= yyend= yypos= yylimit= yythunkpos= 0;
  751. }
  752. yybegin= yyend= yypos;
  753. yythunkpos= 0;
  754. yyval= yyvals;
  755. yyok= yystart();
  756. if (yyok) yyDone();
  757. yyCommit();
  758. return yyok;
  759. (void)yyrefill;
  760. (void)yymatchDot;
  761. (void)yymatchChar;
  762. (void)yymatchString;
  763. (void)yymatchClass;
  764. (void)yyDo;
  765. (void)yyText;
  766. (void)yyDone;
  767. (void)yyCommit;
  768. (void)yyAccept;
  769. (void)yyPush;
  770. (void)yyPop;
  771. (void)yySet;
  772. }
  773. YY_PARSE(int) YYPARSE(void)
  774. {
  775. return YYPARSEFROM(yy_Grammar);
  776. }
  777. #endif