made more efficient by pulling out the terminators when in

GOTCMND state and making them their own rule
This commit is contained in:
Todd C. Miller
1995-08-19 21:53:38 +00:00
parent 35d4d8e6bd
commit ed0730ba03

View File

@@ -49,7 +49,6 @@ int sudolineno = 1;
static void fill __P((void)); static void fill __P((void));
static void append __P((void)); static void append __P((void));
static char chop __P((void));
extern void reset_aliases __P((void)); extern void reset_aliases __P((void));
#ifdef TRACELEXER #ifdef TRACELEXER
@@ -75,6 +74,12 @@ N [0-9][0-9]?[0-9]?
LEXTRACE("\n\t"); LEXTRACE("\n\t");
} /* throw away EOL after \ */ } /* throw away EOL after \ */
<GOTCMND>[:,=\n] {
BEGIN 0;
unput(yytext[0]);
return(PATH);
} /* end of command line args */
\n { \n {
++sudolineno; ++sudolineno;
LEXTRACE("\n"); LEXTRACE("\n");
@@ -87,14 +92,6 @@ N [0-9][0-9]?[0-9]?
return COMMENT; return COMMENT;
} /* return comments */ } /* return comments */
<GOTCMND>[^\,:=\\ \t\n#]+[:,=\n] {
BEGIN 0;
LEXTRACE("ARG");
append();
unput(chop());
return(PATH);
} /* the last command line arg */
<GOTCMND>[^\,:=\\ \t\n#]+ { <GOTCMND>[^\,:=\\ \t\n#]+ {
LEXTRACE("ARG "); LEXTRACE("ARG ");
append(); append();
@@ -129,13 +126,6 @@ N [0-9][0-9]?[0-9]?
return NTWKADDR; return NTWKADDR;
} }
\/[^\,:=\\ \t\n#]+[:,=\n] {
LEXTRACE("PATH ");
fill();
unput(chop());
return(PATH);
} /* a pathname with no args */
\/[^\,:=\\ \t\n#]+ { \/[^\,:=\\ \t\n#]+ {
BEGIN GOTCMND; BEGIN GOTCMND;
LEXTRACE("PATH "); LEXTRACE("PATH ");
@@ -191,17 +181,6 @@ static void append() {
(void) strcat(yylval.string, yytext); (void) strcat(yylval.string, yytext);
} }
static char chop() {
int len;
char c;
len = strlen(yylval.string);
c = yylval.string[--len];
yylval.string[len] = '\0';
return(c);
}
int yywrap() int yywrap()
{ {
#ifdef YY_NEW_FILE #ifdef YY_NEW_FILE