]>
diplodocus.org Git - nmh/blob - zotnet/tws/lexstring.c
19 struct yywork
*yystoff
;
23 struct yysvf
*yyother
;
33 extern struct yywork yycrank
[];
34 extern struct yysvf yysvec
[];
35 extern char yymatch
[];
36 extern char yyextra
[];
43 static char case_map
[] = {
44 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
45 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
46 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
47 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
48 40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
49 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
50 60, 61, 62, 63, 64, 97, 98, 99, 100, 101,
51 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
52 112, 113, 114, 115, 116, 117, 118, 119, 120, 121,
53 122, 91, 92, 93, 94, 95, 96, 97, 98, 99,
54 100, 101, 102, 103, 104, 105, 106, 107, 108, 109,
55 110, 111, 112, 113, 114, 115, 116, 117, 118, 119,
56 120, 121, 122, 123, 124, 125, 126, 127,
57 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
58 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
59 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
60 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
61 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
62 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
63 0, 0, 0, 0, 0, 0, 0, 0
69 lex_string (char **strptr
, int start_cond
)
71 struct yysvf
*state
, **lsp
;
77 struct yysvf
*yylstate
[YYLMAX
];
79 /* start off machines */
81 statenum
= 1 + start_cond
;
82 state
= yysvec
+ statenum
;
86 fprintf(stderr
,"%d ",statenum
- 1);
90 tran
= state
->yystoff
;
92 tran
= &yycrank
[state
->yystoff
];
95 /* may not be any transitions */
96 if (state
->yyother
== 0 ||
98 state
->yyother
->yystoff
== yycrank
)
100 state
->yyother
->yystoff
== 0)
105 ch
= case_map
[(unsigned char) *cp
++];
106 #else /* not ONECASE */
113 fprintf(stderr
, ")");
118 if ( tran
> yycrank
){
120 if ( (int)tran
> (int)yycrank
){
123 if (tran
->verify
== statenum
){
124 if ((statenum
= tran
->advance
) == 0){
125 /* error transitions */
129 state
= statenum
+ yysvec
;
135 } else if(tran
< yycrank
) {
137 } else if( (int)tran
< (int)yycrank
) {
139 tran
= yycrank
+(yycrank
-tran
) + ch
;
142 fprintf(stderr
," compressed");
145 if (tran
->verify
== statenum
){
146 if ((statenum
= tran
->advance
) == 0)
147 /* error transitions */
150 state
= statenum
+ yysvec
;
154 tran
+= (yymatch
[ch
] - ch
);
157 fprintf(stderr
,"(fb ");
158 allprint(yymatch
[ch
]);
162 if (tran
->verify
== statenum
){
163 if((statenum
= tran
->advance
) == 0)
164 /* error transition */
167 state
= statenum
+ yysvec
;
172 if ((state
= state
->yyother
) &&
174 (tran
= state
->yystoff
) != yycrank
){
176 (tran
= &yycrank
[state
->yystoff
]) != yycrank
){
178 statenum
= state
- yysvec
;
181 fprintf(stderr
,"fb %d", statenum
- 1);
198 fprintf(stderr
,"\nStopped in state %d (",*(lsp
-1)-yysvec
-1);
200 fprintf(stderr
, ") ");
203 while (lsp
-- > yylstate
){
204 if (*lsp
!= 0 && (found
= (*lsp
)->yystops
) && *found
> 0){
209 while (*found
&& *found
++ != ch
)
211 } while (lsp
> yylstate
&&
212 (found
= (*--lsp
)->yystops
));
216 fprintf(stderr
," Match \"");
218 cp
<= ((*strptr
)+(lsp
-yylstate
));
221 fprintf(stderr
,"\" action %d\n",*found
);
224 *strptr
+= (lsp
- yylstate
+ 1);
228 /* the string didn't match anything - if we're looking at
229 * eos, just return 0. Otherwise, bump the string pointer
234 fprintf(stderr
," No match\n");
236 #endif /* LEXDEBUG */
251 } else if ( c
== 127 ) {
257 #endif /* LEXDEBUG */