src/Grammar.js
function(str) {
    var app;
    if (str.indexOf('<') === -1) {
      // simple application
      app = new pexprs.Apply(str);
    } else {
      // parameterized application
      var cst = ohmGrammar.match(str, 'Base_application');
      app = buildGrammar(cst, {});
    }

    // Ensure that the application is valid.
    if (!(app.ruleName in this.rules)) {
      throw errors.undeclaredRule(app.ruleName, this.name);
    }
    var formals = this.rules[app.ruleName].formals;
    if (formals.length !== app.args.length) {
      var source = this.rules[app.ruleName].source;
      throw errors.wrongNumberOfParameters(app.ruleName, formals.length, app.args.length, source);
    }
    return app;
  }
function(str) {
    var app;
    if (str.indexOf('<') === -1) {
      // simple application
      app = new pexprs.Apply(str);
    } else {
      // parameterized application
      var cst = ohmGrammar.match(str, 'Base_application');
      app = buildGrammar(cst, {});
    }

    // Ensure that the application is valid.
    if (!(app.ruleName in this.rules)) {
      throw errors.undeclaredRule(app.ruleName, this.name);
    }
    var formals = this.rules[app.ruleName].formals;
    if (formals.length !== app.args.length) {
      var source = this.rules[app.ruleName].source;
      throw errors.wrongNumberOfParameters(app.ruleName, formals.length, app.args.length, source);
    }
    return app;
  }
function ( str ) { var app ; if ( str . indexOf ( '<' ) === - 1 ) { // simple application app = new pexprs . Apply ( str ) ; } else { // parameterized application var cst = ohmGrammar . match ( str , 'Base_application' ) ; app = buildGrammar ( cst , { } ) ; } // Ensure that the application is valid. if ( ! ( app . ruleName in this . rules ) ) { throw errors . undeclaredRule ( app . ruleName , this . name ) ; } var formals = this . rules [ app . ruleName ] . formals ; if ( formals . length !== app . args . length ) { var source = this . rules [ app . ruleName ] . source ; throw errors . wrongNumberOfParameters ( app . ruleName , formals . length , app . args . length , source ) ; } return app ; }
Parse a string which expresses a rule application in this grammar, and return the resulting Apply node.
Parse a string which expresses a rule application in this grammar and return the resulting Apply node .