parse include commands
548693
private static void parseInclude(String line, Pipeline pipeline,
            String parentFilePath, List<String> cliArgs) throws ParseException {
        LOG.info("+-parsing include line '{}'", line);
        String includeName = line.replaceFirst("include: ", "").trim();
        File includeFile = null;
        if (includeName.startsWith("/")) {
            includeFile = new File(includeName);
        } else {
            includeFile = new File(parentFilePath, includeName);
        }
        if (!includeFile.exists()) {
            String didYouMean = "";
            if (new File(parentFilePath, "../" + includeName).exists()) {
                didYouMean = "\ndid you mean: '../" + includeName + "'";
            } else if (new File(parentFilePath, includeName.replaceFirst(
                    "\\.\\./", "")).exists()) {
                didYouMean = "\ndid you mean: '"
                        + includeName.replaceFirst("\\.\\./", "") + "'";
            }
            throw new ParseException("include file does not exist ("
                    + includeFile.getAbsolutePath() + ") " + didYouMean, -1);
        }

        try {
            List<String> includeStr = FileUtils.readLines(includeFile);
            includeStr.add("");
            includeStr.add("");
            parseAndDispatch(includeStr, pipeline, includeFile.getParentFile()
                    .getAbsolutePath(), cliArgs);

        } catch (IOException e) {
            throw new ParseException("cannot read include file ("
                    + includeFile.getAbsolutePath() + ")", -1);
        }
    }
83536
def command_objects(names=self.commands, command_array=Boson.commands)
      command_array.select {|e| names.include?(e.name) && e.lib == self.name }
    end
636230
def _add_include_arg(arg_parser):
    
    arg_parser.add_argument("--include",
                            metavar='Path',
                            action='append',
                            type=to_unicode,
                            dest='include_paths',
                            help="Specifies a single path to include. This argument can be repeated.",
                            default=[])
62437
function parseArguments() {
    var aFileList;

    if (g_aInput.length > 0) {
        aFileList = g_aInput;
    } else {
        aFileList = process.argv;
    }

    Commander.parse(aFileList);
    if (g_aInput.length === 0 && (Commander.args && Commander.args.length === 0)) {
        process.exitCode = EXIT_ERROR_NO_PATH_GIVEN;
        console.error(Chalk.red('Error: ') + Chalk.bold(' no path given'));
        Commander.outputHelp();
    }
}
1131434
function parse() {
  var msie = /MSIE.(\d+)/i.exec(ua);
  var rv = /Trident.+rv:(\d+)/i.exec(ua);
  var version = msie || rv || undefined;
  return version ? +version[1] : version;
}
656485
function parse(path) {
  const data = [];
  const p = String(path).trim();

  // A path data segment (if there is one) must begin with a "moveto" command
  if (p[0] !== 'M' && p[0] !== 'm') {
    return data;
  }

  p.replace(SEGMENT_PATTERN, (_, command, args) => {
    let type = command.toLowerCase();
    let theArgs = parseValues(args);
    let theCommand = command;
    // overloaded moveTo
    if (type === 'm' && theArgs.length > 2) {
      data.push([theCommand].concat(theArgs.splice(0, 2)));
      type = 'l';
      theCommand = theCommand === 'm' ? 'l' : 'L';
    }

    // Ignore invalid commands
    if (theArgs.length < ARG_LENGTH[type]) {
      return '';
    }

    data.push([theCommand].concat(theArgs.splice(0, ARG_LENGTH[type])));

    // The command letter can be eliminated on subsequent commands if the
    // same command is used multiple times in a row (e.g., you can drop the
    // second "L" in "M 100 200 L 200 100 L -100 -200" and use
    // "M 100 200 L 200 100 -100 -200" instead).
    while (theArgs.length >= ARG_LENGTH[type] && theArgs.length && ARG_LENGTH[type]) {
      data.push([theCommand].concat(theArgs.splice(0, ARG_LENGTH[type])));
    }

    return '';
  });
  return data;
}
947900
def parse_cmd(cmd, flags)
      if cmd.flags?
        args = Raw.arguments_to(cmd.flags.short, flags)
        if args.nil? || args.empty?
          args = Raw.arguments_to(cmd.flags.long, flags)
        end
      else
        args = Raw.arguments_to(cmd.index.to_s, flags)
      end
      unless cmd.type.to_s =~ /stdin/
        return nil if args.nil?
      end
      case cmd.type
      when :stdin
        args = STDIN.gets.strip
      when :stdin_stream
        args = STDIN
      when :stdin_string
        args = STDIN.gets.strip
      when :stdin_strings
        args = []
        while arg = STDIN.gets
          next if arg.nil?
          arg = arg.strip
          args << arg
        end
        args
      when :stdin_integer
        args = STDIN.gets.strip.to_i
      when :stdin_integers
        args = []
        while arg = STDIN.gets
          next if arg.nil?
          arg = arg.strip
          parse = arg.to_i
          if parse.to_s == arg
            args << parse
          end
        end
        args
      when :stdin_bool
        args = STDIN.gets.strip.downcase == "true"
      when :single, :string
        args = args.first
      when :strings, :multi
        if cmd.delimiter?
          if args.count > 1
            args = args.first.split(cmd.delimiter)
          else
            args = args.map { |arg| arg.split(cmd.delimiter) }.flatten
          end
        end
        args
      when :integer
        args = args.first.to_i
      when :integers
        if cmd.delimiter?
          if args.count > 1
            args = args.join
            args = args.select { |arg| arg if arg.include?(cmd.delimiter) }
            args = args.map { |arg| arg.split(cmd.delimiter) }.flatten
          else
            args = args.map { |arg| arg.split(cmd.delimiter) }.flatten
          end
        end
        args = args.map(&:to_i)
      when :bool, :bools
        if cmd.delimiter?
          if args.count > 1
            args = args.join
            args = args.select { |arg| arg if arg.include?(cmd.delimiter) }
            args = args.map { |arg| arg.split(cmd.delimiter) }.flatten
          else
            args = args.map { |arg| arg.split(cmd.delimiter) }.flatten
          end
        end
        args = args.map { |arg| arg == "true" }
      end
    rescue => e# this is dangerous
      puts e
      nil
    end
