parser

package
v0.1.16 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 13, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Entry

type Entry struct {
	Comment *string  `parser:"@Comment"`
	Field   *Field   `parser:"| @@"`
	Mapping *Mapping `parser:"| @@"`
}

Entry can either be a comment, field (assignment) or a mapping

type Field

type Field struct {
	Key   string `parser:"@Ident '='"`
	Value *Value `parser:"@@"`
}

Field represents an assigned variable

type Mapping

type Mapping struct {
	Key    string `parser:"( @Ident"`
	Ignore *bool  `parser:" | @Wildcard )"`
	Value  *Value `parser:"'>' @@"`
}

Mapping represents a relationship between the left and right values

type MappingRuleSet

type MappingRuleSet struct {
	Entries []*Entry `parser:"@@*"`
}

MappingRuleSet contains a set of Entries

func UnMarshal

func UnMarshal(filename string, in io.Reader) (*MappingRuleSet, error)

UnMarshal returns a parsed representation of the rules or an error

type Value

type Value struct {
	String   *string  `parser:"@String"`
	List     []*Value `parser:" | '[' ( @@ ( ',' @@ )* )? ']'"`
	Wildcard *bool    `parser:" | @Wildcard"`
}

Value can either be a string or a list of values, or a wildcard

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL