summary refs log tree commit diff
diff options
context:
space:
mode:
authorQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2016-02-12 14:23:57 -0500
committerQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2016-02-12 14:23:57 -0500
commit1d9499172b7d0ebe1ecb9a35589bd8b02e99902c (patch)
tree10faff4a122d47d6943b571cd29c02f625cebfdd
parent8e888618076474e7927563d0cbf14d17ce185e13 (diff)
downloadroux-1d9499172b7d0ebe1ecb9a35589bd8b02e99902c.tar.gz
cut code, use scanf a little more
-rw-r--r--lisc/parse.c16
1 files changed, 3 insertions, 13 deletions
diff --git a/lisc/parse.c b/lisc/parse.c
index 5e84350..024eced 100644
--- a/lisc/parse.c
+++ b/lisc/parse.c
@@ -167,7 +167,7 @@ lex()
 		{ 0, TXXX }
 	};
 	static char tok[NString];
-	int c, c1, i;
+	int c, i;
 	int t;
 
 	do
@@ -190,22 +190,12 @@ lex()
 	case '=':
 		return TEq;
 	case 's':
-		c1 = fgetc(inf);
-		if (c1 != '_') {
-			ungetc(c1, inf);
+		if (fscanf(inf, "_%f", &tokval.flts) != 1)
 			break;
-		}
-		if (fscanf(inf, "%f", &tokval.flts) != 1)
-			err("invalid floating point literal");
 		return TFlts;
 	case 'd':
-		c1 = fgetc(inf);
-		if (c1 != '_') {
-			ungetc(c1, inf);
+		if (fscanf(inf, "_%lf", &tokval.fltd) != 1)
 			break;
-		}
-		if (fscanf(inf, "%lf", &tokval.fltd) != 1)
-			err("invalid floating point literal");
 		return TFltd;
 	case '%':
 		t = TTmp;