conformance

package
v1.5.49 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2025 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ConfidenceNames = map[Confidence]string{
	ConfidenceUnknown:    "Unknown",
	ConfidenceDefinite:   "Definite",
	ConfidenceImpossible: "Impossible",
	ConfidencePossible:   "Possible",
}
View Source
var ExpressionTypeNames = map[ExpressionType]string{
	ExpressionTypeUnknown:     "unknown",
	ExpressionTypeMandatory:   "mandatory",
	ExpressionTypeOptional:    "optional",
	ExpressionTypeProvisional: "provisional",
	ExpressionTypeDeprecated:  "deprecated",
	ExpressionTypeDisallowed:  "disallowed",
	ExpressionTypeDescribed:   "described",
	ExpressionTypeGeneric:     "generic",
	ExpressionTypeSet:         "set",
}
View Source
var StateNames = map[State]string{
	StateUnknown:     "Unknown",
	StateMandatory:   "Mandatory",
	StateOptional:    "Optional",
	StateProvisional: "Provisional",
	StateDeprecated:  "Deprecated",
	StateDisallowed:  "Disallowed",
}
View Source
var TypeNames = map[Type]string{
	TypeUnknown:     "unknown",
	TypeMandatory:   "mandatory",
	TypeOptional:    "optional",
	TypeProvisional: "provisional",
	TypeDeprecated:  "deprecated",
	TypeDisallowed:  "disallowed",
	TypeDescribed:   "described",
	TypeGeneric:     "generic",
	TypeSet:         "set",
}

Functions

func IsBlank

func IsBlank(conformance Conformance) bool

func IsDeprecated

func IsDeprecated(conformance Conformance) bool

func IsDescribed

func IsDescribed(conformance Conformance) bool

func IsDisallowed

func IsDisallowed(conformance Conformance) bool

func IsGeneric

func IsGeneric(conformance Conformance) bool

func IsMandatory

func IsMandatory(conformance Conformance) bool

func IsProvisional

func IsProvisional(conformance Conformance) bool

func IsRequired

func IsRequired(conformance Conformance) bool

func IsZigbee

func IsZigbee(conformance Conformance) bool

func Parse

func Parse(filename string, b []byte, opts ...Option) (any, error)

Parse parses the data from b using filename as information in the error messages.

func ParseFile

func ParseFile(filename string, opts ...Option) (i any, err error)

ParseFile parses the file identified by filename.

func ParseReader

func ParseReader(filename string, r io.Reader, opts ...Option) (any, error)

ParseReader parses the data from r using filename as information in the error messages.

Types

type BooleanValue

type BooleanValue struct {
	Boolean bool `json:"value"`
	// contains filtered or unexported fields
}

func NewBooleanValue

func NewBooleanValue(value bool, raw string) *BooleanValue

func (BooleanValue) ASCIIDocString

func (bv BooleanValue) ASCIIDocString() string

func (BooleanValue) Clone

func (bv BooleanValue) Clone() ComparisonValue

func (*BooleanValue) Compare

func (bv *BooleanValue) Compare(context Context, other ComparisonValue, op ComparisonOperator) (result ExpressionResult, err error)

func (BooleanValue) Description

func (bv BooleanValue) Description() string

func (*BooleanValue) Equal

func (bv *BooleanValue) Equal(ofv ComparisonValue) bool

func (*BooleanValue) Result

func (bv *BooleanValue) Result() ComparisonValue

func (*BooleanValue) Value

func (bv *BooleanValue) Value(context Context) (ExpressionResult, error)

type Choice

type Choice struct {
	Set   string      `json:"set,omitempty"`
	Limit ChoiceLimit `json:"limit,omitempty"`
}

func (*Choice) ASCIIDocString

func (c *Choice) ASCIIDocString() string

func (*Choice) Clone

func (c *Choice) Clone() *Choice

func (*Choice) Description

func (c *Choice) Description() string

func (*Choice) Equal

func (c *Choice) Equal(oc *Choice) bool

type ChoiceExactLimit

type ChoiceExactLimit struct {
	Limit int64 `json:"limit"`
}

