Package org.parboiled.support
Class DebuggingValueStack<V>
- java.lang.Object
-
- org.parboiled.support.DefaultValueStack<V>
-
- org.parboiled.support.DebuggingValueStack<V>
-
- All Implemented Interfaces:
java.lang.Iterable<V>,ValueStack<V>
public class DebuggingValueStack<V> extends DefaultValueStack<V>
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.parboiled.support.DefaultValueStack
DefaultValueStack.Element
-
-
Field Summary
Fields Modifier and Type Field Description Sink<java.lang.String>log-
Fields inherited from class org.parboiled.support.DefaultValueStack
head, tempValue
-
-
Constructor Summary
Constructors Constructor Description DebuggingValueStack()DebuggingValueStack(java.lang.Iterable<V> values)DebuggingValueStack(java.lang.Iterable<V> values, Sink<java.lang.String> log)DebuggingValueStack(Sink<java.lang.String> log)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()Clears all values.protected voidlog(java.lang.String action)voidpoke(int down, V value)Replaces the element the given number of elements below the current top of the stack.Vpop(int down)Removes the value the given number of elements below the top of the stack.voidpush(int down, V value)Inserts the given value a given number of elements below the current top of the stack.voidpush(V value)Pushes the given value onto the stack.voidrestoreSnapshot(java.lang.Object snapshot)Restores the stack state as previously returned byValueStack.takeSnapshot().voidswap()Swaps the top two stack values.voidswap3()Reverses the order of the top 3 stack values.voidswap4()Reverses the order of the top 4 stack values.voidswap5()Reverses the order of the top 5 stack values.voidswap6()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
-
-
-
-
Field Detail
-
log
public final Sink<java.lang.String> log
-
-
Method Detail
-
clear
public void clear()
Description copied from interface:ValueStackClears all values.- Specified by:
clearin interfaceValueStack<V>- Overrides:
clearin classDefaultValueStack<V>
-
restoreSnapshot
public void restoreSnapshot(java.lang.Object snapshot)
Description copied from interface:ValueStackRestores 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:
restoreSnapshotin interfaceValueStack<V>- Overrides:
restoreSnapshotin classDefaultValueStack<V>- Parameters:
snapshot- a snapshot object previously returned byValueStack.takeSnapshot()
-
push
public void push(V value)
Description copied from interface:ValueStackPushes the given value onto the stack. Equivalent to push(0, value).- Specified by:
pushin interfaceValueStack<V>- Overrides:
pushin classDefaultValueStack<V>- Parameters:
value- the value
-
push
public void push(int down, V value)Description copied from interface:ValueStackInserts the given value a given number of elements below the current top of the stack.- Specified by:
pushin interfaceValueStack<V>- Overrides:
pushin classDefaultValueStack<V>- Parameters:
down- the number of elements to skip before inserting the value (0 being equivalent to push(value))value- the value
-
pop
public V pop(int down)
Description copied from interface:ValueStackRemoves the value the given number of elements below the top of the stack.- Specified by:
popin interfaceValueStack<V>- Overrides:
popin classDefaultValueStack<V>- Parameters:
down- the number of elements to skip before removing the value (0 being equivalent to pop())- Returns:
- the value
-
poke
public void poke(int down, V value)Description copied from interface:ValueStackReplaces the element the given number of elements below the current top of the stack.- Specified by:
pokein interfaceValueStack<V>- Overrides:
pokein 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:ValueStackSwaps the top two stack values.- Specified by:
swapin interfaceValueStack<V>- Overrides:
swapin classDefaultValueStack<V>
-
swap3
public void swap3()
Description copied from interface:ValueStackReverses the order of the top 3 stack values.- Specified by:
swap3in interfaceValueStack<V>- Overrides:
swap3in classDefaultValueStack<V>
-
swap4
public void swap4()
Description copied from interface:ValueStackReverses the order of the top 4 stack values.- Specified by:
swap4in interfaceValueStack<V>- Overrides:
swap4in classDefaultValueStack<V>
-
swap5
public void swap5()
Description copied from interface:ValueStackReverses the order of the top 5 stack values.- Specified by:
swap5in interfaceValueStack<V>- Overrides:
swap5in classDefaultValueStack<V>
-
swap6
public void swap6()
Description copied from interface:ValueStackReverses the order of the top 5 stack values.- Specified by:
swap6in interfaceValueStack<V>- Overrides:
swap6in classDefaultValueStack<V>
-
log
protected void log(java.lang.String action)
-
-