MCPcopy Create free account
hub / github.com/antlr/codebuff / writeObjectWithOptions

Method writeObjectWithOptions

output/java/1.4.15/Interpreter.java:684–707  ·  view source on GitHub ↗

Write out an expression result that uses expression options. E.g.,

(STWriter out, InstanceScope scope, Object o, Object[] options)

Source from the content-addressed store, hash-verified

682 */
683
684 protected int writeObjectWithOptions(STWriter out, InstanceScope scope, Object o, Object[] options) {
685 int start = out.index(); // track char we're about to write
686 // precompute all option values (render all the way to strings)
687 String[] optionStrings = null;
688 if ( options !=null ) {
689 optionStrings = new String[options.length];
690 for (int i = 0; i <Compiler.NUM_OPTIONS; i++) {
691 optionStrings[i] = toString(out, scope, options[i]);
692 }
693 }
694 if ( options !=null && options[Option.ANCHOR.ordinal()]!=null ) {
695 out.pushAnchorPoint();
696 }
697
698 int n = writeObject(out, scope, o, optionStrings);
699 if ( options !=null && options[Option.ANCHOR.ordinal()]!=null ) {
700 out.popAnchorPoint();
701 }
702 if ( debug ) {
703 EvalExprEvent e = new EvalExprEvent(scope, start, out.index()-1, getExprStartChar(scope), getExprStopChar(scope));
704 trackDebugEvent(scope, e);
705 }
706 return n;
707 }
708
709 /** Generic method to emit text for an object. It differentiates
710 * between templates, iterable objects, and plain old Java objects (POJOs)

Callers 1

_execMethod · 0.95

Calls 9

toStringMethod · 0.95
writeObjectMethod · 0.95
getExprStartCharMethod · 0.95
getExprStopCharMethod · 0.95
trackDebugEventMethod · 0.95
indexMethod · 0.65
ordinalMethod · 0.65
pushAnchorPointMethod · 0.65
popAnchorPointMethod · 0.65

Tested by

no test coverage detected