# Parsing of literal values in the abstract syntax tree.
module literal
-import parser
-import toolcontext
import phase
redef class ToolContext
var toolcontext: ToolContext
- init(toolcontext: ToolContext)
- do
- self.toolcontext = toolcontext
- end
-
redef fun visit(n)
do
n.accept_literal(self)
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
end
end
+redef class AHexIntExpr
+ redef fun accept_literal(v)
+ do
+ self.value = self.n_hex_number.text.substring_from(2).to_hex
+ end
+end
+
redef class AFloatExpr
# The value of the literal float once computed.
var value: nullable Float