src: Update literal to properly support underscores in decimal literals
authorLucas Bajolet <r4pass@hotmail.com>
Tue, 28 Jul 2015 15:32:03 +0000 (11:32 -0400)
committerLucas Bajolet <r4pass@hotmail.com>
Tue, 28 Jul 2015 15:32:03 +0000 (11:32 -0400)
Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>

src/literal.nit

index eb04e7a..f5f70b0 100644 (file)
@@ -93,7 +93,7 @@ end
 redef class ADecIntExpr
        redef fun accept_literal(v)
        do
-               value = self.n_number.text.to_i
+               value = self.n_number.text.remove_underscores.to_i
        end
 end
 
@@ -142,7 +142,7 @@ redef class ADecByteExpr
        redef fun accept_literal(v)
        do
                var t = self.n_bytenum.text
-               value = t.substring(0, t.length - 2).to_i.to_b
+               value = t.substring(0, t.length - 2).remove_underscores.to_i.to_b
        end
 end