pop the next token, then peek the gid of the following
544775
def _shift(tokens):
    """"""
    after = tokens.peek(n=1, skip=_is_comment, drop=True)
    tok = tokens._buffer.popleft()
    return tok[0], tok[1], tok[2], after[0]
151065
private void scanTwoDigitSpecial() {

        if (mInput == '=' && (mType == TokenType.COMP || mType == TokenType.EQ || mType == TokenType.N_EQ)) {
            mOutput.append(mInput);
            mPos++;
        } else if (mInput == '/' && (mType == TokenType.SLASH)) {
            mOutput.append(mInput);
            mType = TokenType.DESC_STEP;
            mPos++;
        } else if (mInput == '.' && (mType == TokenType.POINT)) {
            mOutput.append(mInput);
            mType = TokenType.PARENT;
            mPos++;
        } else if (mInput == '<' && mOutput.toString().equals("<")) {
            mOutput.append(mInput);
            mType = TokenType.L_SHIFT;
            mPos++;
        } else if (mInput == '>' && mOutput.toString().equals(">")) {
            mOutput.append(mInput);
            mType = TokenType.R_SHIFT;
            mPos++;
        } else if (mInput == ':' && mType == TokenType.OPEN_BR) {
            // could be start of a comment
            mOutput = new StringBuilder();
            mType = TokenType.COMMENT;
            mCommentCount++;
            mState = State.COMMENT;
            mPos++;
        } else {
            mFinnished = true;
        }
    }
469467
private int peekToken()
        throws IOException
    {
        // By far the most common case:  last token hasn't been consumed,
        // so return already-peeked token.
        if (currentFlaggedToken != Token.EOF) {
            return currentToken;
        }

        int lineno = ts.getLineno();
        int tt = ts.getToken();
        boolean sawEOL = false;

        // process comments and whitespace
        while (tt == Token.EOL || tt == Token.COMMENT) {
            if (tt == Token.EOL) {
                lineno++;
                sawEOL = true;
                tt = ts.getToken();
            } else {
                if (compilerEnv.isRecordingComments()) {
                    String comment = ts.getAndResetCurrentComment();
                    recordComment(lineno, comment);
                    // Comments may contain multiple lines, get the number
                    // of EoLs and increase the lineno
                    lineno += getNumberOfEols(comment);
                    break;
                }tt = ts.getToken();
            }
        }

        currentToken = tt;
        currentFlaggedToken = tt | (sawEOL ? TI_AFTER_EOL : 0);
        return currentToken;  // return unflagged token
    }
186035
def pop_source(self):
        ""
        self.instream.close()
        (self.infile, self.instream, self.lineno) = self.filestack.popleft()
        if self.debug:
            print('shlex: popping to %s, line %d' \
                  % (self.instream, self.lineno))
        self.state = ' '
585038
def peek(self, default=None):
        ''''''
        try:
            result = self.pointer.next()
            # immediately push it back onto the front of the iterable
            self.pointer = itertools.chain([result], self.pointer)
            return result
        except StopIteration:
            # nothing to put back; iterating doesn't change anything past the end
            return default
404169
def peek(self, length):
        
        return self.string[self.pos:self.pos + length]
633367
private void nextSegment() {
        assert(checkDir > 0 && seq == rawSeq && pos != limit);
        // The input text [segmentStart..pos[ passes the FCD check.
        int p = pos;
        int prevCC = 0;
        for(;;) {
            // Fetch the next character's fcd16 value.
            int q = p;
            int c = Character.codePointAt(seq, p);
            p += Character.charCount(c);
            int fcd16 = nfcImpl.getFCD16(c);
            int leadCC = fcd16 >> 8;
            if(leadCC == 0 && q != pos) {
                // FCD boundary before the [q, p[ character.
                limit = segmentLimit = q;
                break;
            }
            if(leadCC != 0 && (prevCC > leadCC || CollationFCD.isFCD16OfTibetanCompositeVowel(fcd16))) {
                // Fails FCD check. Find the next FCD boundary and normalize.
                do {
                    q = p;
                    if(p == rawLimit) { break; }
                    c = Character.codePointAt(seq, p);
                    p += Character.charCount(c);
                } while(nfcImpl.getFCD16(c) > 0xff);
                normalize(pos, q);
                pos = start;
                break;
            }
            prevCC = fcd16 & 0xff;
            if(p == rawLimit || prevCC == 0) {
                // FCD boundary after the last character.
                limit = segmentLimit = p;
                break;
            }
        }
        assert(pos != limit);
        checkDir = 0;
    }
354673
Token next() throws ScanException {
        text = null;
        switch (c) {
            case '\n':
                return EOL;
            case ' ':
            case '\t':
                return whiteSpace();
            case ',':
                nextChar();
                return COMMA;
            case '/':
                nextChar();
                return SLASH;
            case '<':
                nextChar();
                return LESS;
            case '>':
                nextChar();
                return MORE;
            case '=':
                nextChar();
                return EQUALS;
            case '!':
                return pipe();
            case '"':
                return quotedText('"');
            case '\'':
                return quotedText('\'');
            default:
                return name();
        }

    }
177731
def next(self):
        """"""
        self.current_token = next(self.token_stream, None)
        if self.current_token is None:
            self.token_span = self.token_span[1], self.token_span[1]
            raise self.error('Unexpected end of input')
        self.token_span = self.current_token.span
        return self
332138
def peek(self, n):
        
        pos = self._read_pos
        end = pos + n
        return self.raw[pos:end]
249768
public function peek()
    {
        $l = count($this->tokens);
        if ($l == 0) {
            return null;
        } else {
            return $this->tokens[$l - 1];
        }
    }
292804
function slice(toToken) {
    if (has(toToken) && !isLast(toToken)) {
        _tokens = _tokens.slice(0, _tokens.lastIndexOf(toToken) + 1);
    }
}
150166
private int next() throws IOException {
        int c = get();
        if (c == '/') {
            switch (peek()) {
                case '/':
                    for (; ; ) {
                        c = get();
                        if (c <= '\n') {
                            break;
                        }
                    }
                    break;
                case '*':
                    get();
                    while (c != ' ') {
                        switch (get()) {
                            case '*':
                                if (peek() == '/') {
                                    get();
                                    c = ' ';
                                }
                                break;
                            case EOF:
                                error("Unterminated comment.");
                        }
                    }
                    break;
            }
        }
        theY = theX;
        theX = c;
        return c;
    }
777674
def peek(self, default=_marker):
        
        if not hasattr(self, '_peek'):
            try:
                self._peek = next(self._it)
            except StopIteration:
                if default is _marker:
                    raise
                return default
        return self._peek
923545
def collect_tokens_until(self, token_type):
        """"""
        self.next()
        if self.current_token.type == token_type:
            return

        while True:
            yield self.current_token

            self.next()
            if self.current_token.type == token_type:
                return

            if self.current_token.type != 'COMMA':
                raise self.error(f'Expected comma but got '
                                 f'{self.current_token.value!r}')
            self.next()
10455
def look(self):
        """"""
        old_token = next(self)
        result = self.current
        self.push(result)
        self.current = old_token
        return result
169246
function() {
    var captures;
    if (captures = /^([.]{1,3}|&&|\|\||[!<>=?:]=|\*\*|[-+*\/%]=?|[,=?:!~<>&\[\]])([ \t]*)/.exec(this.str)) {
      var op = captures[1];
      this.skip(captures);
      op = alias[op] || op;
      var tok = new Token(op, op);
      tok.space = captures[2];
      this.isURL = false;
      return tok;
    }
  }