Module: CEML::InstructionStatements

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

Instance Method Summary collapse

Instance Method Details

#bytecodeObject



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

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

#instructionsObject



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

def instructions
  self
end

#listObject



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

#rolesObject



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