Class: FExpr::Evaluator

Inherits:
Object
  • Object
show all
Defined in:
lib/fexpr/base.rb

Defined Under Namespace

Classes: Node, NumNode, OpNode

Instance Method Summary collapse

Constructor Details

#initialize(argv) ⇒ Evaluator

Returns a new instance of Evaluator.



5
6
7
8
9
# File 'lib/fexpr/base.rb', line 5

def initialize(argv)
  @argv = argv
  @node_stack = []
  @opt_trace = false
end

Instance Method Details

#evalObject

Void -> String



12
13
14
15
16
17
18
# File 'lib/fexpr/base.rb', line 12

def eval
  @toks = Array.new @argv
  @tok  = nil
  next_token
  expr
  evaluate.to_s
end