Parse a line of output from SNMP data
@param line
@returns {{value: *, oid: *}}
555788
function parseSnmpLine(line) {
        if (typeof line !== 'string') {
            throw new Error("Data is not in string format");
        }

        var data = line.trim();
        var errString = 'No Such Object available on this agent at this OID';

        if (data.indexOf(errString) >= 0) {
            throw new Error(data);
        }

        // Messages that occur as a result of doing MIB translation on output
        // We exclude "Cannot find module" and "Did not find *" messages because
        // in some cases we walk the whole tree and there are may be vendor-specific
        // mibs that we don't have installed.
        if (data.indexOf('MIB search path') >= 0 ||
            data.indexOf('Cannot find module') >= 0 ||
            data.indexOf('Did not find') >= 0) {

            return;
        }

        var parsed = data.split(' ');

        return {
            oid: parsed.shift(),
            value: parsed.join(' ').replace(/["']/g, '')   //remove "" in '"name"'
        };
    }
796786
public void processLine(String line) throws CLIException {
        if (lineProcessor != null) {
            String out = lineProcessor.processLine(line);
            if (out != null) {
                output.output(out, outputConverter);
                return;
            } else {
                // Exit from sub-shell
                lineProcessor = null;
            }
        }

        if (line.trim().equals("?")) {
            output.output(String.format(HINT_FORMAT, appName), outputConverter);
        } else {
            List<Token> tokens = Token.tokenize(line);
            if (tokens.size() > 0) {
                String discriminator = tokens.get(0).getString();
                processCommand(discriminator, tokens);
            }
        }
    }
1311437
private ShellCommand getCommandForLine(final String line) {

		final int pos                             = line.indexOf(" ");
		final String commandString                = pos > 0 ? line.substring(0, pos) : line;
		final Class<? extends ShellCommand> clazz = commands.get(commandString);

		if (clazz != null) {

			try {

				return clazz.newInstance();

			} catch (Throwable t) {
				logger.warn("", t);
			}
		}

		return null;
	}
391028
public static List<String> parse(String line)
	{
		
		if(line == null || line.length() ==0)
			return null;
		
		final short START = 2;
		final short TERM = 3;
		final short QUOTED_TERM = 4;
		final short start_ESCAPEDDOUBLEQUOTE =5;
		
		short state = START;
		
		int length = line.length();
		ArrayList<String> tokens = new ArrayList<>(10);
		
		StringBuilder buffer = new StringBuilder();
		
		char currentChar;
		for (int i = 0; i < length; i++)
		{
			currentChar = line.charAt(i);
			
			switch(state)
			{
				case START:
					if(currentChar == '"')
					{
						state = QUOTED_TERM;
					}
					else if(currentChar != ',')
					{
						  state = TERM;
						  buffer.append(currentChar);
					}

				break; 
				case QUOTED_TERM:
					if(currentChar != '"')
					{
						buffer.append(currentChar);
					}
					else
					{
						if(line.length() > (i+ 1) && line.charAt(i+1) != '"')
						{
							state = START;
							tokens.add(buffer.toString());
							buffer.setLength(0);							
						}
						else if(line.length() > (i+ 1) && line.charAt(i+1) == '"')
						{
							state = start_ESCAPEDDOUBLEQUOTE;
						}
					}
				break;
				case start_ESCAPEDDOUBLEQUOTE:
					
					buffer.append(currentChar);

					state = QUOTED_TERM;
				break;
				case TERM: 
					if(currentChar == ',')
					{
						state = START;
						
						if(buffer.length() > 0)
						{
							tokens.add(buffer.toString());
							buffer.setLength(0);
						}
						
					}
					else if(currentChar == '"' && line.charAt(i+1) == '"' )
					{
						state = start_ESCAPEDDOUBLEQUOTE;
					}
					else
							buffer.append(line.charAt(i));
				break;
				default: throw new RuntimeException("Unknown parse state:"+state);
			}
		}
		
		if(buffer.length() > 0)
			tokens.add(buffer.toString());
			
		tokens.trimToSize();
		
		if(tokens.isEmpty())
			return null;
		
		return tokens;
	
	}
133483
function parseStackLine(line) {
    const urlLike = line
        // Sanitize string
        .replace(/^\s+/, '').replace(/\(eval code/g, '(')
        // Split with spaces: 'at someFn (/path/to.js:1:2)' or 'at /path/to.js:1:2'
        .split(/\s+/)
        // Take the last piece
        .pop();
    // Fetch parts: '(/path/to.js:1:2)' → [..., '/path/to.js', 1, 2]
    const parts = /(.+?)(?::(\d+))?(?::(\d+))?$/.exec(urlLike.replace(/[()]/g, ''));
    const filename = ['eval', '<anonymous>'].indexOf(parts[1]) > -1 ? undefined : parts[1];

    return {filename: filename, line: parts[2], column: parts[3]};
}
641117
function parse_domain (line) {
		debug.assert(line).is('string');

		// -S-G-J ==> "tili-lii.fi 2017-06-02"
		// +S-G-J ==> "tili-lii.fi 2017-06-02 lock"
		// +S+G-J ==> "tili-lii.fi 2017-06-02 lock @creator true 0 undef"
		// -S+G-J ==> "tili-lii.fi 2017-06-02 @creator true 0 undef"
		// -S-G+J ==> "tili-lii.fi 2017-06-02 0"
		// +S+G+J ==> "tili-lii.fi 2017-06-02 lock @creator true 0 undef 0"

		//debug.log('line = "' + line + '"');

		var tmp = line.split(' ');

		//debug.log('tmp = ', tmp);

		var domain = tmp.shift();
		var exp_date = tmp.shift();

		var obj = {
			'domain': domain,
			'expiration': exp_date
		};

		debug.assert(obj.domain).is('string');
		debug.assert(obj.expiration).is('string');

		if (showstatus) {
			obj.status = tmp.shift().split(',');
			debug.assert(obj.status).is('array');
		}

		if (showjokerns) {
			obj.jokerns = parse_jokerns(tmp.pop());
			debug.assert(obj.jokerns).is('boolean');
		}

		if (showgrants) {
			obj.grants = tmp.join(' ');
			debug.assert(obj.grants).is('string');
		}

		if (tmp.length !== 0) {
			throw new TypeError("Failed to parse everything: " + tmp.join(','));
		}

		//debug.log("obj = ", obj);
		return obj;
	}
122148
def parse_line(line: str, char_index=0) -> Tuple[ListingType, str]:
    """"""

    entry_name = str.rpartition(line, ' ')[-1]
    entry_type = LISTING_FLAG_MAP.get(line[char_index], ListingType.other)
    return entry_type, entry_name
903117
private Optional<SqlCommandCall> parseCommand(String line) {
		final Optional<SqlCommandCall> parsedLine = SqlCommandParser.parse(line);
		if (!parsedLine.isPresent()) {
			printError(CliStrings.MESSAGE_UNKNOWN_SQL);
		}
		return parsedLine;
	}
162826
function _parseVertex(line) {
        var vertex = JSON.parse(line);
        assert.ok(_smellsLikeAnElement(vertex));
        // A vertex is an object, i.e. a key,value map.
        // We don't sort the keys of the object, leaving that to jsonStableStringify below.
        // But a vertex values contain `property containers`, each of which may contain embedded arrays of elements.
        return _.mapValues(vertex, _sortPropertyContainers);
    }
1206765
def parse_line(self, line, lineno):
        """"""
        # TaskCluster logs are a bit wonky.
        #
        # TaskCluster logs begin with output coming from TaskCluster itself,
        # before it has transitioned control of the task to the configured
        # process. These "internal" logs look like the following:
        #
        #   [taskcluster 2016-09-09 17:41:43.544Z] Worker Group: us-west-2b
        #
        # If an error occurs during this "setup" phase, TaskCluster may emit
        # lines beginning with ``[taskcluster:error]``.
        #
        # Once control has transitioned from TaskCluster to the configured
        # task process, lines can be whatever the configured process emits.
        # The popular ``run-task`` wrapper prefixes output to emulate
        # TaskCluster's "internal" logs. e.g.
        #
        #   [vcs 2016-09-09T17:45:02.842230Z] adding changesets
        #
        # This prefixing can confuse error parsing. So, we strip it.
        #
        # Because regular expression matching and string manipulation can be
        # expensive when performed on every line, we only strip the TaskCluster
        # log prefix if we know we're in a TaskCluster log.

        # First line of TaskCluster logs almost certainly has this.
        if line.startswith('[taskcluster '):
            self.is_taskcluster = True

        # For performance reasons, only do this if we have identified as
        # a TC task.
        if self.is_taskcluster:
            line = re.sub(self.RE_TASKCLUSTER_NORMAL_PREFIX, "", line)

        if self.is_error_line(line):
            self.add(line, lineno)
865622
protected static E164CountryCode parse(String line) throws IOException {
        try {
            int pos = line.indexOf(' ');
            if (pos < 0) throw new IOException("Invalid format, could not parse prefix");
            String prefix = line.substring(0, pos);

            // rest of line is iso
            String iso = line.substring(pos+1).trim();

            // was there a name?
            if (iso == null || iso.equals("")) {
                throw new IOException("Country ISO was null or empty");
            }

            // create the new country code
            return new E164CountryCode(prefix, iso);
        } catch (Exception e) {
            throw new IOException("Failed while parsing country code for line: " + line, e);
        }
    }
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;
}
65416
private String parseLevelOfTheory(String line) {
        StringBuffer summary = new StringBuffer();
        summary.append(line);
        try {

            do {
                line = input.readLine().trim();
                summary.append(line);
            } while (!(line.indexOf('@') >= 0));
        } catch (Exception exc) {
            logger.debug("syntax problem while parsing summary of g98 section: ");
            logger.debug(exc);
        }
        logger.debug("parseLoT(): " + summary.toString());
        StringTokenizer st1 = new StringTokenizer(summary.toString(), "\\");

        // Must contain at least 6 tokens
        if (st1.countTokens() < 6) {
            return null;
        }

        // Skip first four tokens
        for (int i = 0; i < 4; ++i) {
            st1.nextToken();
        }

        return st1.nextToken() + "/" + st1.nextToken();
    }
77118
def _parse_line(self, line):
        
        msg_info = {'raw_message': line}
        if ': ' in line:
            info, msg = [i.strip() for i in line.split(': ', 1)]
            msg_info['message'] = msg

            info_splits = info.split()
            if len(info_splits) == 5:
                msg_info['timestamp'] = ' '.join(info_splits[:3])
                msg_info['hostname'] = info_splits[3]
                msg_info['procname'] = info_splits[4]
        return msg_info
134946
function (line) {
            if (this._content) {
                this._content = this._content + this._newLine + line;
            } else {
                this._values = [];
                this._content = line;
            }
            return this._parseContent();
        }
180071
function trimLine(line) {
	if (!line) {
		return null;
	}

	if (Array.isArray(line)) {
		return line.map(trimLine);
	}

	return String(line).trim();
}
100667
function parseProgressLine(line) {
  var progress = {};

  // Remove all spaces after = and trim
  line  = line.replace(/=\s+/g, '=').trim();
  var progressParts = line.split(' ');

  // Split every progress part by "=" to get key and value
  for(var i = 0; i < progressParts.length; i++) {
    var progressSplit = progressParts[i].split('=', 2);
    var key = progressSplit[0];
    var value = progressSplit[1];

    // This is not a progress line
    if(typeof value === 'undefined')
      return null;

    progress[key] = value;
  }

  return progress;
}