Package org.parboiled.support
Class DebuggingValueStack<V>
java.lang.Object
org.parboiled.support.DefaultValueStack<V>
org.parboiled.support.DebuggingValueStack<V>
- All Implemented Interfaces:
Iterable<V>
,ValueStack<V>
-
Field Summary
-
Constructor Summary
ConstructorDescriptionDebuggingValueStack
(Iterable<V> values) DebuggingValueStack
(Iterable<V> values, Sink<String> log) DebuggingValueStack
(Sink<String> log) -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Clears all values.void
Replaces the element the given number of elements below the current top of the stack.pop
(int down) Removes the value the given number of elements below the top of the stack.void
Inserts the given value a given number of elements below the current top of the stack.void
Pushes the given value onto the stack.void
restoreSnapshot
(Object snapshot) Restores the stack state as previously returned byValueStack.takeSnapshot()
.void
swap()
Swaps the top two stack values.void
swap3()
Reverses the order of the top 3 stack values.void
swap4()
Reverses the order of the top 4 stack values.void
swap5()
Reverses the order of the top 5 stack values.void
swap6()
Reverses the order of the top 5 stack values.Methods inherited from class org.parboiled.support.DefaultValueStack
dup, isEmpty, iterator, peek, peek, poke, pop, pushAll, pushAll, size, takeSnapshot
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
log
-
-
Constructor Details
-
DebuggingValueStack
public DebuggingValueStack() -
DebuggingValueStack
-
DebuggingValueStack
-
DebuggingValueStack
-
-
Method Details
-
clear
public void clear()Description copied from interface:ValueStack
Clears all values.- Specified by:
clear
in interfaceValueStack<V>
- Overrides:
clear
in classDefaultValueStack<V>
-
restoreSnapshot
Description copied from interface:ValueStack
Restores the stack state as previously returned byValueStack.takeSnapshot()
. This cost of running this operation is negligible and independent from the size of the stack.- Specified by:
restoreSnapshot
in interfaceValueStack<V>
- Overrides:
restoreSnapshot
in classDefaultValueStack<V>
- Parameters:
snapshot
- a snapshot object previously returned byValueStack.takeSnapshot()
-
push
Description copied from interface:ValueStack
Pushes the given value onto the stack. Equivalent to push(0, value).- Specified by:
push
in interfaceValueStack<V>
- Overrides:
push
in classDefaultValueStack<V>
- Parameters:
value
- the value
-
push
Description copied from interface:ValueStack
Inserts the given value a given number of elements below the current top of the stack.- Specified by:
push
in interfaceValueStack<V>
- Overrides:
push
in classDefaultValueStack<V>
- Parameters:
down
- the number of elements to skip before inserting the value (0 being equivalent to push(value))value
- the value
-
pop
Description copied from interface:ValueStack
Removes the value the given number of elements below the top of the stack.- Specified by:
pop
in interfaceValueStack<V>
- Overrides:
pop
in classDefaultValueStack<V>
- Parameters:
down
- the number of elements to skip before removing the value (0 being equivalent to pop())- Returns:
- the value
-
poke
Description copied from interface:ValueStack
Replaces the element the given number of elements below the current top of the stack.- Specified by:
poke
in interfaceValueStack<V>
- Overrides:
poke
in classDefaultValueStack<V>
- Parameters:
down
- the number of elements to skip before replacing the value (0 being equivalent to poke(value))value
- the value to replace with
-
swap
public void swap()Description copied from interface:ValueStack
Swaps the top two stack values.- Specified by:
swap
in interfaceValueStack<V>
- Overrides:
swap
in classDefaultValueStack<V>
-
swap3
public void swap3()Description copied from interface:ValueStack
Reverses the order of the top 3 stack values.- Specified by:
swap3
in interfaceValueStack<V>
- Overrides:
swap3
in classDefaultValueStack<V>
-
swap4
public void swap4()Description copied from interface:ValueStack
Reverses the order of the top 4 stack values.- Specified by:
swap4
in interfaceValueStack<V>
- Overrides:
swap4
in classDefaultValueStack<V>
-
swap5
public void swap5()Description copied from interface:ValueStack
Reverses the order of the top 5 stack values.- Specified by:
swap5
in interfaceValueStack<V>
- Overrides:
swap5
in classDefaultValueStack<V>
-
swap6
public void swap6()Description copied from interface:ValueStack
Reverses the order of the top 5 stack values.- Specified by:
swap6
in interfaceValueStack<V>
- Overrides:
swap6
in classDefaultValueStack<V>
-