123456789_123456789_123456789_123456789_123456789_

Class: Racc::UserAction

Relationships & Source Files
Inherits: Object
Defined in: lib/racc/grammar.rb

Class Method Summary

Instance Attribute Summary

Instance Method Summary

Constructor Details

.new(src, proc) ⇒ UserAction

[ GitHub ]

  
# File 'lib/racc/grammar.rb', line 746

def initialize(src, proc)
  @source = src
  @proc = proc
end

Class Method Details

.empty

[ GitHub ]

  
# File 'lib/racc/grammar.rb', line 740

def UserAction.empty
  new(nil, nil)
end

.proc(pr = nil, &block)

[ GitHub ]

  
# File 'lib/racc/grammar.rb', line 733

def UserAction.proc(pr = nil, &block)
  if pr and block
    raise ArgumentError, "both of argument and block given"
  end
  new(nil, pr || block)
end

.source_text(src)

[ GitHub ]

  
# File 'lib/racc/grammar.rb', line 729

def UserAction.source_text(src)
  new(src, nil)
end

Instance Attribute Details

#empty?Boolean (readonly)

[ GitHub ]

  
# File 'lib/racc/grammar.rb', line 762

def empty?
  not @proc and not @source
end

#proc (readonly)

[ GitHub ]

  
# File 'lib/racc/grammar.rb', line 752

attr_reader :proc

#proc?Boolean (readonly)

[ GitHub ]

  
# File 'lib/racc/grammar.rb', line 758

def proc?
  not @source
end

#source (readonly)

[ GitHub ]

  
# File 'lib/racc/grammar.rb', line 751

attr_reader :source

#source?Boolean (readonly)

[ GitHub ]

  
# File 'lib/racc/grammar.rb', line 754

def source?
  not @proc
end

Instance Method Details

#inspect

Alias for #name.

[ GitHub ]

  
# File 'lib/racc/grammar.rb', line 770

alias inspect name

#name Also known as: #inspect

[ GitHub ]

  
# File 'lib/racc/grammar.rb', line 766

def name
  "{action type=#{@source || @proc || 'nil'}}"
end