/*
This file is part of llang.

llang is MIT licensed. Feel free to use it, contribute or spread the word. Created with love by Petr Nevyhoštěný (Twitter).
483128
function parse(tokens) {
    var token;
    return process();

    function process(operation) {
        operation = operation || null;
        var args = [];

        while (next()) {
            if (token.type == 'boundary') {
                if (token.value == '(') args.push(process());
                else if (token.value == ')') return node(operation, args);
            }

            else if (token.type == 'variable') {
                args.push(node('substitution', [ token.value ]));
                if (isUnary(operation)) return node(operation, args);
            }

            else if (token.type == 'operator') {
                if (isUnary(token.value)) {
                    args.push(process(token.value));
                    continue;
                }

                if (operation) {
                    var tmp = args.slice(0);
                    args = [];
                    args.push(node(operation, tmp));
                }

                operation = token.value;
            }
        }

        return node(operation, args);
    }

    function next() {
        //TODO: use pointer instead of shifting
        //(parse would not need to clone tokens array)
        return (token = tokens.shift());
    }

    function node(action, args) {
        return {
            action: translate(action),
            args: args
        };
    }

    function translate(operator) {
        var map = {
            '!': 'negation',
            '|': 'disjunction',
            '&': 'conjunction',
            '->': 'implication',
            '<->': 'equivalence'
        };

        return map[operator] || operator;
    }

    function isUnary(op) {
        return op === '!';
    }

    function syntaxError() {
        throw new Error('Syntax error!');
    }
}
350401
function () {
        var pkg = require(process.cwd() + '/package.json');
        var licenses = [];
        pkg.licenses.forEach(function (license) {
            licenses.push(license.type);
        });

        return '/*! ' + pkg.name + ' - v' + pkg.version + ' - ' + gutil.date("yyyy-mm-dd") + "\n" +
            (pkg.homepage ? "* " + pkg.homepage + "\n" : "") +
            '* Copyright (c) ' + gutil.date("yyyy") + ' ' + pkg.author.name +
            '; Licensed ' + licenses.join(', ') + ' */\n';
    }
