src/Semantics.js
function ASemantics(matchResult) {
    if (!(matchResult instanceof MatchResult)) {
      throw new TypeError(
          'Semantics expected a MatchResult, but got ' + common.unexpectedObjToString(matchResult));
    }
    if (matchResult.failed()) {
      throw new TypeError('cannot apply Semantics to ' + matchResult.toString());
    }

    var cst = matchResult._cst;
    if (cst.grammar !== grammar) {
      throw new Error(
          "Cannot use a MatchResult from grammar '" + cst.grammar.name +
          "' with a semantics for '" + grammar.name + "'");
    }
    var inputStream = new InputStream(matchResult.input);
    return s.wrap(cst, inputStream.interval(matchResult._cstOffset, matchResult.input.length));
  }
function ASemantics(matchResult) {
    if (!(matchResult instanceof MatchResult)) {
      throw new TypeError(
          'Semantics expected a MatchResult, but got ' + common.unexpectedObjToString(matchResult));
    }
    if (matchResult.failed()) {
      throw new TypeError('cannot apply Semantics to ' + matchResult.toString());
    }

    var cst = matchResult._cst;
    if (cst.grammar !== grammar) {
      throw new Error(
          "Cannot use a MatchResult from grammar '" + cst.grammar.name +
          "' with a semantics for '" + grammar.name + "'");
    }
    var inputStream = new InputStream(matchResult.input);
    return s.wrap(cst, inputStream.interval(matchResult._cstOffset, matchResult.input.length));
  }
function ASemantics ( matchResult ) { if ( ! ( matchResult instanceof MatchResult ) ) { throw new TypeError ( 'Semantics expected a MatchResult, but got ' + common . unexpectedObjToString ( matchResult ) ) ; } if ( matchResult . failed ( ) ) { throw new TypeError ( 'cannot apply Semantics to ' + matchResult . toString ( ) ) ; } var cst = matchResult . _cst ; if ( cst . grammar !== grammar ) { throw new Error ( "Cannot use a MatchResult from grammar '" + cst . grammar . name + "' with a semantics for '" + grammar . name + "'" ) ; } var inputStream = new InputStream ( matchResult . input ) ; return s . wrap ( cst , inputStream . interval ( matchResult . _cstOffset , matchResult . input . length ) ) ; }
To enable clients to invoke a semantics like a function, return a function that acts as a proxy for `s`, which is the real `Semantics` instance.
To enable clients to invoke a semantics like a function return a function that acts as a proxy for s which is the real Semantics instance .