Date: Mon, 26 Apr 1999 07:49:46 -0400 (EDT) From: Luoqi Chen <luoqi@watermarkgroup.com> To: chris@calldei.com, peter@netplex.com.au Cc: A.Leidinger@Wurzelausix.CS.Uni-SB.de, current@FreeBSD.ORG Subject: Re: config & NO_F00F_HACK Message-ID: <199904261149.HAA12979@lor.watermarkgroup.com>
next in thread | raw e-mail | index | archive | help
> > On Sun, Apr 25, 1999, A.Leidinger@Wurzelausix.CS.Uni-SB.de wrote:
> > > Hi,
> > >=20
> > > # ident LINT
> > > LINT:
> > > $Id: LINT,v 1.589 1999/04/24 21:45:44 peter Exp $
> > >=20
> > > with:
> > > option NO_F00F_HACK
> > >=20
> > > # config WORK
> > > WORK:15: unknown option "NO_F0F_HACK"
> > ^^^^^^^^^^^^^
> >
> > You made a typo.
>
> No, it is a parsing/stringification botch. It's parsed like this:
>
> ID: NO_F
> NUMBER: 00 (octal 0)
> ID: F_HACK
>
> Of course, an atoi of "00" and then a sprintf("%d") results in a single "0".
>
> I've fixed this here and will commit it shortly, but I'm a bit nervous about
> the scope of the change required to prevent this information loss. :-/ I
> don't know enough lex/yacc to do context-sensitive tokenization.
>
This should be fairly simple, please try this,
Index: lang.l
===================================================================
RCS file: /home/ncvs/src/usr.sbin/config/lang.l,v
retrieving revision 1.19
diff -u -r1.19 lang.l
--- lang.l 1999/04/24 18:59:19 1.19
+++ lang.l 1999/04/26 11:47:35
@@ -105,11 +105,14 @@
int hex __P((char *));
%}
-WORD [-A-Za-z_][-A-Za-z_]*
+WORD [A-Za-z_][-A-Za-z_]*
+ALNUM [A-Za-z_][-A-Za-z_0-9]*
+%s NONUM
%%
-{WORD} {
+<NONUM>{WORD} {
int i;
+ BEGIN(0);
if ((i = kw_lookup(yytext)) == -1)
{
yylval.str = strdup(yytext);
@@ -118,6 +121,22 @@
}
tprintf("(%s) ", yytext);
return i;
+ }
+<INITIAL>{WORD} {
+ int i;
+
+ if ((i = kw_lookup(yytext)) == -1)
+ REJECT
+ if (i == CONTROLLER || i == DEVICE || i == DISK ||
+ i == PSEUDO_DEVICE || i == AT || i == ON)
+ BEGIN(NONUM);
+ tprintf("(%s) ", yytext);
+ return i;
+ }
+<INITIAL>{ALNUM} {
+ yylval.str = strdup(yytext);
+ tprintf("id(%s) ", yytext);
+ return ID;
}
\\\"[^"]+\\\" {
yytext[strlen(yytext)-2] = '"';
> Cheers,
> -Peter
>
-lq
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199904261149.HAA12979>