77776
function define (File, utils) {
  const { callable } = utils;
  const { debug, error, strong } = utils.cnsl;
  const { regexpEscape, uniqueMatch } = utils.string;

  return class NUNJUCKSFile extends File {
    /**
     * Constructor
     * @param {String} id
     * @param {String} filepath
     * @param {Object} options
     *  - {Object} caches
     *  - {Object} fileExtensions
     *  - {Function} fileFactory
     *  - {Object} globalAliases
     *  - {Array} npmModulepaths
     *  - {Object} pluginOptions
     *  - {Object} runtimeOptions
     */
    constructor (id, filepath, options) {
      super(id, filepath, options);

      this.workflows.writeable = WORKFLOW_WRITEABLE;
    }

    /**
     * Parse file contents for dependency references
     * @param {Object} buildOptions
     *  - {Boolean} batch
     *  - {Boolean} bootstrap
     *  - {Boolean} boilerplate
     *  - {Boolean} browser
     *  - {Boolean} bundle
     *  - {Boolean} compress
     *  - {Array} ignoredFiles
     *  - {Boolean} helpers
     *  - {Boolean} watchOnly
     * @param {Function} fn(err)
     */
    parse (buildOptions, fn) {
      super.parse(buildOptions, (err) => {
        if (err) return fn(err);

        // Find sidecar json file
        const sidecarData = super.parseSidecarDependency();
        // Parse includes
        let matches = uniqueMatch(this.content, RE_INCLUDE)
          .map((match) => {
            match.id = match.match;
            match.isInclude = true;
            return match;
          });

        // Parse imports
        matches.push(...uniqueMatch(this.content, RE_IMPORT)
          .map((match) => {
            match.id = match.match;
            match.isImport = true;
            return match;
          }));
        if (sidecarData) matches.push(sidecarData);

        super.addDependencies(matches, buildOptions);
        fn();
      });
    }

    /**
     * Replace relative dependency references with fully resolved
     * @param {Object} buildOptions
     *  - {Boolean} batch
     *  - {Boolean} bootstrap
     *  - {Boolean} boilerplate
     *  - {Boolean} browser
     *  - {Boolean} bundle
     *  - {Boolean} compress
     *  - {Boolean} helpers
     *  - {Array} ignoredFiles
     *  - {Boolean} import
     *  - {Boolean} watchOnly
     * @param {Function} fn(err)
     */
    replaceReferences (buildOptions, fn) {
      [...this.getAllDependencies(), this].forEach((file) => {
        if (file instanceof NUNJUCKSFile && this.dependencyReferences.length) {
          let content = file.content;

          file.dependencyReferences.forEach((reference) => {
            if (reference.file && reference.isImport) {
              const context = reference.context.replace(reference.id, reference.file.filepath);

              // Create new RegExp so that flags work properly
              content = content.replace(new RegExp(regexpEscape(reference.context), 'g'), context);
            }
          });

          file.setContent(content);
        }
      });
      fn();
    }

    /**
     * Inline css/img/js dependency content
     * @param {Object} buildOptions
     *  - {Boolean} batch
     *  - {Boolean} bootstrap
     *  - {Boolean} boilerplate
     *  - {Boolean} browser
     *  - {Boolean} bundle
     *  - {Boolean} compress
     *  - {Boolean} helpers
     *  - {Array} ignoredFiles
     *  - {Boolean} import
     *  - {Boolean} watchOnly
     * @param {Function} fn(err)
     */
    inlineInlineable (buildOptions, fn) {
      // Only dependencies
      parallel([...this.getAllDependencies()].reduce((inlineable, file) => {
        if (file instanceof NUNJUCKSFile && this.dependencyReferences.length) {
          inlineable.push(callable(file, 'inline', buildOptions));
        }
        return inlineable;
      }, []), fn);
    }

    /**
     * Inline included content
     * @param {Object} buildOptions
     *  - {Boolean} batch
     *  - {Boolean} bootstrap
     *  - {Boolean} boilerplate
     *  - {Boolean} browser
     *  - {Boolean} bundle
     *  - {Boolean} compress
     *  - {Boolean} helpers
     *  - {Array} ignoredFiles
     *  - {Boolean} import
     *  - {Boolean} watchOnly
     * @param {Function} fn(err)
     */
    inlineIncludes (buildOptions, fn) {
      [...this.getAllDependencies(), this].forEach((file) => {
        if (file instanceof NUNJUCKSFile && file.dependencyReferences.length) {
          let content = file.content;

          file.dependencyReferences.forEach((reference) => {
            if (reference.file && reference.context && reference.isInclude) {
              content = content.replace(new RegExp(regexpEscape(reference.context), 'g'), reference.file.content);
            }
          });

          file.setContent(content);
        }
      });
      fn();
    }

    /**
     * Compile file contents
     * @param {Object} buildOptions
     *  - {Boolean} batch
     *  - {Boolean} bootstrap
     *  - {Boolean} boilerplate
     *  - {Boolean} browser
     *  - {Boolean} bundle
     *  - {Boolean} compress
     *  - {Array} ignoredFiles
     *  - {Boolean} helpers
     *  - {Boolean} watchOnly
     * @param {Function} fn(err)
     */
    compile (buildOptions, fn) {
      const options = Object.assign({}, DEFAULT_OPTIONS, this.options.pluginOptions.nunjucks);

      nunjucks.configure(null, options);
      nunjucks.renderString(this.content, this.findSidecarDependency(), (err, content) => {
        if (err) {
          if (!this.options.runtimeOptions.watch) return fn(err);
          error(err, 4, false);
        }
        this.setContent(content);
        debug(`compile: ${strong(this.relpath)}`, 4);
        fn();
      });
    }

    /**
     * Reparse file contents for dependency references
     * @param {Object} buildOptions
     *  - {Boolean} batch
     *  - {Boolean} bootstrap
     *  - {Boolean} boilerplate
     *  - {Boolean} browser
     *  - {Boolean} bundle
     *  - {Boolean} compress
     *  - {Array} ignoredFiles
     *  - {Boolean} helpers
     *  - {Boolean} watchOnly
     * @param {Function} fn(err)
     */
    reparse (buildOptions, fn) {
      this.allDependencies = null;
      this.allDependencyReferences = null;
      this.dependencies = [];
      this.dependencyReferences = [];

      super.parse(buildOptions, fn);
    }
  };
}
418976
function() {
      var names = [];
      return {
        type: 'mod',
        file: 'libs',
        includeType: 'system',
        names: names,
        content: system.assets.libs.map(function(lib) { names.push(lib.name); return lib.content; }).join('\n')
      };
    }
