Sha256: 7daa72d307de8e835c89bf3f039f059fe139881b95ca18f84680ec380d53d3ff

Contents?: true

Size: 924 Bytes

Versions: 4

Compression:

Stored size: 924 Bytes

Contents

# frozen_string_literal: true

require_relative 'grm_symbol' # Load superclass

module Rley # This module is used as a namespace
  module Syntax # This module is used as a namespace
    # A terminal symbol represents a class of words in the language 
    # defined the grammar.
    class Terminal < GrmSymbol
      
      # Constructor.
      # @param aName [String] The name of the grammar symbol.
      def initialize(aName)
        super(aName)
        self.generative = true
      end
      
      # Return true iff the symbol is a terminal
      def terminal?
        return true
      end
      
      # @return [false] Return true if the symbol derives
      # the empty string. As terminal symbol corresponds to a input token
      # it is by definition non-nullable.
      def nullable?
        false
      end
      
      def to_s
        name
      end
    end # class
  end # module
end # module

# End of file

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rley-0.7.07 lib/rley/syntax/terminal.rb
rley-0.7.06 lib/rley/syntax/terminal.rb
rley-0.7.05 lib/rley/syntax/terminal.rb
rley-0.7.04 lib/rley/syntax/terminal.rb