summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkugwa <kugwa2000@gmail.com>2015-10-23 03:50:35 +0800
committerkugwa <kugwa2000@gmail.com>2015-10-23 03:50:35 +0800
commit278478c027b75e3716ef5a21ecca332f3d671a8a (patch)
tree427a6718f15e0c990dce645cac17fd5ce3a90720
parent54499f655255823658225227bf1650eaf85c17ec (diff)
downloadcompiler2015-278478c027b75e3716ef5a21ecca332f3d671a8a.tar
compiler2015-278478c027b75e3716ef5a21ecca332f3d671a8a.tar.gz
compiler2015-278478c027b75e3716ef5a21ecca332f3d671a8a.tar.bz2
compiler2015-278478c027b75e3716ef5a21ecca332f3d671a8a.tar.lz
compiler2015-278478c027b75e3716ef5a21ecca332f3d671a8a.tar.xz
compiler2015-278478c027b75e3716ef5a21ecca332f3d671a8a.tar.zst
compiler2015-278478c027b75e3716ef5a21ecca332f3d671a8a.zip
CONST_FLOAT now matchs some fucking cases like '1.' or '.1'HW2
-rw-r--r--lexer.l2
1 files changed, 1 insertions, 1 deletions
diff --git a/lexer.l b/lexer.l
index d34ed7b..c670529 100644
--- a/lexer.l
+++ b/lexer.l
@@ -50,7 +50,7 @@ WS [ \t]+
/* You need to define the following RE's */
CONST_INT [+-]?{digit}+
-CONST_FLOAT [+-]?(([0-9]+|[0-9]*\.[0-9]+)([eE][-+]?[0-9]+)?)
+CONST_FLOAT [+-]?(([0-9]+\.?|[0-9]*\.[0-9]+)([eE][-+]?[0-9]+)?)
/* {digit}+\.{digit}+ */
CONST_STRING \"([^\"\n]|(\\.))*\"
COMMENT \/\*([^*]|\n|(\*+([^*/]|\n)))*\*+\/