Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func TokenError ¶ added in v0.0.4
TokenError diagnose a error caused with a given token
func TokenErrorf ¶ added in v0.0.4
TokenErrorf diagnose a error caused with a given token with custom error message
func Unmarshal ¶
func Unmarshal(c *caddy.Controller, dest interface{}) error
Unmarshal unmarshaller into dest, which must not be channel
Types ¶
type Args ¶
type Args struct {
// contains filtered or unexported fields
}
Args provides access to positional parameters, this is to be used to consume arguments that predate a block I mean the following; let we have a config
head arg₁ arg₂ … argₙ { … }
Head is used (in case of structs) to choose a field with its type. In case if there are arguments, i.e. n > 0 followed by block (there can be no block, in this case regular []int, []string, etc is enough) the type must implement argumentAccess – this is equivalent for having type Args embedded or being type Args itself. Although it is possible to use Args itself, it will not work well enough. So, use it for embedding into your own types
type ArgumentsCollector ¶ added in v0.0.4
deprecated ArgumentsCollector special interface whose implementations can be used for taking arguments with additional control over the content, e.g. they can keep context to provide valuable error diagnostic. Function AppendArgument will be used to consume positional parameters in a right order and Arguments is to be used to get consumed arguments
type ArgumentsConsumer ¶ added in v0.1.0
type ArgumentsConsumer interface { ConsumeArguments(head Token, args []Token) error Arguments() []string }
ArgumentsConsumer special interface whose implementations allows fine grain control over positional arguments Function ConsumeArguments will be used to consume all positional arguments at once
type Stream ¶
Stream stream of tokens with so called confirmation. It works in the following way:
- Next checks if the previous token read was confirmed. Returns true if it is not – Token will return the
previous token. Looks for the next token and return true if it was found. Otherwise returns false.
- NextArg works like Next but only works for the rest of tokens in the current line
- Token returns token scanned with Next or NextArg
- Confirm confirmes scanned token was consumed
type Token ¶
Token config token. Gives token location (Col is not supported currently)
func UnmarshalHeadInfo ¶ added in v0.0.2
func UnmarshalHeadInfo(c *caddy.Controller, dest interface{}) (Token, error)
UnmarshalHeadInfo returns token with plugin name and unmarshal c into dest