Takes a single line of text and parses out the cmd and rest, which are used for dispatching to more exact parsing functions.
17962
function splitCommand(line) {
    // Make sure we get the same results irrespective of leading/trailing spaces
    var match = line.match(TOKEN_WHITESPACE);
    if (!match) {
        return {
            name: line.toUpperCase(),
            rest: ''
        };
    }
    var name = line.substr(0, match.index).toUpperCase();
    var rest = line.substr(match.index + match[0].length);

    return {
        name: name,
        rest: rest
    };
}
241728
function parseLine(line) {
  // except for the command, no field has a space, so we split by that and piece the command back together
  var parts = line.split(/ +/);
  return {
      user    : parts[0]
    , pid     : parseInt(parts[1])
    , '%cpu'  : parseFloat(parts[2])
    , '%mem'  : parseFloat(parts[3])
    , vsz     : parseInt(parts[4])
    , rss     : parseInt(parts[5])
    , tty     : parts[6]
    , state   : parts[7]
    , started : parts[8]
    , time    : parts[9]
    , command : parts.slice(10).join(' ')
  }
}
701972
def _parse(self, text):
        '''
        
        '''
        # ensure unicode first
        text = str(text).strip()

        if not text.startswith(DELIMITER):
            return {}, text

        try:
            _, fm, content = BOUNDARY.split(text, 2)
        except ValueError:
            # if we can't split, bail
            return {}, text
        # loader_class = self.loader_factory(self)
        metadata = yaml.load(fm, Loader=self.loader_class)
        metadata = metadata if (isinstance(metadata, dict)) else {}
        return metadata, content
69711
function parseLine(line) {
	let origin = null;
	let command = null;
	const args = [];
	if (line.length === 0) {
		// empty line is not valid
		return null;
	}
	let spaceAt;
	// first, parse the origin (if any)
	if (line.charAt(0) === ':') {
		spaceAt = line.indexOf(' ');
		if (spaceAt !== -1) {
			origin = line.substring(1, spaceAt);
			line = line.substring(spaceAt + 1);
		} else {
			// one word that starts with a : is not valid
			return null;
		}
	}
	if (line.length === 0) {
		// no command? invalid line
		return null;
	}
	// second, parse the command
	spaceAt = line.indexOf(' ');
	if (spaceAt !== -1) {
		command = line.substr(0, spaceAt);
		line = line.substring(spaceAt + 1);
	} else {
		command = line;
		line = null;
	}
	// now parse the args
	while (line !== null && line.length > 0) {
		if (line.charAt(0) === ':') {
			args.push(line.substring(1));
			line = null;
		} else {
			spaceAt = line.indexOf(' ');
			if (spaceAt !== -1) {
				args.push(line.substring(0, spaceAt));
				line = line.substring(spaceAt + 1);
			} else {
				args.push(line);
				line = null;
			}
		}
	}
	return {
		origin: origin,
		command: command,
		args: args
	};
}
863092
def cmd_split(self, line):
        
        cmd, *args = line.lstrip().split(' ', 1)
        return self.root_command.subcommands[cmd], ' '.join(args)
1210035
def parse_cmd_kwlist(text, off=0):
    '''
    
    '''
    kwlist = []

    _, off = nom(text, off, whites)

    while off < len(text):

        (p, v), off = parse_cmd_kwarg(text, off=off)

        kwlist.append((p, v))

        _, off = nom(text, off, whites)
        if not nextchar(text, off, ','):
            break

    _, off = nom(text, off, whites)
    return kwlist, off
