Generic action before parsing data from string input
191797
public static function prepareParse (string $input, bool $allowFile) : array
    {
        // Is string or is file ?
        if ($allowFile === true && is_file($input)) :
            $input = file_get_contents($input);
        endif;

        // Line
        $input = preg_replace("(\r\n|\n|\r)",';',$input);
        $input = explode(';', $input);

        // Delete comments
        foreach ($input as &$line) :
            // Delete comments
            $is_comment = mb_strpos($line, '#');
            if ($is_comment !== false) :
                $line = substr($line, 0, $is_comment);
            endif;

            // Trim
            $line = trim($line);
        endforeach;

        return $input;
    }
318739
function normalizeAction(base, input) {
  assert(input.name, 'actions must have a name');
  assert(input.href, 'actions must have an href');

  var ret = clone(input);

  ret.href = normalizeHref(base, input.href);
  if (input.method) ret.method = normalizeMethod(input.method);

  var cls = normalizeClass(input.class);
  if (cls) ret.class = cls;

  var fields = normalizeFields(input.fields);
  if (fields) ret.fields = fields;

  return ret;
}
159685
def handle_input(self, code):
        """"""
        if not self.prompt.multiline:
            if not should_indent(code):
                try:
                    return self.comp.parse_block(code)
                except CoconutException:
                    pass
            while True:
                line = self.get_input(more=True)
                if line is None:
                    return None
                elif line:
                    code += "\n" + line
                else:
                    break
        try:
            return self.comp.parse_block(code)
        except CoconutException:
            logger.display_exc()
        return None
1228097
function (model, data, action, options) {
                var processor = this.$dataSource.getProcessorForModel(model);
                return processor.parse(model, data, action, options);
            }
1201360
@SuppressWarnings("unchecked")
    public T parse(String input) throws Exception {
        validate(input);
        setContent(input);
        return (T) this;
    }
547468
function parseSearchString(str) {

    str = tia.cU.replaceXTypesInTeq(str);

    var re = /&(\w|\d|_|-)+/g;

    var searchData = [];
    var prevLastIndex = 0;
    var query;

    while (true) {
      var reResult = re.exec(str);

      if (reResult === null) {
        // Only query string.
        query = str.slice(prevLastIndex).trim();
        if (query) {
          searchData.push({
            query: query,
          });
        }
        return searchData;
      }

      query = str.slice(prevLastIndex, reResult.index).trim();
      var reference = str.slice(reResult.index + 1, re.lastIndex).trim();
      prevLastIndex = re.lastIndex;

      if (query) {
        searchData.push({
          query: query,
        });
      }

      searchData.push({
        reference: reference,
      });

    }
  }
236111
static String parse(final byte content[], final Metadata metadata, final int limit) throws TikaException, IOException {
        // check that its not unprivileged code like a script
        SecurityManager sm = System.getSecurityManager();
        if (sm != null) {
            sm.checkPermission(new SpecialPermission());
        }

        try {
            return AccessController.doPrivileged(new PrivilegedExceptionAction<String>() {
                @Override
                public String run() throws TikaException, IOException {
                    return TIKA_INSTANCE.parseToString(StreamInput.wrap(content), metadata, limit);
                }
            });
        } catch (PrivilegedActionException e) {
            // checked exception from tika: unbox it
            Throwable cause = e.getCause();
            if (cause instanceof TikaException) {
                throw (TikaException) cause;
            } else if (cause instanceof IOException) {
                throw (IOException) cause;
            } else {
                throw new AssertionError(cause);
            }
        }
    }
