parser

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const EOF = -1
View Source
const EPSILON = -2
View Source
const FIRST = 0
View Source
const PopGrammar = -4
View Source
const PushGrammar = -3

Variables

View Source
var E_Base = &proto.ExtensionDesc{
	ExtendedType:  (*descriptor.FileOptions)(nil),
	ExtensionType: (*Grammar)(nil),
	Field:         50000,
	Name:          "sysl.base",
	Tag:           "bytes,50000,opt,name=base",
	Filename:      "grammar.proto",
}

Functions

func GetTermMinMaxCount

func GetTermMinMaxCount(t *Term) (int, int)

GetTermMinMaxCount returns acceptable min and max counts by looking at term's quantifier

Types

type Atom

type Atom struct {
	Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
	// ("<" NAME ">")? ( string | regexp | "(" NestedBody ")" )
	//
	// Types that are valid to be assigned to Union:
	//	*Atom_String_
	//	*Atom_Regexp
	//	*Atom_Rulename
	//	*Atom_Choices
	Union                isAtom_Union `protobuf_oneof:"union"`
	XXX_NoUnkeyedLiteral struct{}     `json:"-"`
	XXX_unrecognized     []byte       `json:"-"`
	XXX_sizecache        int32        `json:"-"`
}

func (*Atom) Descriptor

func (*Atom) Descriptor() ([]byte, []int)

func (*Atom) GetChoices

func (m *Atom) GetChoices() *Choice

func (*Atom) GetId

func (m *Atom) GetId() int32

func (*Atom) GetRegexp

func (m *Atom) GetRegexp() string

func (*Atom) GetRulename

func (m *Atom) GetRulename() *RuleName

func (*Atom) GetString_

func (m *Atom) GetString_() string

func (*Atom) GetUnion

func (m *Atom) GetUnion() isAtom_Union

func (*Atom) ProtoMessage

func (*Atom) ProtoMessage()

func (*Atom) Reset

func (m *Atom) Reset()

func (*Atom) String

func (m *Atom) String() string

func (*Atom) XXX_DiscardUnknown

func (m *Atom) XXX_DiscardUnknown()

func (*Atom) XXX_Marshal

func (m *Atom) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Atom) XXX_Merge

func (m *Atom) XXX_Merge(src proto.Message)

func (*Atom) XXX_OneofWrappers

func (*Atom) XXX_OneofWrappers() []interface{}

XXX_OneofWrappers is for the internal use of the proto package.

func (*Atom) XXX_Size

func (m *Atom) XXX_Size() int

func (*Atom) XXX_Unmarshal

func (m *Atom) XXX_Unmarshal(b []byte) error

type Atom_Choices

type Atom_Choices struct {
	Choices *Choice `protobuf:"bytes,5,opt,name=choices,proto3,oneof"`
}

type Atom_Regexp

type Atom_Regexp struct {
	Regexp string `protobuf:"bytes,3,opt,name=regexp,proto3,oneof"`
}

type Atom_Rulename

type Atom_Rulename struct {
	Rulename *RuleName `protobuf:"bytes,4,opt,name=rulename,proto3,oneof"`
}

type Atom_String_

type Atom_String_ struct {
	String_ string `protobuf:"bytes,2,opt,name=string,proto3,oneof"`
}

type Choice

type Choice struct {
	// ("<" NAME ">")? Sequence:":"
	Sequence             []*Sequence `protobuf:"bytes,1,rep,name=sequence,proto3" json:"sequence,omitempty"`
	XXX_NoUnkeyedLiteral struct{}    `json:"-"`
	XXX_unrecognized     []byte      `json:"-"`
	XXX_sizecache        int32       `json:"-"`
}

func (*Choice) Descriptor

func (*Choice) Descriptor() ([]byte, []int)

func (*Choice) GetSequence

func (m *Choice) GetSequence() []*Sequence

func (*Choice) ProtoMessage

func (*Choice) ProtoMessage()

func (*Choice) Reset

func (m *Choice) Reset()

func (*Choice) String

func (m *Choice) String() string

func (*Choice) XXX_DiscardUnknown

