comparison graal/com.oracle.truffle.ruby.parser/src/com/oracle/truffle/ruby/parser/JRubyParser.java @ 13645:497fada09efb

Ruby: remove versioning.
author Chris Seaton <chris.seaton@oracle.com>
date Wed, 15 Jan 2014 19:27:27 +0000
parents 0fbee3eb71f0
children 232eb6708943 fbf448929260
comparison
equal deleted inserted replaced
13640:bfe7a8c8c3c6 13645:497fada09efb
32 public RubyParserResult parse(RubyContext context, Source source, ParserContext parserContext, MaterializedFrame parentFrame) { 32 public RubyParserResult parse(RubyContext context, Source source, ParserContext parserContext, MaterializedFrame parentFrame) {
33 // Set up the JRuby parser 33 // Set up the JRuby parser
34 34
35 final org.jrubyparser.Parser parser = new org.jrubyparser.Parser(); 35 final org.jrubyparser.Parser parser = new org.jrubyparser.Parser();
36 36
37 org.jrubyparser.CompatVersion parserVersion = null;
38
39 switch (context.getConfiguration().getRubyVersion()) {
40 case RUBY_18:
41 parserVersion = org.jrubyparser.CompatVersion.RUBY1_8;
42 break;
43 case RUBY_19:
44 parserVersion = org.jrubyparser.CompatVersion.RUBY1_9;
45 break;
46 case RUBY_20:
47 parserVersion = org.jrubyparser.CompatVersion.RUBY2_0;
48 break;
49 case RUBY_21:
50 parserVersion = org.jrubyparser.CompatVersion.RUBY2_0;
51 break;
52 }
53
54 // TODO(cs) should this get a new unique method identifier or not? 37 // TODO(cs) should this get a new unique method identifier or not?
55 final TranslatorEnvironment environment = new TranslatorEnvironment(context, environmentForFrame(context, parentFrame), this, allocateReturnID(), true, true, new UniqueMethodIdentifier()); 38 final TranslatorEnvironment environment = new TranslatorEnvironment(context, environmentForFrame(context, parentFrame), this, allocateReturnID(), true, true, new UniqueMethodIdentifier());
56 39
57 // All parsing contexts have a visibility slot at their top level 40 // All parsing contexts have a visibility slot at their top level
58 41
81 64
82 frame = frame.getArguments(RubyArguments.class).getDeclarationFrame(); 65 frame = frame.getArguments(RubyArguments.class).getDeclarationFrame();
83 } 66 }
84 } 67 }
85 68
86 final org.jrubyparser.parser.ParserConfiguration parserConfiguration = new org.jrubyparser.parser.ParserConfiguration(0, parserVersion, staticScope); 69 final org.jrubyparser.parser.ParserConfiguration parserConfiguration = new org.jrubyparser.parser.ParserConfiguration(0, org.jrubyparser.CompatVersion.RUBY2_0, staticScope);
87 70
88 // Parse to the JRuby AST 71 // Parse to the JRuby AST
89 72
90 org.jrubyparser.ast.RootNode node; 73 org.jrubyparser.ast.RootNode node;
91 74