50844
def parse(self, inputstring, parser, preargs, postargs):
        """"""
        self.reset()
        pre_procd = None
        with logger.gather_parsing_stats():
            try:
                pre_procd = self.pre(inputstring, **preargs)
                parsed = parse(parser, pre_procd)
                out = self.post(parsed, **postargs)
            except ParseBaseException as err:
                raise self.make_parse_err(err)
            except CoconutDeferredSyntaxError as err:
                internal_assert(pre_procd is not None, "invalid deferred syntax error in pre-processing", err)
                raise self.make_syntax_err(err, pre_procd)
            except RuntimeError as err:
                raise CoconutException(
                    str(err), extra="try again with --recursion-limit greater than the current "
                    + str(sys.getrecursionlimit()),
                )
        if self.strict:
            for name in self.unused_imports:
                if name != "*":
                    logger.warn("found unused import", name, extra="disable --strict to dismiss")
        return out
1139073
private void parseParameters(String input) {
        for (String param : input.split("&")) {
            String[] pair = param.split("=");

            String name = (pair.length > 0) ? pair[0] : null;
            String value = (pair.length > 1) ? pair[1] : null;

            if (name != null) {
                setParameter(name, value);
            }
        }
    }
293245
def expand_action(data):
    
    # when given a string, assume user wants to index raw json
    if isinstance(data, string_types):
        return '{"index":{}}', data

    # make sure we don't alter the action
    data = data.copy()
    op_type = data.pop('_op_type', 'index')
    action = {op_type: {}}
    for key in ('_index', '_parent', '_percolate', '_routing', '_timestamp',
            '_ttl', '_type', '_version', '_version_type', '_id', '_retry_on_conflict'):
        if key in data:
            action[op_type][key] = data.pop(key)

    # no data payload for delete
    if op_type == 'delete':
        return action, None

    return action, data.get('_source', data)
86443
def parse(self, input):
        """"""
        query = None
        for handler in self._line_handlers:
            try:
                query = handler.handle(input)
            except Exception as e:
                query = None
            finally:
                if query is not None:
                    return query
        return None
406768
@Override
	public ImmutableList<TargetAtom> parse(String input) throws TargetQueryParserException {
		StringBuffer bf = new StringBuffer(input.trim());
		if (!bf.substring(bf.length() - 2, bf.length()).equals(" .")) {
			bf.insert(bf.length() - 1, ' ');
		}
		if (!prefixes.isEmpty()) {
			// Update the input by appending the directives
			appendDirectives(bf);
		}		
		try {
			CharStream inputStream = CharStreams.fromString(bf.toString());
			TurtleOBDALexer lexer = new TurtleOBDALexer(inputStream);

			//substitute the standard ConsoleErrorListener (simply print out the error) with ThrowingErrorListener
            lexer.removeErrorListeners();
			lexer.addErrorListener(ThrowingErrorListener.INSTANCE);

			CommonTokenStream tokenStream = new CommonTokenStream(lexer);
			TurtleOBDAParser parser = new TurtleOBDAParser(tokenStream);
            //substitute the standard ConsoleErrorListener (simply print out the error) with ThrowingErrorListener
			parser.removeErrorListeners();
			parser.addErrorListener(ThrowingErrorListener.INSTANCE);

			return (ImmutableList<TargetAtom>)visitor.visitParse(parser.parse());
		} catch (RuntimeException e) {
			throw new TargetQueryParserException(e.getMessage(), e);
		}
	}
789750
def accept_line(event):
    "  "
    b = event.current_buffer
    b.accept_action.validate_and_handle(event.cli, b)
53224
protected void processInput(String input) {
        String command = input.trim();
        if (!command.isEmpty()) {
            runCommand(command);
        }
    }
761195
def prepend_string(t, string):
    """"""
    node = t.tree
    if node.text is not None:
        node.text += string
    else:
        node.text = string
699495
function isAtStart(string, index) {
  const before = string.substring(0, index).trim();

  return before.length === 0 || before.search(/[({,]$/) !== -1;
}
1204311
def pre(self, inputstring, **kwargs):
        """"""
        out = self.apply_procs(self.preprocs, kwargs, str(inputstring))
        logger.log_tag("skips", self.skips)
        return out