Sha256: d0fc9f5971c70e9f9218e5e21c068ee29feb0c1779ab7831786f4297d2937ac0
Contents?: true
Size: 977 Bytes
Versions: 1
Compression:
Stored size: 977 Bytes
Contents
# encoding: utf-8 # frozen_string_literal: true module Carbon module Compiler class Directive ATTACHING = %w(doc extern).freeze def self.handlers @_handlers ||= {} end def self.handle(name, &block) handlers[name.to_s] = block end require "carbon/compiler/directive/import" def initialize(node, file, index) @node = node @file = file @index = index end def call instance_exec(&self.class.handlers.fetch(name.to_s)) end def name @node.value end def attach? ATTACHING.include?(name) end private def error_excessive_parameters(node, expected) @file.emit("Directive/Parameter/Excessive", node.location, [expected, node.parameters.size]) end def error_invalid_parameter(parameter) @file.emit("Directive/Parameter/Invalid", parameter.location) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
carbon-compiler-0.2.0 | lib/carbon/compiler/directive.rb |