本文整理了Java中org.parboiled.support.ValueStack.isEmpty()
方法的一些代码示例,展示了ValueStack.isEmpty()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ValueStack.isEmpty()
方法的具体详情如下:
包路径:org.parboiled.support.ValueStack
类名称:ValueStack
方法名:isEmpty
[英]Determines whether the stack is empty.
[中]确定堆栈是否为空。
代码示例来源: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.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: jtwig/jtwig-core
@Test
public void set() throws Exception {
ParsingResult<SetNode> result = parse(underTest.NodeRule(), "{% do 1 + 123 %}");
assertThat(result.matched, is(true));
assertThat(result.valueStack.isEmpty(), is(false));
}
代码示例来源:origin: jtwig/jtwig-core
@Test
public void set() throws Exception {
ParsingResult<SetNode> result = parse(underTest.NodeRule(), "{% set a = 123 %}");
assertThat(result.matched, is(true));
assertThat(result.valueStack.isEmpty(), is(false));
}
}
代码示例来源:origin: org.geotools/gt-css
@Override
public boolean run(Context ctx) {
List contents = (List) pop();
Selector selector = (Selector) pop();
String comment = null;
if (!ctx.getValueStack().isEmpty() && peek() instanceof String) {
comment = (String) pop();
comment = comment.trim();
// get rid of the extra comments between rules
while (!ctx.getValueStack().isEmpty() && peek() instanceof String) {
pop();
}
}
final Stream stream = contents.stream();
Map<Boolean, List> splitContents =
(Map<Boolean, List>)
stream.collect(
Collectors.partitioningBy(
x -> x instanceof CssRule));
List<Property> properties = splitContents.get(Boolean.FALSE);
List<CssRule> subRules = splitContents.get(Boolean.TRUE);
final CssRule rule = new CssRule(selector, properties, comment);
rule.nestedRules = subRules;
push(rule);
return true;
}
});
代码示例来源: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");
}
内容来源于网络,如有侵权,请联系作者删除!