Documentation ¶
Overview ¶
Package shortcut transforms strings into dotted paths.
Some examples:
"@var.5" "#obj.field" "#`i have some complex name`.field" "@@ starts with a single at sign" "## starts with a single hash mark"
Rules:
- names consist of alpha numeric runes, underscores are transformed into spaces, case is ignored but lowercase is preferred.
- paths are composed of a target and subsequent path parts.
- targets start with either "@" for variables, or "#" for objects followed by a name.
- path parts follow the target, begin with ".", and are either names or numbers.
- as a special case, a name can also be enclosed in backtick or doublequotes. ( usually it will be backtick because these are embedded in json style strings, so the double quotes would have to be escaped in the original
Index ¶
- Constants
- Variables
- func Decoder(dec *decode.Decoder, slot *typeinfo.Slot, body any) (ret typeinfo.Instance, err error)
- func Encoder(enc *encode.Encoder, op typeinfo.Instance) (ret any, err error)
- func NewTokenizer(n Notifier) charm.State
- func ReadDots(str string) (ret rtti.Address, err error)
- func Tokenize(str string, n Notifier) error
- func WriteDots(a rt.Address) (ret string, okay bool)
- type NotShort
- type Notifier
- type Shortcut
- type Type
Constants ¶
View Source
const ( HashMark = '#' AtSign = '@' FieldSeparator = '.' RawQuote = '`' DoubleQuote = '"' Underscore = '_' Eof = charm.Eof Space = ' ' )
Variables ¶
View Source
var KeepShortcuts bool
should ReadDots try to keep the shortcut string ( ex. for debugging )
Functions ¶
func NewTokenizer ¶
Types ¶
type NotShort ¶
type NotShort int
this isnt a shortcut string the value of the error is 0 for normal strings or 1 if there is a double at or double hash ( so you can slice with this error code ]
Click to show internal directories.
Click to hide internal directories.