|
|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T l
Length: 6345 (0x18c9)
Types: TextFile
Names: »lexicalinput«
└─⟦db229ac7e⟧ Bits:30007240 EUUGD20: SSBA 1.2 / AFW Benchmarks
└─⟦this⟧ »EUUGD20/AFUU-ssba1.21/ssba1.21E/tools/lexicalinput«
└─⟦this⟧ »EUUGD20/AFUU-ssba1.21/ssba1.21F/outils/lexicalinput«
%{
/* $Header: lexan.l,v 1.9 88/01/25 15:41:02 root Locked $ */
/*
* lexan.l -- Lexical Analyzer for EASE.
*
* Contains code for lex(1) which generates a lexical
* analyzer (lex.yy.c) for Ease, a high-level specification
* format for sendmail configuration files.
*
* author -- James S. Schoner, Purdue University Computing Center,
* West Lafayette, Indiana 47907
*
* date -- July 1, 1985
*
* Copyright (c) 1985 by Purdue Research Foundation
*
* All rights reserved.
*
*/
#include "fixstrings.h"
#include "symtab.h"
#include "lexdefs.h"
#define LEXnewline '\n'
#define LEXeof '\0'
#define MaxFN 200 /* maximum file name length */
extern struct he *LookupSymbol ();
extern void ErrorReport ();
int Lcount; /* line counter */
char FNbuf[MaxFN]; /* file name buffer */
short RMatch = FALSE; /* ruleset match flag */
#undef input
# define input() (((yytchar=yysptr>yysbuf?U(*--yysptr):Getc(yyin,yyout))==10?(yylineno++,yytchar):yytchar)==EOF?0:yytchar)
char
Getc (yyin, yyout)
FILE *yyin, *yyout;
{
static char linbuf[BUFSIZ], *pc = linbuf;
char c;
/* initialize buffer: first call only */
if (*pc == '\0' && pc == linbuf) {
if (fgets(linbuf, BUFSIZ, yyin)==NULL)
return EOF;
fprintf(yyout, "# %s", linbuf); /* echo input as comment */
}
c = *pc++;
if (c == '\n') {
pc = linbuf;
if (fgets(linbuf, BUFSIZ, yyin) == NULL)
*pc = EOF;
else
/* echo input as comment */
fprintf(yyout, "# %s", linbuf);
}
return c;
}
%}
/* lex-specific extensions */
%e 1300
%p 4000
%n 600
%%
int INch; /* any input character */
[ \t\f]+ ; /* discard whitepsace */
[\n] Lcount++;
^\#[ \t]*[0-9]+[ \t]*\".*\"[ \t]*[\n] {
sscanf (yytext, "%*c%d%s", &Lcount, FNbuf);
}
match return (MATCH);
in return (IN);
map return (MAP);
bind return (BIND);
define return (DEFINE);
macro return (MACRO);
class return (CLASS);
options return (OPTIONS);
precedence return (PRECEDENCE);
trusted return (TRUSTED);
header return (HEADER);
ruleset return (RULESET);
mailer return (MAILER);
host return (HOST);
user return (USER);
hostnum return (HOSTNUM);
while |
if return (IF);
retry return (RETRY);
next return (NEXT);
return return (RETURN);
resolve return (RESOLVE);
for return (FOR);
field return (FIELD);
concat return (CONCAT);
ifset return (IFSET);
canon return (CANON);
readclass return (READCLASS);
Path return (MPATH);
Flags return (MFLAGS);
Sender return (MSENDER);
Recipient return (MRECIPIENT);
Argv return (MARGV);
Eol return (MEOL);
Maxsize return (MMAXSIZE);
o_alias return (AAOPT);
o_ewait return (AOPT);
o_bsub return (BBOPT);
o_qwait return (COPT);
o_delivery return (DOPT);
d_interactive return (DOPTI);
d_background return (DOPTB);
d_queue return (DOPTQ);
o_rebuild return (DDOPT);
o_handling return (EOPT);
h_print return (EOPTP);
h_exit return (EOPTE);
h_mail return (EOPTM);
h_write return (EOPTW);
h_mailz return (EOPTZ);
o_tmode return (FFOPT);
o_usave return (FOPT);
o_gid return (GOPT);
o_fsmtp return (HHOPT);
o_skipd return (IOPT);
o_slog return (LLOPT);
o_rsend return (MOPT);
o_dnet return (NNOPT);
o_hformat return (OOPT);
o_qfactor return (QOPT);
o_qdir return (QQOPT);
o_tread return (ROPT);
o_flog return (SSOPT);
o_safe return (SOPT);
o_qtimeout return (TTOPT);
o_timezone return (TOPT);
o_dmuid return (UOPT);
o_verbose return (VOPT);
o_wizpass return (WWOPT);
o_loadq return (XOPT);
o_loadnc return (XXOPT);
o_recipfactor return (YOPT);
o_newproc return (YYOPT);
o_prifactor return (ZOPT);
o_waitfactor return (ZZOPT);
f_ffrom return (FFLAG);
f_rfrom return (RFLAG);
f_noreset return (SSFLAG);
f_noufrom return (NFLAG);
f_locm return (LFLAG);
f_strip return (SFLAG);
f_mult return (MFLAG);
f_from return (FFFLAG);
f_date return (DDFLAG);
f_mesg return (MMFLAG);
f_full return (XFLAG);
f_return return (PPFLAG);
f_upperu return (UFLAG);
f_upperh return (HFLAG);
f_arpa return (AAFLAG);
f_ufrom return (UUFLAG);
f_expensive return (EFLAG);
f_dot return (XXFLAG);
f_llimit return (LLFLAG);
f_retsmtp return (PFLAG);
f_smtp return (IIFLAG);
f_addrw return (CCFLAG);
f_escape return (EEFLAG);
[A-Za-z][A-Za-z0-9_-]* {
/* store identifiers in symbol table */
yylval.phe = LookupSymbol (yytext);
return (IDENT);
}
["]((\\\n)|(\\\")|[^"\n])* {
if ((INch = input()) == LEXnewline) {
ErrorReport ("End of line in string.\n");
unput (INch);
}
fixquotes ();
yylval.psb = (char *) malloc (strlen (yytext) + 1);
strcpy (yylval.psb, yytext + 1);
return (SCONST);
}
[0][0-7]* {
sscanf (yytext, "%o", &yylval.ival); /* octal constant */
return (ICONST);
}
[-]?[1-9][0-9]* {
yylval.ival = atoi (yytext);
return (ICONST);
}
"=" return (ASGN);
"," return (COMMA);
"{" return (LBRACE);
"}" return (RBRACE);
"(" return (LPAREN);
")" return (RPAREN);
";" return (SEMI);
"$" return (DOLLAR);
":" return (COLON);
"*" return (STAR);
"/*" {
/* eat C comments */
INch = input ();
while ((INch != '*') ||
((INch = input ()) != '/')) {
if (INch == LEXnewline)
Lcount++;
else
if (INch == LEXeof) {
ErrorReport ("End of file in comment.\n");
break;
}
if (INch != '*')
INch = input ();
}
}
[\\]?. {
if (RMatch) { /* in rulesets, return literal character */
yylval.ival = (yytext[0] == '\\') ? yytext[1] : yytext[0];
return (SEPCHAR);
} else {
ErrorReport ("Illegal delimiter character");
printf (": (octal code) \\%03o\n", *yytext);
}
}
%%
/*
* fixquotes --- inside a "quoted string", turn `\"' into just `"'
*
* this is most useful inside the Argv strings for mailers,
* particularly when debugging.
*/
fixquotes ()
{
register char *cp1, *cp2;
cp1 = cp2 = yytext;
while (*cp2) {
/*
* if we really wanted to get fancy,
* at this point we'd handle C escapes,
* but I don't think it's necessary.
*/
if (*cp2 == '\\' && cp2[1] == '"')
cp2++;
*cp1++ = *cp2++;
}
*cp1++ = *cp2++; /* final '\0' */
}