// emit passes an item back to the client.
191156
func (l *lexer) emit(t TokenType) {
	l.tokens <- Token{
		Type: t,
		Text: l.input[l.start:l.pos],
	}
	l.start = l.pos
}
366966
func (l *lexer) emitError(msg string) {
	l.tokens <- Token{
		Type:         ItemError,
		Text:         l.input[l.start:l.pos],
		ErrorMessage: fmt.Sprintf("[lexer:%d:%d] %s", l.line, l.col, msg),
	}
	l.start = l.pos
}
635048
func (l *pageLexer) emit(t ItemType) {
	l.items = append(l.items, Item{t, l.start, l.input[l.start:l.pos]})
	l.start = l.pos
}
873620
func (ln *Listener) Receive() (channel string, payload string, err error) {
	return ln.ReceiveTimeout(0)
}
489298
func publish(pcc *PubControlClient, channel string, item *Item) error {
	export, err := item.Export()
	if err != nil {
		return err
	}
	export["channel"] = channel
	uri := ""
	auth := ""
	pcc.lock.Lock()
	uri = pcc.uri
	auth, err = pcc.generateAuthHeader()
	pcc.lock.Unlock()
	if err != nil {
		return err
	}
	err = pcc.pubCall(pcc, uri, auth, [](map[string]interface{}){export})
	if err != nil {
		return err
	}
	return nil
}
610728
func (l *lexer) emit(t tokenType) {
	val := ""
	if l.pos <= len(l.input) {
		val = l.input[l.start:l.pos]
	}

	tok := token{val, t, Pos{l.line, l.offset}}

	if c := strings.Count(val, "\n"); c > 0 {
		l.line += c
		lpos := strings.LastIndex(val, "\n")
		l.offset = len(val[lpos+1:])
	} else {
		l.offset += len(val)
	}

	l.tokens <- tok
	l.start = l.pos
	if tok.tokenType == tokenEOF {
		close(l.tokens)
		l.mode = modeClosed
	}
}
572392
func (b *BuildSource) Emit(args *[]string) ([]byte, error) {
	b.g.PrintHeader("jwg", args)

	for _, st := range b.Structs {
		err := st.emit(b.g)
		if err != nil {
			return nil, err
		}
	}

	return b.g.Format()
}
113307
func emitToBackend(emitPeriod *time.Duration) {
	ticker := time.NewTicker(*emitPeriod)
	defer ticker.Stop()
	for range ticker.C {
		backend, ok := pushBackends[*statsBackend]
		if !ok {
			log.Errorf("No PushBackend registered with name %s", *statsBackend)
			return
		}
		err := backend.PushAll()
		if err != nil {
			// TODO(aaijazi): This might cause log spam...
			log.Warningf("Pushing stats to backend %v failed: %v", *statsBackend, err)
		}
	}
}
866713
func (l *Lexer) emit(kind TokenKind) {
	l.produce(kind, l.input[l.start:l.pos])
}
283663
func EmitKey(key []string, val float32) {
	normalizeKeys(key)

	GetMetrics().EmitKey(key, val)
}
1123096
func (conn *DBusFakeConnection) EmitSignal(name, path, iface, signal string, args ...interface{}) {
	sig := &godbus.Signal{
		Sender: name,
		Path:   godbus.ObjectPath(path),
		Name:   iface + "." + signal,
		Body:   args,
	}
	for _, ch := range conn.signalHandlers {
		ch <- sig
	}
}
188116
func (l *Forwarder) EmitAuditEvent(event Event, fields EventFields) error {
	err := UpdateEventFields(event, fields, l.Clock, l.UID)
	if err != nil {
		return trace.Wrap(err)
	}
	data, err := json.Marshal(fields)
	if err != nil {
		return trace.Wrap(err)
	}
	chunks := []*SessionChunk{
		{
			EventType: event.Name,
			Data:      data,
			Time:      time.Now().UTC().UnixNano(),
		},
	}
	return l.PostSessionSlice(SessionSlice{
		Namespace: l.Namespace,
		SessionID: string(l.SessionID),
		Version:   V3,
		Chunks:    chunks,
	})
}
984694
func (sf *AuxFormatter) Emit(id string, aux interface{}) error {
	auxJSONBytes, err := json.Marshal(aux)
	if err != nil {
		return err
	}
	auxJSON := new(json.RawMessage)
	*auxJSON = auxJSONBytes
	msgJSON, err := json.Marshal(&jsonmessage.JSONMessage{ID: id, Aux: auxJSON})
	if err != nil {
		return err
	}
	msgJSON = appendNewline(msgJSON)
	n, err := sf.Writer.Write(msgJSON)
	if n != len(msgJSON) {
		return io.ErrShortWrite
	}
	return err
}
1237710
func (l *lexer) emit(t itemType) {
	l.items <- item{t, l.start, l.input[l.start:l.pos], l.line, l.depth}
	// Some items contain text internally. If so, count their newlines.
	switch t {
	// case itemText, itemRawString, itemLeftDelim, itemRightDelim:
	case itemText:
		l.line += strings.Count(l.input[l.start:l.pos], "\n")
	}
	l.start = l.pos
}
1260062
func (c *Client) Send(t int, data []byte) (err error) {
	return c.Conn.WriteMessage(t, data)
}
1056668
func emitCDATA(w io.Writer, s []byte) error {
	if len(s) == 0 {
		return nil
	}
	if _, err := w.Write(cdataStart); err != nil {
		return err
	}
	for {
		i := bytes.Index(s, cdataEnd)
		if i >= 0 && i+len(cdataEnd) <= len(s) {
			// Found a nested CDATA directive end.
			if _, err := w.Write(s[:i]); err != nil {
				return err
			}
			if _, err := w.Write(cdataEscape); err != nil {
				return err
			}
			i += len(cdataEnd)
		} else {
			if _, err := w.Write(s); err != nil {
				return err
			}
			break
		}
		s = s[i:]
	}
	if _, err := w.Write(cdataEnd); err != nil {
		return err
	}
	return nil
}
1030662
func (c *Client) Publish(channel, message string) error {
	_, err := c.execWithKey(true, "PUBLISH", channel, message)
	return err
}