]>
diplodocus.org Git - nmh/blob - docs/historical/mh-6.8.5/zotnet/tws/phoon/lexstring.c
9 struct yywork
*yystoff
;
10 struct yysvf
*yyother
;
20 extern struct yywork yycrank
[];
21 extern struct yysvf yysvec
[];
22 extern struct yywork
*yytop
;
23 extern char yymatch
[];
24 extern char yyextra
[];
30 lex_string( strptr
, start_cond
)
34 register struct yysvf
*state
, **lsp
;
35 register struct yywork
*tran
;
37 register char *cp
= *strptr
;
39 struct yysvf
*yylstate
[YYLMAX
];
41 /* start off machines */
43 state
= yysvec
+1+start_cond
;
47 fprintf(stderr
,"state %d\n",state
-yysvec
-1);
49 tran
= state
->yystoff
;
51 /* may not be any transitions */
52 if (state
->yyother
== 0 ||
53 state
->yyother
->yystoff
== yycrank
)
64 fprintf(stderr
,"char ");
71 if (tran
<= yytop
&& tran
->verify
+yysvec
== state
){
72 if ((state
= tran
->advance
+yysvec
) == YYLERR
){
73 /* error transitions */
81 } else if(tran
< yycrank
) {
83 tran
= yycrank
+(yycrank
-tran
) + ch
;
86 fprintf(stderr
,"compressed state\n");
88 if(tran
<= yytop
&& tran
->verify
+yysvec
== state
){
89 if ((state
= tran
->advance
+yysvec
) == YYLERR
)
90 /* error transitions */
96 tran
+= (yymatch
[ch
] - ch
);
99 fprintf(stderr
,"try fall back character ");
100 allprint(yymatch
[ch
]);
104 if(tran
<= yytop
&& tran
->verify
+yysvec
== state
){
105 if(tran
->advance
+yysvec
== YYLERR
)
106 /* error transition */
109 *lsp
++ = state
= tran
->advance
+yysvec
;
113 if ((state
= state
->yyother
) &&
114 (tran
= state
->yystoff
) != yycrank
){
117 fprintf(stderr
,"fall back to state %d\n",
127 fprintf(stderr
,"state %d char ",state
-yysvec
-1);
136 fprintf(stderr
,"stopped at %d with ",*(lsp
-1)-yysvec
-1);
141 while (lsp
-- > yylstate
){
142 if (*lsp
!= 0 && (found
= (*lsp
)->yystops
) && *found
> 0){
147 while (*found
&& *found
++ != ch
)
149 } while (lsp
> yylstate
&&
150 (found
= (*--lsp
)->yystops
));
154 fprintf(stderr
,"\nmatch ");
156 cp
<= ((*strptr
)+(lsp
-yylstate
));
159 fprintf(stderr
," action %d\n",*found
);
162 *strptr
+= (lsp
- yylstate
+ 1);
166 /* the string didn't match anything - if we're looking at
167 * eos, just return 0. Otherwise, bump the string pointer
172 fprintf(stderr
,"\nno match\n");
188 } else if ( c
== 127 ) {