MCPcopy Index your code
hub / github.com/python/cpython / get_token

Method get_token

Lib/shlex.py:99–129  ·  view source on GitHub ↗

Get a token from the input stream (or from stack if it's nonempty)

(self)

Source from the content-addressed store, hash-verified

97 self.state = ' '
98
99 def get_token(self):
100 "Get a token from the input stream (or from stack if it's nonempty)"
101 if self.pushback:
102 tok = self.pushback.popleft()
103 if self.debug >= 1:
104 print("shlex: popping token " + repr(tok))
105 return tok
106 # No pushback. Get a token.
107 raw = self.read_token()
108 # Handle inclusions
109 if self.source is not None:
110 while raw == self.source:
111 spec = self.sourcehook(self.read_token())
112 if spec:
113 (newfile, newstream) = spec
114 self.push_source(newstream, newfile)
115 raw = self.get_token()
116 # Maybe we got EOF instead?
117 while raw == self.eof:
118 if not self.filestack:
119 return self.eof
120 else:
121 self.pop_source()
122 raw = self.get_token()
123 # Neither inclusion nor EOF
124 if self.debug >= 1:
125 if raw != self.eof:
126 print("shlex: token=" + repr(raw))
127 else:
128 print("shlex: token=EOF")
129 return raw
130
131 def read_token(self):
132 quoted = False

Callers 4

__next__Method · 0.95
_print_tokensFunction · 0.45
oldSplitMethod · 0.45
testTokenTypesMethod · 0.45

Calls 4

read_tokenMethod · 0.95
sourcehookMethod · 0.95
push_sourceMethod · 0.95
pop_sourceMethod · 0.95

Tested by 2

oldSplitMethod · 0.36
testTokenTypesMethod · 0.36