Parses string and returns a (Tokenizer.TYPE, value) tuple.
189836
def tokentype(self, s):
        """"""
        a = s[0] if len(s)>0 else ""
        b = s[1] if len(s)>1 else ""

        if a.isdigit() or (a in ["+","-"] and b.isdigit()):
            return self.parse_number(s)
        elif a == '"': return self.parse_string(s)
        elif a == ':': return self.parse_colon(s)
        elif a == ';': return self.parse_semicolon(s)
        else:
            return self.parse_word(s)
57896
def parse(str)
      if str.nil? || str == ""
        raise ParserError.new("Empty input",0,"")
      end

      s = StringScanner.new str
      @tokens = []

      until s.eos?
        s.skip(/\s+/) ? nil :
          s.scan(/\A[-+]?[0-9]*\.[0-9]+(e[-+]?[0-9]+)?/i) ? (@tokens << [:FLOAT, s.matched]) :
          s.scan(/\A[-+]?(0|[1-9]\d*)/)      ? (@tokens << [:INTEGER, s.matched]) :
          s.scan(/\A\.(?=\s)/)               ? (@tokens << ['.', '.']) :
          s.scan(/\A[a-z\-.\/_:*<>+=$#][a-z\-.\/_:$*<>+=0-9]*/i) ? (@tokens << [:SYMBOL, s.matched]) :
          s.scan(/\A"(([^\\"]|\\.)*)"/)        ? (@tokens << [:STRING, _unescape_string(s.matched.slice(1...-1))])  :
          s.scan(/\A./)                      ? (a = s.matched; @tokens << [a, a]) :
          (raise ParserError.new("Scanner error",s.pos,s.peek(5)))
      end
      @tokens.push [false, 'END']

      return do_parse.map do |i|
        normalize(i)
      end
    end
1021783
def _parse_value(self, write_token=True, override=None):
        """"""
        v_str = self.prior_token

        # Construct the complex string
        if v_str == '(':
            v_re = self.token

            self._update_tokens(write_token)
            assert self.token == ','

            self._update_tokens(write_token)
            v_im = self.token

            self._update_tokens(write_token)
            assert self.token == ')'

            self._update_tokens(write_token, override)
            v_str = '({0}, {1})'.format(v_re, v_im)

        recast_funcs = [int, pyfloat, pycomplex, pybool, pystr]

        for f90type in recast_funcs:
            try:
                # Unclever hack.. integrate this better
                if f90type == pybool:
                    value = pybool(v_str, self.strict_logical)
                else:
                    value = f90type(v_str)
                return value
            except ValueError:
                continue
107509
def parse_tuple_type_str(old_from_type_str):
    
    @functools.wraps(old_from_type_str)
    def new_from_type_str(cls, type_str, registry):
        normalized_type_str = normalize(type_str)
        abi_type = parse(normalized_type_str)

        type_str_repr = repr(type_str)
        if type_str != normalized_type_str:
            type_str_repr = '{} (normalized to {})'.format(
                type_str_repr,
                repr(normalized_type_str),
            )

        if not isinstance(abi_type, TupleType):
            raise ValueError(
                'Cannot create {} for non-tuple type {}'.format(
                    cls.__name__,
                    type_str_repr,
                )
            )

        abi_type.validate()

        return old_from_type_str(cls, abi_type, registry)

    return classmethod(new_from_type_str)
285191
def parse(self):
        """"""
        token_type = self.current_token.type.lower()
        handler = getattr(self, f'parse_{token_type}', None)
        if handler is None:
            raise self.error(f'Invalid literal {self.current_token.value!r}')
        return handler()
530541
def loadstr(cls, string):
        
        try:
            string = string.decode('utf-8')
        except AttributeError:
            pass

        lexer = tokenizer(string)

        if cls.is_molfile(string):
            molfile = Molfile()

            try:
                molfile.update(json.loads(string))
            except ValueError:
                molfile._build(lexer)
            return molfile

        elif cls.is_sdfile(string):
            sdfile = SDfile()

            try:
                sdfile.update(json.loads(string))
            except ValueError:
                sdfile._build(lexer)
            return sdfile

        else:
            raise ValueError('Cannot determine the format of string.')
978010
def parse_partial(self, text):
        ''' '''
        if not isinstance(text, str):
            raise TypeError(
                'Can only parsing string but got {!r}'.format(text))
        res = self(text, 0)
        if res.status:
            return (res.value, text[res.index:])
        else:
            raise ParseError(res.expected, text, res.index)
557479
def _parse(self):
        """"""
        while self._cur_token['type'] in (TT.ws, TT.lbreak):
            self._skip_whitespace()
            self._skip_newlines()

        self._data = self._parse_value()

        return self._data
43432
def _parse_tuple_string(argument):
        
        if isinstance(argument, str):
            return tuple(int(p.strip()) for p in argument.split(','))
        return argument
