add bools and nil
This commit is contained in:
@ -18,6 +18,22 @@ module Ast
|
||||
end
|
||||
end
|
||||
|
||||
class TrueExpression < Expression
|
||||
def to_s
|
||||
"true"
|
||||
end
|
||||
end
|
||||
class FalseExpression < Expression
|
||||
def to_s
|
||||
"false"
|
||||
end
|
||||
end
|
||||
class NilExpression < Expression
|
||||
def to_s
|
||||
"nil"
|
||||
end
|
||||
end
|
||||
|
||||
class NameExpression < Expression
|
||||
attr_reader :name
|
||||
def initialize name
|
||||
|
@ -10,7 +10,10 @@
|
||||
module Ast
|
||||
class Expression
|
||||
def attributes
|
||||
raise "abstract #{self}"
|
||||
[]
|
||||
end
|
||||
def inspect
|
||||
self.class.name + ".new()"
|
||||
end
|
||||
def == other
|
||||
return false unless other.class == self.class
|
||||
|
Reference in New Issue
Block a user