Documentation ¶
Index ¶
- Constants
- type Abnf
- type Alternation
- func (this *Alternation) AddConcatenation(concatenation *Concatenation)
- func (this *Alternation) GetConcatenations() *list.List
- func (this *Alternation) GetDependentRuleNames() Set_RuleName
- func (this *Alternation) GetNFA(rules map[string]*Rule) *automata.NFA
- func (this *Alternation) GetNFAStates(startState, acceptingState *automata.NFAState, rules map[string]*Rule)
- func (this *Alternation) String() string
- type BinVal
- type CharVal
- func (this *CharVal) GetDependentRuleNames() Set_RuleName
- func (this *CharVal) GetElementType() ElementType
- func (this *CharVal) GetNFA(rules map[string]*Rule) *automata.NFA
- func (this *CharVal) GetNFAStates(startState, acceptingState *automata.NFAState, rules map[string]*Rule)
- func (this *CharVal) String() string
- type CollisionException
- type Concatenation
- func (this *Concatenation) AddRepetition(repetition *Repetition)
- func (this *Concatenation) GetDependentRuleNames() Set_RuleName
- func (this *Concatenation) GetNFA(rules map[string]*Rule) *automata.NFA
- func (this *Concatenation) GetNFAStates(startState, acceptingState *automata.NFAState, rules map[string]*Rule)
- func (this *Concatenation) GetRepetitions() *list.List
- func (this *Concatenation) String() string
- type DecVal
- type Element
- type ElementType
- type Elements
- func (this *Elements) GetAlternation() *Alternation
- func (this *Elements) GetDependentRuleNames() Set_RuleName
- func (this *Elements) GetNFA(rules map[string]*Rule) *automata.NFA
- func (this *Elements) GetNFAStates(startState, acceptingState *automata.NFAState, rules map[string]*Rule)
- func (this *Elements) String() string
- type Group
- func (this *Group) GetDependentRuleNames() Set_RuleName
- func (this *Group) GetElementType() ElementType
- func (this *Group) GetNFA(rules map[string]*Rule) *automata.NFA
- func (this *Group) GetNFAStates(startState, acceptingState *automata.NFAState, rules map[string]*Rule)
- func (this *Group) String() string
- type HexVal
- type MatchException
- type Matcher
- type NumVal
- func (this *NumVal) AddValue(value string)
- func (this *NumVal) GetDependentRuleNames() Set_RuleName
- func (this *NumVal) GetElementType() ElementType
- func (this *NumVal) GetNFA(rules map[string]*Rule) *automata.NFA
- func (this *NumVal) GetNFAStates(startState, acceptingState *automata.NFAState, rules map[string]*Rule)
- func (this *NumVal) GetValues() *list.List
- func (this *NumVal) String() string
- type Option
- func (this *Option) GetAlternation() *Alternation
- func (this *Option) GetDependentRuleNames() Set_RuleName
- func (this *Option) GetElementType() ElementType
- func (this *Option) GetNFA(rules map[string]*Rule) *automata.NFA
- func (this *Option) GetNFAStates(startState, acceptingState *automata.NFAState, rules map[string]*Rule)
- func (this *Option) String() string
- type Parser
- func (this *Parser) ALPHA() string
- func (this *Parser) AssertMatchExpected(value, expected int)
- func (this *Parser) AssertMatchExpectedIgnoreCase(value int, expected byte)
- func (this *Parser) AssertMatchRange(value, lower, upper int)
- func (this *Parser) BIT() string
- func (this *Parser) CHAR() string
- func (this *Parser) CR() string
- func (this *Parser) CRLF() string
- func (this *Parser) CTL() string
- func (this *Parser) DIGIT() string
- func (this *Parser) DQUOTE() string
- func (this *Parser) HEXDIG() string
- func (this *Parser) HTAB() string
- func (this *Parser) LF() string
- func (this *Parser) LWSP() string
- func (this *Parser) MatchExpected(value, expected int) bool
- func (this *Parser) MatchExpectedChars(value int, expected []int) bool
- func (this *Parser) MatchExpectedIgnoreCase(value int, expected byte) bool
- func (this *Parser) MatchRange(value, lower, upper int) bool
- func (this *Parser) OCTET() string
- func (this *Parser) Parse() (*list.List, error)
- func (this *Parser) SP() string
- func (this *Parser) VCHAR() string
- func (this *Parser) WSP() string
- type Peeker
- type ProseVal
- func (this *ProseVal) GetDependentRuleNames() Set_RuleName
- func (this *ProseVal) GetElementType() ElementType
- func (this *ProseVal) GetNFA(rules map[string]*Rule) *automata.NFA
- func (this *ProseVal) GetNFAStates(startState, acceptingState *automata.NFAState, rules map[string]*Rule)
- func (this *ProseVal) String() string
- type RegularAnalyzer
- type Repeat
- type Repetition
- type Rule
- type RuleName
- func (this *RuleName) GetDependentRuleNames() Set_RuleName
- func (this *RuleName) GetElementType() ElementType
- func (this *RuleName) GetNFA(rules map[string]*Rule) *automata.NFA
- func (this *RuleName) GetNFAStates(startState, acceptingState *automata.NFAState, rules map[string]*Rule)
- func (this *RuleName) String() string
- type Set_RuleName
Constants ¶
const (
PEEKER_EOF = -1
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Alternation ¶
type Alternation struct {
// contains filtered or unexported fields
}
alternation = concatenation
*(*c-wsp "/" *c-wsp concatenation)
func NewAlternation ¶
func NewAlternation() *Alternation
func (*Alternation) AddConcatenation ¶
func (this *Alternation) AddConcatenation(concatenation *Concatenation)
func (*Alternation) GetConcatenations ¶
func (this *Alternation) GetConcatenations() *list.List
func (*Alternation) GetDependentRuleNames ¶
func (this *Alternation) GetDependentRuleNames() Set_RuleName
func (*Alternation) GetNFAStates ¶
func (this *Alternation) GetNFAStates(startState, acceptingState *automata.NFAState, rules map[string]*Rule)
func (*Alternation) String ¶
func (this *Alternation) String() string
type CharVal ¶
type CharVal struct {
// contains filtered or unexported fields
}
func NewCharVal ¶
func (*CharVal) GetDependentRuleNames ¶
func (this *CharVal) GetDependentRuleNames() Set_RuleName
@Override
func (*CharVal) GetElementType ¶
func (this *CharVal) GetElementType() ElementType
type CollisionException ¶
type CollisionException struct {
// contains filtered or unexported fields
}
func NewCollisionException ¶
func NewCollisionException(collision string, pos, line int) *CollisionException
func (*CollisionException) String ¶
func (this *CollisionException) String() string
type Concatenation ¶
type Concatenation struct {
// contains filtered or unexported fields
}
concatenation = repetition *(1*c-wsp repetition)
func NewConcatenation ¶
func NewConcatenation() *Concatenation
func (*Concatenation) AddRepetition ¶
func (this *Concatenation) AddRepetition(repetition *Repetition)
func (*Concatenation) GetDependentRuleNames ¶
func (this *Concatenation) GetDependentRuleNames() Set_RuleName
func (*Concatenation) GetNFA ¶
func (this *Concatenation) GetNFA(rules map[string]*Rule) *automata.NFA
func (*Concatenation) GetNFAStates ¶
func (this *Concatenation) GetNFAStates(startState, acceptingState *automata.NFAState, rules map[string]*Rule)
func (*Concatenation) GetRepetitions ¶
func (this *Concatenation) GetRepetitions() *list.List
func (*Concatenation) String ¶
func (this *Concatenation) String() string
type ElementType ¶
type ElementType int
const ( ELEMENT_RULENAME ElementType = iota ELEMENT_GROUP ELEMENT_OPTION ELEMENT_CHARVAL ELEMENT_NUMVAL ELEMENT_PROSEVAL )
type Elements ¶
type Elements struct {
// contains filtered or unexported fields
}
elements = alternation *c-wsp
func NewElements ¶
func NewElements(alternation *Alternation) *Elements
func (*Elements) GetAlternation ¶
func (this *Elements) GetAlternation() *Alternation
func (*Elements) GetDependentRuleNames ¶
func (this *Elements) GetDependentRuleNames() Set_RuleName
func (*Elements) GetNFAStates ¶
type Group ¶
type Group struct {
// contains filtered or unexported fields
}
func NewGroup ¶
func NewGroup(alternation *Alternation) *Group
func (*Group) GetDependentRuleNames ¶
func (this *Group) GetDependentRuleNames() Set_RuleName
func (*Group) GetElementType ¶
func (this *Group) GetElementType() ElementType
func (*Group) GetNFAStates ¶
type MatchException ¶
type MatchException struct {
// contains filtered or unexported fields
}
func NewMatchException ¶
func NewMatchException(expected string, actual, pos, line int) *MatchException
func (*MatchException) String ¶
func (this *MatchException) String() string
type NumVal ¶
type NumVal struct {
// contains filtered or unexported fields
}
num-val = "%" (bin-val / dec-val / hex-val)
bin-val = "b" 1*BIT
[ 1*("." 1*BIT) / ("-" 1*BIT) ] ; series of concatenated bit values ; or single ONEOF range
dec-val = "d" 1*DIGIT
[ 1*("." 1*DIGIT) / ("-" 1*DIGIT) ]
hex-val = "x" 1*HEXDIG
[ 1*("." 1*HEXDIG) / ("-" 1*HEXDIG) ]
func (*NumVal) GetDependentRuleNames ¶
func (this *NumVal) GetDependentRuleNames() Set_RuleName
func (*NumVal) GetElementType ¶
func (this *NumVal) GetElementType() ElementType
type Option ¶
type Option struct {
// contains filtered or unexported fields
}
func NewOption ¶
func NewOption(alternation *Alternation) *Option
func (*Option) GetAlternation ¶
func (this *Option) GetAlternation() *Alternation
func (*Option) GetDependentRuleNames ¶
func (this *Option) GetDependentRuleNames() Set_RuleName
func (*Option) GetElementType ¶
func (this *Option) GetElementType() ElementType
func (*Option) GetNFAStates ¶
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
ABNF文法解析器
func (*Parser) AssertMatchExpected ¶
如果不匹配则抛出MatchException异常 MatchException中包含了产生匹配异常的符号输入流中的行列位置,以及期待的字符。
func (*Parser) AssertMatchExpectedIgnoreCase ¶
如果不匹配(忽略大小写)则抛出MatchException异常 MatchException中包含了产生匹配异常的符号输入流中的行列位置,以及期待的字符。
func (*Parser) AssertMatchRange ¶
如果字符不在某个范围之内则抛出MatchException异常 MatchException中包含了产生匹配异常的符号输入流中的行列位置,以及期待的字符。
func (*Parser) MatchExpected ¶
match函数用来判断两个字符是否相同 (例如判断输入的字符是否与期望的字符相同)
func (*Parser) MatchExpectedChars ¶
match函数用来判断字符是否与某些字符相同 (例如判断输入的字符是否为'-','+',或'%')
func (*Parser) MatchExpectedIgnoreCase ¶
func (*Parser) MatchRange ¶
match函数用来判断字符是否在某个范围之内 (例如判断输入的字符是否是字母、或数字字符等)
type Peeker ¶
type Peeker struct {
// contains filtered or unexported fields
}
func NewPeeker ¶
*
- The constructor accepts an InputStream to setup the
- object. *
- @param is
- The InputStream to parse.
func (*Peeker) Peek ¶
*
- Peek at a specified depth. *
- @param depth
- The depth to check.
- @return The character peeked at.
- @throws IOException
- If an I/O exception occurs.
func (*Peeker) UpdatePosition ¶
when read LF, set pos = 1 when read CR, line++
type ProseVal ¶
type ProseVal struct {
// contains filtered or unexported fields
}
func NewProseVal ¶
func (*ProseVal) GetDependentRuleNames ¶
func (this *ProseVal) GetDependentRuleNames() Set_RuleName
func (*ProseVal) GetElementType ¶
func (this *ProseVal) GetElementType() ElementType
func (*ProseVal) GetNFAStates ¶
type RegularAnalyzer ¶
type RegularAnalyzer struct {
// contains filtered or unexported fields
}
func NewRegularAnalyzer ¶
func NewRegularAnalyzer(rules *list.List) *RegularAnalyzer
func (*RegularAnalyzer) ContainsAll ¶
func (this *RegularAnalyzer) ContainsAll(definedRuleNames Set_RuleName, dependent Set_RuleName) bool
func (*RegularAnalyzer) GetNonRegularRules ¶
func (this *RegularAnalyzer) GetNonRegularRules() *list.List
func (*RegularAnalyzer) GetRegularRules ¶
func (this *RegularAnalyzer) GetRegularRules() *list.List
func (*RegularAnalyzer) GetUndefinedRules ¶
func (this *RegularAnalyzer) GetUndefinedRules() *list.List
type Repeat ¶
type Repeat struct {
// contains filtered or unexported fields
}
repeat = 1*DIGIT / (*DIGIT "*" *DIGIT)
type Repetition ¶
type Repetition struct {
// contains filtered or unexported fields
}
repetition = [repeat] element
func NewRepetition ¶
func NewRepetition(repeat *Repeat, element Element) *Repetition
func (*Repetition) GetDependentRuleNames ¶
func (this *Repetition) GetDependentRuleNames() Set_RuleName
func (*Repetition) GetNFAStates ¶
func (this *Repetition) GetNFAStates(startState, acceptingState *automata.NFAState, rules map[string]*Rule)
func (*Repetition) String ¶
func (this *Repetition) String() string
type Rule ¶
type Rule struct {
// contains filtered or unexported fields
}
func (*Rule) GetDefinedAs ¶
func (*Rule) GetElements ¶
func (*Rule) GetRuleName ¶
func (*Rule) SetDefinedAs ¶
type RuleName ¶
type RuleName struct {
// contains filtered or unexported fields
}
func NewRuleName ¶
func (*RuleName) GetDependentRuleNames ¶
func (this *RuleName) GetDependentRuleNames() Set_RuleName
func (*RuleName) GetElementType ¶
func (this *RuleName) GetElementType() ElementType