/** * <p>Returns the input text matched by the rule immediately preceding the action expression that is currently * being evaluated. This call can only be used in actions that are part of a Sequence rule and are not at first * position in this Sequence.</p> * * @return the input text matched by the immediately preceding subrule */ public String match() { check(); return context.getMatch(); }
/** * Returns true if the current context is for or below a rule marked @SuppressNode or below one * marked @SuppressSubnodes. * * @return true or false */ public boolean nodeSuppressed() { check(); return context.isNodeSuppressed(); }
/** * <p>Returns the current position in the underlying {@link org.parboiled.buffers.InputBuffer} as a * {@link Position} instance.</p> * * @return the current position in the underlying inputbuffer */ public Position position() { check(); return context.getPosition(); }
/** * <p>Returns the end location of the rule immediately preceding the action expression that is currently * being evaluated. This call can only be used in actions that are part of a Sequence rule and are not at first * position in this Sequence.</p> * * @return the end index of the context immediately preceding current action, i.e. the index of the character * immediately following the last matched character */ public int matchEnd() { check(); return context.getMatchEndIndex(); }
/** * Returns the current index in the input buffer. * * @return the current index */ public int currentIndex() { check(); return context.getCurrentIndex(); }
/** * Returns the next input character about to be matched. * * @return the next input character about to be matched */ public Character currentChar() { check(); return context.getCurrentChar(); }
/** * Pushes the given value onto the value stack. Equivalent to push(0, value). * * @param value the value to push * @return true */ public boolean push(V value) { check(); context.getValueStack().push(value); return true; }
/** * Removes the value at the top of the value stack. * * @return true * @throws IllegalArgumentException if the stack is empty */ public boolean drop() { check(); context.getValueStack().pop(); return true; }
/** * Duplicates the top value of the value stack. Equivalent to push(peek()). * * @return true * @throws IllegalArgumentException if the stack is empty */ public boolean dup() { check(); context.getValueStack().dup(); return true; }
/** * Returns the value the given number of elements below the top of the value stack without removing it. * * @param down the number of elements to skip (0 being equivalent to peek()) * @return the value * @throws IllegalArgumentException if the stack does not contain enough elements to perform this operation */ public V peek(int down) { check(); return context.getValueStack().peek(down); }
/** * Replaces the current top value of the value stack with the given value. Equivalent to poke(0, value). * * @param value the value * @return true * @throws IllegalArgumentException if the stack is empty */ public boolean poke(V value) { check(); context.getValueStack().poke(value); return true; }
/** * Reverses the order of the top 4 value stack elements. * * @return true * @throws org.parboiled.errors.GrammarException * if the stack does not contain at least 4 elements */ public boolean swap4() { check(); context.getValueStack().swap4(); return true; }
/** * Reverses the order of the top 6 value stack elements. * * @return true * @throws org.parboiled.errors.GrammarException * if the stack does not contain at least 6 elements */ public boolean swap6() { check(); context.getValueStack().swap6(); return true; }
/** * Removes the value the given number of elements below the top of the value stack. * * @param down the number of elements to skip before removing the value (0 being equivalent to pop()) * @return the value * @throws IllegalArgumentException if the stack does not contain enough elements to perform this operation */ public V pop(int down) { check(); return context.getValueStack().pop(down); }
/** * Returns the value at the top of the value stack without removing it. * * @return the current top value * @throws IllegalArgumentException if the stack is empty */ public V peek() { check(); return context.getValueStack().peek(); }
/** * Reverses the order of the top 3 value stack elements. * * @return true * @throws org.parboiled.errors.GrammarException * if the stack does not contain at least 3 elements */ public boolean swap3() { check(); context.getValueStack().swap3(); return true; }
/** * Reverses the order of the top 5 value stack elements. * * @return true * @throws org.parboiled.errors.GrammarException * if the stack does not contain at least 5 elements */ public boolean swap5() { check(); context.getValueStack().swap5(); return true; }
/** * Pushes all given elements onto the value stack (in the order as given). * * @param firstValue the first value * @param moreValues the other values * @return true */ public boolean pushAll(V firstValue, V... moreValues) { check(); context.getValueStack().pushAll(firstValue, moreValues); return true; }
/** * Removes the value the given number of elements below the top of the value stack. * * @param down the number of elements to skip before removing the value (0 being equivalent to drop()) * @return true * @throws IllegalArgumentException if the stack does not contain enough elements to perform this operation */ public boolean drop(int down) { check(); context.getValueStack().pop(down); return true; }
/** * Swaps the top two elements of the value stack. * * @return true * @throws org.parboiled.errors.GrammarException * if the stack does not contain at least two elements */ public boolean swap() { check(); context.getValueStack().swap(); return true; }