9 date 92.12.15.00.20.22; author jromine; state Exp;
14 date 90.04.05.15.05.05; author sources; state Exp;
19 date 90.02.23.11.14.31; author sources; state Exp;
24 date 90.02.01.14.45.29; author sources; state Exp;
29 date 90.02.01.14.45.07; author sources; state Exp;
35 date 90.02.23.10.43.44; author sources; state Exp;
52 static char ident[] = "@@(#)$Id: lexstring.c,v 1.4 1990/04/05 15:05:05 sources Exp jromine $";
61 struct yywork *yystoff;
65 struct yysvf *yyother;
75 extern struct yywork yycrank[];
76 extern struct yysvf yysvec[];
77 extern char yymatch[];
78 extern char yyextra[];
85 static char case_map[] = {
86 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
87 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
88 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
89 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
90 40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
91 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
92 60, 61, 62, 63, 64, 97, 98, 99, 100, 101,
93 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
94 112, 113, 114, 115, 116, 117, 118, 119, 120, 121,
95 122, 91, 92, 93, 94, 95, 96, 97, 98, 99,
96 100, 101, 102, 103, 104, 105, 106, 107, 108, 109,
97 110, 111, 112, 113, 114, 115, 116, 117, 118, 119,
98 120, 121, 122, 123, 124, 125, 126, 127,
99 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
100 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
101 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
102 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
103 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
104 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
105 0, 0, 0, 0, 0, 0, 0, 0
109 lex_string( strptr, start_cond)
113 register struct yysvf *state, **lsp;
114 register struct yywork *tran;
115 register int statenum;
117 register char *cp = *strptr;
119 struct yysvf *yylstate[YYLMAX];
121 /* start off machines */
123 statenum = 1 + start_cond;
124 state = yysvec + statenum;
128 fprintf(stderr,"%d ",statenum - 1);
132 tran = state->yystoff;
134 tran = &yycrank[state->yystoff];
137 /* may not be any transitions */
138 if (state->yyother == 0 ||
140 state->yyother->yystoff == yycrank)
142 state->yyother->yystoff == 0)
147 ch = case_map[*cp++];
148 #else /* not ONECASE */
155 fprintf(stderr, ")");
160 if ( tran > yycrank){
162 if ( (int)tran > (int)yycrank){
165 if (tran->verify == statenum){
166 if ((statenum = tran->advance) == 0){
167 /* error transitions */
171 state = statenum + yysvec;
177 } else if(tran < yycrank) {
179 } else if( (int)tran < (int)yycrank) {
181 tran = yycrank+(yycrank-tran) + ch;
184 fprintf(stderr," compressed");
187 if (tran->verify == statenum){
188 if ((statenum = tran->advance) == 0)
189 /* error transitions */
192 state = statenum + yysvec;
196 tran += (yymatch[ch] - ch);
199 fprintf(stderr,"(fb ");
200 allprint(yymatch[ch]);
204 if (tran->verify == statenum){
205 if((statenum = tran->advance) == 0)
206 /* error transition */
209 state = statenum + yysvec;
214 if ((state = state->yyother) &&
216 (tran = state->yystoff) != yycrank){
218 (tran = &yycrank[state->yystoff]) != yycrank){
220 statenum = state - yysvec;
223 fprintf(stderr,"fb %d", statenum - 1);
240 fprintf(stderr,"\nStopped in state %d (",*(lsp-1)-yysvec-1);
242 fprintf(stderr, ") ");
245 while (lsp-- > yylstate){
246 if (*lsp != 0 && (found= (*lsp)->yystops) && *found > 0){
251 while (*found && *found++ != ch)
253 } while (lsp > yylstate &&
254 (found = (*--lsp)->yystops));
258 fprintf(stderr," Match \"");
260 cp <= ((*strptr)+(lsp-yylstate));
263 fprintf(stderr,"\" action %d\n",*found);
266 *strptr += (lsp - yylstate + 1);
270 /* the string didn't match anything - if we're looking at
271 * eos, just return 0. Otherwise, bump the string pointer
276 fprintf(stderr," No match\n");
278 #endif /* LEXDEBUG */
293 } else if ( c == 127 ) {
299 #endif /* LEXDEBUG */
310 static char ident[] = "@@(#)$Id:$";
371 @merged VJ and HPUX changes
384 extern struct yywork *yytop;
389 state = yysvec+1+start_cond;
393 fprintf(stderr,"state %d\n",state-yysvec-1);
404 fprintf(stderr,"char ");
411 if (tran <= yytop && tran->verify+yysvec == state){
412 if ((state = tran->advance+yysvec) == YYLERR){
419 fprintf(stderr,"compressed state\n");
422 if(tran <= yytop && tran->verify+yysvec == state){
423 if ((state = tran->advance+yysvec) == YYLERR)
428 fprintf(stderr,"try fall back character ");
434 if(tran <= yytop && tran->verify+yysvec == state){
435 if(tran->advance+yysvec == YYLERR)
438 *lsp++ = state = tran->advance+yysvec;
443 fprintf(stderr,"fall back to state %d\n",
448 fprintf(stderr,"state %d char ",state-yysvec-1);
454 fprintf(stderr,"stopped at %d with ",*(lsp-1)-yysvec-1);
461 fprintf(stderr,"\nmatch ");
464 fprintf(stderr," action %d\n",*found);
468 fprintf(stderr,"\nno match\n");
494 @Fixes from Van Jacobson
500 static char case_map[] = {
501 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
502 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
503 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
504 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
505 40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
506 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
507 60, 61, 62, 63, 64, 97, 98, 99, 100, 101,
508 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
509 112, 113, 114, 115, 116, 117, 118, 119, 120, 121,
510 122, 91, 92, 93, 94, 95, 96, 97, 98, 99,
511 100, 101, 102, 103, 104, 105, 106, 107, 108, 109,
512 110, 111, 112, 113, 114, 115, 116, 117, 118, 119,
513 120, 121, 122, 123, 124, 125, 126, 127,
514 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
515 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
516 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
517 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
518 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
519 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
520 0, 0, 0, 0, 0, 0, 0, 0
525 register int statenum;
528 statenum = 1 + start_cond;
529 state = yysvec + statenum;
533 fprintf(stderr,"%d ",statenum - 1);
538 ch = case_map[*cp++];
548 fprintf(stderr, ")");
553 if (tran->verify == statenum){
554 if ((statenum = tran->advance) == 0){
556 state = statenum + yysvec;
561 fprintf(stderr," compressed");
565 if (tran->verify == statenum){
566 if ((statenum = tran->advance) == 0)
568 state = statenum + yysvec;
572 fprintf(stderr,"(fb ");
578 if (tran->verify == statenum){
579 if((statenum = tran->advance) == 0)
582 state = statenum + yysvec;
585 statenum = state - yysvec;
589 fprintf(stderr,"fb %d", statenum - 1);
598 fprintf(stderr,"\nStopped in state %d (",*(lsp-1)-yysvec-1);
601 fprintf(stderr, ") ");
605 fprintf(stderr," Match \"");
608 fprintf(stderr,"\" action %d\n",*found);
612 fprintf(stderr," No match\n");