52 static void prep (
char **s)
54 static char expr_buf[
MAXLINE+1];
78 if (*s ==
'%' && s[1] ==
'%')
80 else if (*s ==
'\0' || isspace (*s))
83 error (
"missing rule section");
93 fputs (
"\n#ifndef YY_BREAK\n#define YY_BREAK break;\n#endif\n",
outf);
94 fputs (
"void lexact (int no)\n{\n",
outf);
95 fputs (
"\tswitch (no)\n\t{\n",
outf);
98 if (*s ==
'%' && s[1] ==
'%')
100 else if (*s ==
'\0' || isspace (*s))
112 fprintf (stderr,
"%s #%d: regular expression syntax error\n",
120 fputs (
"\t\tYY_BREAK\n",
outf);
122 fprintf (
outf,
"\tcase %d:\n#line %d\n\t\t", no,
line_no);
124 while (*sc ==
'\t' || *sc ==
' ')
129 fputs (
"\tYY_BREAK\n\t}\n}\n",
outf);
131 error (
"no regular expressions in rule section");
144 if (!(
inf=fopen (s,
"r")))
146 error (
"cannot open `%s'", s);
150 if (!(
outf=fopen (
"lex.yy.c",
"w")))
152 error (
"cannot open `%s'",
"lex.yy.c");
void error(const char *format,...)
int dfa_parse(struct DFA *, const char **)
static void read_tail(void)
static const char * inf_name
static void read_rules(struct DFA *dfap)
int read_file(const char *s, struct DFA *dfa)
static void prep(char **s)
static void read_defs(void)
static char * read_line(void)