diff options
-rw-r--r-- | parser.l | 16 | ||||
-rw-r--r-- | txr.1 | 7 |
2 files changed, 12 insertions, 11 deletions
@@ -287,8 +287,12 @@ UONLY {U2}{U}|{U3}{U}{U}|{U4}{U}{U}{U} return NUMBER; } -<SPECIAL,QSPECIAL,NESTED,BRACED>{FLODOT}/[^.] { - val str = string_own(utf8_dup_from(yytext)); +<SPECIAL>({FLO}|{FLODOT}){TOK} | +<BRACED>({FLO}|{FLODOT}){BTOK} | +<NESTED>({FLO}|{FLODOT}){NTOK} { + val str = string_utf8(yytext); + + yyerrorf(yyg, lit("trailing junk in floating-point literal: ~a"), str, nao); if (yy_top_state(yyscanner) == INITIAL || yy_top_state(yyscanner) == QSILIT @@ -299,12 +303,8 @@ UONLY {U2}{U}|{U3}{U}{U}|{U4}{U}{U}{U} return NUMBER; } -<SPECIAL>({FLO}|{FLODOT}){TOK} | -<BRACED>({FLO}|{FLODOT}){BTOK} | -<NESTED>({FLO}|{FLODOT}){NTOK} { - val str = string_utf8(yytext); - - yyerrorf(yyg, lit("trailing junk in floating-point literal: ~a"), str, nao); +<SPECIAL,QSPECIAL,NESTED,BRACED>{FLODOT}/[^.] { + val str = string_own(utf8_dup_from(yytext)); if (yy_top_state(yyscanner) == INITIAL || yy_top_state(yyscanner) == QSILIT @@ -2652,17 +2652,18 @@ Examples: 9.E19 -.5 +3E+3 + 1.E5 .cble Examples which are not floating-point constant tokens: .cblk - . ;; consing dot + . ;; dot token, not a number 123E ;; the symbol 123E 1.0E- ;; syntax error: invalid floating point constant 1.0E ;; syntax error: invalid floating point constant - 1.E ;; 1; consing dot; symbol E - .e ;; consing dot followed by symbol e + 1.E ;; syntax error: invalid floating point literal + .e ;; syntax error: dot token followed by symbol .cble In \*(TX there is a special "dotdot" token consisting of two consecutive periods. |