private static void printContext(Object caller, Context<Object> context) { String message = ErrorUtils.printErrorMessage("%s:%s:%s", "", context.getCurrentIndex(), context.getCurrentIndex() + 1, context.getInputBuffer()); System.err.println("*** " + caller + message + "\n\t" + Joiner.on("\n\t - ").join(context.getValueStack())); } }
public Rule NodeSequence(Object... nodeRules) { return Sequence( push(getContext().getCurrentIndex()), Sequence(nodeRules), setIndices() ); }
public Rule SingleQuoted() { return NodeSequence( !Character.isLetter(getContext().getInputBuffer().charAt(getContext().getCurrentIndex() - 1)), '\'', push(new QuotedNode(QuotedNode.Type.Single)), OneOrMore(TestNot(SingleQuoteEnd()), Inline(), addAsChild()), SingleQuoteEnd() ); }
Var<SuperNode> tightFirstItem = new Var<SuperNode>(); return Sequence( push(getContext().getCurrentIndex()), FirstOf(CrossedOut(BlankLine(), block), tight.set(true)), CrossedOut(itemStart, block), Line(block), ZeroOrMore( push(getContext().getCurrentIndex()),
Var<SuperNode> tightFirstItem = new Var<SuperNode>(); return Sequence( push(getContext().getCurrentIndex()), FirstOf(CrossedOut(BlankLine(), block), tight.set(true)), CrossedOut(itemStart, block), Optional(CrossedOut(Sequence(FirstOf(Sequence("[ ]", taskType.set(1)), Sequence(FirstOf("[x]","[X]"), taskType.set(2))), OneOrMore(Spacechar())), taskListMarker)), ZeroOrMore( push(getContext().getCurrentIndex()),
/** * Returns the current index in the input buffer. * * @return the current index */ public int currentIndex() { check(); return context.getCurrentIndex(); }
boolean debug(String text, Context context) { System.out.println("DEBUG("+context.getCurrentIndex()+"):" + text + " nodes:" +context.getSubNodes()); return true; }
int currentPos() { return getContext().getCurrentIndex(); }
int currentPos() { return getContext().getCurrentIndex(); }
private static void printContext(Object caller, Context<Object> context) { String message = ErrorUtils.printErrorMessage("%s:%s:%s", "", context.getCurrentIndex(), context.getCurrentIndex() + 1, context.getInputBuffer()); System.err.println("*** " + caller + message + "\n\t" + Joiner.on("\n\t - ").join(context.getValueStack())); } }
private static void printContext(Object caller, Context<Object> context) { String message = ErrorUtils.printErrorMessage("%s:%s:%s", "", context.getCurrentIndex(), context.getCurrentIndex() + 1, context.getInputBuffer()); System.err.println("*** " + caller + message + "\n\t" + Joiner.on("\n\t - ").join(context.getValueStack())); } }
public boolean apply(Tuple2<Context<?>, Boolean> tuple) { int line = tuple.a.getInputBuffer().getPosition(tuple.a.getCurrentIndex()).line; return firstLine <= line && line <= lastLine; } };
public boolean apply(Tuple2<Context<?>, Boolean> tuple) { return tuple.a.getInputBuffer().getPosition(tuple.a.getCurrentIndex()).line <= lastLine; } };
public boolean apply(Tuple2<Context<?>, Boolean> tuple) { return tuple.a.getInputBuffer().getPosition(tuple.a.getCurrentIndex()).line >= firstLine; } };
public Rule NodeSequence(Object... nodeRules) { return Sequence( push(getContext().getCurrentIndex()), Sequence(nodeRules), setIndices() ); }