Class: Pegarus::Machine::State
- Inherits:
-
Object
- Object
- Pegarus::Machine::State
- Defined in:
- lib/pegarus/machine/state.rb
Instance Attribute Summary collapse
-
#captures ⇒ Object
readonly
Returns the value of attribute captures.
-
#index ⇒ Object
Returns the value of attribute index.
-
#ip ⇒ Object
Returns the value of attribute ip.
-
#stack ⇒ Object
readonly
Returns the value of attribute stack.
-
#subject ⇒ Object
readonly
Returns the value of attribute subject.
Instance Method Summary collapse
- #continue ⇒ Object
- #failure ⇒ Object
- #failure? ⇒ Boolean
-
#initialize(subject) ⇒ State
constructor
A new instance of State.
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
#captures ⇒ Object (readonly)
Returns the value of attribute captures.
5 6 7 |
# File 'lib/pegarus/machine/state.rb', line 5 def captures @captures end |
#index ⇒ Object
Returns the value of attribute index.
4 5 6 |
# File 'lib/pegarus/machine/state.rb', line 4 def index @index end |
#ip ⇒ Object
Returns the value of attribute ip.
4 5 6 |
# File 'lib/pegarus/machine/state.rb', line 4 def ip @ip end |
#stack ⇒ Object (readonly)
Returns the value of attribute stack.
5 6 7 |
# File 'lib/pegarus/machine/state.rb', line 5 def stack @stack end |
#subject ⇒ Object (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
#continue ⇒ Object
24 25 26 |
# File 'lib/pegarus/machine/state.rb', line 24 def continue @failure = false end |
#failure ⇒ Object
20 21 22 |
# File 'lib/pegarus/machine/state.rb', line 20 def failure @failure = true end |
#failure? ⇒ Boolean
16 17 18 |
# File 'lib/pegarus/machine/state.rb', line 16 def failure? @failure end |