285817
def from_text(self, line, line_index, column, is_escaped):
        """"""
        begin = self._begin
        end = self._end
        single = self._single

        single_len = len(single)
        start_len = len(begin)

        if _token_at_col_in_line(line, column, single, single_len):
            return (STATE_IN_COMMENT,
                    (line_index, column + single_len),
                    ParserState.EOL)
        elif _token_at_col_in_line(line, column, begin, start_len):
            return (STATE_IN_COMMENT,
                    (line_index, column + single_len),
                    end)
        elif ((_token_at_col_in_line(line, column, "\"") or
               _token_at_col_in_line(line, column, "'")) and
              not _is_escaped(line, column, is_escaped)):
            # Check here to see whether this is a quote or if this
            # is a spellcheckable line
            if (_token_at_col_in_line(line, column, "\"\"\"") or
                    _token_at_col_in_line(line, column, "'''")):
                return (STATE_IN_COMMENT,
                        (line_index, column + 3),
                        line[column:column + 3])
            else:
                return (STATE_IN_QUOTE,
                        (line_index, column + 1),
                        line[column:column + 1])

        return (STATE_IN_TEXT,
                (0, 0),
                None)
519291
function parseCommandLine() {
	var commands = process.argv.slice(2);
	var args = {};

	for (var i = 0; i < commands.length; i++) {
		var match = commands[i].match(/^--(.+)=(.+)$/);
		if (match)
			args[match[1]] = match[2];
		else if (i < commands.length - 1 && commands[i].substr(0, 1) === "-") {
			args[commands[i].substr(1)] = commands[i + 1];
			i++;
		}
		else if (i === 0) args[commandKey] = commands[i];
		else if (i === 1) args[commandHost] = commands[i];
	}

	return args;
}
720720
function parseMessage(line) { // {{{
  var message = {};
  var match;

  // Parse prefix
  if (match = line.match(/^:([^ ]+) +/)) {
    message.prefix = match[1];
    line = line.replace(/^:[^ ]+ +/, '');
    if (match = message.prefix.match(/^([_a-zA-Z0-9\[\]\\`^{}|-]*)(!([^@]+)@(.*))?$/)) {
      message.nick = match[1];
      message.user = match[3];
      message.host = match[4];
    }
    else
      message.server = message.prefix;
  }

  // Parse command
  match = line.match(/^([^ ]+) +/);
  message.command = match[1];
  message.rawCommand = match[1];
  message.commandType = 'normal';
  line = line.replace(/^[^ ]+ +/, '');

  if (replyFor[message.rawCommand]) {
    message.command     = replyFor[message.rawCommand].name;
    message.commandType = replyFor[message.rawCommand].type;
  }

  message.args = [];
  var middle, trailing;

  // Parse parameters
  if (line.indexOf(':') != -1) {
    var index = line.indexOf(':');
    middle = line.substr(0, index).replace(/ +$/, "");
    trailing = line.substr(index+1);
  } else
    middle = line;

  if (middle.length)
    message.args = middle.split(/ +/);

  if (typeof(trailing) != 'undefined' && trailing.length)
    message.args.push(trailing);

  return message;
}
767328
def parse(text):
    
    rv = {}
    m = META.match(text)

    while m:
        key = m.group(1)
        value = m.group(2)
        value = INDENTATION.sub('\n', value.strip())
        rv[key] = value
        text = text[len(m.group(0)):]
        m = META.match(text)

    return rv, text
1245764
def parse(self, text):
        """"""
        text = self.preprocess(text)
        token_stack = []
        last_pos = 0

        # Iterate through all matched tokens
        for match in self.regex.finditer(text):
            # Find which token has been matched by regex
            token, match_type, group = self.get_matched_token(match)

            # Get params from stack of tokens
            params = self.get_params(token_stack)

            # Should we skip interpreting tokens?
            skip = token_stack[-1].skip if token_stack else False

            # Check for end token first
            if match_type == MatchType.end:
                if not skip or token_stack[-1] == token:
                    removed = self.remove_token(token_stack, token)
                    if removed:
                        skip = False
                    else:
                        skip = True

            if not skip:
                # Append text preceding matched token
                start_pos = match.start(group)
                if start_pos > last_pos:
                    yield Segment(self.postprocess(text[last_pos:start_pos]), **params)

                # Actions specific for start token or single token
                if match_type == MatchType.start:
                    token_stack.append(token)
                elif match_type == MatchType.single:
                    single_params = params.copy()
                    single_params.update(token.params)
                    single_text = token.text if token.text is not None else match.group(group)
                    yield Segment(single_text, token=token, match=match, **single_params)

                # Move last position pointer to the end of matched token
                last_pos = match.end(group)

        # Append anything that's left
        if last_pos < len(text):
            params = self.get_params(token_stack)
            yield Segment(self.postprocess(text[last_pos:]), **params)
629517
def parse_batch(text)
      io = StringIO.new(text)
      objects = []
      while line = io.gets
        sha, type, size = line.split(" ", 3)
        parser = BATCH_PARSERS[type]
        if type == 'missing' || !parser
          io.seek(size.to_i + 1, IO::SEEK_CUR)
          objects << nil
          next
        end

        object   = io.read(size.to_i + 1)
        objects << parser.parse_batch(self, sha, size, object)
      end
      objects
    end
31224
def parse(self, line):
        
        tree = list(self.parser.raw_parse(line))[0]
        tree = tree[0]
        return tree
286518
def parse_line(string):
    """"""
    match = line_regexp().match(string)
    if match:
        matches = match.groupdict()
        line_number = matches['line_number']
        path_to_python = matches['path_to_python']
        spaceless_path_to_python = matches['spaceless_path_to_python']
        if path_to_python:
            return path_to_python, line_number
        elif spaceless_path_to_python:
            return spaceless_path_to_python, line_number
641711
def each_line(text, separator)
      lines = text.split(separator)
      return yield(text) if text.empty?
      lines.reduce([]) do |aligned, line|
        aligned << yield(line)
      end.join(separator)
    end
704243
public NerResultSet process(final String text) {
        // program pipeline: (Text) ------> (Phrases without classified) ------> (Phrases classified)
        //                         extractor                            classifier
        final NerResultSet rs = extractor.process(text);
        classifier.process(rs);
        if (tracing) trace = classifier.trace;
        return rs;
    }
1209768
def parse(self, text, *, metadata=None, filename="input"):
        

        metadata = metadata or {}
        body = []
        in_metadata = True

        line_number = None

        def throw(s):
            raise BlurbError(f("Error in {filename}:{line_number}:\n{s}"))

        def finish_entry():
            nonlocal body
            nonlocal in_metadata
            nonlocal metadata
            nonlocal self

            if not body:
                throw("Blurb 'body' text must not be empty!")
            text = textwrap_body(body)
            for naughty_prefix in ("- ", "Issue #", "bpo-"):
                if text.startswith(naughty_prefix):
                    throw("Blurb 'body' can't start with " + repr(naughty_prefix) + "!")

            no_changes = metadata.get('no changes')
            section = metadata.get('section')

            if not no_changes:
                if not section:
                    throw("No 'section' specified.  You must provide one!")
                elif section not in sections:
                    throw("Invalid 'section'!  You must use one of the predefined sections.")

            bpo = None
            try:
                bpo = int(metadata.get('bpo'))
            except (TypeError, ValueError):
                throw("Invalid bpo issue number! (" + repr(bpo) + ")")

            self.append((metadata, text))
            metadata = {}
            body = []
            in_metadata = True

        for line_number, line in enumerate(text.split("\n")):
            line = line.rstrip()
            if in_metadata:
                if line.startswith('..'):
                    line = line[2:].strip()
                    name, colon, value = line.partition(":")
                    assert colon
                    name = name.strip()
                    value = value.strip()
                    if name in metadata:
                        throw("Blurb metadata sets " + repr(name) + " twice!")
                    metadata[name] = value
                    continue
                if line.startswith("#") or not line:
                    continue
                in_metadata = False

            if line == "..":
                finish_entry()
                continue
            body.append(line)

        finish_entry()