浏览代码

Fixed for literals

Yentl Van Tendeloo 8 年之前
父节点
当前提交
9e331a3a1d

+ 2 - 6
interface/HUTN/hutn_compiler/constructors_visitor.py

@@ -112,17 +112,13 @@ class ConstructorsVisitor(Visitor):
             {"value": tree.get_tail()[0].get_text()[1:]})
 
     def visit_string(self, tree):
-        self.visit_literal(tree)
-
-    # there is no such rule in the grammar, we just avoid code duplicates
-    def visit_literal(self, tree):
         self.add_constructors("const", tree.get_text())
 
     def visit_integer(self, tree):
-        self.visit_literal(tree)
+        self.add_constructors("const", int(tree.get_text()))
 
     def visit_float(self, tree):
-        self.visit_literal(tree)
+        self.add_constructors("const", float(tree.get_text()))
 
     def visit_rvalue(self, tree):
         self.add_constructors("access")

+ 1 - 0
interface/HUTN/hutn_compiler/primitives_visitor.py

@@ -189,6 +189,7 @@ class PrimitivesVisitor(Visitor):
             v = tree.get_text()[1:]
         else:
             v = tree.get_text()
+        print("Literal: " + str(v))
         #NOTE Wrap this in an Action, even though it might not be an action: this has to be seen directly in the Mv without additional wrapping
         n = self.value(Action(v))
         self.dict(c, "node", n)