Class: Pegarus::Machine::State

Inherits:
Object
  • Object
show all
Defined in:
lib/pegarus/machine/state.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(subject) ⇒ State

Returns a new instance of State.



7
8
9
10
11
12
13
14
# File 'lib/pegarus/machine/state.rb', line 7

def initialize(subject)
  @subject  = subject
  @ip       = 0
  @index    = 0
  @stack    = []
  @captures = []
  @failure  = false
end

Instance Attribute Details

#capturesObject (readonly)

Returns the value of attribute captures.



5
6
7
# File 'lib/pegarus/machine/state.rb', line 5

def captures
  @captures
end

#indexObject

Returns the value of attribute index.



4
5
6
# File 'lib/pegarus/machine/state.rb', line 4

def index
  @index
end

#ipObject

Returns the value of attribute ip.



4
5
6
# File 'lib/pegarus/machine/state.rb', line 4

def ip
  @ip
end

#stackObject (readonly)

Returns the value of attribute stack.



5
6
7
# File 'lib/pegarus/machine/state.rb', line 5

def stack
  @stack
end

#subjectObject (readonly)

Returns the value of attribute subject.



5
6
7
# File 'lib/pegarus/machine/state.rb', line 5

def subject
  @subject
end

Instance Method Details

#continueObject



24
25
26
# File 'lib/pegarus/machine/state.rb', line 24

def continue
  @failure = false
end

#failureObject



20
21
22
# File 'lib/pegarus/machine/state.rb', line 20

def failure
  @failure = true
end

#failure?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/pegarus/machine/state.rb', line 16

def failure?
  @failure
end