Lines Matching refs:token

287         for token in self.alias:
288 if token is not None and name == token.name:
342 for token in token_list:
343 if token.name == node.name:
467 token = tokens[end]
469 if token.name == '<':
471 elif token.name == '>':
508 token = tokens[i]
509 if token.name == '<':
516 elif token.name == ',':
519 elif token.name == '*':
521 elif token.name == '&':
523 elif token.name == '[':
525 elif token.name == ']':
528 name_tokens.append(token)
699 def HandleError(self, msg, token):
702 (msg, self.filename, token, printable_queue))
706 token = self._GetNextToken()
707 if not token:
710 # Get the next token.
711 self.current_token = token
713 # Dispatch on the next token type.
714 if token.token_type == _INTERNAL_TOKEN:
715 if token.name == _NAMESPACE_POP:
720 result = self._GenerateOne(token)
724 self.HandleError('exception', token)
738 def _GenerateOne(self, token):
739 if token.token_type == tokenize.NAME:
740 if (keywords.IsKeyword(token.name) and
741 not keywords.IsBuiltinType(token.name)):
742 method = getattr(self, 'handle_' + token.name)
744 elif token.name == self.in_class_name_only:
745 # The token name is the same as the class, must be a ctor if
747 # Peek ahead to get the next token to figure out which.
751 return self._GetMethod([token], FUNCTION_CTOR, None, True)
758 temp_tokens.insert(0, token)
806 elif token.token_type == tokenize.SYNTAX:
807 if token.name == '~' and self.in_class:
809 token = self._GetNextToken()
812 if (token.token_type == tokenize.NAME and
813 token.name == self.in_class_name_only):
814 return self._GetMethod([token], FUNCTION_DTOR, None, True)
816 elif token.token_type == tokenize.PREPROCESSOR:
818 # token starts with a #, so remove it and strip whitespace.
819 name = token.name[1:].lstrip()
827 assert name[0] in '<"', token
828 assert name[-1] in '>"', token
831 return Include(token.start, token.end, filename, system)
842 return Define(token.start, token.end, name, value)
862 def _IgnoreUpTo(self, token_type, token):
863 unused_tokens = self._GetTokensUpTo(token_type, token)
868 token = self._GetNextToken()
869 if token.token_type != tokenize.PREPROCESSOR:
872 name = token.name[1:].lstrip()
883 # Assumes the current token is open_paren and we will consume
886 token = GetNextToken()
888 if token.token_type == tokenize.SYNTAX:
889 if token.name == open_paren:
891 elif token.name == close_paren:
895 yield token
896 token = GetNextToken()
897 yield token
910 def _AddBackToken(self, token):
911 if token.whence == tokenize.WHENCE_STREAM:
912 token.whence = tokenize.WHENCE_QUEUE
913 self.token_queue.insert(0, token)
915 assert token.whence == tokenize.WHENCE_QUEUE, token
916 self.token_queue.append(token)
921 for token in tokens:
922 token.whence = tokenize.WHENCE_QUEUE
963 token = self._GetNextToken()
964 assert token.token_type == tokenize.SYNTAX, token
965 if token.name == '<':
967 template_portion = [token]
969 token = self._GetNextToken()
970 assert token.token_type == tokenize.SYNTAX, token
971 assert token.name == '(', token
1007 token = self._GetNextToken()
1008 assert token.name == '(', token
1012 token = self._GetNextToken()
1013 while token.token_type == tokenize.NAME:
1014 modifier_token = token
1015 token = self._GetNextToken()
1021 assert token.name == '(', token
1024 token = self._GetNextToken()
1027 assert token.name == '(', token
1030 token = self._GetNextToken()
1038 self.HandleError('unexpected token', modifier_token)
1040 assert token.token_type == tokenize.SYNTAX, token
1042 if token.name == ':':
1044 while token.name != ';' and token.name != '{':
1045 token = self._GetNextToken()
1049 if token.name == '(':
1059 token = self._GetNextToken()
1060 assert token.token_type == tokenize.SYNTAX, token
1061 assert token.name == ';', token
1078 if token.name == '{':
1083 if token.name == '=':
1084 token = self._GetNextToken()
1086 if token.name == 'default' or token.name == 'delete':
1089 token = self._GetNextToken()
1092 assert token.token_type == tokenize.CONSTANT, token
1093 assert token.name == '0', token
1095 token = self._GetNextToken()
1097 if token.name == '[':
1101 token = self._GetNextToken()
1103 assert token.name == ';', (token, return_type_and_name, parameters)
1154 # Flatten the token sequence for the return type.
1195 name_tokens, token = self.GetName()
1200 if token.token_type == tokenize.SYNTAX and token.name == ';':
1201 return ctor(token.start, token.end, name, None,
1204 if token.token_type == tokenize.NAME and self._handling_typedef:
1205 self._AddBackToken(token)
1206 return ctor(token.start, token.end, name, None,
1212 if token.token_type == tokenize.SYNTAX and token.name == '{':
1214 new_type = ctor(token.start, token.end, name, fields,
1221 token = next
1224 assert token.token_type == tokenize.NAME, token
1225 return self._CreateVariable(token, token.name, name, [], '', None)
1291 token = token2 = self._GetNextToken()
1292 if token.name == 'inline':
1297 assert token.token_type == tokenize.NAME or token.name == '::', token
1299 return_type_and_name.insert(0, token)
1300 if token2 is not token:
1350 token = self._GetNextToken()
1351 if (token.token_type == tokenize.NAME and
1352 keywords.IsKeyword(token.name)):
1354 method = getattr(self, 'handle_' + token.name)
1359 tokens = [token]
1371 indices = token
1423 token = self._GetNextToken()
1424 assert token.token_type == tokenize.SYNTAX, token
1425 assert token.name == '<', token
1428 token = self._GetNextToken()
1429 if token.token_type == tokenize.NAME:
1430 if token.name == 'class':
1432 elif token.name == 'struct':
1434 elif token.name == 'friend':
1436 self._AddBackToken(token)
1461 token = self._GetNextToken()
1462 assert token.token_type == tokenize.NAME, token
1464 if token.name not in ('public', 'protected', 'private'):
1466 # Just put the token back so we can form a name.
1468 self._AddBackToken(token)
1471 token = self._GetNextToken()
1472 if token.name != 'virtual':
1473 self._AddBackToken(token)
1483 token = next_token
1487 return bases, token
1494 token = class_token
1503 name_tokens, token = self.GetName()
1506 if token.token_type == tokenize.SYNTAX:
1507 if token.name == ';':
1512 if token.name in '*&':
1521 modifiers, token.name, None)
1524 tokens = (class_token, token, name_token, next_token)
1527 if token.name == ':':
1528 bases, token = self._GetBases()
1531 if token.token_type == tokenize.SYNTAX and token.name == '{':
1532 assert token.token_type == tokenize.SYNTAX, token
1533 assert token.name == '{', token
1540 token = self._GetNextToken()
1541 if token.token_type != tokenize.NAME:
1542 assert token.token_type == tokenize.SYNTAX, token
1543 assert token.name == ';', token
1551 token.name, new_class,
1552 modifiers, token.name, None)
1555 self.HandleError('non-typedef token', token)
1556 self._AddBackToken(token)
1562 token = self._GetNextToken()
1565 if token.token_type == tokenize.NAME:
1566 name = token.name
1567 token = self._GetNextToken()
1569 assert token.token_type == tokenize.SYNTAX, token
1570 # Create an internal token that denotes when the namespace is complete.
1573 internal_token.whence = token.whence
1574 if token.name == '=':
1580 assert token.name == '{', token
1582 # Replace the trailing } with the internal namespace pop token.
1604 # Pull off the next token(s?) and make that part of the method name.
1617 token = self._GetNextToken()
1618 assert token.token_type == tokenize.SYNTAX
1619 assert token.name == ':'
1681 should_print: predicate with signature: bool Function(token)
1705 should_print: predicate with signature: bool Function(token)