From 47cf523c3abc5af218560f9412f3cf203996817d Mon Sep 17 00:00:00 2001 From: kugwa Date: Fri, 23 Oct 2015 02:35:10 +0800 Subject: More complex format of int and float can be match --- lexer.l | 6 +++--- 1 file 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)))*\*+\/ -- cgit v1.2.3