summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.bin/bc/bc.y11
-rw-r--r--usr.bin/bc/scan.l15
2 files changed, 13 insertions, 13 deletions
diff --git a/usr.bin/bc/bc.y b/usr.bin/bc/bc.y
index 31fa4df9524..d10b9962ca6 100644
--- a/usr.bin/bc/bc.y
+++ b/usr.bin/bc/bc.y
@@ -1,5 +1,5 @@
%{
-/* $OpenBSD: bc.y,v 1.8 2003/09/28 07:57:57 otto Exp $ */
+/* $OpenBSD: bc.y,v 1.9 2003/09/29 03:24:27 otto Exp $ */
/*
* Copyright (c) 2003, Otto Moerbeek <otto@drijf.net>
@@ -31,7 +31,7 @@
*/
#ifndef lint
-static const char rcsid[] = "$OpenBSD: bc.y,v 1.8 2003/09/28 07:57:57 otto Exp $";
+static const char rcsid[] = "$OpenBSD: bc.y,v 1.9 2003/09/29 03:24:27 otto Exp $";
#endif /* not lint */
#include <ctype.h>
@@ -113,8 +113,8 @@ extern char *__progname;
const char *str;
}
-%token COMMA SEMICOLON LPAR RPAR LBRACE RBRACE LBRACKET RBRACKET
-%token ENDOFFILE NEWLINE
+%token COMMA SEMICOLON LPAR RPAR LBRACE RBRACE LBRACKET RBRACKET DOT
+%token NEWLINE
%token <str> LETTER NUMBER STRING
%token DEFINE BREAK QUIT LENGTH
%token RETURN FOR IF WHILE SQRT
@@ -457,6 +457,9 @@ expression : named_expression
{
$$ = node($1.load, END_NODE);
}
+ | DOT {
+ $$ = node(cs("l."), END_NODE);
+ }
| NUMBER
{
$$ = node(cs(" "), as($1), END_NODE);
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;
}
}