func (*ChoiceExactLimit) ASCIIDocString

func (c *ChoiceExactLimit) ASCIIDocString() string

func (*ChoiceExactLimit) Clone

func (c *ChoiceExactLimit) Clone() ChoiceLimit

func (*ChoiceExactLimit) Description

func (c *ChoiceExactLimit) Description(set string) string

func (*ChoiceExactLimit) Equal

func (c *ChoiceExactLimit) Equal(cl ChoiceLimit) bool

func (*ChoiceExactLimit) MarshalJSON

func (c *ChoiceExactLimit) MarshalJSON() ([]byte, error)

type ChoiceLimit

type ChoiceLimit interface {
	Description(set string) string
	ASCIIDocString() string

	Equal(cl ChoiceLimit) bool
	Clone() ChoiceLimit
}

type ChoiceMaxLimit

type ChoiceMaxLimit struct {
	Max int64 `json:"max"`
}

func (*ChoiceMaxLimit) ASCIIDocString

func (c *ChoiceMaxLimit) ASCIIDocString() string

func (*ChoiceMaxLimit) Clone

func (c *ChoiceMaxLimit) Clone() ChoiceLimit

func (*ChoiceMaxLimit) Description

func (c *ChoiceMaxLimit) Description(set string) string

func (*ChoiceMaxLimit) Equal

func (c *ChoiceMaxLimit) Equal(cl ChoiceLimit) bool

func (*ChoiceMaxLimit) MarshalJSON

func (c *ChoiceMaxLimit) MarshalJSON() ([]byte, error)

type ChoiceMinLimit

type ChoiceMinLimit struct {
	Min int64 `json:"min"`
}

func (*ChoiceMinLimit) ASCIIDocString

func (c *ChoiceMinLimit) ASCIIDocString() string

func (*ChoiceMinLimit) Clone

func (c *ChoiceMinLimit) Clone() ChoiceLimit

func (*ChoiceMinLimit) Description

func (c *ChoiceMinLimit) Description(set string) string

func (*ChoiceMinLimit) Equal

func (c *ChoiceMinLimit) Equal(cl ChoiceLimit) bool

func (*ChoiceMinLimit) MarshalJSON

func (c *ChoiceMinLimit) MarshalJSON() ([]byte, error)

type ChoiceRangeLimit

type ChoiceRangeLimit struct {
	Min int64 `json:"min"`
	Max int64 `json:"max"`
}

func (*ChoiceRangeLimit) ASCIIDocString

func (c *ChoiceRangeLimit) ASCIIDocString() string

func (*ChoiceRangeLimit) Clone

func (c *ChoiceRangeLimit) Clone() ChoiceLimit

func (*ChoiceRangeLimit) Description

func (c *ChoiceRangeLimit) Description(set string) string

func (*ChoiceRangeLimit) Equal

func (c *ChoiceRangeLimit) Equal(cl ChoiceLimit) bool

func (*ChoiceRangeLimit) MarshalJSON

func (c *ChoiceRangeLimit) MarshalJSON() ([]byte, error)

type ComparisonExpression

type ComparisonExpression struct {
	Op    ComparisonOperator
	Left  ComparisonValue
	Right ComparisonValue
}

func (*ComparisonExpression) ASCIIDocString

func (ce *ComparisonExpression) ASCIIDocString() string

func (*ComparisonExpression) Clone

func (ce *ComparisonExpression) Clone() Expression

func (*ComparisonExpression) Description

func (ce *ComparisonExpression) Description() string

func (*ComparisonExpression) Equal

func (ce *ComparisonExpression) Equal(e Expression) bool

func (*ComparisonExpression) Eval

func (ce *ComparisonExpression) Eval(context Context) (ExpressionResult, error)

func (*ComparisonExpression) MarshalJSON

func (ce *ComparisonExpression) MarshalJSON() ([]byte, error)

type ComparisonOperator

type ComparisonOperator uint8
const (
	ComparisonOperatorNone ComparisonOperator = iota
	ComparisonOperatorEqual
	ComparisonOperatorNotEqual
	ComparisonOperatorLessThan
	ComparisonOperatorLessThanOrEqual
	ComparisonOperatorGreaterThan
	ComparisonOperatorGreaterThanOrEqual
)