func (m *Choice) XXX_DiscardUnknown()

func (*Choice) XXX_Marshal

func (m *Choice) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Choice) XXX_Merge

func (m *Choice) XXX_Merge(src proto.Message)

func (*Choice) XXX_Size

func (m *Choice) XXX_Size() int

func (*Choice) XXX_Unmarshal

func (m *Choice) XXX_Unmarshal(b []byte) error

type Flag

type Flag struct {
	// <sign>/[-+]/ <token>NAME
	Sign                 string   `protobuf:"bytes,1,opt,name=sign,proto3" json:"sign,omitempty"`
	Token                string   `protobuf:"bytes,2,opt,name=token,proto3" json:"token,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*Flag) Descriptor

func (*Flag) Descriptor() ([]byte, []int)

func (*Flag) GetSign

func (m *Flag) GetSign() string

func (*Flag) GetToken

func (m *Flag) GetToken() string

func (*Flag) ProtoMessage

func (*Flag) ProtoMessage()

func (*Flag) Reset

func (m *Flag) Reset()

func (*Flag) String

func (m *Flag) String() string

func (*Flag) XXX_DiscardUnknown

func (m *Flag) XXX_DiscardUnknown()

func (*Flag) XXX_Marshal

func (m *Flag) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Flag) XXX_Merge

func (m *Flag) XXX_Merge(src proto.Message)

func (*Flag) XXX_Size

func (m *Flag) XXX_Size() int

func (*Flag) XXX_Unmarshal

func (m *Flag) XXX_Unmarshal(b []byte) error

type Flags

type Flags struct {
	// "[" Flag:"," "]"
	Flag                 []*Flag  `protobuf:"bytes,1,rep,name=flag,proto3" json:"flag,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*Flags) Descriptor

func (*Flags) Descriptor() ([]byte, []int)

func (*Flags) GetFlag

func (m *Flags) GetFlag() []*Flag

func (*Flags) ProtoMessage

func (*Flags) ProtoMessage()

func (*Flags) Reset

func (m *Flags) Reset()

func (*Flags) String

func (m *Flags) String() string

func (*Flags) XXX_DiscardUnknown

func (m *Flags) XXX_DiscardUnknown()

func (*Flags) XXX_Marshal

func (m *Flags) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Flags) XXX_Merge

func (m *Flags) XXX_Merge(src proto.Message)

func (*Flags) XXX_Size

func (m *Flags) XXX_Size() int

func (*Flags) XXX_Unmarshal

func (m *Flags) XXX_Unmarshal(b []byte) error

type Grammar

