Documentation ¶
Index ¶
- func LinkTokens(token *Token)
- func PrintASTNode(node *ASTNode, level int) int
- func PrintASTTree(node interface{}, level int) int
- func PrintL2ParseTree(token *L2Token, level int) int
- func PrintParseTree(token *Token, grammar *set.BitGrammar, level int)
- type ASTNode
- type ASTProperty
- type BaseToken
- type CompilerError
- type L2Token
- type Outcome
- type OutcomeMixin
- type Parser
- type ParserError
- type ParserGenerator
- type ParserMap
- type ParserPlugin
- type ParserPluginMixin
- type Position
- type Prefix
- type PrefixSet
- type State
- type StringContext
- type StringParserPlugin
- type StringState
- func (s *StringState) Advance(n int) bool
- func (s *StringState) Copy() State
- func (s *StringState) CreateToken(tokenId uint, from int, to int, ignore bool) (*Token, bool)
- func (s *StringState) GetPosition(position int) Position
- func (s *StringState) HasPrefix(prefix []byte) bool
- func (s *StringState) Initialize(code []byte, tokenIds *set.BitGrammar)
- func (s *StringState) PushASTNode(node *ASTNode, state State) error
- func (s *StringState) PushASTProperty(node *ASTProperty, state State) error
- func (s *StringState) Value() []byte
- func (s *StringState) ValueN(n int) []byte
- type Token
- type TokenContext
- type TokenParserPlugin
- type TokenState
- func (self *TokenState) Advance(token *Token)
- func (self *TokenState) Copy() State
- func (s *TokenState) CreateToken(_type string, from *Token, to *Token) *L2Token
- func (self *TokenState) Get(tokenId uint, leavesOnly bool) *Token
- func (s *TokenState) Initialize(token *Token, stringState *StringState)
- func (s *TokenState) PushASTNode(node *ASTNode, oldState State) error
- func (s *TokenState) PushASTProperty(property *ASTProperty, oldState State) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LinkTokens ¶
func LinkTokens(token *Token)
func PrintASTNode ¶
func PrintASTTree ¶
func PrintL2ParseTree ¶
func PrintParseTree ¶
func PrintParseTree(token *Token, grammar *set.BitGrammar, level int)
Types ¶
type ASTNode ¶
func (*ASTNode) Initialize ¶
type ASTProperty ¶
type CompilerError ¶
type CompilerError struct {
// contains filtered or unexported fields
}
func (*CompilerError) Error ¶
func (e *CompilerError) Error() string
type L2Token ¶
type OutcomeMixin ¶
func (*OutcomeMixin) Initialize ¶
func (om *OutcomeMixin) Initialize(N uint, M uint)
type ParserError ¶
type ParserError struct {
// contains filtered or unexported fields
}
func (*ParserError) Error ¶
func (e *ParserError) Error() string
type ParserGenerator ¶
type ParserGenerator struct {
// contains filtered or unexported fields
}
func (*ParserGenerator) Compile ¶
func (pg *ParserGenerator) Compile(grammar map[string]interface{}) (Parser, error)
func (*ParserGenerator) GetFingerprint ¶
func (pg *ParserGenerator) GetFingerprint(rule interface{}) string
func (*ParserGenerator) SetPlugin ¶
func (pg *ParserGenerator) SetPlugin(plugin ParserPlugin)
type ParserPlugin ¶
type ParserPlugin interface { PrepareGrammar(grammar map[string]interface{}) SetGenerator(generator *ParserGenerator) // contains filtered or unexported methods }
type ParserPluginMixin ¶
type ParserPluginMixin struct { RulePrefixes map[string]interface{} // contains filtered or unexported fields }
func (*ParserPluginMixin) Initialize ¶
func (pg *ParserPluginMixin) Initialize()
func (*ParserPluginMixin) SetGenerator ¶
func (pg *ParserPluginMixin) SetGenerator(generator *ParserGenerator)
type StringContext ¶
type StringContext struct { TokenNumber uint TokenIds *set.BitGrammar TokenId uint Errors uint Calls uint S []byte CurrentRow int LineBreaks []int NumberOfLines int }
func (*StringContext) Initialize ¶
func (s *StringContext) Initialize(N uint, tokenIds *set.BitGrammar)
type StringParserPlugin ¶
type StringParserPlugin struct { ParserPluginMixin PrefixGrammar *set.BitGrammar //contains all possible prefixes PrefixList [][]byte PrefixIds []uint TokenIds *set.BitGrammar PrefixTree *Prefix MaxPrefixLength int }
func (*StringParserPlugin) Initialize ¶
func (pg *StringParserPlugin) Initialize()
func (*StringParserPlugin) PrepareGrammar ¶
func (pg *StringParserPlugin) PrepareGrammar(grammar map[string]interface{})
type StringState ¶
type StringState struct { Pos int N int Level int Debug bool CurrentPrefixSet *PrefixSet Indents [][]byte Context *StringContext }
func (*StringState) Advance ¶
func (s *StringState) Advance(n int) bool
func (*StringState) Copy ¶
func (s *StringState) Copy() State
func (*StringState) CreateToken ¶
func (*StringState) GetPosition ¶
func (s *StringState) GetPosition(position int) Position
func (*StringState) HasPrefix ¶
func (s *StringState) HasPrefix(prefix []byte) bool
func (*StringState) Initialize ¶
func (s *StringState) Initialize(code []byte, tokenIds *set.BitGrammar)
func (*StringState) PushASTNode ¶
func (s *StringState) PushASTNode(node *ASTNode, state State) error
func (*StringState) PushASTProperty ¶
func (s *StringState) PushASTProperty(node *ASTProperty, state State) error
func (*StringState) Value ¶
func (s *StringState) Value() []byte
func (*StringState) ValueN ¶
func (s *StringState) ValueN(n int) []byte
type Token ¶
type TokenContext ¶
type TokenContext struct { Errors uint Calls uint StringState *StringState }
type TokenParserPlugin ¶
type TokenParserPlugin struct { ParserPluginMixin // contains filtered or unexported fields }
func (*TokenParserPlugin) Initialize ¶
func (pg *TokenParserPlugin) Initialize(tokenIds *set.BitGrammar)
func (*TokenParserPlugin) PrepareGrammar ¶
func (pg *TokenParserPlugin) PrepareGrammar(grammar map[string]interface{})
type TokenState ¶
type TokenState struct { CurrentToken *Token Context *TokenContext //The AST stack ASTStack []interface{} Level int Debug bool }
func (*TokenState) Advance ¶
func (self *TokenState) Advance(token *Token)
func (*TokenState) Copy ¶
func (self *TokenState) Copy() State
func (*TokenState) CreateToken ¶
func (s *TokenState) CreateToken(_type string, from *Token, to *Token) *L2Token
func (*TokenState) Initialize ¶
func (s *TokenState) Initialize(token *Token, stringState *StringState)
func (*TokenState) PushASTNode ¶
func (s *TokenState) PushASTNode(node *ASTNode, oldState State) error
func (*TokenState) PushASTProperty ¶
func (s *TokenState) PushASTProperty(property *ASTProperty, oldState State) error
Click to show internal directories.
Click to hide internal directories.