func (ComparisonOperator) String

func (co ComparisonOperator) String() string

type ComparisonValue

type ComparisonValue interface {
	ASCIIDocString() string
	Description() string

	Compare(context Context, other ComparisonValue, op ComparisonOperator) (ExpressionResult, error)
	Value(context Context) (ExpressionResult, error)
	Equal(e ComparisonValue) bool
	Clone() ComparisonValue
}

type Confidence

type Confidence uint8
const (
	ConfidenceUnknown Confidence = iota
	ConfidencePossible
	ConfidenceDefinite
	ConfidenceImpossible
)

The order here is important; impossible overrides definite, which overrides possible

func (Confidence) String added in v1.5.48

func (c Confidence) String() string

type Conformance

type Conformance interface {
	ASCIIDocString() string
	Description() string

	Type() Type
	Eval(context Context) (ConformanceState, error)
	Equal(oc Conformance) bool
	Clone() Conformance
}

type ConformanceState

type ConformanceState struct {
	State      State
	Confidence Confidence
}

type Context

type Context struct {
	Values            map[string]any
	VisitedReferences map[string]struct{}
}

type Deprecated

type Deprecated struct {
	// contains filtered or unexported fields
}

func (*Deprecated) ASCIIDocString

func (d *Deprecated) ASCIIDocString() string

func (*Deprecated) Clone

func (d *Deprecated) Clone() Conformance

func (*Deprecated) Description

func (d *Deprecated) Description() string

func (*Deprecated) Equal

func (d *Deprecated) Equal(c Conformance) bool

func (*Deprecated) Eval

func (d *Deprecated) Eval(context Context) (ConformanceState, error)

func (*Deprecated) RawText

func (d *Deprecated) RawText() string

func (*Deprecated) Type

func (d *Deprecated) Type() Type

type Described

type Described struct {
}

func (*Described) ASCIIDocString

func (d *Described) ASCIIDocString() string

func (*Described) Clone

func (d *Described) Clone() Conformance

func (*Described) Description

func (d *Described) Description() string

func (*Described) Equal

func (d *Described) Equal(c Conformance) bool

func (*Described) Eval

func (d *Described) Eval(context Context) (ConformanceState, error)

func (*Described) Type

func (d *Described) Type() Type

type Disallowed

type Disallowed struct {
	// contains filtered or unexported fields
}

func (*Disallowed) ASCIIDocString

func (d *Disallowed) ASCIIDocString() string

func (*Disallowed) Clone

func (d *Disallowed) Clone() Conformance

func (*Disallowed) Description

func (d *Disallowed) Description() string

func (*Disallowed) Equal

func (d *Disallowed) Equal(c Conformance) bool

func (*Disallowed) Eval

func (d *Disallowed) Eval(context Context) (ConformanceState, error)

func (*Disallowed) RawText

func (d *Disallowed) RawText() string

func (*Disallowed) Type

func (d *Disallowed) Type() Type

type EqualityExpression

type EqualityExpression struct {
	Not   bool
	Left  Expression
	Right Expression
}

func (*EqualityExpression) ASCIIDocString

func (ee *EqualityExpression) ASCIIDocString() string

func (*EqualityExpression) Clone

func (ee *EqualityExpression) Clone() Expression

func (*EqualityExpression) Description

func (ee *EqualityExpression) Description() string

func (*EqualityExpression) Equal

func (ee *EqualityExpression) Equal(e Expression) bool

func (*EqualityExpression) Eval

func (ee *EqualityExpression) Eval(context Context) (result ExpressionResult, err error)

func (*EqualityExpression) MarshalJSON

func (ee *EqualityExpression) MarshalJSON() ([]byte, error)

type Expression

type Expression interface {
	ASCIIDocString() string
	Description() string

	Eval(context Context) (ExpressionResult, error)
	Equal(e Expression) bool
	Clone() Expression
}

type ExpressionResult

type ExpressionResult interface {
	Confidence() Confidence
	Result() any
	IsTrue() bool
}

