Versions in this module Expand all Collapse all v0 v0.1.3 May 5, 2024 v0.1.2 May 1, 2024 v0.1.1 May 1, 2024 v0.1.0 Apr 14, 2024 v0.0.10 Apr 14, 2024 Changes in this version + var AstType = types.AddType(&types.Type{ ... }) + var DepthLimit = 10000 + var GuiActive = false + var RuleMap map[string]*Rule + var RuleType = types.AddType(&types.Type{ ... }) + type Act struct + Act Actions + FromToken token.Tokens + Path string + RunIndex int + Token token.Tokens + func (ac *Act) ChangeToken(lx *lexer.Lex) + func (ac Act) String() string + type Actions int32 + const ActionsN + const AddDetail + const AddSymbol + const AddType + const ChangeToken + const PopScope + const PopScopeReg + const PopStack + const PushNewScope + const PushScope + const PushStack + func ActionsValues() []Actions + func (i *Actions) SetInt64(in int64) + func (i *Actions) SetString(s string) error + func (i *Actions) UnmarshalText(text []byte) error + func (i Actions) Desc() string + func (i Actions) Int64() int64 + func (i Actions) MarshalText() ([]byte, error) + func (i Actions) String() string + func (i Actions) Values() []enums.Enum + type Acts []Act + func (ac Acts) String() string + type Ast struct + Src string + SrcReg lexer.Reg + Syms syms.SymStack + TokReg lexer.Reg + func NewAst(parent tree.Node, name ...string) *Ast + func (ast *Ast) ChildAst(idx int) *Ast + func (ast *Ast) Destroy() + func (ast *Ast) NextAst() *Ast + func (ast *Ast) NextSiblingAst() *Ast + func (ast *Ast) ParentAst() *Ast + func (ast *Ast) PrevAst() *Ast + func (ast *Ast) SetTokReg(reg lexer.Reg, src *lexer.File) + func (ast *Ast) SetTokRegEnd(pos lexer.Pos, src *lexer.File) + func (ast *Ast) WriteTree(out io.Writer, depth int) + func (t *Ast) New() tree.Node + func (t *Ast) NodeType() *types.Type + type AstActs int32 + const AddAst + const AnchorAst + const AnchorFirstAst + const AstActsN + const NoAst + const SubAst + func AstActsValues() []AstActs + func (i *AstActs) SetInt64(in int64) + func (i *AstActs) SetString(s string) error + func (i *AstActs) UnmarshalText(text []byte) error + func (i AstActs) Desc() string + func (i AstActs) Int64() int64 + func (i AstActs) MarshalText() ([]byte, error) + func (i AstActs) String() string + func (i AstActs) Values() []enums.Enum + type MatchStack []MatchState + func (rs *MatchStack) Add(pr *Rule, scope lexer.Reg, regs Matches) + func (rs *MatchStack) Find(pr *Rule, scope lexer.Reg) (*MatchState, bool) + type MatchState struct + Regs Matches + Rule *Rule + Scope lexer.Reg + func (rs MatchState) String() string + type Matches []lexer.Reg + func (mm Matches) StartEnd() lexer.Reg + func (mm Matches) StartEndExcl(ps *State) lexer.Reg + type Parser interface + AsParseRule func() *Rule + Compile func(ps *State) bool + Parse func(ps *State, parent *Rule, ast *Ast, scope lexer.Reg, optMap lexer.TokenMap, ...) *Rule + Validate func(ps *State) bool + type Rule struct + Acts Acts + Ast AstActs + Desc string + ExclFwd RuleList + ExclKeyIndex int + ExclRev RuleList + FiTokenElseIndex int + FiTokenMap map[string]*Rule + FirstTokenMap bool + Off bool + OptTokenMap bool + Order []int + Rule string + Rules RuleList + StackMatch string + func NewRule(parent tree.Node, name ...string) *Rule + func (pr *Rule) AsParseRule() *Rule + func (pr *Rule) BaseIface() reflect.Type + func (pr *Rule) Compile(ps *State) bool + func (pr *Rule) CompileAll(ps *State) bool + func (pr *Rule) CompileExcl(ps *State, rs []string, rist int) bool + func (pr *Rule) CompileTokMap(ps *State) bool + func (pr *Rule) DoAct(ps *State, act *Act, parent *Rule, ourAst, parAst *Ast) bool + func (pr *Rule) DoActs(ps *State, ri int, parent *Rule, ourAst, parentAst *Ast) bool + func (pr *Rule) DoRules(ps *State, parent *Rule, parentAst *Ast, scope lexer.Reg, mpos Matches, ...) bool + func (pr *Rule) DoRulesRevBinExp(ps *State, parent *Rule, parentAst *Ast, scope lexer.Reg, mpos Matches, ...) bool + func (pr *Rule) Find(find string) []*Rule + func (pr *Rule) IsGroup() bool + func (pr *Rule) Match(ps *State, parAst *Ast, scope lexer.Reg, depth int, optMap lexer.TokenMap) (bool, lexer.Reg, Matches) + func (pr *Rule) MatchExclude(ps *State, scope lexer.Reg, ktpos lexer.Reg, depth int, optMap lexer.TokenMap) bool + func (pr *Rule) MatchGroup(ps *State, parAst *Ast, scope lexer.Reg, depth int, optMap lexer.TokenMap) (bool, lexer.Reg, Matches) + func (pr *Rule) MatchMixed(ps *State, parAst *Ast, scope lexer.Reg, depth int, optMap lexer.TokenMap) (bool, Matches) + func (pr *Rule) MatchNoToks(ps *State, parAst *Ast, scope lexer.Reg, depth int, optMap lexer.TokenMap) (bool, Matches) + func (pr *Rule) MatchOnlyToks(ps *State, parAst *Ast, scope lexer.Reg, depth int, optMap lexer.TokenMap) (bool, Matches) + func (pr *Rule) MatchToken(ps *State, rr *RuleEl, ri int, kt token.KeyToken, creg *lexer.Reg, ...) (bool, lexer.Pos) + func (pr *Rule) OptimizeOrder(ps *State) + func (pr *Rule) Parse(ps *State, parent *Rule, parAst *Ast, scope lexer.Reg, optMap lexer.TokenMap, ...) *Rule + func (pr *Rule) ParseRules(ps *State, parent *Rule, parAst *Ast, scope lexer.Reg, optMap lexer.TokenMap, ...) *Rule + func (pr *Rule) Scope(ps *State, parAst *Ast, scope lexer.Reg) (lexer.Reg, bool) + func (pr *Rule) SetRuleMap(ps *State) + func (pr *Rule) StartParse(ps *State) *Rule + func (pr *Rule) Validate(ps *State) bool + func (pr *Rule) WriteGrammar(writer io.Writer, depth int) + func (t *Rule) New() tree.Node + func (t *Rule) NodeType() *types.Type + func (t *Rule) SetActs(v Acts) *Rule + func (t *Rule) SetAst(v AstActs) *Rule + func (t *Rule) SetDesc(v string) *Rule + func (t *Rule) SetFirstTokenMap(v bool) *Rule + func (t *Rule) SetOff(v bool) *Rule + func (t *Rule) SetOptTokenMap(v bool) *Rule + func (t *Rule) SetOrder(v ...int) *Rule + func (t *Rule) SetRule(v string) *Rule + func (t *Rule) SetRules(v RuleList) *Rule + func (t *Rule) SetStackMatch(v string) *Rule + type RuleEl struct + FromNext bool + Match bool + Opt bool + Rule *Rule + StInc int + Token token.KeyToken + func (re RuleEl) IsRule() bool + func (re RuleEl) IsToken() bool + type RuleFlags tree.Flags + const MatchEOS + const MultiEOS + const NoTokens + const OnlyTokens + const Reverse + const RuleFlagsN + const SetsScope + const TokenMatchGroup + func RuleFlagsValues() []RuleFlags + func (i *RuleFlags) SetFlag(on bool, f ...enums.BitFlag) + func (i *RuleFlags) SetInt64(in int64) + func (i *RuleFlags) SetString(s string) error + func (i *RuleFlags) SetStringOr(s string) error + func (i *RuleFlags) UnmarshalText(text []byte) error + func (i RuleFlags) BitIndexString() string + func (i RuleFlags) Desc() string + func (i RuleFlags) HasFlag(f enums.BitFlag) bool + func (i RuleFlags) Int64() int64 + func (i RuleFlags) MarshalText() ([]byte, error) + func (i RuleFlags) String() string + func (i RuleFlags) Values() []enums.Enum + type RuleList []RuleEl + func (rl RuleList) Last() *RuleEl + type ScopeRule struct + Rule *Rule + Scope lexer.Reg + type ScopeRuleSet map[ScopeRule]struct + func (rs ScopeRuleSet) Add(scope lexer.Reg, pr *Rule) + func (rs ScopeRuleSet) Has(scope lexer.Reg, pr *Rule) bool + type State struct + Ast *Ast + Errs lexer.ErrorList + Matches [][]MatchStack + NonMatches ScopeRuleSet + Pos lexer.Pos + Scopes syms.SymStack + Src *lexer.File + Stack lexer.Stack + Syms syms.SymMap + Trace TraceOptions + func (ps *State) AddAst(parAst *Ast, rule string, reg lexer.Reg) *Ast + func (ps *State) AddMatch(pr *Rule, scope lexer.Reg, regs Matches) + func (ps *State) AddNonMatch(scope lexer.Reg, pr *Rule) + func (ps *State) AllocRules() + func (ps *State) AtEof() bool + func (ps *State) AtEofNext() bool + func (ps *State) ClearAst() + func (ps *State) Destroy() + func (ps *State) Error(pos lexer.Pos, msg string, rule *Rule) + func (ps *State) FindNameScoped(nm string) (*syms.Symbol, bool) + func (ps *State) FindNameTopScope(nm string) (*syms.Symbol, bool) + func (ps *State) FindToken(tkey token.KeyToken, reg lexer.Reg) (lexer.Pos, bool) + func (ps *State) FindTokenReverse(tkey token.KeyToken, reg lexer.Reg) (lexer.Pos, bool) + func (ps *State) GotoEof() + func (ps *State) Init(src *lexer.File, ast *Ast) + func (ps *State) IsMatch(pr *Rule, scope lexer.Reg) (*MatchState, bool) + func (ps *State) IsNonMatch(scope lexer.Reg, pr *Rule) bool + func (ps *State) MatchLex(lx *lexer.Lex, tkey token.KeyToken, isCat, isSubCat bool, cp lexer.Pos) bool + func (ps *State) MatchToken(tkey token.KeyToken, pos lexer.Pos) bool + func (ps *State) NextSrcLine() string + func (ps *State) ResetNonMatches() + func (ps *State) RuleString(full bool) string + type Steps int32 + const Match + const NoMatch + const Run + const RunAct + const StepsN + const SubMatch + func StepsValues() []Steps + func (i *Steps) SetInt64(in int64) + func (i *Steps) SetString(s string) error + func (i *Steps) UnmarshalText(text []byte) error + func (i Steps) Desc() string + func (i Steps) Int64() int64 + func (i Steps) MarshalText() ([]byte, error) + func (i Steps) String() string + func (i Steps) Values() []enums.Enum + type TraceOptions struct + FullStackOut bool + Match bool + NoMatch bool + On bool + OutRead *os.File + OutWrite *os.File + Rules string + RulesList []string + Run bool + RunAct bool + ScopeSrc bool + SubMatch bool + func (pt *TraceOptions) CheckRule(rule string) bool + func (pt *TraceOptions) CopyOpts(ot *TraceOptions) + func (pt *TraceOptions) FullOn() + func (pt *TraceOptions) Init() + func (pt *TraceOptions) Out(ps *State, pr *Rule, step Steps, pos lexer.Pos, scope lexer.Reg, ast *Ast, ...) bool + func (pt *TraceOptions) PipeOut() + func (pt *TraceOptions) Stdout()