Class: Peruby::Op::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/peruby/op.rb

Overview

Base evaluation protocol. Context is one of :scalar, :list, or :void.

Instance Method Summary collapse

Instance Method Details

#argument_cells(env) ⇒ Object



20
21
22
# File 'lib/peruby/op.rb', line 20

def argument_cells(env)
  run(env, :list)
end

#local_slot(_env) ⇒ Object

Raises:



16
17
18
# File 'lib/peruby/op.rb', line 16

def local_slot(_env)
  raise PerlError, "Can't localize #{self.class}"
end

#lvalue(_env, _context) ⇒ Object

Raises:



12
13
14
# File 'lib/peruby/op.rb', line 12

def lvalue(_env, _context)
  raise PerlError, "Can't modify #{self.class} in assignment"
end

#run(_env, _context) ⇒ Object

Raises:

  • (NotImplementedError)


8
9
10
# File 'lib/peruby/op.rb', line 8

def run(_env, _context)
  raise NotImplementedError
end

#run_subroutine(env, context) ⇒ Object



28
29
30
# File 'lib/peruby/op.rb', line 28

def run_subroutine(env, context)
  catch(:peruby_return) { run(env, context) }
end

#to_callableObject



24
25
26
# File 'lib/peruby/op.rb', line 24

def to_callable
  ->(env, context) { run(env, context) }
end

#warning_directive?Boolean

Returns:

  • (Boolean)


32
# File 'lib/peruby/op.rb', line 32

def warning_directive? = false