summaryrefslogtreecommitdiff
path: root/usr.bin/bc/scan.l
diff options
context:
space:
mode:
authorOtto Moerbeek <otto@cvs.openbsd.org>2003-09-29 03:24:28 +0000
committerOtto Moerbeek <otto@cvs.openbsd.org>2003-09-29 03:24:28 +0000
commitc3ccaed3bdefe5ae241a201b982a9eb3400378be (patch)
treeee447e64ee9241b0241ffee5c2e9f9e918f11e35 /usr.bin/bc/scan.l
parent4ae6757f7e51115cd506d4f5555ef6c733d05d5d (diff)
Implement (undocumented) dot shorthand, which was missing.
Spotted by millert@.
Diffstat (limited to 'usr.bin/bc/scan.l')
-rw-r--r--usr.bin/bc/scan.l15
1 files changed, 6 insertions, 9 deletions
diff --git a/usr.bin/bc/scan.l b/usr.bin/bc/scan.l
index 43245a80b2d..5add37f6d52 100644
--- a/usr.bin/bc/scan.l
+++ b/usr.bin/bc/scan.l
@@ -1,5 +1,5 @@
%{
-/* $OpenBSD: scan.l,v 1.5 2003/09/28 07:57:57 otto Exp $ */
+/* $OpenBSD: scan.l,v 1.6 2003/09/29 03:24:27 otto Exp $ */
/*
* Copyright (c) 2003, Otto Moerbeek <otto@drijf.net>
@@ -18,7 +18,7 @@
*/
#ifndef lint
-static const char rcsid[] = "$OpenBSD: scan.l,v 1.5 2003/09/28 07:57:57 otto Exp $";
+static const char rcsid[] = "$OpenBSD: scan.l,v 1.6 2003/09/29 03:24:27 otto Exp $";
#endif /* not lint */
#include <err.h>
@@ -88,15 +88,12 @@ DIGIT [0-9A-F]
}
\\\n[ \t]* lineno++;
[^0-9A-F\.] {
- if (strcmp(strbuf, ".") == 0) {
- yyerror("syntax error");
- BEGIN(INITIAL);
- REJECT;
- }
+ BEGIN(INITIAL);
+ unput(yytext[0]);
+ if (strcmp(strbuf, ".") == 0)
+ return DOT;
else {
- BEGIN(INITIAL);
yylval.str = strbuf;
- unput(yytext[0]);
return NUMBER;
}
}