parser: split `AIntExpr` and `ADecIntExpr`
authorJean Privat <jean@pryen.org>
Tue, 15 Apr 2014 13:49:52 +0000 (09:49 -0400)
committerJean Privat <jean@pryen.org>
Tue, 15 Apr 2014 18:32:32 +0000 (14:32 -0400)
next commit will introduce AHexIntExpr

Signed-off-by: Jean Privat <jean@pryen.org>

src/astbuilder.nit
src/literal.nit
src/parser/parser_abs.nit
src/parser/parser_nodes.nit

index 96948ea..fa1d188 100644 (file)
@@ -32,7 +32,7 @@ class ASTBuilder
        # Make a new Int literal
        fun make_int(value: Int): AIntExpr
        do
-               return new AIntExpr.make(value, mmodule.get_primitive_class("Int").mclass_type)
+               return new ADecIntExpr.make(value, mmodule.get_primitive_class("Int").mclass_type)
        end
 
        # Make a new instatiation
@@ -220,7 +220,7 @@ redef class AType
        end
 end
 
-redef class AIntExpr
+redef class ADecIntExpr
        private init make(value: Int, t: MType)
        do
                self.value = value
index 9ea79f0..92f137b 100644 (file)
@@ -65,6 +65,9 @@ end
 redef class AIntExpr
        # The value of the literal int once computed.
        var value: nullable Int
+end
+
+redef class ADecIntExpr
        redef fun accept_literal(v)
        do
                self.value = self.n_number.text.to_i
index 48e2e1d..2493164 100644 (file)
@@ -999,7 +999,7 @@ class ANullExpr
     readable var _n_kwnull: TKwnull
     readable var _n_annotations: nullable AAnnotations = null
 end
-class AIntExpr
+class ADecIntExpr
        super AExpr
     readable var _n_number: TNumber
     readable var _n_annotations: nullable AAnnotations = null
index 5a6fd23..c9db2fa 100644 (file)
@@ -1542,6 +1542,10 @@ end
 # An integer literal
 class AIntExpr
        super AExpr
+end
+# An integer literal in decimal format
+class ADecIntExpr
+       super AIntExpr
        readable writable var _n_number: TNumber
 end
 # A float literal