type Grammar struct {
	// "!grammar" NAME ":" INDENT Rule* OUTDENT
	Name                 string           `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	Flags                *Flags           `protobuf:"bytes,2,opt,name=flags,proto3" json:"flags,omitempty"`
	Rules                map[string]*Rule `` /* 151-byte string literal not displayed */
	Start                string           `protobuf:"bytes,4,opt,name=start,proto3" json:"start,omitempty"`
	XXX_NoUnkeyedLiteral struct{}         `json:"-"`
	XXX_unrecognized     []byte           `json:"-"`
	XXX_sizecache        int32            `json:"-"`
}

func ParseEBNF

func ParseEBNF(ebnfText string, name string, start string) *Grammar

ParseEBNF Parses and build the EBNF grammar

func (*Grammar) Descriptor

func (*Grammar) Descriptor() ([]byte, []int)

func (*Grammar) GetFlags

func (m *Grammar) GetFlags() *Flags

func (*Grammar) GetName

func (m *Grammar) GetName() string

func (*Grammar) GetRules

func (m *Grammar) GetRules() map[string]*Rule

func (*Grammar) GetStart

func (m *Grammar) GetStart() string

func (*Grammar) ProtoMessage

func (*Grammar) ProtoMessage()

func (*Grammar) Reset

func (m *Grammar) Reset()

func (*Grammar) String

func (m *Grammar) String() string

func (*Grammar) XXX_DiscardUnknown

func (m *Grammar) XXX_DiscardUnknown()

func (*Grammar) XXX_Marshal

func (m *Grammar) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Grammar) XXX_Merge

func (m *Grammar) XXX_Merge(src proto.Message)

func (*Grammar) XXX_Size

func (m *Grammar) XXX_Size() int

func (*Grammar) XXX_Unmarshal

func (m *Grammar) XXX_Unmarshal(b []byte) error

type Quantifier

type Quantifier struct {
	//( <opt>"?" | <zero_plus>"*" | <one_plus>"+" | ":" <separator>Atom )*
	//
	// Types that are valid to be assigned to Union:
	//	*Quantifier_Optional
	//	*Quantifier_ZeroPlus
	//	*Quantifier_OnePlus
	//	*Quantifier_Separator
	Union                isQuantifier_Union `protobuf_oneof:"union"`
	XXX_NoUnkeyedLiteral struct{}           `json:"-"`
	XXX_unrecognized     []byte             `json:"-"`
	XXX_sizecache        int32              `json:"-"`
}

func (*Quantifier) Descriptor

func (*Quantifier) Descriptor() ([]byte, []int)

func (*Quantifier) GetOnePlus

func (m *Quantifier) GetOnePlus() *empty.Empty

func (*Quantifier) GetOptional

func (m *Quantifier) GetOptional() *empty.Empty

func (*Quantifier) GetSeparator

func (m *Quantifier) GetSeparator() *Atom

func (*Quantifier) GetUnion

func (m *Quantifier) GetUnion() isQuantifier_Union

func (*Quantifier) GetZeroPlus

func (m *Quantifier) GetZeroPlus() *empty.Empty

func (*Quantifier) ProtoMessage

func (*Quantifier) ProtoMessage()

func (*Quantifier) Reset

func (m *Quantifier) Reset()

func (*Quantifier) String

func (m *Quantifier) String() string

func (*Quantifier) XXX_DiscardUnknown

func (m *Quantifier) XXX_DiscardUnknown()

func (*Quantifier) XXX_Marshal

func (m *Quantifier) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Quantifier) XXX_Merge

func (m *Quantifier) XXX_Merge(src proto.Message)

func (*Quantifier) XXX_OneofWrappers

func (*Quantifier) XXX_OneofWrappers() []interface{}

XXX_OneofWrappers is for the internal use of the proto package.

func (*Quantifier) XXX_Size

func (m *Quantifier) XXX_Size() int

func (*Quantifier) XXX_Unmarshal

func (m *Quantifier) XXX_Unmarshal(b []byte) error

type Quantifier_OnePlus

type Quantifier_OnePlus struct {
	OnePlus *empty.Empty `protobuf:"bytes,3,opt,name=one_plus,json=onePlus,proto3,oneof"`
}

type Quantifier_Optional

type Quantifier_Optional struct {
	Optional *empty.Empty `protobuf:"bytes,1,opt,name=optional,proto3,oneof"`
}

type Quantifier_Separator

type Quantifier_Separator struct {
	Separator *Atom `protobuf:"bytes,4,opt,name=separator,proto3,oneof"`
}

type Quantifier_ZeroPlus

type Quantifier_ZeroPlus struct {
	ZeroPlus *empty.Empty `protobuf:"bytes,2,opt,name=zero_plus,json=zeroPlus,proto3,oneof"`
}

type Rule

type Rule struct {
	// RuleName Flags? ":" INDENT Body OUTDENT
	Name                 *RuleName `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	Choices              *Choice   `protobuf:"bytes,2,opt,name=choices,proto3" json:"choices,omitempty"`
	XXX_NoUnkeyedLiteral struct{}  `json:"-"`
	XXX_unrecognized     []byte    `json:"-"`
	XXX_sizecache        int32     `json:"-"`
}

func (*Rule) Descriptor

func (*Rule) Descriptor() ([]byte, []int)

func (*Rule) GetChoices

func (m *Rule) GetChoices() *Choice

func (*Rule) GetName

func (m *Rule) GetName() *RuleName

func (*Rule) ProtoMessage

func (*Rule) ProtoMessage()

func (*Rule) Reset

