summaryrefslogtreecommitdiffstats
path: root/contrib/amd/fsinfo/fsi_lex.l
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/amd/fsinfo/fsi_lex.l')
-rw-r--r--contrib/amd/fsinfo/fsi_lex.l28
1 files changed, 17 insertions, 11 deletions
diff --git a/contrib/amd/fsinfo/fsi_lex.l b/contrib/amd/fsinfo/fsi_lex.l
index 2fc7b8a..8de8a13 100644
--- a/contrib/amd/fsinfo/fsi_lex.l
+++ b/contrib/amd/fsinfo/fsi_lex.l
@@ -1,6 +1,6 @@
%{
/*
- * Copyright (c) 1997-2003 Erez Zadok
+ * Copyright (c) 1997-2004 Erez Zadok
* Copyright (c) 1989 Jan-Simon Pendry
* Copyright (c) 1989 Imperial College of Science, Technology & Medicine
* Copyright (c) 1989 The Regents of the University of California.
@@ -37,9 +37,8 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * %W% (Berkeley) %G%
*
- * $Id: fsi_lex.l,v 1.4.2.4 2002/12/27 22:45:06 ezk Exp $
+ * $Id: fsi_lex.l,v 1.4.2.6 2004/05/12 15:54:31 ezk Exp $
*
*/
@@ -48,8 +47,9 @@
* TODO: Needs rewriting.
*/
+static int ayylineno;
+
#ifdef FLEX_SCANNER
-static int yylineno;
# define INIT_STATE { \
switch ((yy_start - 1) / 2) { \
case 0: \
@@ -159,6 +159,13 @@ struct r {
%}
+/* This option causes Solaris lex to fail. Use flex. See BUGS file */
+/* no need to use yyunput() */
+%option nounput
+
+/* allocate more output slots so lex scanners don't run out of mem */
+%o 1024
+
%start F Q
%%
@@ -166,22 +173,22 @@ struct r {
<F>[^ \t\n"={}]+ { return find_resword(yytext); } /* dummy " */
<F>[ \t] ;
-<F>"\n" { yylineno++; }
+<F>"\n" { ayylineno++; }
<F>[={}] { return *yytext; }
<F>\" { BEGIN Q; optr = ostr; quoted = 1; }
-<Q>\n { yylineno++; yyerror("\" expected"); BEGIN F; }
+<Q>\n { ayylineno++; yyerror("\" expected"); BEGIN F; }
<Q>\\b { *optr++ = '\b'; /* escape */ }
<Q>\\t { *optr++ = '\t'; /* escape */ }
<Q>\\\" { *optr++ = '\"'; /* escape */ }
<Q>\\\\ { *optr++ = '\\'; /* escape */ }
-<Q>\\\n { yylineno++; /* continue */ }
+<Q>\\\n { ayylineno++; /* continue */ }
<Q>\\r { *optr++ = '\r'; /* escape */ }
<Q>\\n { *optr++ = '\n'; /* escape */ }
<Q>\\f { *optr++ = '\f'; /* escape */ }
<Q>"\\ " { *optr++ = ' '; /* force space */ }
<Q>\\. { yyerror("Unknown \\ sequence"); }
-<Q>([ \t]|"\\\n"){2,} { char *p = (char *) yytext-1; while ((p = strchr(p+1, '\n'))) yylineno++; }
+<Q>([ \t]|"\\\n"){2,} { char *p = (char *) yytext-1; while ((p = strchr(p+1, '\n'))) ayylineno++; }
<Q>\" { BEGIN F; quoted = 0;
*optr = '\0';
yylval.s = strdup(ostr);
@@ -235,12 +242,11 @@ yyerror(char *fmt, ...)
va_start(ap, fmt);
col_cleanup(0);
- fprintf(stderr, "%s:%d: ", fsi_filename ? fsi_filename : "/dev/stdin", yylineno);
+ fprintf(stderr, "%s:%d: ", fsi_filename ? fsi_filename : "/dev/stdin", ayylineno);
vfprintf(stderr, fmt, ap);
fputc('\n', stderr);
parse_errors++;
va_end(ap);
- if (0) unput(0);/* dummy to shut gcc up: "unput defined but not used" */
return 0;
}
@@ -249,7 +255,7 @@ ioloc *
current_location(void)
{
ioloc *ip = CALLOC(struct ioloc);
- ip->i_line = yylineno;
+ ip->i_line = ayylineno;
ip->i_file = fsi_filename;
return ip;
}
OpenPOWER on IntegriCloud