Documentation
¶
Overview ¶
Package abnf provides basic ABNF operators (RFC 5234, RFC 7405).
Core ABNF rules implementation can be found in github.com/ghettovoice/abnf/pkg/abnf_core, ABNF definition rules are in github.com/ghettovoice/abnf/pkg/abnf_def, code and parser generators are in github.com/ghettovoice/abnf/pkg/abnf_gen.
Index ¶
- Constants
- type Node
- type Nodes
- type Operator
- func Alt(key string, oprts ...Operator) Operator
- func AltFirst(key string, oprts ...Operator) Operator
- func Concat(key string, oprts ...Operator) Operator
- func ConcatAll(key string, oprts ...Operator) Operator
- func Literal(key string, val []byte) Operator
- func LiteralCS(key string, val []byte) Operator
- func Optional(key string, op Operator) Operator
- func Range(key string, low, high []byte) Operator
- func Repeat(key string, min, max uint, op Operator) Operator
- func Repeat0Inf(key string, op Operator) Operator
- func Repeat1Inf(key string, op Operator) Operator
- func RepeatN(key string, n uint, op Operator) Operator
Constants ¶
const (
VERSION = "0.2.0" // package version
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Node ¶
Node represents a single node in a tree generated by Operator.
func (*Node) Compare ¶
Compare compares node values via bytes.Compare. The result will be 0 if n.Value == other.Value, -1 if n.Value < other.Value, and +1 if n.Value > other.Value.
func (*Node) GetNode ¶
GetNode recursively searches a node with the given key starting from itself. Returns found node and true on success, empty node and false on failure.
func (*Node) GetNodes ¶
GetNodes recursively searches all nodes with the given key starting from itself.
type Nodes ¶
type Nodes []*Node
Nodes represents a list of nodes.
func (Nodes) Compare ¶
Compare compares two best nodes. The result will be 0 if a == b, -1 if a < b, and +1 if a > b where a - self best node, b - other best node.
type Operator ¶
Operator represents an ABNF operator.
func Alt ¶
Alt defines a sequence of alternative elements that are separated by a forward slash ("/"). Created operator will return all matched alternatives.
func AltFirst ¶
AltFirst defines a sequence of alternative elements that are separated by a forward slash ("/"). Created operator will return first matched alternative.
func Concat ¶
Concat defines a simple, ordered string of values. Created operator will return the longest alternative.
func ConcatAll ¶
ConcatAll defines a simple, ordered string of values. Created operator will return all alternatives.
func Repeat0Inf ¶
Repeat0Inf defines a specific repetition from 0 to infinity.
func Repeat1Inf ¶
Repeat1Inf defines a specific repetition from 1 to infinity.
Directories
¶
Path | Synopsis |
---|---|
cmd
|
|
pkg
|
|
abnf_core
Package abnf_core implements core ABNF rules defined in [RFC 5234 Appendix B].
|
Package abnf_core implements core ABNF rules defined in [RFC 5234 Appendix B]. |
abnf_def
Package abnf_def implements ABNF grammar rules defined in [RFC 5234] and [RFC 7405].
|
Package abnf_def implements ABNF grammar rules defined in [RFC 5234] and [RFC 7405]. |
abnf_gen
Package abnf_gen implements parser and code generation from ABNF grammar.
|
Package abnf_gen implements parser and code generation from ABNF grammar. |