Module: CEML::InstructionStatements

Defined in:
lib/ceml/lang/instruction_statements.rb

Instance Method Summary collapse

Instance Method Details

#bytecode ⇒ Object



7
8
9
10
# File 'lib/ceml/lang/instruction_statements.rb', line 7

def bytecode
  # p list
  list.map(&:bytecode)
end

#instructions ⇒ Object



12
13
14
# File 'lib/ceml/lang/instruction_statements.rb', line 12

def instructions
  self
end

#list ⇒ Object



3
4
5
# File 'lib/ceml/lang/instruction_statements.rb', line 3

def list
  [instruction_stmt.basic_statement] + more.elements.map{ |x| x.instruction_stmt.basic_statement }
end

#roles ⇒ Object



21
22
23
# File 'lib/ceml/lang/instruction_statements.rb', line 21

def roles
  list.map{ |s| s.role.to_sym }.uniq
end

#validate_instructions!(allowed_roles) ⇒ Object



16
17
18
19
# File 'lib/ceml/lang/instruction_statements.rb', line 16

def validate_instructions!(allowed_roles)
  extra_roles = roles - allowed_roles
  raise "unrecognized rolenames: #{extra_roles.inspect}" unless extra_roles.empty?
end