docs/traceur-package/services/atParser.js
function parseModule(fileInfo) {

    var moduleName = file2modulename(fileInfo.relativePath);
    var sourceFile = new SourceFile(moduleName, fileInfo.content);
    var comments = [];
    var moduleTree;
    var parser = new Parser(sourceFile);

    // Configure the parser
    parser.handleComment = function(range) {
      comments.push({ range: range });
    };
    traceurOptions.setFromObject(service.traceurOptions);

    try {
      // Parse the file as a module, attaching the comments
      moduleTree = parser.parseModule();
      attachComments(moduleTree, comments);
    } catch(ex) {
      // HACK: sometime traceur crashes for various reasons including
      // Not Yet Implemented (NYI)!
      log.error(ex.stack);
      moduleTree = {};
    }
    log.debug(moduleName);
    moduleTree.moduleName = moduleName;

    // We return the module AST but also a collection of all the comments
    // since it can be helpful to iterate through them without having to
    // traverse the AST again
    return {
      moduleTree: moduleTree,
      comments: comments
    };
  }
function parseModule(fileInfo) {

    var moduleName = file2modulename(fileInfo.relativePath);
    var sourceFile = new SourceFile(moduleName, fileInfo.content);
    var comments = [];
    var moduleTree;
    var parser = new Parser(sourceFile);

    // Configure the parser
    parser.handleComment = function(range) {
      comments.push({ range: range });
    };
    traceurOptions.setFromObject(service.traceurOptions);

    try {
      // Parse the file as a module, attaching the comments
      moduleTree = parser.parseModule();
      attachComments(moduleTree, comments);
    } catch(ex) {
      // HACK: sometime traceur crashes for various reasons including
      // Not Yet Implemented (NYI)!
      log.error(ex.stack);
      moduleTree = {};
    }
    log.debug(moduleName);
    moduleTree.moduleName = moduleName;

    // We return the module AST but also a collection of all the comments
    // since it can be helpful to iterate through them without having to
    // traverse the AST again
    return {
      moduleTree: moduleTree,
      comments: comments
    };
  }
function parseModule ( fileInfo ) { var moduleName = file2modulename ( fileInfo . relativePath ) ; var sourceFile = new SourceFile ( moduleName , fileInfo . content ) ; var comments = [ ] ; var moduleTree ; var parser = new Parser ( sourceFile ) ; // Configure the parser parser . handleComment = function ( range ) { comments . push ( { range : range } ) ; } ; traceurOptions . setFromObject ( service . traceurOptions ) ; try { // Parse the file as a module, attaching the comments moduleTree = parser . parseModule ( ) ; attachComments ( moduleTree , comments ) ; } catch ( ex ) { // HACK: sometime traceur crashes for various reasons including // Not Yet Implemented (NYI)! log . error ( ex . stack ) ; moduleTree = { } ; } log . debug ( moduleName ) ; moduleTree . moduleName = moduleName ; // We return the module AST but also a collection of all the comments // since it can be helpful to iterate through them without having to // traverse the AST again return { moduleTree : moduleTree , comments : comments } ; }
Parse the contents of the file using traceur
Parse the contents of the file using traceur