Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
diff --git a/kernel/loader.rb b/kernel/loader.rb
index 514453d..767820e 100644
--- a/kernel/loader.rb
+++ b/kernel/loader.rb
@@ -241,14 +241,9 @@ containing the Rubinius standard library files.
options.on "-c", "FILE", "Check the syntax of FILE" do |file|
if File.exists?(file)
- case
- when Rubinius.ruby18?
- parser = Rubinius::Melbourne
- when Rubinius.ruby19?
- parser = Rubinius::Melbourne19
- when Rubinius.ruby20?
- parser = Rubinius::Melbourne20
- else
+ parser = Rubinius::Compiler.default_compiler
+
+ unless parser
raise "no parser available for this ruby version"
end
diff --git a/lib/compiler/stages.rb b/lib/compiler/stages.rb
index 9505c96..a2e216b 100644
--- a/lib/compiler/stages.rb
+++ b/lib/compiler/stages.rb
@@ -2,6 +2,23 @@ module Rubinius
class Compiler
Stages = { }
+ def self.default_processor
+ @default_processor ||= case
+ when Rubinius.ruby18?
+ Rubinius::Melbourne
+ when Rubinius.ruby19?
+ Rubinius::Melbourne19
+ when Rubinius.ruby20?
+ Rubinius::Melbourne20
+ else
+ raise Exception, "no processor is defined for Parser compiler stage."
+ end
+ end
+
+ def self.default_processor=(processor)
+ @default_processor = processor
+ end
+
class Stage
attr_accessor :next_stage, :printer
@@ -163,16 +180,12 @@ module Rubinius
compiler.parser = self
@transforms = []
- case
- when Rubinius.ruby18?
- @processor = Rubinius::Melbourne
- when Rubinius.ruby19?
- @processor = Rubinius::Melbourne19
- when Rubinius.ruby20?
- @processor = Rubinius::Melbourne20
- else
+ @processor = Rubinius::Compiler.default_processor
+
+ unless @processor
raise Exception, "no processor is defined for Parser compiler stage."
end
+
end
def root(klass)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.