Documentation
¶
Index ¶
- Constants
- func AllSingleRuneTokens() string
- type KeyValBuilder
- func (x *KeyValBuilder) AppendPartToDirectory(token string)
- func (x *KeyValBuilder) AppendToLastDirPart(token string) error
- func (x *KeyValBuilder) AppendToValueStr(token string) error
- func (x *KeyValBuilder) AppendToValueVar(typ keyval.ValueType) error
- func (x *KeyValBuilder) AppendVarToDirectory()
- func (x *KeyValBuilder) Get() keyval.KeyValue
- func (x *KeyValBuilder) SetKeyTuple(tup keyval.Tuple)
- func (x *KeyValBuilder) SetValue(val keyval.Value)
- type TupBuilder
Constants ¶
const ( // Whitespace contains the runes allowed to be // in a whitespace token. Whitespace = "\t " // Newline together with Whitespace contains the // runes allowed to be in a newline token. Newline = "\n\r" )
const ( KeyValSep = '=' DirSep = '/' TupStart = '(' TupSep = ',' TupEnd = ')' VarStart = '<' VarSep = '|' VarEnd = '>' StrMark = '"' StampStart = '#' StampSep = ':' Exclamation = '!' Dollar = '$' Percent = '%' Ampersand = '&' CurlyStart = '{' CurlyEnd = '}' Star = '*' Plus = '+' Semicolon = ';' Question = '?' At = '@' BraceStart = '[' BraceEnd = ']' Caret = '^' Grave = '`' Tilde = '~' )
These are single-rune tokens. When these runes are encountered by the scanner.Scanner, they are usually returned in their own single-rune token string.
const ( // Escape marks the start of an escape token. Escape = '\\' // HexStart marks the start of a hexadecimal number token. HexStart = "0x" // Nil token string. Nil = "nil" // True token string. True = "true" // False token string. False = "false" // Clear token string. Clear = "clear" // MaybeMore token string. MaybeMore = "..." )
Variables ¶
This section is empty.
Functions ¶
func AllSingleRuneTokens ¶
func AllSingleRuneTokens() string
Types ¶
type KeyValBuilder ¶
type KeyValBuilder struct {
// contains filtered or unexported fields
}
KeyValBuilder is used by parser.Parser to construct the resultant key-value. parser.Parser doesn't interact with keyval.KeyValue directly, so these methods outline all the key-value state changes performed by the parser.
func (*KeyValBuilder) AppendPartToDirectory ¶
func (x *KeyValBuilder) AppendPartToDirectory(token string)
AppendPartToDirectory appends a keyval.String to the end of the directory.
func (*KeyValBuilder) AppendToLastDirPart ¶
func (x *KeyValBuilder) AppendToLastDirPart(token string) error
AppendToLastDirPart appends the given string to the last element of the directory, which is assumed to be a keyval.String. If the last element is not a keyval.String then this method panics.
func (*KeyValBuilder) AppendToValueStr ¶
func (x *KeyValBuilder) AppendToValueStr(token string) error
AppendToValueStr appends the given string to the keyval.String assigned as the value. If the value is not a keyval.String then this method panics.
func (*KeyValBuilder) AppendToValueVar ¶
func (x *KeyValBuilder) AppendToValueVar(typ keyval.ValueType) error
AppendToValueVar appends the given keyval.ValueType to the keyval.Variable assigned as the value. If the value is not a keyval.Variable then this method panics.
func (*KeyValBuilder) AppendVarToDirectory ¶
func (x *KeyValBuilder) AppendVarToDirectory()
AppendVarToDirectory appends a keyval.Variable to the end of the directory.
func (*KeyValBuilder) Get ¶
func (x *KeyValBuilder) Get() keyval.KeyValue
Get returns the keyval.KeyValue being constructed.
func (*KeyValBuilder) SetKeyTuple ¶
func (x *KeyValBuilder) SetKeyTuple(tup keyval.Tuple)
SetKeyTuple sets the tuple portion of the keyval.Key.
func (*KeyValBuilder) SetValue ¶
func (x *KeyValBuilder) SetValue(val keyval.Value)
SetValue sets the value portion of the keyval.KeyValue.
type TupBuilder ¶
type TupBuilder struct {
// contains filtered or unexported fields
}
TupBuilder is used by parser.Parser to construct tuples. parser.Parser doesn't interact with keyval.Tuple directly, so these methods outline all the key-value state changes performed by the parser.
func (*TupBuilder) Append ¶
func (x *TupBuilder) Append(e keyval.TupElement)
Append appends the given element to the keyval.Tuple.
func (*TupBuilder) AppendToLastElemStr ¶
func (x *TupBuilder) AppendToLastElemStr(token string) error
AppendToLastElemStr appends the given string to the keyval.String assigned as the last element of the currently constructed tuple. If the last element is not a keyval.String, then this method panics.
func (*TupBuilder) AppendToLastElemVar ¶
func (x *TupBuilder) AppendToLastElemVar(typ keyval.ValueType) error
AppendToLastElemVar appends the given keyval.ValueType to the keyval.Variable assigned as the last element of the currently constructed tuple. If the last element is not a keyval.Variable then this method panics.
func (*TupBuilder) EndTuple ¶
func (x *TupBuilder) EndTuple() bool
EndTuple completes the currently constructed tuple and assigns it as a sub-tuple of the previously constructed tuple. The previously constructed tuple becomes the currently constructed tuple and all subsequent method calls will be applied to it.
func (*TupBuilder) Get ¶
func (x *TupBuilder) Get() keyval.Tuple
Get returns the keyval.Tuple being constructed.
func (*TupBuilder) StartSubTuple ¶
func (x *TupBuilder) StartSubTuple()
StartSubTuple starts a new sub-tuple which will be appended to the currently constructed tuple. This sub-tuple will be treated as the currently constructed tuple and all subsequent method calls will be applied to this sub-tuple. When the sub-tuple is completed, EndTuple can be called and construction of the previous tuple will be resumed.