فهرست منبع

Float constants of the form .5 and 5. are now allowed by the lexer

Taddeus Kroes 12 سال پیش
والد
کامیت
c373abd89b
1فایلهای تغییر یافته به همراه2 افزوده شده و 1 حذف شده
  1. 2 1
      lexer.mll

+ 2 - 1
lexer.mll

@@ -81,7 +81,8 @@ rule token = parse
   | "true"    { BOOL_CONST true }
   | "false"   { BOOL_CONST false }
   | ['0'-'9']+ as i              { INT_CONST (int_of_string i) }
-  | ['0'-'9']+'.'['0'-'9']+ as f { FLOAT_CONST (float_of_string f) }
+  | ['0'-'9']+'.'['0'-'9']* as f { FLOAT_CONST (float_of_string f) }
+  | ['0'-'9']*'.'['0'-'9']+ as f { FLOAT_CONST (float_of_string f) }
   | ['A'-'Z''a'-'z']['A'-'Z''a'-'z''0'-'9''_']* as id { ID id }
 
   | '\r' | '\n' | "\r\n"  { next_line lexbuf; token lexbuf }