// Consume will consume the current token and move to the next one if it matches
// the provided token, false otherwise.
504823
func (l *LLk) Consume(tt lexer.TokenType) bool {
	if l.tkns[0].Type != tt {
		return false
	}
	l.tkns = l.tkns[1:]
	appendNextToken(l)
	return true
}
626215
func (cons HTTP) Consume(workers *sync.WaitGroup) {
	listen, err := tnet.NewStopListener(cons.address)
	if err != nil {
		cons.Logger.Error(err)
		return // ### return, could not connect ###
	}

	cons.listen = listen
	cons.AddMainWorker(workers)

	go cons.serve()
	defer cons.listen.Close()

	cons.ControlLoop()
}
785742
func (p *parser) next() (*Token, Error) {
	// do we have any previously read tokens?
	_length := len(p._undo)
	if _length > 0 {
		_token := p._undo[_length-1]
		p._undo = p._undo[:_length-1]
		return _token, nil
	}

	// otherwise, attempt to retrieve the next token from the lexer
	return p._lexer.Next()
}
1080918
func (l *Logger) consume() {
	go func() {
		// Process the single next task in sequence until completion,
		// then consume the next task.
		for task := range l.tasks {
			l.logTask(task)
		}
	}()

	defer close(l.tasks)

	pending := make([]Task, 0)

	for {
		// If there is a pending task, "peek" it off of the set of
		// pending tasks.
		var next Task
		if len(pending) > 0 {
			next = pending[0]
		}

		if next == nil {
			// If there was no pending task, wait for either a)
			// l.queue to close, or b) a new task to be submitted.
			task, ok := <-l.queue
			if !ok {
				// If the queue is closed, no more new tasks may
				// be added.
				return
			}

			// Otherwise, add a new task to the set of tasks to
			// process immediately, since there is no current
			// buffer.
			l.tasks <- task
		} else {
			// If there is a pending task, wait for either a) a
			// write to process the task to become non-blocking, or
			// b) a new task to enter the queue.
			select {
			case task, ok := <-l.queue:
				if !ok {
					// If the queue is closed, no more tasks
					// may be added.
					return
				}
				// Otherwise, add the next task to the set of
				// pending, active tasks.
				pending = append(pending, task)
			case l.tasks <- next:
				// Or "pop" the peeked task off of the pending
				// set.
				pending = pending[1:]
			}
		}
	}
}
924410
func (d *Decoder) Skip() error {
	for {
		err := d.currentToken()
		if err != nil {
			return err
		}

		if d.TokenType == StartElement {
			if err := d.Skip(); err != nil {
				return err
			}
		} else if d.TokenType == EndElement {
			return nil
		}
	}
}
1084802
func (cons *Syslogd) Consume(workers *sync.WaitGroup) {
	server := syslog.NewServer()
	server.SetFormat(cons.format)
	server.SetHandler(cons)

	switch cons.protocol {
	case "unix":
		if err := server.ListenUnixgram(cons.address); err != nil {
			if errRemove := os.Remove(cons.address); errRemove != nil {
				cons.Logger.WithError(errRemove).Error("Failed to remove exisiting socket")
			} else {
				cons.Logger.Warning("Found existing socket ", cons.address, ". Removing.")
				err = server.ListenUnixgram(cons.address)
			}

			if err != nil {
				cons.Logger.WithError(err).Error("Failed to open unix://", cons.address)
			}
		}
	case "udp":
		if err := server.ListenUDP(cons.address); err != nil {
			cons.Logger.Error("Failed to open udp://", cons.address)
		}
	case "tcp":
		if err := server.ListenTCP(cons.address); err != nil {
			cons.Logger.Error("Failed to open tcp://", cons.address)
		}
	}

	server.Boot()
	defer server.Kill()

	cons.ControlLoop()
	server.Wait()
}
180148
func (p *Parser) consume(llk *LLk, st *semantic.Statement, s semantic.Symbol) (bool, error) {
	for _, clause := range (*p.grammar)[s] {
		if len(clause.Elements) == 0 {
			return true, nil
		}
		elem := clause.Elements[0]
		if elem.isSymbol {
			return false, fmt.Errorf("Parser.consume: not left factored grammar in %v", clause)
		}
		if llk.CanAccept(elem.Token()) {
			return p.expect(llk, st, s, clause)
		}
	}
	return false, fmt.Errorf("Parser.consume: could not consume token %s in production %s", llk.Current(), s)
}
351854
func (l *Lexer) consumeBracket() TokenType {
	switch l.r.Peek(0) {
	case '(':
		l.r.Move(1)
		return LeftParenthesisToken
	case ')':
		l.r.Move(1)
		return RightParenthesisToken
	case '[':
		l.r.Move(1)
		return LeftBracketToken
	case ']':
		l.r.Move(1)
		return RightBracketToken
	case '{':
		l.r.Move(1)
		return LeftBraceToken
	case '}':
		l.r.Move(1)
		return RightBraceToken
	}
	return ErrorToken
}
1255707
func consumeKeyword(l *lexer, t TokenType) {
	for {
		if r := l.next(); !unicode.IsLetter(r) || r == eof {
			l.backup()
			l.emit(t)
			break
		}
	}
}
422398
func (cip *cachedSelectorPolicy) Consume(owner policy.PolicyOwner, cache cache.IdentityCache) *policy.EndpointPolicy {
	// TODO: This currently computes the EndpointPolicy from SelectorPolicy
	// on-demand, however in future the cip is intended to cache the
	// EndpointPolicy for this Identity and emit datapath deltas instead.
	// Changing this requires shifting IdentityCache management
	// responsibilities from the caller into this package.
	return cip.getPolicy().DistillPolicy(owner, cache)
}
94852
func (p *Peeker) Read() *Token {
	token := p.Peek()

	// As a special case, we will produce the EOF token forever once
	// it is reached.
	if token.Type != EOF {
		p.peeked = nil
	}

	return token
}
852076
func (c *Client) Token() string {
	c.modifyLock.RLock()
	defer c.modifyLock.RUnlock()

	return c.token
}
59071
func (z *TokenBuffer) Shift() *Token {
	if z.pos >= len(z.buf) {
		t := &z.buf[:1][0]
		z.read(t)
		return t
	}
	t := &z.buf[z.pos]
	z.pos++
	return t
}
285373
func (cons *SystemdConsumer) Consume(workers *sync.WaitGroup) {
	cons.AddMainWorker(workers)
	go cons.read()
	cons.ControlLoop()
}
1270606
func (cons *File) Consume(workers *sync.WaitGroup) {
	go tgo.WithRecoverShutdown(func() {
		cons.AddMainWorker(workers)
		cons.observeFiles()
	})

	cons.ControlLoop()
}
698715
func (p *Peeker) Peek() *Token {
	if p.peeked == nil {
		p.peeked = <-p.ch
	}
	return p.peeked
}
124750
func (token *tokenRes) Token() *oauth2.Token {
	if token == nil {
		return nil
	}

	return &oauth2.Token{
		AccessToken: token.AccessToken,
		Expiry:      time.Now().Add(time.Duration(token.ExpiresIn) * time.Second),
	}
}