Class: Electr::ASTReader
- Inherits:
-
BaseReader
- Object
- BaseReader
- Electr::ASTReader
- Defined in:
- lib/electr/repl/ast_reader.rb
Overview
Special reader for a REPL that display an AST instead of the computation.
Instance Method Summary collapse
-
#initialize(readline_lib = Readline) ⇒ ASTReader
constructor
A new instance of ASTReader.
- #run ⇒ Object
Constructor Details
#initialize(readline_lib = Readline) ⇒ ASTReader
Returns a new instance of ASTReader.
7 8 9 |
# File 'lib/electr/repl/ast_reader.rb', line 7 def initialize(readline_lib = Readline) super("E--ast> ", readline_lib) end |
Instance Method Details
#run ⇒ Object
11 12 13 14 |
# File 'lib/electr/repl/ast_reader.rb', line 11 def run line = @readline.readline(@prompt, true) Compiler.compile_to_ast(line) end |