type ExpressionType

type ExpressionType uint8
const (
	ExpressionTypeUnknown ExpressionType = iota
	ExpressionTypeMandatory
	ExpressionTypeOptional
	ExpressionTypeProvisional
	ExpressionTypeDeprecated
	ExpressionTypeDisallowed
	ExpressionTypeDescribed
	ExpressionTypeGeneric
	ExpressionTypeSet
)

func (ExpressionType) MarshalJSON

func (et ExpressionType) MarshalJSON() ([]byte, error)

func (ExpressionType) String

func (et ExpressionType) String() string

func (*ExpressionType) UnmarshalJSON

func (et *ExpressionType) UnmarshalJSON(data []byte) error

type FloatValue

type FloatValue struct {
	Float decimal.Decimal `json:"value"`
	// contains filtered or unexported fields
}

func NewFloatValue

func NewFloatValue(d decimal.Decimal, raw string) *FloatValue

func (FloatValue) ASCIIDocString

func (fv FloatValue) ASCIIDocString() string

func (FloatValue) Clone

func (fv FloatValue) Clone() ComparisonValue

func (*FloatValue) Compare

func (fv *FloatValue) Compare(context Context, other ComparisonValue, op ComparisonOperator) (ExpressionResult, error)

func (FloatValue) Description

func (fv FloatValue) Description() string

func (*FloatValue) Equal

func (fv *FloatValue) Equal(ofv ComparisonValue) bool

func (*FloatValue) Value

func (fv *FloatValue) Value(context Context) (ExpressionResult, error)

type Generic

type Generic struct {
	// contains filtered or unexported fields
}

func (*Generic) ASCIIDocString

func (g *Generic) ASCIIDocString() string

func (*Generic) Clone

func (g *Generic) Clone() Conformance

func (*Generic) Description

func (g *Generic) Description() string

func (*Generic) Equal

func (g *Generic) Equal(c Conformance) bool

func (*Generic) Eval

func (g *Generic) Eval(context Context) (ConformanceState, error)

func (*Generic) RawText

func (g *Generic) RawText() string

func (*Generic) Type

func (g *Generic) Type() Type

type HasConformance

type HasConformance interface {
	GetConformance() Set
}

type HasExpression

type HasExpression interface {
	GetExpression() Expression
}

type HexValue

type HexValue struct {
	Hex uint64 `json:"value"`
	// contains filtered or unexported fields
}

func NewHexValue

func NewHexValue(value uint64, raw string) *HexValue

func (HexValue) ASCIIDocString

func (fv HexValue) ASCIIDocString() string

func (HexValue) Clone

func (fv HexValue) Clone() ComparisonValue

func (*HexValue) Compare

func (fv *HexValue) Compare(context Context, other ComparisonValue, op ComparisonOperator) (ExpressionResult, error)

func (HexValue) Description

func (fv HexValue) Description() string

func (*HexValue) Equal

func (fv *HexValue) Equal(ofv ComparisonValue) bool

func (*HexValue) Value

func (fv *HexValue) Value(context Context) (ExpressionResult, error)

type IdentifierExpression

type IdentifierExpression struct {
	ID     string          `json:"id"`
	Not    bool            `json:"not,omitempty"`
	Field  ComparisonValue `json:"field,omitempty"`
	Entity types.Entity    `json:"-"`
}

func (*IdentifierExpression) ASCIIDocString

func (ie *IdentifierExpression) ASCIIDocString() string

func (*IdentifierExpression) Clone

func (ie *IdentifierExpression) Clone() Expression

func (*IdentifierExpression) Description

func (ie *IdentifierExpression) Description() string

func (*IdentifierExpression) Equal

func (ie *IdentifierExpression) Equal(e Expression) bool

func (*IdentifierExpression) Eval

func (ie *IdentifierExpression) Eval(context Context) (ExpressionResult, error)

func (*IdentifierExpression) MarshalJSON

func (ie *IdentifierExpression) MarshalJSON() ([]byte, error)

type IdentifierValue

