Documentation ¶
Overview ¶
Package dictionary provides the Dictionary interface for abstraction, and a simple stringmap implementation called SimpleDict, used for macro definition and replacement. Dictionary is an abstraction from JAR.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Dictionary ¶
type Dictionary interface { // Replacer takes a string, and expands any %%-prefixed strings registered as macros, with their corresponding values Replacer(string) string }
Dictionary is an interface for macro-expanding structures
type Resolver ¶
type Resolver interface { // Replacer takes a string, and expands any %%-prefixed strings registered as macros, with their corresponding values Replacer(string) string // Resolve is intended to walk the dictionary and replace any dictionary items with static strings Resolve() }
Resolver is an interface for macro-expanded structures that also can replace their own embedded macros with static strings
type SimpleDict ¶
SimpleDict is a string map Dictionary to do simple key-value replacements
func (*SimpleDict) Replacer ¶
func (m *SimpleDict) Replacer(in string) string
Replacer takes a string, and expands any %%-prefixed strings registered as macros, with their corresponding values. Note that shortest-prefixes *may* match first, so for dictionaries of %%VERSION1="one" and %%VERSION12="twelve" you may find cases where %%VERSION12 is expanded to "twelve" or "one2". WONTFIX
func (*SimpleDict) Resolve ¶
func (m *SimpleDict) Resolve()
Resolve walks the dictionary and updates any values that contain macros with static strings.
type SyncDict ¶
type SyncDict struct {
// contains filtered or unexported fields
}
SyncDict is a string map Dictionary to do simple key-value replacements. It is goro-safe for updates, and optimized for read-mostly implementations.