diff options
author | Quentin Carbonneaux <quentin.carbonneaux@yale.edu> | 2016-02-12 14:23:57 -0500 |
---|---|---|
committer | Quentin Carbonneaux <quentin.carbonneaux@yale.edu> | 2016-02-12 14:23:57 -0500 |
commit | 1d9499172b7d0ebe1ecb9a35589bd8b02e99902c (patch) | |
tree | 10faff4a122d47d6943b571cd29c02f625cebfdd /lisc/parse.c | |
parent | 8e888618076474e7927563d0cbf14d17ce185e13 (diff) | |
download | roux-1d9499172b7d0ebe1ecb9a35589bd8b02e99902c.tar.gz |
cut code, use scanf a little more
Diffstat (limited to 'lisc/parse.c')
-rw-r--r-- | lisc/parse.c | 16 |
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; |