type IdentifierValue struct {
	ID     string          `json:"id"`
	Field  ComparisonValue `json:"field,omitempty"`
	Entity types.Entity    `json:"-"`
}

func (*IdentifierValue) ASCIIDocString

func (ie *IdentifierValue) ASCIIDocString() string

func (*IdentifierValue) Clone

func (ie *IdentifierValue) Clone() ComparisonValue

func (*IdentifierValue) Compare

func (*IdentifierValue) Description

func (ie *IdentifierValue) Description() string

func (*IdentifierValue) Equal

func (ie *IdentifierValue) Equal(e ComparisonValue) bool

func (*IdentifierValue) Value

func (ie *IdentifierValue) Value(context Context) (ExpressionResult, error)

type IntValue

type IntValue struct {
	Int int64 `json:"value"`
	// contains filtered or unexported fields
}

func NewIntValue

func NewIntValue(value int64, raw string) *IntValue

func (IntValue) ASCIIDocString

func (fv IntValue) ASCIIDocString() string

func (IntValue) Clone

func (fv IntValue) Clone() ComparisonValue

func (*IntValue) Compare

func (fv *IntValue) Compare(context Context, other ComparisonValue, op ComparisonOperator) (ExpressionResult, error)

func (IntValue) Description

func (fv IntValue) Description() string

func (*IntValue) Equal

func (fv *IntValue) Equal(ofv ComparisonValue) bool

func (*IntValue) Value

func (fv *IntValue) Value(context Context) (ExpressionResult, error)

type LogicalExpression

type LogicalExpression struct {
	Operand string
	Left    Expression
	Right   []Expression
	Not     bool
}

func NewLogicalExpression

func NewLogicalExpression(operand string, left Expression, right []any) (*LogicalExpression, error)

func (*LogicalExpression) ASCIIDocString

func (le *LogicalExpression) ASCIIDocString() string

func (*LogicalExpression) Clone

func (le *LogicalExpression) Clone() Expression

func (*LogicalExpression) Description

func (le *LogicalExpression) Description() string

func (*LogicalExpression) Equal

func (le *LogicalExpression) Equal(e Expression) bool

func (*LogicalExpression) Eval

func (le *LogicalExpression) Eval(context Context) (ExpressionResult, error)

func (*LogicalExpression) MarshalJSON

func (le *LogicalExpression) MarshalJSON() ([]byte, error)

type Mandatory

type Mandatory struct {
	Expression Expression `json:"expression,omitempty"`
}

func (*Mandatory) ASCIIDocString

func (m *Mandatory) ASCIIDocString() string

func (*Mandatory) Clone

func (m *Mandatory) Clone() Conformance

func (*Mandatory) Description

func (m *Mandatory) Description() string

func (*Mandatory) Equal

func (m *Mandatory) Equal(c Conformance) bool

func (*Mandatory) Eval

func (o *Mandatory) Eval(context Context) (state ConformanceState, err error)

func (*Mandatory) Type

func (m *Mandatory) Type() Type

type MathOperand

type MathOperand uint8
const (
	MathOperandNone MathOperand = iota
	MathOperandAdd
	MathOperandSubtract
	MathOperandMultiply
	MathOperandDivide
)

func (MathOperand) String

func (mo MathOperand) String() string

type MathOperation

type MathOperation struct {
	Operand MathOperand
	Left    ComparisonValue
	Right   ComparisonValue
}

func (*MathOperation) ASCIIDocString

func (mv *MathOperation) ASCIIDocString() string

func (*MathOperation) Clone

func (mv *MathOperation) Clone() ComparisonValue

func (*MathOperation) Compare

func (*MathOperation) Description

func (mv *MathOperation) Description() string

func (*MathOperation) Equal

func (mv *MathOperation) Equal(e ComparisonValue) bool

func (*MathOperation) Value

func (mv *MathOperation) Value(context Context) (ExpressionResult, error)

type NullValue

type NullValue struct {
	// contains filtered or unexported fields
}

func NewNullValue

func NewNullValue(raw string) *NullValue

func (NullValue) ASCIIDocString

func (fv NullValue) ASCIIDocString() string

