]>
diplodocus.org Git - nmh/blob - docs/historical/mh-6.8.5/zotnet/tws/lexstring.c
4 static char ident
[] = "@(#)$Id: lexstring.c,v 1.5 1992/12/15 00:20:22 jromine Exp $";
13 struct yywork
*yystoff
;
17 struct yysvf
*yyother
;
27 extern struct yywork yycrank
[];
28 extern struct yysvf yysvec
[];
29 extern char yymatch
[];
30 extern char yyextra
[];
37 static char case_map
[] = {
38 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
39 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
40 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
41 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
42 40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
43 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
44 60, 61, 62, 63, 64, 97, 98, 99, 100, 101,
45 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
46 112, 113, 114, 115, 116, 117, 118, 119, 120, 121,
47 122, 91, 92, 93, 94, 95, 96, 97, 98, 99,
48 100, 101, 102, 103, 104, 105, 106, 107, 108, 109,
49 110, 111, 112, 113, 114, 115, 116, 117, 118, 119,
50 120, 121, 122, 123, 124, 125, 126, 127,
51 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
52 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
53 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
54 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
55 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
56 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
57 0, 0, 0, 0, 0, 0, 0, 0
61 lex_string( strptr
, start_cond
)
65 register struct yysvf
*state
, **lsp
;
66 register struct yywork
*tran
;
67 register int statenum
;
69 register char *cp
= *strptr
;
71 struct yysvf
*yylstate
[YYLMAX
];
73 /* start off machines */
75 statenum
= 1 + start_cond
;
76 state
= yysvec
+ statenum
;
80 fprintf(stderr
,"%d ",statenum
- 1);
84 tran
= state
->yystoff
;
86 tran
= &yycrank
[state
->yystoff
];
89 /* may not be any transitions */
90 if (state
->yyother
== 0 ||
92 state
->yyother
->yystoff
== yycrank
)
94 state
->yyother
->yystoff
== 0)
100 #else /* not ONECASE */
107 fprintf(stderr
, ")");
112 if ( tran
> yycrank
){
114 if ( (int)tran
> (int)yycrank
){
117 if (tran
->verify
== statenum
){
118 if ((statenum
= tran
->advance
) == 0){
119 /* error transitions */
123 state
= statenum
+ yysvec
;
129 } else if(tran
< yycrank
) {
131 } else if( (int)tran
< (int)yycrank
) {
133 tran
= yycrank
+(yycrank
-tran
) + ch
;
136 fprintf(stderr
," compressed");
139 if (tran
->verify
== statenum
){
140 if ((statenum
= tran
->advance
) == 0)
141 /* error transitions */
144 state
= statenum
+ yysvec
;
148 tran
+= (yymatch
[ch
] - ch
);
151 fprintf(stderr
,"(fb ");
152 allprint(yymatch
[ch
]);
156 if (tran
->verify
== statenum
){
157 if((statenum
= tran
->advance
) == 0)
158 /* error transition */
161 state
= statenum
+ yysvec
;
166 if ((state
= state
->yyother
) &&
168 (tran
= state
->yystoff
) != yycrank
){
170 (tran
= &yycrank
[state
->yystoff
]) != yycrank
){
172 statenum
= state
- yysvec
;
175 fprintf(stderr
,"fb %d", statenum
- 1);
192 fprintf(stderr
,"\nStopped in state %d (",*(lsp
-1)-yysvec
-1);
194 fprintf(stderr
, ") ");
197 while (lsp
-- > yylstate
){
198 if (*lsp
!= 0 && (found
= (*lsp
)->yystops
) && *found
> 0){
203 while (*found
&& *found
++ != ch
)
205 } while (lsp
> yylstate
&&
206 (found
= (*--lsp
)->yystops
));
210 fprintf(stderr
," Match \"");
212 cp
<= ((*strptr
)+(lsp
-yylstate
));
215 fprintf(stderr
,"\" action %d\n",*found
);
218 *strptr
+= (lsp
- yylstate
+ 1);
222 /* the string didn't match anything - if we're looking at
223 * eos, just return 0. Otherwise, bump the string pointer
228 fprintf(stderr
," No match\n");
230 #endif /* LEXDEBUG */
245 } else if ( c
== 127 ) {
251 #endif /* LEXDEBUG */