class Python::FileInterpreter
Constants
- ParsingError
Public Class Methods
new(code, bind={})
click to toggle source
# File lib/python/file_interpreter.rb, line 9 def initialize(code, bind={}) @code = code @bind = bind end
Public Instance Methods
execute()
click to toggle source
# File lib/python/file_interpreter.rb, line 25 def execute parse().eval(Environment.new(@bind)) end
parse()
click to toggle source
# File lib/python/file_interpreter.rb, line 14 def parse parser = Parser::StatementParser.file_input result = parser.parse(Parser::IndentConverter.new.convert(@code)) if result.is_a?(Parser::Succeeded) && result.rest == "" result.parsed else raise ParsingError.new end end