Sha256: 3725d13baf21cc2e4fd0b0071aee816955ec811f766992dd777630119755fb91

Contents?: true

Size: 718 Bytes

Versions: 11

Compression:

Stored size: 718 Bytes

Contents

# frozen_string_literal: true

require_relative 'edge'

module Rley # This module is used as a namespace
  module GFG # This module is used as a namespace
    # Abstract class. Represents an edge in a grammar flow graph
    # Responsibilities:
    # - To know the successor vertex
    class ShortcutEdge < Edge
      # The terminal symbol expected from the input stream
      attr_reader :nonterminal

      def initialize(thePredecessor, theSuccessor)
        super(nil, theSuccessor)
        @nonterminal = thePredecessor.next_symbol
        thePredecessor.shortcut = self
      end

      def to_s
        " -#{nonterminal}-> #{successor.label}"
      end
    end # class
  end # module
end # module

# End of file

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
rley-0.8.11 lib/rley/gfg/shortcut_edge.rb
rley-0.8.10 lib/rley/gfg/shortcut_edge.rb
rley-0.8.09 lib/rley/gfg/shortcut_edge.rb
rley-0.8.08 lib/rley/gfg/shortcut_edge.rb
rley-0.8.06 lib/rley/gfg/shortcut_edge.rb
rley-0.8.05 lib/rley/gfg/shortcut_edge.rb
rley-0.8.03 lib/rley/gfg/shortcut_edge.rb
rley-0.8.02 lib/rley/gfg/shortcut_edge.rb
rley-0.8.01 lib/rley/gfg/shortcut_edge.rb
rley-0.8.00 lib/rley/gfg/shortcut_edge.rb
rley-0.7.08 lib/rley/gfg/shortcut_edge.rb