353028
private static Type doParse(String str) throws Exception {
        Class<?> token = PRIMITIVES.get(str);
        if (token != null) {
            return token;
        }
        int first = str.indexOf('<');
        if (first < 0) {
            return StringConvert.loadType(str);
        }
        int last = str.lastIndexOf('>');
        String baseStr = str.substring(0, first);
        Class<?> base = StringConvert.loadType(baseStr);
        String argsStr = str.substring(first + 1, last);
        List<String> splitArgs = split(argsStr);
        List<Type> types = new ArrayList<Type>();
        for (String splitArg : splitArgs) {
            Type argType;
            if (splitArg.startsWith(EXTENDS)) {
                String remainder = splitArg.substring(EXTENDS.length());
                argType = wildExtendsType(doParse(remainder));
            } else if (splitArg.startsWith(SUPER)) {
                String remainder = splitArg.substring(SUPER.length());
                argType = wildSuperType(doParse(remainder));
            } else if (splitArg.equals("?")) {
                argType = wildExtendsType(Object.class);
            } else if (splitArg.endsWith("[]")) {
                String componentStr = splitArg.substring(0, splitArg.length() - 2);
                Class<?> componentCls = StringConvert.loadType(componentStr);
                argType = Array.newInstance(componentCls, 0).getClass();
            } else if (splitArg.startsWith("[L") && splitArg.endsWith(";")) {
                String componentStr = splitArg.substring(2, splitArg.length() - 1);
                Class<?> componentCls = StringConvert.loadType(componentStr);
                argType = Array.newInstance(componentCls, 0).getClass();
            } else {
                argType = doParse(splitArg);
            }
            types.add(argType);
        }
        return newParameterizedType(base, types.toArray(new Type[types.size()]));
    }
673973
function Parser(str, opts) {
  this._oneWayVoid = !!(opts && opts.oneWayVoid);
  this._reassignJavadoc = !!(opts && opts.reassignJavadoc);
  this._imports = [];
  this._tk = new Tokenizer(str);
  this._tk.next(); // Prime tokenizer.
}
698787
def parse_string(self, string=''):
        '''
        
        '''
        self.strings = string.splitlines(1)
        self.strings = [self.__parse(line) for line in self.strings]
        return ''.join(self.strings)
617132
def _parse_string(self):
        """"""
        if self._next_token() in ['{', '(']:
            field = self._parse_field()
            if field:
                self.definitions[field[0]] = field[1]
360429
def kw_str_parse(a_string):
    """"""
    try:
        return dict((k, eval(v.rstrip(',')))
                    for k, v in kw_list_re.findall(a_string))
    except (AttributeError, TypeError):
        if isinstance(a_string, collections.Mapping):
            return a_string
        return {}
1006009
def Parse(self, value):
    

    value_line = value.split(' ')
    if len(value_line) < 3:
      raise TextFSMTemplateError('Expect at least 3 tokens on line.')

    if not value_line[2].startswith('('):
      # Options are present
      options = value_line[1]
      for option in options.split(','):
        self._AddOption(option)
      # Call option OnCreateOptions callbacks
      _ = [option.OnCreateOptions() for option in self.options]

      self.name = value_line[2]
      self.regex = ' '.join(value_line[3:])
    else:
      # There were no valid options, so there are no options.
      # Treat this argument as the name.
      self.name = value_line[1]
      self.regex = ' '.join(value_line[2:])

    if len(self.name) > self.max_name_len:
      raise TextFSMTemplateError(
          "Invalid Value name '%s' or name too long." % self.name)

    if (not re.match(r'^\(.*\)$', self.regex) or
        self.regex.count('(') != self.regex.count(')')):
      raise TextFSMTemplateError(
          "Value '%s' must be contained within a '()' pair." % self.regex)

    self.template = re.sub(r'^\(', '(?P<%s>' % self.name, self.regex)

    # Compile and store the regex object only on List-type values for use in nested matching
    if any(map(lambda x: isinstance(x, TextFSMOptions.List), self.options)):
        try:
            self.compiled_regex = re.compile(self.regex)
        except re.error as e:
            raise TextFSMTemplateError(str(e))
931294
def parse(string, language=None):
    
    if language:
        string = replace_word_tokens(string, language)

    tokens = tokenize(string)
    postfix = to_postfix(tokens)

    return evaluate_postfix(postfix)
1232461
def parse(self, format_string):
        """"""
        txt, state = '', 0
        colorstack = [(None, None)]
        itokens = self.tokenize(format_string)

        for token, escaped in itokens:
            if token == self._START_TOKEN and not escaped:
                if txt:
                    yield txt, colorstack[-1]
                    txt = ''

                state += 1
                colors = self.extract_syntax(colorise.compat.next(itokens)[0])
                colorstack.append(tuple(b or a
                                        for a, b in zip(colorstack[-1],
                                                        colors)))
            elif token == self._FMT_TOKEN and not escaped:
                # if state == 0:
                #     raise ColorSyntaxError("Missing '{0}'"
                #                            .format(self._START_TOKEN))

                if state % 2 != 0:
                    state += 1
                else:
                    txt += token
            elif token == self._STOP_TOKEN and not escaped:
                if state < 2:
                    raise ColorSyntaxError("Missing '{0}' or '{1}'"
                                           .format(self._STOP_TOKEN,
                                                   self._FMT_TOKEN))

                if txt:
                    yield txt, colorstack[-1]
                    txt = ''

                state -= 2
                colorstack.pop()
            else:
                txt += token

        if state != 0:
            raise ColorSyntaxError("Invalid color format")

        if txt:
            yield txt, colorstack[-1]