%{
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 1996 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
%}
%{
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
%}
%{
/* All Rights Reserved */
%}
%{
#pragma ident "%Z%%M% %I% %E% SMI"
%}
%{
#include "awk.h"
#include "awk.def"
extern int yylval;
extern int mustfld;
long long lineno = 1;
#ifdef DEBUG
#else
# define RETURN(x) return (x)
#endif
#define CBUFLEN 150
%}
%a 50000
%o 50000
D [0-9]
WS [ \t]
%%
case 0:
BEGIN A;
break;
case sc:
BEGIN A;
RETURN('}');
}
<A>^\n lineno++;
<A>{WS} /* dummy for cstyle */;
<A>"\\"\n lineno++;
<A>"$"{D}+ {
} else {
}
}
<A>({D}+("."?){D}*|"."{D}+)((e|E)("+"|-)?{D}+)? {
<A>{A}{B}* {
symtab);
}
<A>\" { BEGIN str; clen=0; }
<A># { BEGIN comment; }
<comment>\n { BEGIN A; lineno++; RETURN(NL); }
<comment>. /* dummy */;
<A>. { yylval = yytext[0]; RETURN(yytext[0]); }
<reg>"[" { BEGIN chc; clen=0; cflag=0; }
<reg>"[^" { BEGIN chc; clen=0; cflag=1; }
<reg>"?" RETURN(QUEST);
<reg>"+" RETURN(PLUS);
<reg>"*" RETURN(STAR);
<reg>"|" RETURN(OR);
<reg>"." RETURN(DOT);
<reg>"(" RETURN('(');
<reg>")" RETURN(')');
<reg>"^" RETURN('^');
<reg>"$" RETURN('$');
<reg>\\{D}{D}{D} { wsscanf(yytext+1, "%o", &yylval); RETURN(CHAR); }
<reg>\\. { if (yytext[1]=='n') yylval = '\n';
else if (yytext[1] == 't') yylval = '\t';
else if (yytext[1] == 'b') yylval = '\b';
else if (yytext[1] == 'r') yylval = '\r';
else if (yytext[1] == 'f') yylval = '\f';
else yylval = yytext[1];
RETURN(CHAR);
}
<reg>"/" { BEGIN A; unput('/'); }
<reg>. { yylval = yytext[0]; RETURN(CHAR); }
<str>\" { wchar_t *s; BEGIN A; cbuf[clen]=0; s = tostring(cbuf);
cbuf[clen] = ' '; cbuf[++clen] = 0;
yylval = (int)setsymtab(cbuf, s, 0.0, CON|STR, symtab);
RETURN(STRING); }
%%
int
input()
{
int c;
c = U(*--yysptr);
c = *lexprog++;
else
if (c == '\n')
yylineno++;
else if (c == EOF)
c = 0;
return (c);
}
void
startreg()
{
}