import * as babylon from "babylon";

/**
 * Parse `code` with normalized options, collecting tokens and comments.
 */

export default function (code, opts = {}) {
  var parseOpts = {
    allowImportExportEverywhere: opts.looseModules,
    allowReturnOutsideFunction:  opts.looseModules,
    allowHashBang:               true,
    ecmaVersion:                 6,
    strictMode:                  opts.strictMode,
    sourceType:                  opts.sourceType,
    locations:                   true,
    features:                    opts.features || {},
    plugins:                     opts.plugins || {}
  };

  if (opts.nonStandard) {
    parseOpts.plugins.jsx = true;
    parseOpts.plugins.flow = true;
  }

  return babylon.parse(code, parseOpts);
}

@@ -284,83 +284,8 @@
 es,%0A
-    allowHashBang:               true,%0A    ecmaVersion:                 6,%0A
     
@@ -295,30 +295,16 @@
 ictMode:
-              
     opts
@@ -331,30 +331,16 @@
 rceType:
-              
     opts
@@ -356,47 +356,8 @@
 pe,%0A
-    locations:                   true,%0A
     
@@ -365,30 +365,16 @@
 eatures:
-              
       op
@@ -404,30 +404,16 @@
 plugins:
-              
        o

simplify parse helper options