Class: NonTerminal

Inherits:
GrammarSymbol show all
Includes:
Indexable
Defined in:
lib/rpdf2txt-rockit/parsetable_generation.rb,
lib/rpdf2txt-rockit/grammar.rb

Overview

Decorate the grammar symbols with some additional info we’re gonna need

Instance Attribute Summary collapse

Attributes included from Indexable

#factory, #index_number

Attributes inherited from GrammarSymbol

#name

Attributes inherited from Element

#sub_elements, #tree_specification

Instance Method Summary collapse

Methods inherited from GrammarSymbol

#==, #eql?, #hash, #initialize, #inspect, #to_src

Methods inherited from Element

#initialize, #normalize

Methods included from SourceCodeDumpable

as_code, as_method_named, as_module_method_named, #create_new, indent_lines, name_hash, #new_of_my_type, #parameter_named, #to_compact_src, #to_src_in_module, #type_to_src

Constructor Details

This class inherits a constructor from GrammarSymbol

Instance Attribute Details

#derives_epsilon=(value) ⇒ Object (writeonly)

Sets the attribute derives_epsilon

Parameters:

  • value

    the value to set the attribute derives_epsilon to.



142
143
144
# File 'lib/rpdf2txt-rockit/parsetable_generation.rb', line 142

def derives_epsilon=(value)
  @derives_epsilon = value
end

#nonkernel_itemsObject (readonly)

Returns the value of attribute nonkernel_items.



131
132
133
# File 'lib/rpdf2txt-rockit/parsetable_generation.rb', line 131

def nonkernel_items
  @nonkernel_items
end

Instance Method Details

#calc_nonkernel_items(grammar, itemFactory) ⇒ Object



132
133
134
135
136
137
# File 'lib/rpdf2txt-rockit/parsetable_generation.rb', line 132

def calc_nonkernel_items(grammar, itemFactory)
  @nonkernel_items = Array.new
  grammar.alternatives(self).each do |production|
    @nonkernel_items.push itemFactory.make(production, 0)
  end
end

#derives_epsilon?Boolean

Returns:

  • (Boolean)


144
# File 'lib/rpdf2txt-rockit/parsetable_generation.rb', line 144

def derives_epsilon?; @derives_epsilon; end

#nonterminal?Boolean

Returns:

  • (Boolean)


139
# File 'lib/rpdf2txt-rockit/parsetable_generation.rb', line 139

def nonterminal?; true; end

#terminal?Boolean

Returns:

  • (Boolean)


140
# File 'lib/rpdf2txt-rockit/parsetable_generation.rb', line 140

def terminal?; false; end