tagscan

package
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 3, 2026 License: BSD-2-Clause Imports: 2 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package tagscan extracts control tags like <dtmf>1</dtmf> from a streamed text response, so a processor can act on the tags and speak the rest. It buffers across chunks, since a tag may span several, and holds back a trailing partial tag until it completes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Scanner

type Scanner struct {
	// contains filtered or unexported fields
}

Scanner extracts <tag>value</tag> control tags for a fixed set of tag names from a stream of text chunks, returning the text with the tags removed.

func New

func New(tags ...string) *Scanner

New builds a Scanner recognizing the given tag names.

func (*Scanner) Feed

func (s *Scanner) Feed(chunk string, onTag func(tag, value string)) string

Feed appends chunk, invokes onTag for each complete tag found (in order), and returns the text safe to emit now: tag content removed, with a trailing partial tag held back until a later Feed or Flush completes it.

func (*Scanner) Flush

func (s *Scanner) Flush() string

Flush returns any held-back text and clears the buffer. Call it at the end of a response, when no more chunks will complete a partial tag.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL