Returns ([tokens], next_token_info).
(self, seq=None)
| 925 | self.token_queue.extend(reversed(tokens)) |
| 926 | |
| 927 | def GetName(self, seq=None): |
| 928 | """Returns ([tokens], next_token_info).""" |
| 929 | GetNextToken = self._GetNextToken |
| 930 | if seq is not None: |
| 931 | it = iter(seq) |
| 932 | GetNextToken = lambda: next(it) |
| 933 | next_token = GetNextToken() |
| 934 | tokens = [] |
| 935 | last_token_was_name = False |
| 936 | while (next_token.token_type == tokenize.NAME or |
| 937 | (next_token.token_type == tokenize.SYNTAX and |
| 938 | next_token.name in ('::', '<'))): |
| 939 | # Two NAMEs in a row means the identifier should terminate. |
| 940 | # It's probably some sort of variable declaration. |
| 941 | if last_token_was_name and next_token.token_type == tokenize.NAME: |
| 942 | break |
| 943 | last_token_was_name = next_token.token_type == tokenize.NAME |
| 944 | tokens.append(next_token) |
| 945 | # Handle templated names. |
| 946 | if next_token.name == '<': |
| 947 | tokens.extend(self._GetMatchingChar('<', '>', GetNextToken)) |
| 948 | last_token_was_name = True |
| 949 | next_token = GetNextToken() |
| 950 | return tokens, next_token |
| 951 | |
| 952 | def GetMethod(self, modifiers, templated_types): |
| 953 | return_type_and_name = self._GetTokensUpTo(tokenize.SYNTAX, '(') |
no test coverage detected