Lines Matching full:position
27 // Enables traversal of a token stream, resetting the position in a token
39 // Must not be called directly at the position directly after insertTokens()
52 // Gets the current position in the token stream, to be used by setPosition().
54 // Note that the value of the position is not meaningful, and specifically
59 // Position, and return the token at that position in the stream.
60 virtual FormatToken *setPosition(unsigned Position) = 0;
62 // Insert the given tokens before the current position.
89 : Tokens(Tokens), Position(-1) {}
92 if (Position >= 0 && isEOF()) {
95 dbgToken(Position);
97 return Tokens[Position];
99 Position = successor(Position);
102 dbgToken(Position);
104 return Tokens[Position];
108 assert(Position <= 0 || Tokens[Position - 1]->isNot(tok::eof));
109 return Position > 0 ? Tokens[Position - 1] : nullptr;
114 return Tokens[Position];
115 int Next = successor(Position);
127 return Position == -1 ? false : Tokens[Position]->is(tok::eof);
131 LLVM_DEBUG(llvm::dbgs() << "Getting Position: " << Position << "\n");
132 assert(Position >= 0);
133 return Position;
137 LLVM_DEBUG(llvm::dbgs() << "Setting Position: " << P << "\n");
138 Position = P;
139 return Tokens[Position];
143 assert(Position != -1);
152 << Position << "\n";
154 Jumps[Tokens.size() - 1] = Position;
155 Position = Next;
158 dbgToken(Position);
160 return Tokens[Position];
163 void reset() { Position = -1; }
176 void dbgToken(int Position, StringRef Indent = "") {
177 FormatToken *Tok = Tokens[Position];
178 llvm::dbgs() << Indent << "[" << Position
184 int Position;
186 // Maps from position a to position b, so that when we reach a, the token
187 // stream continues at position b instead.
239 FormatToken *setPosition(unsigned Position) override {
241 Token = PreviousTokenSource->setPosition(Position);