2003-11-23 18:04:08 +00:00
|
|
|
#include "rc.h"
|
|
|
|
|
#include "exec.h"
|
|
|
|
|
#include "io.h"
|
|
|
|
|
#include "getflags.h"
|
|
|
|
|
#include "fns.h"
|
|
|
|
|
int getnext(void);
|
2007-03-26 12:02:41 +00:00
|
|
|
|
|
|
|
|
int
|
|
|
|
|
wordchr(int c)
|
2003-11-23 18:04:08 +00:00
|
|
|
{
|
|
|
|
|
return !strchr("\n \t#;&|^$=`'{}()<>", c) && c!=EOF;
|
|
|
|
|
}
|
2007-03-26 12:02:41 +00:00
|
|
|
|
|
|
|
|
int
|
|
|
|
|
idchr(int c)
|
2003-11-23 18:04:08 +00:00
|
|
|
{
|
|
|
|
|
/*
|
|
|
|
|
* Formerly:
|
|
|
|
|
* return 'a'<=c && c<='z' || 'A'<=c && c<='Z' || '0'<=c && c<='9'
|
|
|
|
|
* || c=='_' || c=='*';
|
|
|
|
|
*/
|
|
|
|
|
return c>' ' && !strchr("!\"#$%&'()+,-./:;<=>?@[\\]^`{|}~", c);
|
|
|
|
|
}
|
2007-03-26 12:02:41 +00:00
|
|
|
int future = EOF;
|
|
|
|
|
int doprompt = 1;
|
2003-11-23 18:04:08 +00:00
|
|
|
int inquote;
|
2007-03-26 12:02:41 +00:00
|
|
|
int incomm;
|
2003-11-23 18:04:08 +00:00
|
|
|
/*
|
|
|
|
|
* Look ahead in the input stream
|
|
|
|
|
*/
|
2007-03-26 12:02:41 +00:00
|
|
|
|
|
|
|
|
int
|
|
|
|
|
nextc(void)
|
|
|
|
|
{
|
|
|
|
|
if(future==EOF)
|
|
|
|
|
future = getnext();
|
2003-11-23 18:04:08 +00:00
|
|
|
return future;
|
|
|
|
|
}
|
|
|
|
|
/*
|
|
|
|
|
* Consume the lookahead character.
|
|
|
|
|
*/
|
2007-03-26 12:02:41 +00:00
|
|
|
|
|
|
|
|
int
|
|
|
|
|
advance(void)
|
|
|
|
|
{
|
|
|
|
|
int c = nextc();
|
|
|
|
|
lastc = future;
|
|
|
|
|
future = EOF;
|
2003-11-23 18:04:08 +00:00
|
|
|
return c;
|
|
|
|
|
}
|
|
|
|
|
/*
|
|
|
|
|
* read a character from the input stream
|
2020-01-10 14:44:21 +00:00
|
|
|
*/
|
2007-03-26 12:02:41 +00:00
|
|
|
|
|
|
|
|
int
|
|
|
|
|
getnext(void)
|
|
|
|
|
{
|
|
|
|
|
int c;
|
|
|
|
|
static int peekc = EOF;
|
2003-11-23 18:04:08 +00:00
|
|
|
if(peekc!=EOF){
|
2007-03-26 12:02:41 +00:00
|
|
|
c = peekc;
|
|
|
|
|
peekc = EOF;
|
2003-11-23 18:04:08 +00:00
|
|
|
return c;
|
|
|
|
|
}
|
2007-03-26 12:02:41 +00:00
|
|
|
if(runq->eof)
|
|
|
|
|
return EOF;
|
|
|
|
|
if(doprompt)
|
|
|
|
|
pprompt();
|
|
|
|
|
c = rchr(runq->cmdfd);
|
2003-11-23 18:04:08 +00:00
|
|
|
if(!inquote && c=='\\'){
|
2007-03-26 12:02:41 +00:00
|
|
|
c = rchr(runq->cmdfd);
|
|
|
|
|
if(c=='\n' && !incomm){ /* don't continue a comment */
|
|
|
|
|
doprompt = 1;
|
2003-11-23 18:04:08 +00:00
|
|
|
c=' ';
|
|
|
|
|
}
|
|
|
|
|
else{
|
2007-03-26 12:02:41 +00:00
|
|
|
peekc = c;
|
2003-11-23 18:04:08 +00:00
|
|
|
c='\\';
|
|
|
|
|
}
|
|
|
|
|
}
|
2007-03-26 12:02:41 +00:00
|
|
|
doprompt = doprompt || c=='\n' || c==EOF;
|
|
|
|
|
if(c==EOF)
|
|
|
|
|
runq->eof++;
|
2003-11-23 18:04:08 +00:00
|
|
|
else if(flag['V'] || ndot>=2 && flag['v']) pchr(err, c);
|
|
|
|
|
return c;
|
|
|
|
|
}
|
2007-03-26 12:02:41 +00:00
|
|
|
|
|
|
|
|
void
|
|
|
|
|
pprompt(void)
|
|
|
|
|
{
|
2003-11-23 18:04:08 +00:00
|
|
|
var *prompt;
|
|
|
|
|
if(runq->iflag){
|
|
|
|
|
pstr(err, promptstr);
|
|
|
|
|
flush(err);
|
2007-03-26 12:02:41 +00:00
|
|
|
prompt = vlook("prompt");
|
2003-11-23 18:04:08 +00:00
|
|
|
if(prompt->val && prompt->val->next)
|
2007-03-26 12:02:41 +00:00
|
|
|
promptstr = prompt->val->next->word;
|
2003-11-23 18:04:08 +00:00
|
|
|
else
|
|
|
|
|
promptstr="\t";
|
|
|
|
|
}
|
|
|
|
|
runq->lineno++;
|
2007-03-26 12:02:41 +00:00
|
|
|
doprompt = 0;
|
2003-11-23 18:04:08 +00:00
|
|
|
}
|
2007-03-26 12:02:41 +00:00
|
|
|
|
|
|
|
|
void
|
|
|
|
|
skipwhite(void)
|
|
|
|
|
{
|
2003-11-23 18:04:08 +00:00
|
|
|
int c;
|
|
|
|
|
for(;;){
|
2007-03-26 12:02:41 +00:00
|
|
|
c = nextc();
|
|
|
|
|
/* Why did this used to be if(!inquote && c=='#') ?? */
|
|
|
|
|
if(c=='#'){
|
|
|
|
|
incomm = 1;
|
2003-11-23 18:04:08 +00:00
|
|
|
for(;;){
|
2007-03-26 12:02:41 +00:00
|
|
|
c = nextc();
|
|
|
|
|
if(c=='\n' || c==EOF) {
|
|
|
|
|
incomm = 0;
|
|
|
|
|
break;
|
|
|
|
|
}
|
2003-11-23 18:04:08 +00:00
|
|
|
advance();
|
|
|
|
|
}
|
|
|
|
|
}
|
2007-03-26 12:02:41 +00:00
|
|
|
if(c==' ' || c=='\t')
|
|
|
|
|
advance();
|
2003-11-23 18:04:08 +00:00
|
|
|
else return;
|
|
|
|
|
}
|
|
|
|
|
}
|
2007-03-26 12:02:41 +00:00
|
|
|
|
|
|
|
|
void
|
|
|
|
|
skipnl(void)
|
|
|
|
|
{
|
|
|
|
|
int c;
|
2003-11-23 18:04:08 +00:00
|
|
|
for(;;){
|
|
|
|
|
skipwhite();
|
2007-03-26 12:02:41 +00:00
|
|
|
c = nextc();
|
|
|
|
|
if(c!='\n')
|
|
|
|
|
return;
|
2003-11-23 18:04:08 +00:00
|
|
|
advance();
|
|
|
|
|
}
|
|
|
|
|
}
|
2007-03-26 12:02:41 +00:00
|
|
|
|
|
|
|
|
int
|
|
|
|
|
nextis(int c)
|
|
|
|
|
{
|
2003-11-23 18:04:08 +00:00
|
|
|
if(nextc()==c){
|
|
|
|
|
advance();
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
2007-03-26 12:02:41 +00:00
|
|
|
|
|
|
|
|
char*
|
|
|
|
|
addtok(char *p, int val)
|
|
|
|
|
{
|
|
|
|
|
if(p==0)
|
|
|
|
|
return 0;
|
2006-03-20 02:25:59 +00:00
|
|
|
if(p==&tok[NTOK-1]){
|
2007-03-26 12:02:41 +00:00
|
|
|
*p = 0;
|
2003-11-23 18:04:08 +00:00
|
|
|
yyerror("token buffer too short");
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
*p++=val;
|
|
|
|
|
return p;
|
|
|
|
|
}
|
2007-03-26 12:02:41 +00:00
|
|
|
|
|
|
|
|
char*
|
|
|
|
|
addutf(char *p, int c)
|
|
|
|
|
{
|
|
|
|
|
p = addtok(p, c);
|
2003-11-23 18:04:08 +00:00
|
|
|
if(twobyte(c)) /* 2-byte escape */
|
|
|
|
|
return addtok(p, advance());
|
|
|
|
|
if(threebyte(c)){ /* 3-byte escape */
|
2007-03-26 12:02:41 +00:00
|
|
|
p = addtok(p, advance());
|
2003-11-23 18:04:08 +00:00
|
|
|
return addtok(p, advance());
|
|
|
|
|
}
|
2011-01-02 13:44:15 -05:00
|
|
|
if(fourbyte(c)){ /* 4-byte escape */
|
|
|
|
|
p = addtok(p, advance());
|
|
|
|
|
p = addtok(p, advance());
|
|
|
|
|
return addtok(p, advance());
|
|
|
|
|
}
|
2003-11-23 18:04:08 +00:00
|
|
|
return p;
|
|
|
|
|
}
|
|
|
|
|
int lastdol; /* was the last token read '$' or '$#' or '"'? */
|
|
|
|
|
int lastword; /* was the last token read a word or compound word terminator? */
|
2007-03-26 12:02:41 +00:00
|
|
|
|
|
|
|
|
int
|
|
|
|
|
yylex(void)
|
|
|
|
|
{
|
|
|
|
|
int c, d = nextc();
|
|
|
|
|
char *w = tok;
|
rc: add recursive descent parser
The old yacc-based parser is available with the -Y flag,
which will probably be removed at some point.
The new -D flag dumps a parse tree of the input,
without executing it. This allows comparing the output
of rc -D and rc -DY on different scripts to see that the
two parsers behave the same.
The rc paper ends by saying:
It is remarkable that in the four most recent editions of the UNIX
system programmer’s manual the Bourne shell grammar described in the
manual page does not admit the command who|wc. This is surely an
oversight, but it suggests something darker: nobody really knows what
the Bourne shell’s grammar is. Even examination of the source code is
little help. The parser is implemented by recursive descent, but the
routines corresponding to the syntactic categories all have a flag
argument that subtly changes their operation depending on the context.
Rc’s parser is implemented using yacc, so I can say precisely what the
grammar is.
The new recursive descent parser here has no such flags.
It is a straightforward translation of the yacc.
The new parser will make it easier to handle free carats
in more generality as well as potentially allow the use of
unquoted = as a word character.
Going through this exercise has highlighted a few
dark corners here as well. For example, I was surprised to
find that
x >f | y
>f x | y
are different commands (the latter redirects y's output).
It is similarly surprising that
a=b x | y
sets a during the execution of y.
It is also a bit counter-intuitive
x | y | z
x | if(c) y | z
are not both 3-phase pipelines.
These are certainly not things we should change, but they
are not entirely obvious from the man page description,
undercutting the quoted claim a bit.
On the other hand, who | wc is clearly accepted by the grammar
in the manual page, and the new parser still handles that test case.
2020-05-04 18:34:19 -04:00
|
|
|
tree *t;
|
2007-03-26 12:02:41 +00:00
|
|
|
yylval.tree = 0;
|
2003-11-23 18:04:08 +00:00
|
|
|
/*
|
|
|
|
|
* Embarassing sneakiness: if the last token read was a quoted or unquoted
|
|
|
|
|
* WORD then we alter the meaning of what follows. If the next character
|
|
|
|
|
* is `(', we return SUB (a subscript paren) and consume the `('. Otherwise,
|
|
|
|
|
* if the next character is the first character of a simple or compound word,
|
|
|
|
|
* we insert a `^' before it.
|
|
|
|
|
*/
|
|
|
|
|
if(lastword){
|
2007-03-26 12:02:41 +00:00
|
|
|
lastword = 0;
|
2003-11-23 18:04:08 +00:00
|
|
|
if(d=='('){
|
|
|
|
|
advance();
|
|
|
|
|
strcpy(tok, "( [SUB]");
|
|
|
|
|
return SUB;
|
|
|
|
|
}
|
|
|
|
|
if(wordchr(d) || d=='\'' || d=='`' || d=='$' || d=='"'){
|
|
|
|
|
strcpy(tok, "^");
|
|
|
|
|
return '^';
|
|
|
|
|
}
|
|
|
|
|
}
|
2007-03-26 12:02:41 +00:00
|
|
|
inquote = 0;
|
2003-11-23 18:04:08 +00:00
|
|
|
skipwhite();
|
2007-03-26 12:02:41 +00:00
|
|
|
switch(c = advance()){
|
2003-11-23 18:04:08 +00:00
|
|
|
case EOF:
|
2007-03-26 12:02:41 +00:00
|
|
|
lastdol = 0;
|
2003-11-23 18:04:08 +00:00
|
|
|
strcpy(tok, "EOF");
|
|
|
|
|
return EOF;
|
|
|
|
|
case '$':
|
2007-03-26 12:02:41 +00:00
|
|
|
lastdol = 1;
|
2003-11-23 18:04:08 +00:00
|
|
|
if(nextis('#')){
|
|
|
|
|
strcpy(tok, "$#");
|
|
|
|
|
return COUNT;
|
|
|
|
|
}
|
|
|
|
|
if(nextis('"')){
|
|
|
|
|
strcpy(tok, "$\"");
|
|
|
|
|
return '"';
|
|
|
|
|
}
|
|
|
|
|
strcpy(tok, "$");
|
|
|
|
|
return '$';
|
|
|
|
|
case '&':
|
2007-03-26 12:02:41 +00:00
|
|
|
lastdol = 0;
|
2003-11-23 18:04:08 +00:00
|
|
|
if(nextis('&')){
|
|
|
|
|
skipnl();
|
|
|
|
|
strcpy(tok, "&&");
|
|
|
|
|
return ANDAND;
|
|
|
|
|
}
|
|
|
|
|
strcpy(tok, "&");
|
|
|
|
|
return '&';
|
|
|
|
|
case '|':
|
2007-03-26 12:02:41 +00:00
|
|
|
lastdol = 0;
|
2003-11-23 18:04:08 +00:00
|
|
|
if(nextis(c)){
|
|
|
|
|
skipnl();
|
|
|
|
|
strcpy(tok, "||");
|
|
|
|
|
return OROR;
|
|
|
|
|
}
|
|
|
|
|
case '<':
|
|
|
|
|
case '>':
|
2007-03-26 12:02:41 +00:00
|
|
|
lastdol = 0;
|
2003-11-23 18:04:08 +00:00
|
|
|
/*
|
|
|
|
|
* funny redirection tokens:
|
|
|
|
|
* redir: arrow | arrow '[' fd ']'
|
|
|
|
|
* arrow: '<' | '<<' | '>' | '>>' | '|'
|
|
|
|
|
* fd: digit | digit '=' | digit '=' digit
|
|
|
|
|
* digit: '0'|'1'|'2'|'3'|'4'|'5'|'6'|'7'|'8'|'9'
|
|
|
|
|
* some possibilities are nonsensical and get a message.
|
|
|
|
|
*/
|
|
|
|
|
*w++=c;
|
2007-03-26 12:02:41 +00:00
|
|
|
t = newtree();
|
2003-11-23 18:04:08 +00:00
|
|
|
switch(c){
|
|
|
|
|
case '|':
|
2007-03-26 12:02:41 +00:00
|
|
|
t->type = PIPE;
|
|
|
|
|
t->fd0 = 1;
|
|
|
|
|
t->fd1 = 0;
|
2003-11-23 18:04:08 +00:00
|
|
|
break;
|
|
|
|
|
case '>':
|
2007-03-26 12:02:41 +00:00
|
|
|
t->type = REDIR;
|
2003-11-23 18:04:08 +00:00
|
|
|
if(nextis(c)){
|
2007-03-26 12:02:41 +00:00
|
|
|
t->rtype = APPEND;
|
2003-11-23 18:04:08 +00:00
|
|
|
*w++=c;
|
|
|
|
|
}
|
2007-03-26 12:02:41 +00:00
|
|
|
else t->rtype = WRITE;
|
|
|
|
|
t->fd0 = 1;
|
2003-11-23 18:04:08 +00:00
|
|
|
break;
|
|
|
|
|
case '<':
|
2007-03-26 12:02:41 +00:00
|
|
|
t->type = REDIR;
|
2003-11-23 18:04:08 +00:00
|
|
|
if(nextis(c)){
|
2007-03-26 12:02:41 +00:00
|
|
|
t->rtype = HERE;
|
2003-11-23 18:04:08 +00:00
|
|
|
*w++=c;
|
2007-03-26 12:02:41 +00:00
|
|
|
} else if (nextis('>')){
|
|
|
|
|
t->rtype = RDWR;
|
|
|
|
|
*w++=c;
|
|
|
|
|
} else t->rtype = READ;
|
|
|
|
|
t->fd0 = 0;
|
2003-11-23 18:04:08 +00:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if(nextis('[')){
|
|
|
|
|
*w++='[';
|
2007-03-26 12:02:41 +00:00
|
|
|
c = advance();
|
|
|
|
|
*w++=c;
|
2003-11-23 18:04:08 +00:00
|
|
|
if(c<'0' || '9'<c){
|
|
|
|
|
RedirErr:
|
2007-03-26 12:02:41 +00:00
|
|
|
*w = 0;
|
2003-11-23 18:04:08 +00:00
|
|
|
yyerror(t->type==PIPE?"pipe syntax"
|
|
|
|
|
:"redirection syntax");
|
|
|
|
|
return EOF;
|
|
|
|
|
}
|
2007-03-26 12:02:41 +00:00
|
|
|
t->fd0 = 0;
|
2003-11-23 18:04:08 +00:00
|
|
|
do{
|
2007-03-26 12:02:41 +00:00
|
|
|
t->fd0 = t->fd0*10+c-'0';
|
2003-11-23 18:04:08 +00:00
|
|
|
*w++=c;
|
2007-03-26 12:02:41 +00:00
|
|
|
c = advance();
|
2003-11-23 18:04:08 +00:00
|
|
|
}while('0'<=c && c<='9');
|
|
|
|
|
if(c=='='){
|
|
|
|
|
*w++='=';
|
2007-03-26 12:02:41 +00:00
|
|
|
if(t->type==REDIR)
|
|
|
|
|
t->type = DUP;
|
|
|
|
|
c = advance();
|
2003-11-23 18:04:08 +00:00
|
|
|
if('0'<=c && c<='9'){
|
2007-03-26 12:02:41 +00:00
|
|
|
t->rtype = DUPFD;
|
|
|
|
|
t->fd1 = t->fd0;
|
|
|
|
|
t->fd0 = 0;
|
2003-11-23 18:04:08 +00:00
|
|
|
do{
|
2007-03-26 12:02:41 +00:00
|
|
|
t->fd0 = t->fd0*10+c-'0';
|
2003-11-23 18:04:08 +00:00
|
|
|
*w++=c;
|
2007-03-26 12:02:41 +00:00
|
|
|
c = advance();
|
2003-11-23 18:04:08 +00:00
|
|
|
}while('0'<=c && c<='9');
|
|
|
|
|
}
|
|
|
|
|
else{
|
2007-03-26 12:02:41 +00:00
|
|
|
if(t->type==PIPE)
|
|
|
|
|
goto RedirErr;
|
|
|
|
|
t->rtype = CLOSE;
|
2003-11-23 18:04:08 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(c!=']'
|
|
|
|
|
|| t->type==DUP && (t->rtype==HERE || t->rtype==APPEND))
|
|
|
|
|
goto RedirErr;
|
|
|
|
|
*w++=']';
|
|
|
|
|
}
|
|
|
|
|
*w='\0';
|
2007-03-26 12:02:41 +00:00
|
|
|
yylval.tree = t;
|
|
|
|
|
if(t->type==PIPE)
|
|
|
|
|
skipnl();
|
rc: add recursive descent parser
The old yacc-based parser is available with the -Y flag,
which will probably be removed at some point.
The new -D flag dumps a parse tree of the input,
without executing it. This allows comparing the output
of rc -D and rc -DY on different scripts to see that the
two parsers behave the same.
The rc paper ends by saying:
It is remarkable that in the four most recent editions of the UNIX
system programmer’s manual the Bourne shell grammar described in the
manual page does not admit the command who|wc. This is surely an
oversight, but it suggests something darker: nobody really knows what
the Bourne shell’s grammar is. Even examination of the source code is
little help. The parser is implemented by recursive descent, but the
routines corresponding to the syntactic categories all have a flag
argument that subtly changes their operation depending on the context.
Rc’s parser is implemented using yacc, so I can say precisely what the
grammar is.
The new recursive descent parser here has no such flags.
It is a straightforward translation of the yacc.
The new parser will make it easier to handle free carats
in more generality as well as potentially allow the use of
unquoted = as a word character.
Going through this exercise has highlighted a few
dark corners here as well. For example, I was surprised to
find that
x >f | y
>f x | y
are different commands (the latter redirects y's output).
It is similarly surprising that
a=b x | y
sets a during the execution of y.
It is also a bit counter-intuitive
x | y | z
x | if(c) y | z
are not both 3-phase pipelines.
These are certainly not things we should change, but they
are not entirely obvious from the man page description,
undercutting the quoted claim a bit.
On the other hand, who | wc is clearly accepted by the grammar
in the manual page, and the new parser still handles that test case.
2020-05-04 18:34:19 -04:00
|
|
|
if(t->type==REDIR) {
|
|
|
|
|
skipwhite();
|
|
|
|
|
if(nextc() == '{')
|
|
|
|
|
t->type = REDIRW;
|
|
|
|
|
}
|
2003-11-23 18:04:08 +00:00
|
|
|
return t->type;
|
|
|
|
|
case '\'':
|
2007-03-26 12:02:41 +00:00
|
|
|
lastdol = 0;
|
|
|
|
|
lastword = 1;
|
|
|
|
|
inquote = 1;
|
2003-11-23 18:04:08 +00:00
|
|
|
for(;;){
|
2007-03-26 12:02:41 +00:00
|
|
|
c = advance();
|
|
|
|
|
if(c==EOF)
|
|
|
|
|
break;
|
2003-11-23 18:04:08 +00:00
|
|
|
if(c=='\''){
|
|
|
|
|
if(nextc()!='\'')
|
|
|
|
|
break;
|
|
|
|
|
advance();
|
|
|
|
|
}
|
2007-03-26 12:02:41 +00:00
|
|
|
w = addutf(w, c);
|
2003-11-23 18:04:08 +00:00
|
|
|
}
|
2007-03-26 12:02:41 +00:00
|
|
|
if(w!=0)
|
|
|
|
|
*w='\0';
|
|
|
|
|
t = token(tok, WORD);
|
|
|
|
|
t->quoted = 1;
|
|
|
|
|
yylval.tree = t;
|
2003-11-23 18:04:08 +00:00
|
|
|
return t->type;
|
|
|
|
|
}
|
|
|
|
|
if(!wordchr(c)){
|
2007-03-26 12:02:41 +00:00
|
|
|
lastdol = 0;
|
|
|
|
|
tok[0] = c;
|
2003-11-23 18:04:08 +00:00
|
|
|
tok[1]='\0';
|
|
|
|
|
return c;
|
|
|
|
|
}
|
|
|
|
|
for(;;){
|
|
|
|
|
/* next line should have (char)c==GLOB, but ken's compiler is broken */
|
|
|
|
|
if(c=='*' || c=='[' || c=='?' || c==(unsigned char)GLOB)
|
2007-03-26 12:02:41 +00:00
|
|
|
w = addtok(w, GLOB);
|
|
|
|
|
w = addutf(w, c);
|
|
|
|
|
c = nextc();
|
2003-11-23 18:04:08 +00:00
|
|
|
if(lastdol?!idchr(c):!wordchr(c)) break;
|
|
|
|
|
advance();
|
|
|
|
|
}
|
|
|
|
|
|
2007-03-26 12:02:41 +00:00
|
|
|
lastword = 1;
|
|
|
|
|
lastdol = 0;
|
|
|
|
|
if(w!=0)
|
|
|
|
|
*w='\0';
|
|
|
|
|
t = klook(tok);
|
|
|
|
|
if(t->type!=WORD)
|
|
|
|
|
lastword = 0;
|
|
|
|
|
t->quoted = 0;
|
|
|
|
|
yylval.tree = t;
|
2003-11-23 18:04:08 +00:00
|
|
|
return t->type;
|
|
|
|
|
}
|