lib/castaddon.rb in bones-compiler-1.3.1 vs lib/castaddon.rb in bones-compiler-1.6.0
- old
+ new
@@ -10,16 +10,14 @@
# Include the extentions to the CAST gem provided. These
# extentions provide a significant amount of functionality
# for Bones and A-Darwin.
require 'castaddon/node_common.rb'
require 'castaddon/node_adarwin.rb'
-if File.exists?('lib/bones.rb')
- require 'castaddon/node_bones.rb'
- require 'castaddon/transformations.rb'
- require 'castaddon/type.rb'
- require 'castaddon/index.rb'
-end
+require 'castaddon/node_bones.rb'
+require 'castaddon/transformations.rb'
+require 'castaddon/type.rb'
+require 'castaddon/index.rb'
# Modify the NodeArray and NodeChain lists to output correct
# code when printed to a file.
class C::NodeList
# Modify the 'to_s' method to output correct code when printed
@@ -28,5 +26,24 @@
def to_s
self.join("\n")
end
end
+# update the FloatLiteral and IntLiteral classes in CAST to print suffixes
+class C::FloatLiteral
+ def to_s
+ if suffix.nil?
+ val.to_s
+ else
+ val.to_s + suffix
+ end
+ end
+end
+class C::IntLiteral
+ def to_s
+ if suffix.nil?
+ val.to_s
+ else
+ val.to_s + suffix
+ end
+ end
+end