|
|
BSD 4.3reno
*** lexstring.c Tue Jun 3 06:29:37 1986
--- /usr/tmp/mh-6.5/zotnet/tws/lexstring.c Wed Feb 12 12:04:27 1986
***************
*** 19,53 ****
extern int yyvstop[];
extern struct yywork yycrank[];
extern struct yysvf yysvec[];
extern char yymatch[];
extern char yyextra[];
! #ifdef ONECASE
! static char case_map[] = {
! 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
! 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
! 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
! 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
! 40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
! 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
! 60, 61, 62, 63, 64, 97, 98, 99, 100, 101,
! 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
! 112, 113, 114, 115, 116, 117, 118, 119, 120, 121,
! 122, 91, 92, 93, 94, 95, 96, 97, 98, 99,
! 100, 101, 102, 103, 104, 105, 106, 107, 108, 109,
! 110, 111, 112, 113, 114, 115, 116, 117, 118, 119,
! 120, 121, 122, 123, 124, 125, 126, 127,
! 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
! 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
! 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
! 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
! 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
! 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
! 0, 0, 0, 0, 0, 0, 0, 0
! };
! #endif ONECASE
-
lex_string( strptr, start_cond)
char **strptr;
int start_cond;
--- 19,32 ----
extern int yyvstop[];
extern struct yywork yycrank[];
extern struct yysvf yysvec[];
+ extern struct yywork *yytop;
extern char yymatch[];
extern char yyextra[];
! #ifdef LEXDEBUG
! static int debug = 0;
! #endif LEXDEBUG
lex_string( strptr, start_cond)
char **strptr;
int start_cond;
***************
*** 54,60 ****
{
register struct yysvf *state, **lsp;
register struct yywork *tran;
- register int statenum;
register int ch;
register char *cp = *strptr;
register int *found;
--- 33,38 ----
***************
*** 62,72 ****
/* start off machines */
lsp = yylstate;
! statenum = 1 + start_cond;
! state = yysvec + statenum;
for (;;){
# ifdef LEXDEBUG
! fprintf(stdout,"%d ",statenum - 1);
# endif
tran = state->yystoff;
if(tran == yycrank)
--- 40,50 ----
/* start off machines */
lsp = yylstate;
! state = yysvec+1+start_cond;
for (;;){
# ifdef LEXDEBUG
! if(debug)
! fprintf(stderr,"state %d\n",state-yysvec-1);
# endif
tran = state->yystoff;
if(tran == yycrank)
***************
*** 75,140 ****
state->yyother->yystoff == yycrank)
break;
- #ifdef ONECASE
- ch = case_map[*cp++];
- #else not ONECASE
ch = *cp++;
#endif ONECASE
# ifdef LEXDEBUG
! fprintf(stdout,"(");
! allprint(ch);
! fprintf(stdout, ")");
# endif
- tryagain:
if ( tran > yycrank){
tran += ch;
! if (tran->verify == statenum){
! if ((statenum = tran->advance) == 0){
/* error transitions */
--cp;
break;
}
- state = statenum + yysvec;
*lsp++ = state;
goto contin;
}
} else if(tran < yycrank) {
tran = yycrank+(yycrank-tran) + ch;
# ifdef LEXDEBUG
! fprintf(stdout," compressed");
# endif
! if (tran->verify == statenum){
! if ((statenum = tran->advance) == 0)
/* error transitions */
break;
- state = statenum + yysvec;
*lsp++ = state;
goto contin;
}
tran += (yymatch[ch] - ch);
# ifdef LEXDEBUG
! fprintf(stdout,"(fb ");
! allprint(yymatch[ch]);
! fprintf(stdout,")");
# endif
! if (tran->verify == statenum){
! if((statenum = tran->advance) == 0)
/* error transition */
break;
! state = statenum + yysvec;
! *lsp++ = state;
goto contin;
}
}
if ((state = state->yyother) &&
(tran = state->yystoff) != yycrank){
- statenum = state - yysvec;
# ifdef LEXDEBUG
! fprintf(stdout,"fb %d",
! statenum - 1);
# endif
goto tryagain;
} else
--- 53,121 ----
state->yyother->yystoff == yycrank)
break;
ch = *cp++;
+ #ifdef ONECASE
+ if (isupper(ch) )
+ ch = tolower(ch);
#endif ONECASE
+ tryagain:
# ifdef LEXDEBUG
! if(debug){
! fprintf(stderr,"char ");
! allprint(ch);
! putchar('\n');
! }
# endif
if ( tran > yycrank){
tran += ch;
! if (tran <= yytop && tran->verify+yysvec == state){
! if ((state = tran->advance+yysvec) == YYLERR){
/* error transitions */
--cp;
break;
}
*lsp++ = state;
goto contin;
}
} else if(tran < yycrank) {
+ /* r < yycrank */
tran = yycrank+(yycrank-tran) + ch;
# ifdef LEXDEBUG
! if (debug)
! fprintf(stderr,"compressed state\n");
# endif
! if(tran <= yytop && tran->verify+yysvec == state){
! if ((state = tran->advance+yysvec) == YYLERR)
/* error transitions */
break;
*lsp++ = state;
goto contin;
}
tran += (yymatch[ch] - ch);
# ifdef LEXDEBUG
! if(debug){
! fprintf(stderr,"try fall back character ");
! allprint(yymatch[ch]);
! putchar('\n');
! }
# endif
! if(tran <= yytop && tran->verify+yysvec == state){
! if(tran->advance+yysvec == YYLERR)
/* error transition */
break;
! *lsp++ = state = tran->advance+yysvec;
goto contin;
}
}
if ((state = state->yyother) &&
(tran = state->yystoff) != yycrank){
# ifdef LEXDEBUG
! if(debug)
! fprintf(stderr,"fall back to state %d\n",
! state-yysvec-1);
# endif
goto tryagain;
} else
***************
*** 142,155 ****
contin:
# ifdef LEXDEBUG
! fprintf(stdout,">");
# endif
;
}
# ifdef LEXDEBUG
! fprintf(stdout,"\nStopped in state %d (",*(lsp-1)-yysvec-1);
! allprint(ch);
! fprintf(stdout, ") ");
# endif
while (lsp-- > yylstate){
if (*lsp != 0 && (found= (*lsp)->yystops) && *found > 0){
--- 123,142 ----
contin:
# ifdef LEXDEBUG
! if(debug){
! fprintf(stderr,"state %d char ",state-yysvec-1);
! allprint(ch);
! putchar('\n');
! }
# endif
;
}
# ifdef LEXDEBUG
! if(debug){
! fprintf(stderr,"stopped at %d with ",*(lsp-1)-yysvec-1);
! allprint(ch);
! putchar('\n');
! }
# endif
while (lsp-- > yylstate){
if (*lsp != 0 && (found= (*lsp)->yystops) && *found > 0){
***************
*** 163,174 ****
(found = (*--lsp)->yystops));
}
# ifdef LEXDEBUG
! fprintf(stdout," Match \"");
! for ( cp = *strptr;
! cp <= ((*strptr)+(lsp-yylstate));
! cp++)
! allprint( *cp );
! fprintf(stdout,"\" action %d\n",*found);
# endif
*strptr += (lsp - yylstate + 1);
return(*found);
--- 150,163 ----
(found = (*--lsp)->yystops));
}
# ifdef LEXDEBUG
! if(debug){
! fprintf(stderr,"\nmatch ");
! for ( cp = *strptr;
! cp <= ((*strptr)+(lsp-yylstate));
! cp++)
! allprint( *cp );
! fprintf(stderr," action %d\n",*found);
! }
# endif
*strptr += (lsp - yylstate + 1);
return(*found);
***************
*** 179,185 ****
* and return -1.
*/
# ifdef LEXDEBUG
! fprintf(stdout," No match\n");
#endif LEXDEBUG
if ( **strptr ) {
(*strptr)++;
--- 168,175 ----
* and return -1.
*/
# ifdef LEXDEBUG
! if(debug)
! fprintf(stderr,"\nno match\n");
#endif LEXDEBUG
if ( **strptr ) {
(*strptr)++;
***************
*** 193,204 ****
char c;
{
if ( c < 32 ) {
! putc( '^', stdout );
c += 32;
} else if ( c == 127 ) {
! putc( '^', stdout );
c = '?';
}
! putc( c, stdout );
}
#endif LEXDEBUG
--- 183,194 ----
char c;
{
if ( c < 32 ) {
! putc( '^', stderr );
c += 32;
} else if ( c == 127 ) {
! putc( '^', stderr );
c = '?';
}
! putc( c, stderr );
}
#endif LEXDEBUG
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.