本文整理了Java中org.parboiled.support.ValueStack.peek()
方法的一些代码示例,展示了ValueStack.peek()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ValueStack.peek()
方法的具体详情如下:
包路径:org.parboiled.support.ValueStack
类名称:ValueStack
方法名:peek
[英]Returns the value at the top of the stack without removing it.
[中]返回堆栈顶部的值,而不删除它。
代码示例来源:origin: immutables/immutables
@Override
public final boolean run(Context<Object> context) {
V value = extractor.get(context);
@SuppressWarnings("unchecked")
B builder = (B) context.getValueStack().peek();
specify(builder, value);
return true;
}
代码示例来源:origin: org.pegdown/pegdown
boolean setListItemIndices() {
SuperNode listItem = (SuperNode) getContext().getValueStack().peek();
List<Node> children = listItem.getChildren();
listItem.setStartIndex(children.get(0).getStartIndex());
listItem.setEndIndex(children.get(children.size() - 1).getEndIndex());
return true;
}
代码示例来源:origin: org.parboiled/parboiled-java
/**
* 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();
}
代码示例来源:origin: org.parboiled/parboiled-java
/**
* 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);
}
代码示例来源:origin: org.geotools/gt-css
<T> List<T> popAll(Class... classes) {
ValueStack<Object> valueStack = getContext().getValueStack();
List<T> result = new ArrayList<T>();
while (!valueStack.isEmpty() && isInstance(classes, valueStack.peek())) {
result.add((T) valueStack.pop());
}
if (!valueStack.isEmpty() && valueStack.peek() == MARKER) {
valueStack.pop();
}
Collections.reverse(result);
return result;
}
代码示例来源:origin: org.immutables/cases
@Override
public final boolean run(Context<Object> context) {
V value = extractor.get(context);
@SuppressWarnings("unchecked")
B builder = (B) context.getValueStack().peek();
specify(builder, value);
return true;
}
代码示例来源:origin: org.immutables/trees
@Override
public final boolean run(Context<Object> context) {
V value = extractor.get(context);
@SuppressWarnings("unchecked")
B builder = (B) context.getValueStack().peek();
specify(builder, value);
return true;
}
代码示例来源:origin: org.parboiled/parboiled-core
@SuppressWarnings({"ConstantConditions"})
public void createNode() {
if (!nodeSuppressed) {
node = new NodeImpl<V>(matcher, getSubNodes(), startIndex, currentIndex,
valueStack.isEmpty() ? null : valueStack.peek(), hasError);
if (parent != null) {
parent.subNodes = parent.subNodes.prepend(node);
}
}
}
代码示例来源:origin: org.parboiled/parboiled-core
/**
* Creates a new ParsingResult.
*
* @param matched true if the rule matched the input
* @param parseTreeRoot the parse tree root node
* @param valueStack the value stack of the parsing run
* @param parseErrors the list of parse errors
* @param inputBuffer the input buffer
*/
public ParsingResult(boolean matched, Node<V> parseTreeRoot, ValueStack<V> valueStack, List<ParseError> parseErrors,
InputBuffer inputBuffer) {
this.matched = matched;
this.parseTreeRoot = parseTreeRoot;
this.valueStack = checkArgNotNull(valueStack, "valueStack");
this.resultValue = valueStack.isEmpty() ? null : valueStack.peek();
this.parseErrors = checkArgNotNull(parseErrors, "parseErrors");
this.inputBuffer = checkArgNotNull(inputBuffer, "inputBuffer");
}
内容来源于网络,如有侵权,请联系作者删除!