public static Parser<Void> nestedScanner(final Parser<?> outer, final Parser<Void> inner) {
    return new Parser<Void>() {
      @Override boolean apply(ParseContext ctxt) {
        int from = ctxt.at;
        if (!outer.apply(ctxt)) return false;
        ScannerState innerState = new ScannerState(
            ctxt.module, ctxt.characters(), from, ctxt.at, ctxt.locator, ctxt.result);
        ctxt.getTrace().startFresh(innerState);
        innerState.getTrace().setStateAs(ctxt.getTrace());
        return ctxt.applyNested(inner, innerState);
      }
      @Override public String toString() {
        return "nested scanner";
      }
    };
  }
public static Parser < Void > nestedScanner ( final Parser < ? > outer , final Parser < Void > inner ) { return new Parser < Void > ( ) { @ Override boolean apply ( ParseContext ctxt ) { int from = ctxt . at ; if ( ! outer . apply ( ctxt ) ) return false ; ScannerState innerState = new ScannerState ( ctxt . module , ctxt . characters ( ) , from , ctxt . at , ctxt . locator , ctxt . result ) ; ctxt . getTrace ( ) . startFresh ( innerState ) ; innerState . getTrace ( ) . setStateAs ( ctxt . getTrace ( ) ) ; return ctxt . applyNested ( inner , innerState ) ; } @ Override public String toString ( ) { return "nested scanner" ; } } ; }
A scanner that after character level {@code outer} succeeds,
subsequently feeds the recognized characters to {@code inner} for a nested scanning.

<p> Is useful for scenarios like parsing string interpolation grammar, with parsing errors
correctly pointing to the right location in the original source.