Class: Racc::StateTransitionTable

Inherits:
Struct
  • Object
show all
Defined in:
lib/racc/statetransitiontable.rb,
lib/racc/statetransitiontable.rb

Overview

reopen

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(states) ⇒ StateTransitionTable

Returns a new instance of StateTransitionTable.



38
39
40
41
42
43
44
# File 'lib/racc/statetransitiontable.rb', line 38

def initialize(states)
  super()
  @states = states
  @grammar = states.grammar
  self.use_result_var = true
  self.debug_parser = true
end

Instance Attribute Details

#action_checkObject

Returns the value of attribute action_check

Returns:

  • (Object)

    the current value of action_check



17
18
19
# File 'lib/racc/statetransitiontable.rb', line 17

def action_check
  @action_check
end

#action_defaultObject

Returns the value of attribute action_default

Returns:

  • (Object)

    the current value of action_default



17
18
19
# File 'lib/racc/statetransitiontable.rb', line 17

def action_default
  @action_default
end

#action_pointerObject

Returns the value of attribute action_pointer

Returns:

  • (Object)

    the current value of action_pointer



17
18
19
# File 'lib/racc/statetransitiontable.rb', line 17

def action_pointer
  @action_pointer
end

#action_tableObject

Returns the value of attribute action_table

Returns:

  • (Object)

    the current value of action_table



17
18
19
# File 'lib/racc/statetransitiontable.rb', line 17

def action_table
  @action_table
end

#debug_parserObject

Returns the value of attribute debug_parser

Returns:

  • (Object)

    the current value of debug_parser



17
18
19
# File 'lib/racc/statetransitiontable.rb', line 17

def debug_parser
  @debug_parser
end

#goto_checkObject

Returns the value of attribute goto_check

Returns:

  • (Object)

    the current value of goto_check



17
18
19
# File 'lib/racc/statetransitiontable.rb', line 17

def goto_check
  @goto_check
end

#goto_defaultObject

Returns the value of attribute goto_default

Returns:

  • (Object)

    the current value of goto_default



17
18
19
# File 'lib/racc/statetransitiontable.rb', line 17

def goto_default
  @goto_default
end

#goto_pointerObject

Returns the value of attribute goto_pointer

Returns:

  • (Object)

    the current value of goto_pointer



17
18
19
# File 'lib/racc/statetransitiontable.rb', line 17

def goto_pointer
  @goto_pointer
end

#goto_tableObject

Returns the value of attribute goto_table

Returns:

  • (Object)

    the current value of goto_table



17
18
19
# File 'lib/racc/statetransitiontable.rb', line 17

def goto_table
  @goto_table
end

#grammarObject (readonly)

Returns the value of attribute grammar.



47
48
49
# File 'lib/racc/statetransitiontable.rb', line 47

def grammar
  @grammar
end

#nt_baseObject

Returns the value of attribute nt_base

Returns:

  • (Object)

    the current value of nt_base



17
18
19
# File 'lib/racc/statetransitiontable.rb', line 17

def nt_base
  @nt_base
end

#reduce_nObject

Returns the value of attribute reduce_n

Returns:

  • (Object)

    the current value of reduce_n



17
18
19
# File 'lib/racc/statetransitiontable.rb', line 17

def reduce_n
  @reduce_n
end

#reduce_tableObject

Returns the value of attribute reduce_table

Returns:

  • (Object)

    the current value of reduce_table



17
18
19
# File 'lib/racc/statetransitiontable.rb', line 17

def reduce_table
  @reduce_table
end

#shift_nObject

Returns the value of attribute shift_n

Returns:

  • (Object)

    the current value of shift_n



17
18
19
# File 'lib/racc/statetransitiontable.rb', line 17

def shift_n
  @shift_n
end

#statesObject (readonly)

Returns the value of attribute states.



46
47
48
# File 'lib/racc/statetransitiontable.rb', line 46

def states
  @states
end

#token_tableObject

Returns the value of attribute token_table

Returns:

  • (Object)

    the current value of token_table



17
18
19
# File 'lib/racc/statetransitiontable.rb', line 17

def token_table
  @token_table
end

#token_to_s_tableObject

Returns the value of attribute token_to_s_table

Returns:

  • (Object)

    the current value of token_to_s_table



17
18
19
# File 'lib/racc/statetransitiontable.rb', line 17

def token_to_s_table
  @token_to_s_table
end

#use_result_varObject

Returns the value of attribute use_result_var

Returns:

  • (Object)

    the current value of use_result_var



17
18
19
# File 'lib/racc/statetransitiontable.rb', line 17

def use_result_var
  @use_result_var
end

Class Method Details

.generate(states) ⇒ Object



34
35
36
# File 'lib/racc/statetransitiontable.rb', line 34

def StateTransitionTable.generate(states)
  StateTransitionTableGenerator.new(states).generate
end

Instance Method Details

#parser_classObject



49
50
51
# File 'lib/racc/statetransitiontable.rb', line 49

def parser_class
  ParserClassGenerator.new(@states).generate
end

#token_value_tableObject



53
54
55
56
57
58
59
# File 'lib/racc/statetransitiontable.rb', line 53

def token_value_table
  h = {}
  token_table().each do |sym, i|
    h[sym.value] = i
  end
  h
end