Class: KPeg::Parser::MemoEntry

Inherits:
Object
  • Object
show all
Defined in:
lib/kpeg/parser.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ans, pos) ⇒ MemoEntry

Returns a new instance of MemoEntry.



58
59
60
61
62
# File 'lib/kpeg/parser.rb', line 58

def initialize(ans, pos)
  @ans = ans
  @pos = pos
  @uses = 1
end

Instance Attribute Details

#ansObject (readonly)

Returns the value of attribute ans.



64
65
66
# File 'lib/kpeg/parser.rb', line 64

def ans
  @ans
end

#posObject (readonly)

Returns the value of attribute pos.



64
65
66
# File 'lib/kpeg/parser.rb', line 64

def pos
  @pos
end

#usesObject (readonly)

Returns the value of attribute uses.



64
65
66
# File 'lib/kpeg/parser.rb', line 64

def uses
  @uses
end

Instance Method Details

#inc!Object



66
67
68
# File 'lib/kpeg/parser.rb', line 66

def inc!
  @uses += 1
end

#move!(ans, pos) ⇒ Object



70
71
72
73
# File 'lib/kpeg/parser.rb', line 70

def move!(ans, pos)
  @ans = ans
  @pos = pos
end