Class: Duby::NbCompiler

Inherits:
Object
  • Object
show all
Defined in:
lib/duby/nbcompiler.rb

Defined Under Namespace

Classes: ParseResult

Instance Method Summary collapse

Instance Method Details

#parse(text) ⇒ Object



21
22
23
24
25
26
27
# File 'lib/duby/nbcompiler.rb', line 21

def parse(text)
  Duby::AST.type_factory = Duby::JVM::Types::TypeFactory.new
  ast = Duby::AST.parse_ruby(text)
  transformer = Duby::Transform::Transformer.new(Duby::CompilationState.new)
  return ParseResult.new(
      transformer.transform(ast, nil), transformer.errors)
end