44225
function uglifyWithCopyrights() {
    const preserveComments = (f) => {
        return (_node, comment) => {
            const text = comment.value;
            const type = comment.type;
            if (/@minifier_do_not_preserve/.test(text)) {
                return false;
            }
            const isOurCopyright = IS_OUR_COPYRIGHT_REGEXP.test(text);
            if (isOurCopyright) {
                if (f.__hasOurCopyright) {
                    return false;
                }
                f.__hasOurCopyright = true;
                return true;
            }
            if ('comment2' === type) {
                // check for /*!. Note that text doesn't contain leading /*
                return (text.length > 0 && text[0] === '!') || /@preserve|license|@cc_on|copyright/i.test(text);
            }
            else if ('comment1' === type) {
                return /license|copyright/i.test(text);
            }
            return false;
        };
    };
    const minify = composer(uglifyes);
    const input = es.through();
    const output = input
        .pipe(flatmap((stream, f) => {
        return stream.pipe(minify({
            output: {
                comments: preserveComments(f),
                max_line_len: 1024
            }
        }));
    }));
    return es.duplex(input, output);
}
149125
function compressDistributionPackage() {
  const src = [
    path.join(__dirname, 'build/**'),
    path.join(__dirname, 'LICENSE'),
    path.join(__dirname, 'CHANGELOG.md'),
    path.join(__dirname, 'bindings/*/esm/**'),
    path.join(__dirname, 'bindings/*/dist/**'),
    '!' + path.join(__dirname, 'build/docs/**'),
    '!' + path.join(__dirname, 'build/docs'),
  ];

  return gulp.src(src)
    .pipe($.zip('onsenui.zip'))
    .pipe(gulp.dest(path.join(__dirname, 'build')));
}
670120
function load($symbol) {

		if ($this->env->knownUnknown($symbol)) {
			return false;
		}

		if ($this->env->autoresolve($symbol)) {
			return true;
		}

		$ns_pos = \strripos($symbol, '\\');

		if ($ns_pos !== false && $ns_pos != 0) {
			$ns = \substr($symbol, 0, $ns_pos + 1);

			// Validate Main Segment
			// =====================

			$mainsegment = null;
			$firstslash = \strpos($ns, '\\');
			if ($firstslash !== false || $firstslash == 0) {
				$mainsegment = \substr($ns, 0, $firstslash);
			}
			else { // no \ in namespace
				// the namespace is the main segment itself
				$mainsegment = $ns;
			}

			if ( ! $this->env->knownSegment($mainsegment)) {
				$this->env->unknownSymbol($symbol);
				$this->env->save();
				return false;
			}


			// Continue Loading Process
			// ========================

			$name = \substr($symbol, $ns_pos + 1);
			$filename = \str_replace('_', '/', $name);
			$dirbreak = \strlen($name) - \strcspn(strrev($name), 'ABCDEFGHJIJKLMNOPQRSTUVWXYZ') - 1;

			if ($dirbreak > 0 && $dirbreak != \strlen($name) - 1) {
				$filename = \substr($name, $dirbreak).'/'.\substr($name, 0, $dirbreak);
			}
			else { // dirbreak == 0
				$filename = $name;
			}

			$nextPtr = \strrpos($ns, '\\next\\');

			$resolution = null;
			if ($nextPtr === false) {
				$resolution = $this->env->findFirstFileMatching($ns, $name, $filename);
			}
			else { // "\next\" is present in string
				$resolution = $this->env->findFirstFileMatchingAfterNext($ns, $name, $filename);
			}

			if ($resolution != null) {
				list($targetfile, $targetns, $target) = $resolution;

				if ( ! $this->env->isLoadedSymbol($target)) {
					$this->env->loadSymbol($target, $targetfile);
				}

				if ($targetns != $ns) {
					$this->env->aliasSymbol($target, $symbol);
				}

				$this->env->save();

				return true;
			}

		}
		# else: symbol belongs to global namespace

		$this->env->unknownSymbol($symbol);
		$this->env->save();

		return false; // failed to resolve symbol; pass to next autoloader
	}
895280
def lint(session):
    

    session.install("black", "flake8", *LOCAL_DEPS)
    session.install(".")
    session.run("flake8", os.path.join("google", "cloud", "bigquery"))
    session.run("flake8", "tests")
    session.run("flake8", os.path.join("docs", "snippets.py"))
    session.run("black", "--check", *BLACK_PATHS)
1148938
function() {

			// origRepo is not defined if dist was skipped
			Release.dir.repo = Release.dir.origRepo || Release.dir.repo;
			return npmTags();
		}
