LLgen.c 26 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400
  1. /* LLgen generated code from source LLgen.g */
  2. #include "Lpars.h"
  3. #define LL_LEXI scanner
  4. #define LLNOFIRSTS
  5. #if __STDC__ || __cplusplus
  6. #define LL_ANSI_C 1
  7. #endif
  8. #define LL_LEXI scanner
  9. /* $Id$ */
  10. #ifdef LL_DEBUG
  11. #include <assert.h>
  12. #include <stdio.h>
  13. #define LL_assert(x) assert(x)
  14. #else
  15. #define LL_assert(x) /* nothing */
  16. #endif
  17. extern int LLsymb;
  18. #define LL_SAFE(x) /* Nothing */
  19. #define LL_SSCANDONE(x) if (LLsymb != x) LLsafeerror(x)
  20. #define LL_SCANDONE(x) if (LLsymb != x) LLerror(x)
  21. #define LL_NOSCANDONE(x) LLscan(x)
  22. #ifdef LL_FASTER
  23. #define LLscan(x) if ((LLsymb = LL_LEXI()) != x) LLerror(x)
  24. #endif
  25. extern unsigned int LLscnt[];
  26. extern unsigned int LLtcnt[];
  27. extern int LLcsymb;
  28. #if LL_NON_CORR
  29. extern int LLstartsymb;
  30. #endif
  31. #define LLsdecr(d) {LL_assert(LLscnt[d] > 0); LLscnt[d]--;}
  32. #define LLtdecr(d) {LL_assert(LLtcnt[d] > 0); LLtcnt[d]--;}
  33. #define LLsincr(d) LLscnt[d]++
  34. #define LLtincr(d) LLtcnt[d]++
  35. #if LL_ANSI_C
  36. extern int LL_LEXI(void);
  37. extern void LLread(void);
  38. extern int LLskip(void);
  39. extern int LLnext(int);
  40. extern void LLerror(int);
  41. extern void LLsafeerror(int);
  42. extern void LLnewlevel(unsigned int *);
  43. extern void LLoldlevel(unsigned int *);
  44. #ifndef LL_FASTER
  45. extern void LLscan(int);
  46. #endif
  47. #ifndef LLNOFIRSTS
  48. extern int LLfirst(int, int);
  49. #endif
  50. #if LL_NON_CORR
  51. extern void LLnc_recover(void);
  52. #endif
  53. #else /* not LL_ANSI_C */
  54. extern LLread();
  55. extern int LLskip();
  56. extern int LLnext();
  57. extern LLerror();
  58. extern LLsafeerror();
  59. extern LLnewlevel();
  60. extern LLoldlevel();
  61. #ifndef LL_FASTER
  62. extern LLscan();
  63. #endif
  64. #ifndef LLNOFIRSTS
  65. extern int LLfirst();
  66. #endif
  67. #if LL_NON_CORR
  68. extern LLnc_recover();
  69. #endif
  70. #endif /* not LL_ANSI_C */
  71. # line 20 "LLgen.g"
  72. # include <stdlib.h>
  73. # include <string.h>
  74. # include "types.h"
  75. # include "io.h"
  76. # include "extern.h"
  77. # include "assert.h"
  78. # include "cclass.h"
  79. #include "LLgen.h"
  80. static int acount; /* count #of global actions */
  81. static p_term t_list;
  82. static int t_cnt;
  83. static p_gram alt_table;
  84. static int n_alts;
  85. static int max_alts;
  86. #define ALTINCR 32
  87. static p_gram rule_table;
  88. static int n_rules;
  89. static int max_rules;
  90. #define RULEINCR 32
  91. /* Here are defined : */
  92. /* and of course LLparse() */
  93. STATIC void newnorder(int index) {
  94. static int porder;
  95. if (norder != -1) {
  96. nonterms[porder].n_next = index;
  97. }
  98. else norder = index;
  99. porder = index;
  100. nonterms[porder].n_next = -1;
  101. }
  102. STATIC void newtorder(int index) {
  103. static int porder;
  104. if (torder != -1) {
  105. tokens[porder].t_next = index;
  106. }
  107. else torder = index;
  108. porder = index;
  109. tokens[porder].t_next = -1;
  110. }
  111. void p_init()
  112. {
  113. alt_table = (p_gram )alloc(ALTINCR*sizeof(t_gram));
  114. n_alts = 0;
  115. max_alts = ALTINCR;
  116. rule_table = (p_gram )alloc(RULEINCR*sizeof(t_gram));
  117. n_rules = 0;
  118. max_rules = RULEINCR;
  119. }
  120. #if LL_ANSI_C
  121. static void LL1_def(void);
  122. static void LL2_rule(void);
  123. static void LL3_listel(void);
  124. static void LL4_firsts(void);
  125. static void LL5_productions(
  126. # line 233 "LLgen.g"
  127. p_gram *p) ;
  128. static void LL6_simpleproduction(
  129. # line 318 "LLgen.g"
  130. p_gram *p ,register int *conflres) ;
  131. static void LL7_elem(
  132. # line 465 "LLgen.g"
  133. register p_gram pres) ;
  134. static void LL8_repeats(
  135. # line 587 "LLgen.g"
  136. int *kind ,int *cnt) ;
  137. static void LL9_number(
  138. # line 604 "LLgen.g"
  139. int *t) ;
  140. #else
  141. static LL1_def();
  142. static LL2_rule();
  143. static LL3_listel();
  144. static LL4_firsts();
  145. static LL5_productions();
  146. static LL6_simpleproduction();
  147. static LL7_elem();
  148. static LL8_repeats();
  149. static LL9_number();
  150. #endif
  151. #if LL_ANSI_C
  152. void
  153. #endif
  154. LL0_spec(
  155. #if LL_ANSI_C
  156. void
  157. #endif
  158. ) {
  159. LLsincr(0);
  160. # line 84 "LLgen.g"
  161. { acount = 0; p_init(); }
  162. for (;;) {
  163. goto L_1;
  164. L_1 : {switch(LLcsymb) {
  165. case /* EOFILE */ 0 : ;
  166. break;
  167. default:{int LL_1=LLnext(0);
  168. ;if (!LL_1) {
  169. break;
  170. }
  171. else if (LL_1 & 1) goto L_1;}
  172. case /* C_IDENT */ 2 : ;
  173. case /* C_ACTION */ 7 : ;
  174. case /* C_TOKEN */ 8 : ;
  175. case /* C_START */ 9 : ;
  176. case /* C_FIRST */ 13 : ;
  177. case /* C_LEXICAL */ 14 : ;
  178. case /* C_PREFIX */ 15 : ;
  179. case /* C_ONERROR */ 16 : ;
  180. LL1_def();
  181. LLread();
  182. continue;
  183. }
  184. }
  185. LLsdecr(0);
  186. break;
  187. }
  188. # line 86 "LLgen.g"
  189. { /*
  190. * Put an endmarker in temporary file
  191. */
  192. putc('\0', fact);
  193. putc('\0', fact);
  194. free((p_mem) rule_table);
  195. free((p_mem) alt_table);
  196. }
  197. }
  198. static
  199. #if LL_ANSI_C
  200. void
  201. #endif
  202. LL1_def(
  203. #if LL_ANSI_C
  204. void
  205. #endif
  206. ) {
  207. # line 96 "LLgen.g"
  208. register string p;
  209. switch(LLcsymb) {
  210. case /* C_IDENT */ 2 : ;
  211. LL2_rule();
  212. break;
  213. case /* C_TOKEN */ 8 : ;
  214. LLtincr(23);
  215. LLtincr(24);
  216. LL_SAFE(C_TOKEN);
  217. LL3_listel();
  218. LLread();
  219. for (;;) {
  220. goto L_4;
  221. L_4 : {switch(LLcsymb) {
  222. case /* ';' */ 24 : ;
  223. break;
  224. default:{int LL_2=LLnext(44);
  225. ;if (!LL_2) {
  226. break;
  227. }
  228. else if (LL_2 & 1) goto L_4;}
  229. case /* ',' */ 23 : ;
  230. LL_SAFE(',');
  231. LL3_listel();
  232. LLread();
  233. continue;
  234. }
  235. }
  236. LLtdecr(23);
  237. break;
  238. }
  239. LLtdecr(24);
  240. LL_SSCANDONE(';');
  241. break;
  242. case /* C_START */ 9 : ;
  243. LLtincr(23);
  244. LLtincr(2);
  245. LLtincr(24);
  246. LL_SAFE(C_START);
  247. LL_NOSCANDONE(C_IDENT);
  248. # line 106 "LLgen.g"
  249. { p = store(lextoken.t_string); }
  250. LLtdecr(23);
  251. LL_NOSCANDONE(',');
  252. LLtdecr(2);
  253. LL_NOSCANDONE(C_IDENT);
  254. # line 111 "LLgen.g"
  255. { /*
  256. * Put the declaration in the list
  257. * of start symbols
  258. */
  259. register p_gram temp;
  260. register p_start ff;
  261. temp = search(NONTERM,lextoken.t_string,BOTH);
  262. ff = (p_start) alloc(sizeof(t_start));
  263. ff->ff_nont = g_getcont(temp);
  264. ff->ff_name = p;
  265. ff->ff_next = start;
  266. start = ff;
  267. while ((ff = ff->ff_next)) {
  268. if (! strcmp(p, ff->ff_name)) {
  269. error(linecount, "\"%s\" already used in a %%start", p, NULL);
  270. break;
  271. }
  272. }
  273. }
  274. LLtdecr(24);
  275. LL_NOSCANDONE(';');
  276. break;
  277. case /* C_LEXICAL */ 14 : ;
  278. LLtincr(24);
  279. LL_SAFE(C_LEXICAL);
  280. LL_NOSCANDONE(C_IDENT);
  281. # line 137 "LLgen.g"
  282. { if (!lexical) {
  283. lexical = store(lextoken.t_string);
  284. }
  285. else error(linecount,"Duplicate %%lexical", NULL, NULL);
  286. }
  287. LLtdecr(24);
  288. LL_NOSCANDONE(';');
  289. break;
  290. case /* C_PREFIX */ 15 : ;
  291. LLtincr(24);
  292. LL_SAFE(C_PREFIX);
  293. LL_NOSCANDONE(C_IDENT);
  294. # line 147 "LLgen.g"
  295. { if (!prefix) {
  296. prefix = store(lextoken.t_string);
  297. if (strlen(prefix) > 6) {
  298. error(linecount,
  299. "%%prefix too long", NULL, NULL);
  300. prefix[6] = 0;
  301. }
  302. }
  303. else error(linecount,"Duplicate %%prefix", NULL, NULL);
  304. }
  305. LLtdecr(24);
  306. LL_NOSCANDONE(';');
  307. break;
  308. case /* C_ONERROR */ 16 : ;
  309. LLtincr(24);
  310. LL_SAFE(C_ONERROR);
  311. LL_NOSCANDONE(C_IDENT);
  312. # line 159 "LLgen.g"
  313. {
  314. #ifdef NON_CORRECTING
  315. if (non_corr) {
  316. warning(linecount, "%%onerror conflicts with -n option", NULL, NULL);
  317. }
  318. else
  319. #endif
  320. if (! onerror) {
  321. onerror = store(lextoken.t_string);
  322. }
  323. else error(linecount,"Duplicate %%onerror", NULL, NULL);
  324. }
  325. LLtdecr(24);
  326. LL_NOSCANDONE(';');
  327. break;
  328. default:
  329. LL_SSCANDONE(C_ACTION);
  330. # line 172 "LLgen.g"
  331. { acount++; }
  332. break;
  333. case /* C_FIRST */ 13 : ;
  334. LL4_firsts();
  335. break;
  336. }
  337. }
  338. static
  339. #if LL_ANSI_C
  340. void
  341. #endif
  342. LL3_listel(
  343. #if LL_ANSI_C
  344. void
  345. #endif
  346. ) {
  347. LL_NOSCANDONE(C_IDENT);
  348. # line 182 "LLgen.g"
  349. { p_gram temp = search(TERMINAL,lextoken.t_string,ENTERING);
  350. newtorder(g_getcont(temp));
  351. tokens[g_getcont(temp)].t_lineno = linecount;
  352. }
  353. }
  354. static
  355. #if LL_ANSI_C
  356. void
  357. #endif
  358. LL2_rule(
  359. #if LL_ANSI_C
  360. void
  361. #endif
  362. ) {
  363. # line 188 "LLgen.g"
  364. register p_nont p;
  365. p_gram rr;
  366. register p_gram temp;
  367. LLtincr(6);
  368. LLtincr(7);
  369. LLtincr(25);
  370. LLsincr(1);
  371. LLtincr(24);
  372. LL_SAFE(C_IDENT);
  373. # line 195 "LLgen.g"
  374. { temp = search(NONTERM,lextoken.t_string,BOTH);
  375. p = &nonterms[g_getcont(temp)];
  376. if (p->n_rule) {
  377. error(linecount, "Nonterminal %s already defined", lextoken.t_string, NULL);
  378. }
  379. /*
  380. * Remember the order in which the nonterminals
  381. * were defined. Code must be generated in that
  382. * order to keep track with the actions on the
  383. * temporary file
  384. */
  385. newnorder(p - nonterms);
  386. p->n_count = acount;
  387. acount = 0;
  388. p->n_lineno = linecount;
  389. p->n_off = ftell(fact);
  390. }
  391. LLread();
  392. goto L_1;
  393. L_1 : {switch(LLcsymb) {
  394. case /* C_ACTION */ 7 : ;
  395. case /* ':' */ 25 : ;
  396. LLtdecr(6);
  397. break;
  398. default:{int LL_3=LLnext(262);
  399. ;if (!LL_3) {
  400. LLtdecr(6);
  401. break;
  402. }
  403. else if (LL_3 & 1) goto L_1;}
  404. case /* C_PARAMS */ 6 : ;
  405. LLtdecr(6);
  406. LL_SAFE(C_PARAMS);
  407. # line 212 "LLgen.g"
  408. { if (lextoken.t_num > 0) {
  409. p->n_flags |= PARAMS;
  410. if (lextoken.t_num > 15) {
  411. error(linecount,"Too many parameters", NULL, NULL);
  412. }
  413. else setntparams(p,lextoken.t_num);
  414. }
  415. }
  416. LLread();
  417. }
  418. }
  419. goto L_2;
  420. L_2 : {switch(LLcsymb) {
  421. case /* ':' */ 25 : ;
  422. LLtdecr(7);
  423. break;
  424. default:{int LL_4=LLnext(263);
  425. ;if (!LL_4) {
  426. LLtdecr(7);
  427. break;
  428. }
  429. else if (LL_4 & 1) goto L_2;}
  430. case /* C_ACTION */ 7 : ;
  431. LLtdecr(7);
  432. LL_SAFE(C_ACTION);
  433. # line 221 "LLgen.g"
  434. { p->n_flags |= LOCALS; }
  435. LLread();
  436. }
  437. }
  438. LLtdecr(25);
  439. LL_SCANDONE(':');
  440. # line 223 "LLgen.g"
  441. { in_production = 1; }
  442. LLread();
  443. LLsdecr(1);
  444. LL5_productions(
  445. # line 224 "LLgen.g"
  446. &rr);
  447. LLtdecr(24);
  448. LL_SCANDONE(';');
  449. # line 225 "LLgen.g"
  450. { in_production = 0; }
  451. # line 230 "LLgen.g"
  452. { nonterms[g_getcont(temp)].n_rule = rr;}
  453. }
  454. static
  455. #if LL_ANSI_C
  456. void
  457. #endif
  458. LL5_productions(
  459. #if LL_ANSI_C
  460. # line 233 "LLgen.g"
  461. p_gram *p)
  462. #else
  463. # line 233 "LLgen.g"
  464. p) p_gram *p;
  465. #endif
  466. {
  467. # line 237 "LLgen.g"
  468. p_gram prod;
  469. int conflres = 0;
  470. int t = 0;
  471. int haddefault = 0;
  472. int altcnt = 0;
  473. int o_lc, n_lc;
  474. LLtincr(26);
  475. # line 244 "LLgen.g"
  476. { o_lc = linecount; }
  477. LL6_simpleproduction(
  478. # line 245 "LLgen.g"
  479. p,&conflres);
  480. # line 246 "LLgen.g"
  481. { if (conflres & DEF) haddefault = 1; }
  482. goto L_2; /* so that the label is used for certain */
  483. L_2: ;
  484. switch(LLcsymb) {
  485. case /* '|' */ 26 : ;
  486. LLtdecr(26);
  487. LLsincr(1);
  488. LLsdecr(1);
  489. LLtincr(26);
  490. for (;;) {
  491. LL_SAFE('|');
  492. # line 248 "LLgen.g"
  493. { n_lc = linecount; }
  494. LLread();
  495. LL6_simpleproduction(
  496. # line 249 "LLgen.g"
  497. &prod,&t);
  498. # line 250 "LLgen.g"
  499. { if (n_alts >= max_alts-2) {
  500. alt_table = (p_gram ) ralloc(
  501. (p_mem) alt_table,
  502. (unsigned)(max_alts+=ALTINCR)*sizeof(t_gram));
  503. }
  504. if (t & DEF) {
  505. if (haddefault) {
  506. error(n_lc,
  507. "More than one %%default in alternation", NULL, NULL);
  508. }
  509. haddefault = 1;
  510. }
  511. mkalt(*p,conflres,o_lc,&alt_table[n_alts++]);
  512. altcnt++;
  513. o_lc = n_lc;
  514. conflres = t;
  515. t = 0;
  516. *p = prod;
  517. }
  518. goto L_4;
  519. L_4 : {switch(LLcsymb) {
  520. case /* ';' */ 24 : ;
  521. case /* ']' */ 28 : ;
  522. break;
  523. default:{int LL_5=LLnext(124);
  524. ;if (!LL_5) {
  525. break;
  526. }
  527. else if (LL_5 & 1) goto L_4;}
  528. case /* '|' */ 26 : ;
  529. continue;
  530. }
  531. }
  532. LLtdecr(26);
  533. break;
  534. }
  535. # line 269 "LLgen.g"
  536. { if (conflres & (COND|PREFERING|AVOIDING)) {
  537. error(n_lc,
  538. "Resolver on last alternative not allowed", NULL, NULL);
  539. }
  540. mkalt(*p,conflres,n_lc,&alt_table[n_alts++]);
  541. altcnt++;
  542. g_settype((&alt_table[n_alts]),EORULE);
  543. *p = copyrule(&alt_table[n_alts-altcnt],altcnt+1);
  544. }
  545. break;
  546. case /* ';' */ 24 : ;
  547. case /* ']' */ 28 : ;
  548. goto L_3;
  549. L_3: ;
  550. LLtdecr(26);
  551. # line 279 "LLgen.g"
  552. { if (conflres & (COND|PREFERING|AVOIDING)) {
  553. error(o_lc,
  554. "No alternation conflict resolver allowed here", NULL, NULL);
  555. }
  556. /*
  557. if (conflres & DEF) {
  558. error(o_lc,
  559. "No %%default allowed here", NULL, NULL);
  560. }
  561. */
  562. }
  563. break;
  564. default: if (LLskip()) goto L_2;
  565. goto L_3;
  566. }
  567. # line 291 "LLgen.g"
  568. { n_alts -= altcnt; }
  569. }
  570. # line 293 "LLgen.g"
  571. STATIC void mkalt(p_gram prod, int condition, int lc, p_gram res) {
  572. /*
  573. * Create an alternation and initialise it.
  574. */
  575. register p_link l;
  576. static p_link list;
  577. static int cnt;
  578. if (! cnt) {
  579. cnt = 50;
  580. list = (p_link) alloc(50 * sizeof(t_link));
  581. }
  582. cnt--;
  583. l = list++;
  584. l->l_rule = prod;
  585. l->l_flag = condition;
  586. g_setlink(res,l);
  587. g_settype(res,ALTERNATION);
  588. res->g_lineno = lc;
  589. nalts++;
  590. }
  591. static
  592. #if LL_ANSI_C
  593. void
  594. #endif
  595. LL6_simpleproduction(
  596. #if LL_ANSI_C
  597. # line 318 "LLgen.g"
  598. p_gram *p ,register int *conflres)
  599. #else
  600. # line 318 "LLgen.g"
  601. p,conflres) p_gram *p; register int *conflres;
  602. #endif
  603. {
  604. # line 319 "LLgen.g"
  605. t_gram elem;
  606. int elmcnt = 0;
  607. int cnt, kind;
  608. int termdeleted = 0;
  609. LLtincr(19);
  610. LLsincr(2);
  611. LLtincr(22);
  612. LLsincr(3);
  613. goto L_1;
  614. L_1 : {switch(LLcsymb) {
  615. case /* C_IDENT */ 2 : ;
  616. case /* C_LITERAL */ 4 : ;
  617. case /* C_ACTION */ 7 : ;
  618. case /* C_IF */ 10 : ;
  619. case /* C_AVOID */ 17 : ;
  620. case /* C_PREFER */ 18 : ;
  621. case /* C_SUBSTART */ 20 : ;
  622. case /* C_ERRONEOUS */ 21 : ;
  623. case /* C_ILLEGAL */ 22 : ;
  624. case /* ';' */ 24 : ;
  625. case /* '|' */ 26 : ;
  626. case /* '[' */ 27 : ;
  627. case /* ']' */ 28 : ;
  628. LLtdecr(19);
  629. break;
  630. default:{int LL_6=LLnext(275);
  631. ;if (!LL_6) {
  632. LLtdecr(19);
  633. break;
  634. }
  635. else if (LL_6 & 1) goto L_1;}
  636. case /* C_DEFAULT */ 19 : ;
  637. LLtdecr(19);
  638. LL_SAFE(C_DEFAULT);
  639. # line 324 "LLgen.g"
  640. { *conflres |= DEF; }
  641. LLread();
  642. }
  643. }
  644. goto L_2;
  645. L_2 : {switch(LLcsymb) {
  646. case /* C_IDENT */ 2 : ;
  647. case /* C_LITERAL */ 4 : ;
  648. case /* C_ACTION */ 7 : ;
  649. case /* C_SUBSTART */ 20 : ;
  650. case /* C_ERRONEOUS */ 21 : ;
  651. case /* C_ILLEGAL */ 22 : ;
  652. case /* ';' */ 24 : ;
  653. case /* '|' */ 26 : ;
  654. case /* '[' */ 27 : ;
  655. case /* ']' */ 28 : ;
  656. LLsdecr(2);
  657. break;
  658. default:{int LL_7=LLnext(-8);
  659. ;if (!LL_7) {
  660. LLsdecr(2);
  661. break;
  662. }
  663. else if (LL_7 & 1) goto L_2;}
  664. case /* C_IF */ 10 : ;
  665. case /* C_AVOID */ 17 : ;
  666. case /* C_PREFER */ 18 : ;
  667. LLsdecr(2);
  668. switch(LLcsymb) {
  669. case /* C_IF */ 10 : ;
  670. LL_SAFE(C_IF);
  671. LL_NOSCANDONE(C_EXPR);
  672. # line 330 "LLgen.g"
  673. { *conflres |= COND; }
  674. break;
  675. default:
  676. LL_SAFE(C_PREFER);
  677. # line 331 "LLgen.g"
  678. { *conflres |= PREFERING; }
  679. break;
  680. case /* C_AVOID */ 17 : ;
  681. LL_SAFE(C_AVOID);
  682. # line 332 "LLgen.g"
  683. { *conflres |= AVOIDING; }
  684. break;
  685. }
  686. LLread();
  687. }
  688. }
  689. goto L_6;
  690. L_6 : {switch(LLcsymb) {
  691. case /* C_IDENT */ 2 : ;
  692. case /* C_LITERAL */ 4 : ;
  693. case /* C_ACTION */ 7 : ;
  694. case /* C_SUBSTART */ 20 : ;
  695. case /* C_ERRONEOUS */ 21 : ;
  696. case /* ';' */ 24 : ;
  697. case /* '|' */ 26 : ;
  698. case /* '[' */ 27 : ;
  699. case /* ']' */ 28 : ;
  700. LLtdecr(22);
  701. break;
  702. default:{int LL_8=LLnext(278);
  703. ;if (!LL_8) {
  704. LLtdecr(22);
  705. break;
  706. }
  707. else if (LL_8 & 1) goto L_6;}
  708. case /* C_ILLEGAL */ 22 : ;
  709. LLtdecr(22);
  710. LL_SAFE(C_ILLEGAL);
  711. # line 334 "LLgen.g"
  712. {
  713. #ifdef NON_CORRECTING
  714. if (n_rules >= max_rules-2) {
  715. rule_table = (p_gram) ralloc(
  716. (p_mem) rule_table,
  717. (unsigned)(max_rules+=RULEINCR)*sizeof(t_gram));
  718. }
  719. elmcnt++;
  720. rule_table[n_rules++] =
  721. *search(TERMINAL, "LLILLEGAL", BOTH);
  722. if (*conflres & DEF) {
  723. error(linecount, "%%illegal not allowed in %%default rule", NULL, NULL);
  724. }
  725. #endif
  726. }
  727. LLread();
  728. }
  729. }
  730. for (;;) {
  731. goto L_7;
  732. L_7 : {switch(LLcsymb) {
  733. case /* ';' */ 24 : ;
  734. case /* '|' */ 26 : ;
  735. case /* ']' */ 28 : ;
  736. break;
  737. default:{int LL_9=LLnext(-12);
  738. ;if (!LL_9) {
  739. break;
  740. }
  741. else if (LL_9 & 1) goto L_7;}
  742. case /* C_IDENT */ 2 : ;
  743. case /* C_NUMBER */ 3 : ;
  744. case /* C_LITERAL */ 4 : ;
  745. case /* C_ACTION */ 7 : ;
  746. case /* C_SUBSTART */ 20 : ;
  747. case /* C_ERRONEOUS */ 21 : ;
  748. case /* '[' */ 27 : ;
  749. case /* '?' */ 29 : ;
  750. case /* '*' */ 30 : ;
  751. case /* '+' */ 31 : ;
  752. LLsincr(4);
  753. LL7_elem(
  754. # line 350 "LLgen.g"
  755. &elem);
  756. # line 351 "LLgen.g"
  757. { if (n_rules >= max_rules-2) {
  758. rule_table = (p_gram) ralloc(
  759. (p_mem) rule_table,
  760. (unsigned)(max_rules+=RULEINCR)*sizeof(t_gram));
  761. }
  762. kind = FIXED;
  763. cnt = 0;
  764. }
  765. goto L_9; /* so that the label is used for certain */
  766. L_9: ;
  767. switch(LLcsymb) {
  768. case /* C_NUMBER */ 3 : ;
  769. case /* '?' */ 29 : ;
  770. case /* '*' */ 30 : ;
  771. case /* '+' */ 31 : ;
  772. LLsdecr(4);
  773. LL8_repeats(
  774. # line 359 "LLgen.g"
  775. &kind, &cnt);
  776. # line 360 "LLgen.g"
  777. { if (g_gettype(&elem) != TERM) {
  778. rule_table[n_rules] = elem;
  779. g_settype((&rule_table[n_rules+1]),EORULE);
  780. mkterm(copyrule(&rule_table[n_rules],2),
  781. 0,
  782. elem.g_lineno,
  783. &elem);
  784. }
  785. }
  786. break;
  787. case /* C_IDENT */ 2 : ;
  788. case /* C_LITERAL */ 4 : ;
  789. case /* C_ACTION */ 7 : ;
  790. case /* C_SUBSTART */ 20 : ;
  791. case /* C_ERRONEOUS */ 21 : ;
  792. case /* ';' */ 24 : ;
  793. case /* '|' */ 26 : ;
  794. case /* '[' */ 27 : ;
  795. case /* ']' */ 28 : ;
  796. goto L_10;
  797. L_10: ;
  798. LLsdecr(4);
  799. # line 370 "LLgen.g"
  800. { if (g_gettype(&elem) == TERM) {
  801. register p_term q = g_getterm(&elem);
  802. if (! (q->t_flags & RESOLVER) &&
  803. g_gettype(q->t_rule) != ALTERNATION &&
  804. g_gettype(q->t_rule) != EORULE) {
  805. while (g_gettype(q->t_rule) != EORULE) {
  806. rule_table[n_rules++] = *q->t_rule++;
  807. elmcnt++;
  808. if (n_rules >= max_rules-2) {
  809. rule_table = (p_gram) ralloc(
  810. (p_mem) rule_table,
  811. (unsigned)(max_rules+=RULEINCR)*sizeof(t_gram));
  812. }
  813. }
  814. elem = *--(q->t_rule);
  815. n_rules--;
  816. elmcnt--;
  817. if (q == t_list - 1) {
  818. t_list--;
  819. nterms--;
  820. t_cnt++;
  821. }
  822. termdeleted = 1;
  823. }
  824. }
  825. }
  826. break;
  827. default: if (LLskip()) goto L_9;
  828. goto L_10;
  829. }
  830. # line 397 "LLgen.g"
  831. { if (!termdeleted && g_gettype(&elem) == TERM) {
  832. register p_term q;
  833. q = g_getterm(&elem);
  834. r_setkind(q,kind);
  835. r_setnum(q,cnt);
  836. if ((q->t_flags & RESOLVER) &&
  837. (kind == PLUS || kind == FIXED)) {
  838. error(linecount,
  839. "%%while not allowed in this term", NULL, NULL);
  840. }
  841. /*
  842. * A persistent fixed term is the same
  843. * as a non-persistent fixed term.
  844. * Should we complain?
  845. if ((q->t_flags & PERSISTENT) &&
  846. kind == FIXED) {
  847. error(linecount,
  848. "Illegal %%persistent", NULL, NULL);
  849. }
  850. */
  851. }
  852. termdeleted = 0;
  853. elmcnt++;
  854. rule_table[n_rules++] = elem;
  855. }
  856. continue;
  857. }
  858. }
  859. LLsdecr(3);
  860. break;
  861. }
  862. # line 423 "LLgen.g"
  863. { register p_term q;
  864. g_settype((&rule_table[n_rules]),EORULE);
  865. *p = 0;
  866. n_rules -= elmcnt;
  867. if (g_gettype(&rule_table[n_rules]) == TERM &&
  868. elmcnt == 1) {
  869. q = g_getterm(&rule_table[n_rules]);
  870. if (r_getkind(q) == FIXED &&
  871. r_getnum(q) == 0) {
  872. *p = q->t_rule;
  873. }
  874. }
  875. if (!*p) *p = copyrule(&rule_table[n_rules],
  876. elmcnt+1);
  877. }
  878. }
  879. # line 440 "LLgen.g"
  880. STATIC void mkterm(p_gram prod, int flags, int lc, p_gram result) {
  881. /*
  882. * Create a term, initialise it and return
  883. * a grammar element containing it
  884. */
  885. register p_term q;
  886. if (! t_cnt) {
  887. t_cnt = 50;
  888. t_list = (p_term) alloc(50 * sizeof(t_term));
  889. }
  890. t_cnt--;
  891. q = t_list++;
  892. q->t_rule = prod;
  893. q->t_contains = 0;
  894. q->t_flags = flags;
  895. g_settype(result,TERM);
  896. g_setterm(result,q);
  897. result->g_lineno = lc;
  898. nterms++;
  899. }
  900. static
  901. #if LL_ANSI_C
  902. void
  903. #endif
  904. LL7_elem(
  905. #if LL_ANSI_C
  906. # line 465 "LLgen.g"
  907. register p_gram pres)
  908. #else
  909. # line 465 "LLgen.g"
  910. pres) register p_gram pres;
  911. #endif
  912. {
  913. # line 466 "LLgen.g"
  914. register int t = 0;
  915. p_gram p1;
  916. int ln;
  917. p_gram pe;
  918. #ifdef NON_CORRECTING
  919. int erroneous = 0;
  920. #endif
  921. switch(LLcsymb) {
  922. case /* '[' */ 27 : ;
  923. LLtincr(11);
  924. LLtincr(12);
  925. LLsincr(1);
  926. LLtincr(28);
  927. LL_SAFE('[');
  928. # line 474 "LLgen.g"
  929. { ln = linecount; }
  930. LLread();
  931. goto L_4;
  932. L_4 : {switch(LLcsymb) {
  933. case /* C_IDENT */ 2 : ;
  934. case /* C_LITERAL */ 4 : ;
  935. case /* C_ACTION */ 7 : ;
  936. case /* C_IF */ 10 : ;
  937. case /* C_PERSISTENT */ 12 : ;
  938. case /* C_AVOID */ 17 : ;
  939. case /* C_PREFER */ 18 : ;
  940. case /* C_DEFAULT */ 19 : ;
  941. case /* C_SUBSTART */ 20 : ;
  942. case /* C_ERRONEOUS */ 21 : ;
  943. case /* C_ILLEGAL */ 22 : ;
  944. case /* '|' */ 26 : ;
  945. case /* '[' */ 27 : ;
  946. case /* ']' */ 28 : ;
  947. LLtdecr(11);
  948. break;
  949. default:{int LL_10=LLnext(267);
  950. ;if (!LL_10) {
  951. LLtdecr(11);
  952. break;
  953. }
  954. else if (LL_10 & 1) goto L_4;}
  955. case /* C_WHILE */ 11 : ;
  956. LLtdecr(11);
  957. LL_SAFE(C_WHILE);
  958. LL_NOSCANDONE(C_EXPR);
  959. # line 475 "LLgen.g"
  960. { t |= RESOLVER; }
  961. LLread();
  962. }
  963. }
  964. goto L_5;
  965. L_5 : {switch(LLcsymb) {
  966. case /* C_IDENT */ 2 : ;
  967. case /* C_LITERAL */ 4 : ;
  968. case /* C_ACTION */ 7 : ;
  969. case /* C_IF */ 10 : ;
  970. case /* C_AVOID */ 17 : ;
  971. case /* C_PREFER */ 18 : ;
  972. case /* C_DEFAULT */ 19 : ;
  973. case /* C_SUBSTART */ 20 : ;
  974. case /* C_ERRONEOUS */ 21 : ;
  975. case /* C_ILLEGAL */ 22 : ;
  976. case /* '|' */ 26 : ;
  977. case /* '[' */ 27 : ;
  978. case /* ']' */ 28 : ;
  979. LLtdecr(12);
  980. break;
  981. default:{int LL_11=LLnext(268);
  982. ;if (!LL_11) {
  983. LLtdecr(12);
  984. break;
  985. }
  986. else if (LL_11 & 1) goto L_5;}
  987. case /* C_PERSISTENT */ 12 : ;
  988. LLtdecr(12);
  989. LL_SAFE(C_PERSISTENT);
  990. # line 477 "LLgen.g"
  991. { t |= PERSISTENT; }
  992. LLread();
  993. }
  994. }
  995. LLsdecr(1);
  996. LL5_productions(
  997. # line 479 "LLgen.g"
  998. &p1);
  999. LLtdecr(28);
  1000. LL_SCANDONE(']');
  1001. # line 480 "LLgen.g"
  1002. {
  1003. mkterm(p1,t,ln,pres);
  1004. }
  1005. LLread();
  1006. break;
  1007. case /* C_IDENT */ 2 : ;
  1008. case /* C_LITERAL */ 4 : ;
  1009. case /* C_ERRONEOUS */ 21 : ;
  1010. LLsincr(5);
  1011. goto L_6;
  1012. L_6 : {switch(LLcsymb) {
  1013. default:
  1014. break;
  1015. case /* C_ERRONEOUS */ 21 : ;
  1016. LL_SAFE(C_ERRONEOUS);
  1017. # line 484 "LLgen.g"
  1018. {
  1019. #ifdef NON_CORRECTING
  1020. erroneous = 1;
  1021. #endif
  1022. }
  1023. LLread();
  1024. }
  1025. }
  1026. goto L_8; /* so that the label is used for certain */
  1027. L_8: ;
  1028. switch(LLcsymb) {
  1029. case /* C_IDENT */ 2 : ;
  1030. goto L_9;
  1031. L_9: ;
  1032. LLsdecr(5);
  1033. LLtincr(6);
  1034. LL_SSCANDONE(C_IDENT);
  1035. # line 492 "LLgen.g"
  1036. { pe = search(UNKNOWN,lextoken.t_string,BOTH);
  1037. *pres = *pe;
  1038. #ifdef NON_CORRECTING
  1039. if (erroneous) {
  1040. if (g_gettype(pres) != TERMINAL){
  1041. warning(linecount,
  1042. "Erroneous only allowed on terminal", NULL, NULL);
  1043. erroneous = 0;
  1044. }
  1045. else
  1046. pres->g_erroneous = 1;
  1047. }
  1048. #endif
  1049. }
  1050. LLread();
  1051. goto L_10;
  1052. L_10 : {switch(LLcsymb) {
  1053. case /* C_IDENT */ 2 : ;
  1054. case /* C_NUMBER */ 3 : ;
  1055. case /* C_LITERAL */ 4 : ;
  1056. case /* C_ACTION */ 7 : ;
  1057. case /* C_SUBSTART */ 20 : ;
  1058. case /* C_ERRONEOUS */ 21 : ;
  1059. case /* ';' */ 24 : ;
  1060. case /* '|' */ 26 : ;
  1061. case /* '[' */ 27 : ;
  1062. case /* ']' */ 28 : ;
  1063. case /* '?' */ 29 : ;
  1064. case /* '*' */ 30 : ;
  1065. case /* '+' */ 31 : ;
  1066. LLtdecr(6);
  1067. break;
  1068. default:{int LL_12=LLnext(262);
  1069. ;if (!LL_12) {
  1070. LLtdecr(6);
  1071. break;
  1072. }
  1073. else if (LL_12 & 1) goto L_10;}
  1074. case /* C_PARAMS */ 6 : ;
  1075. LLtdecr(6);
  1076. LL_SAFE(C_PARAMS);
  1077. # line 507 "LLgen.g"
  1078. { if (lextoken.t_num > 15) {
  1079. error(linecount,"Too many parameters", NULL, NULL);
  1080. } else g_setnpar(pres,lextoken.t_num);
  1081. if (g_gettype(pres) == TERMINAL) {
  1082. error(linecount,
  1083. "Terminal with parameters", NULL, NULL);
  1084. }
  1085. }
  1086. LLread();
  1087. }
  1088. }
  1089. break;
  1090. default: if (LLskip()) goto L_8;
  1091. goto L_9;
  1092. case /* C_LITERAL */ 4 : ;
  1093. LLsdecr(5);
  1094. LL_SAFE(C_LITERAL);
  1095. # line 516 "LLgen.g"
  1096. { pe = search(LITERAL,lextoken.t_string,BOTH);
  1097. *pres = *pe;
  1098. #ifdef NON_CORRECTING
  1099. if (erroneous)
  1100. pres->g_erroneous = 1;
  1101. #endif
  1102. }
  1103. LLread();
  1104. break;
  1105. }
  1106. break;
  1107. default:
  1108. LLtincr(7);
  1109. # line 524 "LLgen.g"
  1110. { g_settype(pres,ACTION);
  1111. pres->g_lineno = linecount;
  1112. #ifdef NON_CORRECTING
  1113. g_setsubparse(pres, (p_start) 0);
  1114. #endif
  1115. }
  1116. goto L_11;
  1117. L_11 : {switch(LLcsymb) {
  1118. default:
  1119. break;
  1120. case /* C_SUBSTART */ 20 : ;
  1121. LLtincr(23);
  1122. LLtincr(24);
  1123. LL_SAFE(C_SUBSTART);
  1124. # line 533 "LLgen.g"
  1125. {
  1126. #ifdef NON_CORRECTING
  1127. nsubstarts++;
  1128. #endif
  1129. }
  1130. LL_NOSCANDONE(C_IDENT);
  1131. # line 540 "LLgen.g"
  1132. {
  1133. #ifdef NON_CORRECTING
  1134. register p_gram temp;
  1135. register p_start subp;
  1136. temp = search(NONTERM,lextoken.t_string,BOTH);
  1137. subp = (p_start) alloc (sizeof(t_start));
  1138. subp->ff_nont = g_getcont(temp);
  1139. subp->ff_name = (string) 0;
  1140. subp->ff_next = (p_start) 0;
  1141. g_setsubparse(pres, subp);
  1142. #endif
  1143. }
  1144. LLread();
  1145. for (;;) {
  1146. goto L_12;
  1147. L_12 : {switch(LLcsymb) {
  1148. case /* ';' */ 24 : ;
  1149. break;
  1150. default:{int LL_13=LLnext(44);
  1151. ;if (!LL_13) {
  1152. break;
  1153. }
  1154. else if (LL_13 & 1) goto L_12;}
  1155. case /* ',' */ 23 : ;
  1156. LL_SAFE(',');
  1157. LL_NOSCANDONE(C_IDENT);
  1158. # line 556 "LLgen.g"
  1159. {
  1160. #ifdef NON_CORRECTING
  1161. register p_gram temp;
  1162. register p_start ff;
  1163. temp = search(NONTERM,lextoken.t_string,BOTH);
  1164. ff = g_getsubparse(pres);
  1165. while (ff) {
  1166. if (ff->ff_nont == g_getcont(temp)) {
  1167. warning(linecount, "\"%s\" used twice in %%substart", lextoken.t_string, NULL);
  1168. break;
  1169. }
  1170. ff = ff->ff_next;
  1171. }
  1172. ff = (p_start) alloc(sizeof(t_start));
  1173. ff->ff_nont = g_getcont(temp);
  1174. ff->ff_name = (string) 0;
  1175. ff->ff_next = g_getsubparse(pres);
  1176. g_setsubparse(pres, ff);
  1177. #endif
  1178. }
  1179. LLread();
  1180. continue;
  1181. }
  1182. }
  1183. LLtdecr(23);
  1184. break;
  1185. }
  1186. LLtdecr(24);
  1187. LL_SSCANDONE(';');
  1188. LLread();
  1189. }
  1190. }
  1191. LLtdecr(7);
  1192. LL_SCANDONE(C_ACTION);
  1193. LLread();
  1194. break;
  1195. }
  1196. }
  1197. static
  1198. #if LL_ANSI_C
  1199. void
  1200. #endif
  1201. LL8_repeats(
  1202. #if LL_ANSI_C
  1203. # line 587 "LLgen.g"
  1204. int *kind ,int *cnt)
  1205. #else
  1206. # line 587 "LLgen.g"
  1207. kind,cnt) int *kind; int *cnt;
  1208. #endif
  1209. {
  1210. # line 587 "LLgen.g"
  1211. int t1 = 0;
  1212. switch(LLcsymb) {
  1213. default:
  1214. LL_SAFE('?');
  1215. # line 589 "LLgen.g"
  1216. { *kind = OPT; }
  1217. LLread();
  1218. break;
  1219. case /* '*' */ 30 : ;
  1220. case /* '+' */ 31 : ;
  1221. LLtincr(3);
  1222. switch(LLcsymb) {
  1223. default:
  1224. LL_SAFE('*');
  1225. # line 590 "LLgen.g"
  1226. { *kind = STAR; }
  1227. break;
  1228. case /* '+' */ 31 : ;
  1229. LL_SAFE('+');
  1230. # line 591 "LLgen.g"
  1231. { *kind = PLUS; }
  1232. break;
  1233. }
  1234. LLread();
  1235. goto L_7;
  1236. L_7 : {switch(LLcsymb) {
  1237. case /* C_IDENT */ 2 : ;
  1238. case /* C_LITERAL */ 4 : ;
  1239. case /* C_ACTION */ 7 : ;
  1240. case /* C_SUBSTART */ 20 : ;
  1241. case /* C_ERRONEOUS */ 21 : ;
  1242. case /* ';' */ 24 : ;
  1243. case /* '|' */ 26 : ;
  1244. case /* '[' */ 27 : ;
  1245. case /* ']' */ 28 : ;
  1246. LLtdecr(3);
  1247. break;
  1248. default:{int LL_14=LLnext(259);
  1249. ;if (!LL_14) {
  1250. LLtdecr(3);
  1251. break;
  1252. }
  1253. else if (LL_14 & 1) goto L_7;}
  1254. case /* C_NUMBER */ 3 : ;
  1255. LLtdecr(3);
  1256. LL9_number(
  1257. # line 593 "LLgen.g"
  1258. &t1);
  1259. LLread();
  1260. }
  1261. }
  1262. # line 594 "LLgen.g"
  1263. { if (t1 == 1) {
  1264. t1 = 0;
  1265. if (*kind == STAR) *kind = OPT;
  1266. if (*kind == PLUS) *kind = FIXED;
  1267. }
  1268. }
  1269. break;
  1270. case /* C_NUMBER */ 3 : ;
  1271. LL9_number(
  1272. # line 600 "LLgen.g"
  1273. &t1);
  1274. LLread();
  1275. break;
  1276. }
  1277. # line 601 "LLgen.g"
  1278. { *cnt = t1; }
  1279. }
  1280. static
  1281. #if LL_ANSI_C
  1282. void
  1283. #endif
  1284. LL9_number(
  1285. #if LL_ANSI_C
  1286. # line 604 "LLgen.g"
  1287. int *t)
  1288. #else
  1289. # line 604 "LLgen.g"
  1290. t) int *t;
  1291. #endif
  1292. {
  1293. LL_SAFE(C_NUMBER);
  1294. # line 606 "LLgen.g"
  1295. { *t = lextoken.t_num;
  1296. if (*t <= 0 || *t >= 8192) {
  1297. error(linecount,"Illegal number", NULL, NULL);
  1298. }
  1299. }
  1300. }
  1301. static
  1302. #if LL_ANSI_C
  1303. void
  1304. #endif
  1305. LL4_firsts(
  1306. #if LL_ANSI_C
  1307. void
  1308. #endif
  1309. ) {
  1310. # line 613 "LLgen.g"
  1311. register string p;
  1312. LLtincr(23);
  1313. LLtincr(2);
  1314. LLtincr(24);
  1315. LL_SAFE(C_FIRST);
  1316. LL_NOSCANDONE(C_IDENT);
  1317. # line 615 "LLgen.g"
  1318. { p = store(lextoken.t_string); }
  1319. LLtdecr(23);
  1320. LL_NOSCANDONE(',');
  1321. LLtdecr(2);
  1322. LL_NOSCANDONE(C_IDENT);
  1323. LLtdecr(24);
  1324. LL_NOSCANDONE(';');
  1325. # line 617 "LLgen.g"
  1326. { /*
  1327. * Store this %first in the list belonging
  1328. * to this input file
  1329. */
  1330. p_gram temp;
  1331. register p_first ff;
  1332. temp = search(NONTERM,lextoken.t_string,BOTH);
  1333. ff = (p_first) alloc(sizeof(t_first));
  1334. ff->ff_nont = g_getcont(temp);
  1335. ff->ff_name = p;
  1336. ff->ff_next = pfile->f_firsts;
  1337. pfile->f_firsts = ff;
  1338. }
  1339. }
  1340. # line 632 "LLgen.g"
  1341. STATIC p_gram
  1342. copyrule(p,length) register p_gram p; {
  1343. /*
  1344. * Returns a pointer to a grammar rule that was created in
  1345. * p. The space pointed to by p can now be reused
  1346. */
  1347. register p_gram t;
  1348. p_gram rule;
  1349. t = (p_gram) alloc((unsigned) length * sizeof(t_gram));
  1350. rule = t;
  1351. while (length--) {
  1352. *t++ = *p++;
  1353. }
  1354. return rule;
  1355. }