func (NullValue) Clone

func (fv NullValue) Clone() ComparisonValue

func (*NullValue) Compare

func (fv *NullValue) Compare(context Context, other ComparisonValue, op ComparisonOperator) (ExpressionResult, error)

func (NullValue) Description

func (fv NullValue) Description() string

func (*NullValue) Equal

func (fv *NullValue) Equal(ofv ComparisonValue) bool

func (NullValue) Value

func (fv NullValue) Value(context Context) (ExpressionResult, error)

type Option

type Option func(*parser) Option

Option is a function that can set an option on the parser. It returns the previous setting as an Option.

func AllowInvalidUTF8

func AllowInvalidUTF8(b bool) Option

AllowInvalidUTF8 creates an Option to allow invalid UTF-8 bytes. Every invalid UTF-8 byte is treated as a utf8.RuneError (U+FFFD) by character class matchers and is matched by the any matcher. The returned matched value, c.text and c.offset are NOT affected.

The default is false.

func Entrypoint

func Entrypoint(ruleName string) Option

Entrypoint creates an Option to set the rule name to use as entrypoint. The rule name must have been specified in the -alternate-entrypoints if generating the parser with the -optimize-grammar flag, otherwise it may have been optimized out. Passing an empty string sets the entrypoint to the first rule in the grammar.

The default is to start parsing at the first rule in the grammar.

func GlobalStore

func GlobalStore(key string, value any) Option

GlobalStore creates an Option to set a key to a certain value in the globalStore.

func MaxExpressions

func MaxExpressions(maxExprCnt uint64) Option

MaxExpressions creates an Option to stop parsing after the provided number of expressions have been parsed, if the value is 0 then the parser will parse for as many steps as needed (possibly an infinite number).

The default for maxExprCnt is 0.

func Recover

func Recover(b bool) Option

Recover creates an Option to set the recover flag to b. When set to true, this causes the parser to recover from panics and convert it to an error. Setting it to false can be useful while debugging to access the full stack trace.

The default is true.

type Optional

type Optional struct {
	Expression Expression `json:"expression,omitempty"`
	Choice     *Choice    `json:"choice,omitempty"`
}

func (*Optional) ASCIIDocString

func (o *Optional) ASCIIDocString() string

func (*Optional) Clone

func (o *Optional) Clone() Conformance

func (*Optional) Description

func (o *Optional) Description() string

func (*Optional) Equal

func (o *Optional) Equal(c Conformance) bool

func (*Optional) Eval

func (o *Optional) Eval(context Context) (state ConformanceState, err error)

func (*Optional) Type

func (o *Optional) Type() Type

type Provisional

type Provisional struct {
}

func (*Provisional) ASCIIDocString

func (p *Provisional) ASCIIDocString() string

func (*Provisional) Clone

func (p *Provisional) Clone() Conformance

func (*Provisional) Description

func (p *Provisional) Description() string

func (*Provisional) Equal

func (p *Provisional) Equal(c Conformance) bool

func (*Provisional) Eval

func (p *Provisional) Eval(context Context) (ConformanceState, error)

func (*Provisional) Type

func (p *Provisional) Type() Type

type ReferenceExpression

type ReferenceExpression struct {
	Reference string          `json:"ref"`
	Field     ComparisonValue `json:"field,omitempty"`
	Label     string          `json:"label,omitempty"`
	Not       bool            `json:"not,omitempty"`
	Entity    types.Entity    `json:"-"`
}

func (*ReferenceExpression) ASCIIDocString

func (re *ReferenceExpression) ASCIIDocString() string

func (*ReferenceExpression) Clone

func (re *ReferenceExpression) Clone() Expression

func (*ReferenceExpression) Description

func (re *ReferenceExpression) Description() string

func (*ReferenceExpression) Equal

func (re *ReferenceExpression) Equal(e Expression) bool

func (*ReferenceExpression) Eval

func (re *ReferenceExpression) Eval(context Context) (ExpressionResult, error)

func (*ReferenceExpression) MarshalJSON

func (re *ReferenceExpression) MarshalJSON() ([]byte, error)

type ReferenceValue