1282447
function makeShimNode(main) {
	return {
		bundles: [main],
		dependencies: ["@loader"],
		deps: ["@loader"],
		load: {
			address: "",
			metadata: {
				format: "amd",
				deps: ["@loader"],
				dependencies: ["@loader"]
			},
			name: "@steal",
			source: `
				define("@steal", ["@loader"], function(atLoader) {
					var steal = {};

					steal.loader = atLoader;
					steal.done = function() {
						return Promise.resolve();
					};

					return steal;
				});
			`
		}
	};
}
924628
function _rawGithubUrl (resolvedPackageRoot) {
  var { packageJson, relativeFile } = resolvedPackageRoot
  const orgRepo = _githubOrgRepo(packageJson && packageJson.repository && packageJson.repository.url)
  if (orgRepo) {
    return `https://raw.githubusercontent.com/${orgRepo}/v${packageJson.version}/${relativeFile}`
  }
}
1319169
function lint(files) {
  return gulp.src(files)
    .pipe($.plumber())
    .pipe($.eslint())
    .pipe($.eslint.format())
    .pipe($.eslint.failOnError())
    .pipe($.jscs())
    .pipe($.jscs.reporter())
    .pipe($.jscs.reporter('fail'))
    .on('error', onError);
}
248244
def stdlib(self):
        
        if self.module == 'pkg_resources' or self.module.startswith('pkg_resources.'):
            return False
        elif self.filename.startswith(SITE_PACKAGES_PATHS):
            # if it's in site-packages then its definitely not stdlib
            return False
        elif self.filename.startswith(SYS_PREFIX_PATHS):
            return True
        else:
            return False
573440
function makeShim(platform, lib) {
  console.log(`Creating the ${platform} ${lib} shim for the zeit-client-api`);

  let destFilePath = `${__dirname}/${lib}.js`;
  let sourceFilePath = `${__dirname}/shims/${lib}.${platform}.js`;
  fs.writeFileSync(destFilePath, fs.readFileSync(sourceFilePath));
}
468946
function lint(applyFixes) {
    logInfo("Lint TypeScript source files");

    const tsDir = path.resolve(TS_TARGETDIR);
    const cwdLength = tsDir.length - TS_TARGETDIR.length;
    const tsSuffix = ".ts";
    const dtsSuffix = ".d.ts";
    const lintConfigFile = path.resolve("./build/tslint.json");
    const lintOptions = {
        formatter: "verbose",
        fix: applyFixes
    };

    lintFolders(tsDir);

    function lintFolders(parent) {
        fse.readdirSync(parent).forEach((file, index) => {
            let curPath = path.join(parent, file);
            if (!fse.lstatSync(curPath).isDirectory()) {
                if ((file.substr(-tsSuffix.length) === tsSuffix) &&
                    !(file.substr(-dtsSuffix.length) === dtsSuffix)) {
                    lintFile(curPath.substr(cwdLength));
                }
            } else {
                lintFolders(curPath);
            }
        });
    }

    function lintFile(file) {
        const contents = fse.readFileSync(file, "utf-8");
        const linter = new tslint.Linter(lintOptions);
        const configuration = tslint.Configuration.findConfiguration(lintConfigFile).results;
        linter.lint(file, contents, configuration);
        const result = linter.getResult();

        // For debugging, use console.log(result);
        result.errorCount > 0 && console.log(result.output);
    }
}
1257471
function lintMsg(data) {
  return !data.autoInstall &&
    data.lint &&
    lintStyles.indexOf(data.lintConfig) !== -1
    ? 'npm run lint -- --fix (or for yarn: yarn run lint --fix)\n  '
    : ''
}
259845
function gulpLua2Js({ useFilenameAsName = true, ...options } = {}) {
  // creating a stream through which each file will pass
  return through.obj(function (file, enc, cb) {
    const newFile = file.clone();

    vinylToString(file, enc)
    .then(lua => {
      const dirname = path.dirname(file.path);
      const basename = path.basename(file.path, path.extname(file.path));

      if (!{}.hasOwnProperty.call(options, 'name') && useFilenameAsName) {
        options.name = basename;
      }

      const js = lua2js(lua, options);

      if (file.isBuffer()) {
        newFile.contents = new Buffer(js);
      } else if (file.isStream()) {
        // start the transformation
        newFile.contents = through();
        newFile.contents.end(js);
      } else {
        throw new PluginError(PLUGIN_NAME, 'Invalid file');
      }

      newFile.path = path.join(dirname, `${basename}.js`);
      // make sure the file goes through the next gulp plugin
      this.push(newFile);

      cb();
    });
  });
}