function build(grammar, problems) {
    $('#build-message').attr("class", "message progress").text("Building the parser...");
    $("#input").attr("disabled", "disabled");
    $("#parse-message").attr("class", "message disabled").text("Parser not available.");
    $("#output").addClass("disabled").text("Output not available.");
    $("#parser-var").attr("disabled", "disabled");
    $("#option-cache").attr("disabled", "disabled");
    $("#parser-download").attr("disabled", "disabled");

    try {
      var timeBefore = (new Date).getTime();
      parserSource = peggy.generate(grammar, {
        cache:    $("#option-cache").is(":checked"),
        output:   "source",

        error: function(_stage, message, location) {
          problems.push({
            severity: "error",
            message: message,
            from: convertLocation(location.start),
            to:   convertLocation(location.end),
          });
        },
        warn: function(_stage, message, location) {
          problems.push({
            severity: "warning",
            message: message,
            from: convertLocation(location.start),
            to:   convertLocation(location.end),
          });
        },
      });
      var timeAfter = (new Date).getTime();

      parser = eval(parserSource);

      $("#build-message")
        .attr("class", "message info")
        .html("Parser built successfully.")
        .append(buildSizeAndTimeInfoHtml(
          "Parser build time and speed",
          grammar.length,
          timeAfter - timeBefore
        ));
      $("#input").removeAttr("disabled");
      $("#parser-var").removeAttr("disabled");
      $("#option-cache").removeAttr("disabled");
      $("#parser-download").removeAttr("disabled");

      var result = true;
    } catch (e) {
      convertError(e, problems);
      $("#build-message").attr("class", "message error").text(buildErrorMessage(e));

      var result = false;
    }

    doLayout();
    return result;
  }
/**
   * Generates code from the parser, collects problems in `problems` in CodeMirror
   * lint format.
   *
   * @param {string} grammar Grammar text
   * @param {CodeMirror.lint.Annotation[]} problems List of problems of current
   *        grammar that editor should show
   * @returns {string} Source code of the parser
   */
Generates code from the parser, collects problems in `problems` in CodeMirror
lint format.

@param {string} grammar Grammar text
@param {CodeMirror.lint.Annotation[]} problems List of problems of current
grammar that editor should show
@returns {string} Source code of the parser
Generates code from the parser collects problems in ` problems ` in CodeMirror lint format . @param { string } grammar Grammar text @param { CodeMirror . lint . Annotation [] } problems List of problems of current grammar that editor should show @returns { string } Source code of the parser
function build(grammar, problems) {
    $('#build-message').attr("class", "message progress").text("Building the parser...");
    $("#input").attr("disabled", "disabled");
    $("#parse-message").attr("class", "message disabled").text("Parser not available.");
    $("#output").addClass("disabled").text("Output not available.");
    $("#parser-var").attr("disabled", "disabled");
    $("#option-cache").attr("disabled", "disabled");
    $("#parser-download").attr("disabled", "disabled");
    try {
      var timeBefore = (new Date).getTime();
      parserSource = peggy.generate(grammar, {
        cache:    $("#option-cache").is(":checked"),
        output:   "source",
        error: function(_stage, message, location) {
          problems.push({
            severity: "error",
            message: message,
            from: convertLocation(location.start),
            to:   convertLocation(location.end),
          });
        },
        warn: function(_stage, message, location) {
          problems.push({
            severity: "warning",
            message: message,
            from: convertLocation(location.start),
            to:   convertLocation(location.end),
          });
        },
      });
      var timeAfter = (new Date).getTime();
      parser = eval(parserSource);
      $("#build-message")
        .attr("class", "message info")
        .html("Parser built successfully.")
        .append(buildSizeAndTimeInfoHtml(
          "Parser build time and speed",
          grammar.length,
          timeAfter - timeBefore
        ));
      $("#input").removeAttr("disabled");
      $("#parser-var").removeAttr("disabled");
      $("#option-cache").removeAttr("disabled");
      $("#parser-download").removeAttr("disabled");
      var result = true;
    } catch (e) {
      convertError(e, problems);
      $("#build-message").attr("class", "message error").text(buildErrorMessage(e));
      var result = false;
    }
    doLayout();
    return result;
  }
function build ( grammar , problems ) { $ ( '#build-message' ) . attr ( "class" , "message progress" ) . text ( "Building the parser..." ) ; $ ( "#input" ) . attr ( "disabled" , "disabled" ) ; $ ( "#parse-message" ) . attr ( "class" , "message disabled" ) . text ( "Parser not available." ) ; $ ( "#output" ) . addClass ( "disabled" ) . text ( "Output not available." ) ; $ ( "#parser-var" ) . attr ( "disabled" , "disabled" ) ; $ ( "#option-cache" ) . attr ( "disabled" , "disabled" ) ; $ ( "#parser-download" ) . attr ( "disabled" , "disabled" ) ; try { var timeBefore = ( new Date ) . getTime ( ) ; parserSource = peggy . generate ( grammar , { cache : $ ( "#option-cache" ) . is ( ":checked" ) , output : "source" , error : function ( _stage , message , location ) { problems . push ( { severity : "error" , message : message , from : convertLocation ( location . start ) , to : convertLocation ( location . end ) , } ) ; } , warn : function ( _stage , message , location ) { problems . push ( { severity : "warning" , message : message , from : convertLocation ( location . start ) , to : convertLocation ( location . end ) , } ) ; } , } ) ; var timeAfter = ( new Date ) . getTime ( ) ; parser = eval ( parserSource ) ; $ ( "#build-message" ) . attr ( "class" , "message info" ) . html ( "Parser built successfully." ) . append ( buildSizeAndTimeInfoHtml ( "Parser build time and speed" , grammar . length , timeAfter - timeBefore ) ) ; $ ( "#input" ) . removeAttr ( "disabled" ) ; $ ( "#parser-var" ) . removeAttr ( "disabled" ) ; $ ( "#option-cache" ) . removeAttr ( "disabled" ) ; $ ( "#parser-download" ) . removeAttr ( "disabled" ) ; var result = true ; } catch ( e ) { convertError ( e , problems ) ; $ ( "#build-message" ) . attr ( "class" , "message error" ) . text ( buildErrorMessage ( e ) ) ; var result = false ; } doLayout ( ) ; return result ; }
Generates code from the parser, collects problems in `problems` in CodeMirror
 lint format.
Generates code from the parser collects problems in ` problems ` in CodeMirror lint format .