module Fbe::Award::PTerm

def publish_to(bylaw)

def publish_to(bylaw)
  case @op
  when :award
    @operands.each do |o|
      o.publish_to(bylaw)
    rescue StandardError => e
      raise "Failure in #{o}: #{e.message}"
    end
  when :aka
    @operands[0..-2].each do |o|
      o.publish_to(bylaw)
    rescue StandardError => e
      raise "Failure in #{o}: #{e.message}"
    end
    bylaw.revert(@operands.size - 1)
    bylaw.line(to_p(@operands[@operands.size - 1]))
  when :explain
    bylaw.intro(to_p(@operands[0]))
  when :in
    bylaw.line("assume that #{to_p(@operands[0])} is #{to_p(@operands[1])}")
  when :let
    bylaw.line("let #{to_p(@operands[0])} be equal to #{to_p(@operands[1])}")
    bylaw.let(@operands[0], @operands[1])
  when :set
    bylaw.line("set #{to_p(@operands[0])} to #{to_p(@operands[1])}")
  when :give
    bylaw.line("award #{to_p(@operands[0])}")
  else
    raise "Unknown term '#{@op}'"
  end
end