summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkugwa <kugwa2000@gmail.com>2015-10-23 02:35:10 +0800
committerkugwa <kugwa2000@gmail.com>2015-10-23 02:35:10 +0800
commit47cf523c3abc5af218560f9412f3cf203996817d (patch)
tree96b7a7fd840623fcd8b1588741d52896f0a86d43
parent6eb80220249bbbb73a3a9449fa3c65c854f38997 (diff)
downloadcompiler2015-47cf523c3abc5af218560f9412f3cf203996817d.tar
compiler2015-47cf523c3abc5af218560f9412f3cf203996817d.tar.gz
compiler2015-47cf523c3abc5af218560f9412f3cf203996817d.tar.bz2
compiler2015-47cf523c3abc5af218560f9412f3cf203996817d.tar.lz
compiler2015-47cf523c3abc5af218560f9412f3cf203996817d.tar.xz
compiler2015-47cf523c3abc5af218560f9412f3cf203996817d.tar.zst
compiler2015-47cf523c3abc5af218560f9412f3cf203996817d.zip
More complex format of int and float can be match
-rw-r--r--lexer.l6
1 files changed, 3 insertions, 3 deletions
diff --git a/lexer.l b/lexer.l
index 829c158..529ba1a 100644
--- a/lexer.l
+++ b/lexer.l
@@ -48,9 +48,9 @@ ID {letter}({letter}|{digit}|"_")*
WS [ \t]+
/* You need to define the following RE's */
-CONST_INT {digit}+
-CONST_FLOAT {digit}+\.{digit}+
-/* -?([0-9]+|[0-9]*\.[0-9]+([eE][-+]?[0-9]+)?) */
+CONST_INT [+-]?{digit}+
+CONST_FLOAT [+-]?([0-9]+|[0-9]*\.[0-9]+([eE][-+]?[0-9]+)?)
+ /* {digit}+\.{digit}+ */
CONST_STRING \"([^\"\n]|(\\.))*\"
COMMENT \/\*([^*]|\n|(\*+([^*/]|\n)))*\*+\/