func (m *Rule) Reset()

func (*Rule) String

func (m *Rule) String() string

func (*Rule) XXX_DiscardUnknown

func (m *Rule) XXX_DiscardUnknown()

func (*Rule) XXX_Marshal

func (m *Rule) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Rule) XXX_Merge

func (m *Rule) XXX_Merge(src proto.Message)

func (*Rule) XXX_Size

func (m *Rule) XXX_Size() int

func (*Rule) XXX_Unmarshal

func (m *Rule) XXX_Unmarshal(b []byte) error

type RuleName

type RuleName struct {
	// NAME ":" INDENT Body OUTDENT
	Name                 string   `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	Alias                string   `protobuf:"bytes,2,opt,name=alias,proto3" json:"alias,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*RuleName) Descriptor

func (*RuleName) Descriptor() ([]byte, []int)

func (*RuleName) GetAlias

func (m *RuleName) GetAlias() string

func (*RuleName) GetName

func (m *RuleName) GetName() string

func (*RuleName) ProtoMessage

func (*RuleName) ProtoMessage()

func (*RuleName) Reset

func (m *RuleName) Reset()

func (*RuleName) String

func (m *RuleName) String() string

func (*RuleName) XXX_DiscardUnknown

func (m *RuleName) XXX_DiscardUnknown()

func (*RuleName) XXX_Marshal

func (m *RuleName) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*RuleName) XXX_Merge

func (m *RuleName) XXX_Merge(src proto.Message)

func (*RuleName) XXX_Size

func (m *RuleName) XXX_Size() int

func (*RuleName) XXX_Unmarshal

func (m *RuleName) XXX_Unmarshal(b []byte) error

type Sequence

type Sequence struct {
	// Term*:"|"
	Term                 []*Term  `protobuf:"bytes,1,rep,name=term,proto3" json:"term,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*Sequence) Descriptor

func (*Sequence) Descriptor() ([]byte, []int)

func (*Sequence) GetTerm

func (m *Sequence) GetTerm() []*Term

func (*Sequence) ProtoMessage

func (*Sequence) ProtoMessage()

func (*Sequence) Reset

func (m *Sequence) Reset()

func (*Sequence) String

func (m *Sequence) String() string

func (*Sequence) XXX_DiscardUnknown

func (m *Sequence) XXX_DiscardUnknown()

func (*Sequence) XXX_Marshal

func (m *Sequence) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Sequence) XXX_Merge

func (m *Sequence) XXX_Merge(src proto.Message)

func (*Sequence) XXX_Size

func (m *Sequence) XXX_Size() int

func (*Sequence) XXX_Unmarshal

func (m *Sequence) XXX_Unmarshal(b []byte) error

type Term

type Term struct {
	// Atom Quantifier
	Atom                 *Atom       `protobuf:"bytes,1,opt,name=atom,proto3" json:"atom,omitempty"`
	Quantifier           *Quantifier `protobuf:"bytes,2,opt,name=quantifier,proto3" json:"quantifier,omitempty"`
	XXX_NoUnkeyedLiteral struct{}    `json:"-"`
	XXX_unrecognized     []byte      `json:"-"`
	XXX_sizecache        int32       `json:"-"`
}

func (*Term) Descriptor

func (*Term) Descriptor() ([]byte, []int)

func (*Term) GetAtom

func (m *Term) GetAtom() *Atom

func (*Term) GetQuantifier

func (m *Term) GetQuantifier() *Quantifier

func (*Term) ProtoMessage

func (*Term) ProtoMessage()

func (*Term) Reset

func (m *Term) Reset()

func (*Term) String

func (m *Term) String() string

func (*Term) XXX_DiscardUnknown

func (m *Term) XXX_DiscardUnknown()

func (*Term) XXX_Marshal

func (m *Term) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Term) XXX_Merge

func (m *Term) XXX_Merge(src proto.Message)

func (*Term) XXX_Size

func (m *Term) XXX_Size() int

func (*Term) XXX_Unmarshal

func (m *Term) XXX_Unmarshal(b []byte) error

Jump to

Keyboard shortcuts

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