type ReferenceValue struct {
	Reference string          `json:"ref"`
	Field     ComparisonValue `json:"field,omitempty"`
	Label     string          `json:"label,omitempty"`
	Entity    types.Entity    `json:"-"`
}

func (*ReferenceValue) ASCIIDocString

func (re *ReferenceValue) ASCIIDocString() string

func (*ReferenceValue) Clone

func (ie *ReferenceValue) Clone() ComparisonValue

func (*ReferenceValue) Compare

func (*ReferenceValue) Description

func (ie *ReferenceValue) Description() string

func (*ReferenceValue) Equal

func (re *ReferenceValue) Equal(e ComparisonValue) bool

func (*ReferenceValue) Value

func (ie *ReferenceValue) Value(context Context) (ExpressionResult, error)

type Set

type Set []Conformance

func ParseConformance

func ParseConformance(conformance string) Set

func TryParseConformance

func TryParseConformance(conformance string) (Set, error)

func (Set) ASCIIDocString

func (cs Set) ASCIIDocString() string

func (Set) Clone

func (cs Set) Clone() Conformance

func (Set) CloneSet

func (cs Set) CloneSet() Set

func (Set) Description

func (cs Set) Description() string

func (Set) Equal

func (cs Set) Equal(c Conformance) bool

func (Set) Eval

func (cs Set) Eval(context Context) (ConformanceState, error)

func (Set) MarshalJSON

func (cs Set) MarshalJSON() ([]byte, error)

func (Set) Type

func (cs Set) Type() Type

type State

type State uint8
const (
	StateUnknown State = iota
	StateOptional
	StateProvisional
	StateDeprecated
	StateDisallowed
	StateMandatory
)

func (State) String

func (cs State) String() string

type Stats

type Stats struct {
	// ExprCnt counts the number of expressions processed during parsing
	// This value is compared to the maximum number of expressions allowed
	// (set by the MaxExpressions option).
	ExprCnt uint64

	// ChoiceAltCnt is used to count for each ordered choice expression,
	// which alternative is used how may times.
	// These numbers allow to optimize the order of the ordered choice expression
	// to increase the performance of the parser
	//
	// The outer key of ChoiceAltCnt is composed of the name of the rule as well
	// as the line and the column of the ordered choice.
	// The inner key of ChoiceAltCnt is the number (one-based) of the matching alternative.
	// For each alternative the number of matches are counted. If an ordered choice does not
	// match, a special counter is incremented. The name of this counter is set with
	// the parser option Statistics.
	// For an alternative to be included in ChoiceAltCnt, it has to match at least once.
	ChoiceAltCnt map[string]map[string]int
}

Stats stores some statistics, gathered during parsing

type StatusCodeValue

type StatusCodeValue struct {
	StatusCode types.StatusCode `json:"statusCode"`
	// contains filtered or unexported fields
}

func NewStatusCodeValue

func NewStatusCodeValue(statusCode types.StatusCode, raw string) *StatusCodeValue

func (StatusCodeValue) ASCIIDocString

func (scv StatusCodeValue) ASCIIDocString() string

func (StatusCodeValue) Clone

func (scv StatusCodeValue) Clone() ComparisonValue

func (*StatusCodeValue) Compare

func (StatusCodeValue) Description

func (scv StatusCodeValue) Description() string

func (*StatusCodeValue) Equal

func (scv *StatusCodeValue) Equal(ofv ComparisonValue) bool

func (*StatusCodeValue) Value

func (scv *StatusCodeValue) Value(context Context) (ExpressionResult, error)

type Type

type Type uint8
const (
	TypeUnknown Type = iota
	TypeMandatory
	TypeOptional
	TypeProvisional
	TypeDeprecated
	TypeDisallowed
	TypeDescribed
	TypeGeneric
	TypeSet
)

func (Type) MarshalJSON

func (ct Type) MarshalJSON() ([]byte, error)

func (Type) String

func (ct Type) String() string

func (*Type) UnmarshalJSON

func (ct *Type) UnmarshalJSON(data []byte) error

Jump to

Keyboard shortcuts

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