Sha256: cafeb914e2017913b5367fd3748454be34b1ef03d0e195a23dac3d5f03bc48d2

Contents?: true

Size: 1.53 KB

Versions: 4

Compression:

Stored size: 1.53 KB

Contents

# encoding: utf-8

require "antelope/ace/grammar/terminals"
require "antelope/ace/grammar/productions"
require "antelope/ace/grammar/precedences"
require "antelope/ace/grammar/loading"
require "antelope/ace/grammar/generation"

module Antelope
  module Ace

    # Defines a grammar from an Ace file.  This handles setting up
    # productions, loading from files, terminals, precedence, and
    # generation.
    class Grammar

      include Terminals
      include Productions
      include Precedences
      include Loading
      include Grammar::Generation

      # Used by a generation class; this is all the generated states
      # of the grammar.
      #
      # @return [Set<Generation::Recognizer::State>]
      # @see Generation::Recognizer
      attr_accessor :states

      # The name of the grammar.  This is normally assumed from a file
      # name.
      #
      # @return [String]
      attr_accessor :name

      # The output directory for the grammar.  This is normally the
      # same directory as the Ace file.
      #
      # @return [Pathname]
      attr_accessor :output

      # The compiler for the Ace file.
      #
      # @return [Compiler]
      attr_reader :compiler

      # Initialize.
      #
      # @param name [String]
      # @param output [String] the output directory.  Automagically
      #   turned into a Pathname.
      # @param compiler [Compiler]
      def initialize(name, output, compiler)
        @name     = name
        @output   = Pathname.new(output)
        @compiler = compiler
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
antelope-0.1.8 lib/antelope/ace/grammar.rb
antelope-0.1.7 lib/antelope/ace/grammar.rb
antelope-0.1.6 lib/antelope/ace/grammar.rb
antelope-0.1.5 lib/antelope/ace/grammar.rb