Sha256: 512f270d01390ce7ca2370ea9f2f2431e1dacc1a6ed439fb6dd1b3183a3eded6

Contents?: true

Size: 1.04 KB

Versions: 3

Compression:

Stored size: 1.04 KB

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
      # An indicator that tells whether the grammar symbol can generate a
      # non-empty string of terminals.
      # @return [TrueClass]
      def generative?
        true
      end

      # Return true iff the symbol is a terminal
      # @return [TrueClass]
      def terminal?
        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.
      # @return [FalseClass]
      def nullable?
        false
      end

      # Return a readable text representation of the instance
      # @return [String] The symbol name
      def to_s
        name
      end
    end # class
  end # module
end # module

# End of file

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rley-0.8.11 lib/rley/syntax/terminal.rb
rley-0.8.10 lib/rley/syntax/terminal.rb
rley-0.8.09 lib/rley/syntax/terminal.rb