139634
def include(d, e):
    """"""

    return (d, [f for f in glob.glob('%s/%s' % (d, e)) if os.path.isfile(f)])
724980
def parse(command)
      case command.class.name.downcase.to_sym #Array => :array
      when :array
        command.compact.join(' && ')
      when :string
        command.chomp
      else
        raise Trooper::MalformedCommandError, "Command Not a String or Array: #{command.inspect}"
      end
    end
726332
def parse(code="", mode="sys"):
    """"""
    if CLI.comp is None:
        setup()
    if mode in PARSERS:
        return PARSERS[mode](CLI.comp)(code)
    else:
        raise CoconutException(
            "invalid parse mode " + ascii(mode),
            extra="valid modes are " + ", ".join(PARSERS),
        )
241894
function resolveIncludeDirectives(text, fileItem) {
	var result = [];

	// parse source code with esprima
	try {
		var srcParsed = esprima.parse(text);
	} catch (e) {
		logger.error(buildErrMsg(fileItem.ancestor, 'Failed to parse a [%s] JavaScript file. Reason : [%s]', fileItem.filePath, e));
		throw buildShortErrMsg(fileItem.ancestor, 'Failed to parse a [%s] JavaScript file. Reason : [%s]', path.basename(fileItem.filePath), e)
	}

	// iterating over and looking for include directives
	for (var key in srcParsed.body) {
		var item = srcParsed.body[key];

		// resolve include directive from dom item
		var includeDirective = resolveIncludeDirectiveDom(item);
		if (includeDirective != null) {
			result.push(includeDirective);
		}
	}

	return result;
}
16526
def construct_include(self, node):
        """"""

        filename = os.path.join(self._root, self.construct_scalar(node))
        filename = os.path.abspath(filename)
        extension = os.path.splitext(filename)[1].lstrip('.')

        with open(filename, 'r') as f:
            if extension in ('yaml', 'yml'):
                return yaml.load(f, Loader=self)
            else:
                return ''.join(f.readlines())
103627
def _load_includes(self, tag, ssh=False):
        
        import re
        includes = []
        for child in tag:
            if child.tag == "include" and "path" in child.attrib:
                incl = { "path": child.attrib["path"] }
                if "modules" in child.attrib:
                    incl["modules"] = re.split(",\s*", child.attrib["modules"].lower())
                includes.append(incl)

        if ssh == False:
            self._vardict["includes"] = includes
        else:
            self._vardict["ssh.includes"] = includes
225400
def expand_includes(text, path='.'):
    """"""
    def read_and_expand(match):
        filename = match.group('filename')
        filename = join(path, filename)
        text = read(filename)
        return expand_includes(
            text, path=join(path, dirname(filename)))

    return re.sub(r'^\.\. include:: (?P<filename>.*)$',
                  read_and_expand,
                  text,
                  flags=re.MULTILINE)
1164071
def _check_and_handle_includes(self, from_file):
        
        logger.debug("Check/handle includes from %s", from_file)
        try:
            paths = self._parser.get("INCLUDE", "paths")
        except (config_parser.NoSectionError,
                config_parser.NoOptionError) as exc:
            logger.debug("_check_and_handle_includes: EXCEPTION: %s", exc)
            return
        paths_lines = [p.strip() for p in paths.split("\n")]
        logger.debug("paths = %s (wanted just once; CLEARING)", paths_lines)
        self._parser.remove_option("INCLUDE", "paths")
        for f in paths_lines:
            abspath = (f if os.path.isabs(f) else
                       os.path.abspath(
                           os.path.join(os.path.dirname(from_file), f)))
            use_path = os.path.normpath(abspath)
            if use_path in self._parsed_files:
                raise RecursionInConfigFile("In %s: %s already read",
                                            from_file, use_path)
            self._parsed_files.append(use_path)
            self._handle_rc_file(use_path)
1255216
def command_in_path?(command)
      found = ENV['PATH'].split(File::PATH_SEPARATOR).map do |p|
        File.exist?(File.join(p, command))
      end
      found.include?(true)
    end
160341
function parseRELEASES(content) {
    return _.chain(stripBom(content))
        .replace('\r\n', '\n')
        .split('\n')
        .map(function(line) {
            var parts = releaseRe.exec(line);
            if (!parts) return null;

            var filename = parts[2];
            var isDelta = filename.indexOf('-full.nupkg') == -1;

            var filenameParts = filename
                .replace(".nupkg", "")
                .replace("-delta", "")
                .replace("-full", "")
                .split(/\.|-/)
                .reverse();

            var version = _.chain(filenameParts)
                .filter(function(x) {
                    return /^\d+$/.exec(x);
                })
                .reverse()
                .value()
                .join('.');

            return {
                sha: parts[1],
                filename: filename,
                size: Number(parts[3]),
                isDelta: isDelta,
                version: version,
                semver: toSemver(version)
            };
        })
        .compact()
        .value();
}