Versions in this module Expand all Collapse all v0 v0.1.4 Jun 1, 2024 Changes in this version type Rule + func (lr *Rule) BaseInterface() reflect.Type 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 PosErr = Pos + var PosZero = Pos + var RegZero = Reg + var RuleType = types.AddType(&types.Type{ ... }) + var Trace = false + func BracePair(r rune) (match rune, right bool) + func BracketIndentLine(src [][]rune, tags []Line, ln int, tabSz int) (pInd, delInd, pLn int, ichr indent.Char) + func DigitValue(ch rune) int + func FirstNonSpaceRune(src []rune) int + func FirstWord(str string) string + func FirstWordApostrophe(str string) string + func FirstWordDigits(str string) string + func HasUpperCase(str string) bool + func InnerBracketScope(str string, brl, brr string) string + func IsDigit(ch rune) bool + func IsLetter(ch rune) bool + func IsLetterOrDigit(ch rune) bool + func IsWhiteSpace(ch rune) bool + func LastField(str string) string + func LastNonSpaceRune(src []rune) int + func LastScopedString(str string) string + func LineIndent(src []rune, tabSz int) (ind int, ichr indent.Char) + func LineStartEndBracket(src []rune, tags Line) (start, end bool) + func MarkupPathsAsLinks(flds []string, maxFlds int) (orig, link []byte) + func MatchCase(src, trg string) string + func OpenFileBytes(fname string) ([]byte, error) + func PrevLineIndent(src [][]rune, tags []Line, ln int, tabSz int) (ind, pln int, ichr indent.Char) + func PrintError(w io.Writer, err error) + func RunesFromBytes(b []byte) [][]rune + func RunesFromString(str string) [][]rune + func TrimLeftToAlpha(nm string) string + type Actions int32 + const ActionsN + const EOL + const Name + const Next + const Number + const PopGuestLex + const PopState + const PushState + const Quoted + const QuotedRaw + const ReadUntil + const SetGuestLex + 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 EosPos []int + func (ep EosPos) FindGt(ch int) int + func (ep EosPos) FindGtEq(ch int) int + type Error struct + Filename string + Msg string + Pos Pos + Rule tree.Node + Src string + func (e Error) Error() string + func (e Error) Report(basepath string, showSrc, showRule bool) string + type ErrorList []*Error + func (p *ErrorList) Add(pos Pos, fname, msg string, srcln string, rule tree.Node) *Error + func (p *ErrorList) RemoveMultiples() + func (p *ErrorList) Reset() + func (p ErrorList) Err() error + func (p ErrorList) Error() string + func (p ErrorList) Len() int + func (p ErrorList) Less(i, j int) bool + func (p ErrorList) Report(maxN int, basepath string, showSrc, showRule bool) string + func (p ErrorList) Sort() + func (p ErrorList) Swap(i, j int) + type File struct + BasePath string + Comments []Line + EosPos []EosPos + Filename string + LastStacks []Stack + Lexs []Line + Lines [][]rune + Sup fileinfo.Known + func (fl *File) AllocLines() + func (fl *File) EnsureFinalEos(ln int) + func (fl *File) InitFromLine(sfl *File, ln int) bool + func (fl *File) InitFromString(str string, fname string, sup fileinfo.Known) bool + func (fl *File) InsertEos(cp Pos) Pos + func (fl *File) IsLexPosValid(pos Pos) bool + func (fl *File) LexAt(cp Pos) *Lex + func (fl *File) LexAtSafe(cp Pos) Lex + func (fl *File) LexLine(ln int) Line + func (fl *File) LexTagSrc() string + func (fl *File) LexTagSrcLn(ln int) string + func (fl *File) LinesDeleted(stln, edln int) + func (fl *File) LinesInserted(stln, nlns int) + func (fl *File) NLines() int + func (fl *File) NTokens(ln int) int + func (fl *File) NextEos(stpos Pos, depth int) (Pos, bool) + func (fl *File) NextEosAnyDepth(stpos Pos) (Pos, bool) + func (fl *File) NextTokenPos(pos Pos) (Pos, bool) + func (fl *File) OpenFile(fname string) error + func (fl *File) PrevDepth(ln int) int + func (fl *File) PrevStack(ln int) Stack + func (fl *File) PrevTokenPos(pos Pos) (Pos, bool) + func (fl *File) RegSrc(reg Reg) string + func (fl *File) ReplaceEos(cp Pos) + func (fl *File) SetBytes(txt []byte) + func (fl *File) SetLine(ln int, lexs, comments Line, stack Stack) + func (fl *File) SetLineSrc(ln int, txt []rune) bool + func (fl *File) SetSrc(src [][]rune, fname, basepath string, sup fileinfo.Known) + func (fl *File) SrcLine(ln int) string + func (fl *File) Token(pos Pos) token.KeyToken + func (fl *File) TokenMapReg(reg Reg) TokenMap + func (fl *File) TokenRegSrc(reg Reg) string + func (fl *File) TokenSrc(pos Pos) []rune + func (fl *File) TokenSrcPos(pos Pos) Reg + func (fl *File) TokenSrcReg(reg Reg) Reg + func (fl *File) ValidTokenPos(pos Pos) (Pos, bool) + type LangLexer interface + LexerByName func(lang string) *Rule + var TheLangLexer LangLexer + type Lex struct + Ed int + St int + Time nptime.Time + Token token.KeyToken + func LastLexIgnoreComment(tags Line) (*Lex, int) + func NewLex(tok token.KeyToken, st, ed int) Lex + func ObjPathAt(line Line, lx *Lex) *Lex + func (lx *Lex) ContainsPos(pos int) bool + func (lx *Lex) Now() + func (lx *Lex) OverlapsReg(or Lex) bool + func (lx *Lex) Region(ln int) Reg + func (lx *Lex) Src(src []rune) []rune + func (lx *Lex) String() string + type Lexer interface + AsLexerRule func() *Rule + Compile func(ls *State) bool + Lex func(ls *State) *Rule + Validate func(ls *State) bool + type Line []Lex + func MergeLines(t1, t2 Line) Line + func RuneFields(src []rune) Line + func (ll *Line) Add(lx Lex) + func (ll *Line) AddLex(tok token.KeyToken, st, ed int) *Lex + func (ll *Line) AddSort(lx Lex) + func (ll *Line) AtPos(pos int) (*Lex, int) + func (ll *Line) Clone() Line + func (ll *Line) DeleteIndex(idx int) + func (ll *Line) DeleteToken(tok token.Tokens) + func (ll *Line) Insert(idx int, lx Lex) + func (ll *Line) NonCodeWords(src []rune) Line + func (ll *Line) RuneStrings(rstr []rune) []string + func (ll *Line) Sort() + func (ll *Line) String() string + func (ll *Line) Strings(src []rune) []string + func (ll *Line) TagSrc(src []rune) string + type MatchPos int32 + const AnyPos + const EndOfLine + const EndOfWord + const MatchPosN + const MiddleOfLine + const MiddleOfWord + const StartOfLine + const StartOfWord + func MatchPosValues() []MatchPos + func (i *MatchPos) SetInt64(in int64) + func (i *MatchPos) SetString(s string) error + func (i *MatchPos) UnmarshalText(text []byte) error + func (i MatchPos) Desc() string + func (i MatchPos) Int64() int64 + func (i MatchPos) MarshalText() ([]byte, error) + func (i MatchPos) String() string + func (i MatchPos) Values() []enums.Enum + type Matches int32 + const AnyRune + const CurState + const Digit + const Letter + const MatchesN + const StrName + const String + const WhiteSpace + func MatchesValues() []Matches + func (i *Matches) SetInt64(in int64) + func (i *Matches) SetString(s string) error + func (i *Matches) UnmarshalText(text []byte) error + func (i Matches) Desc() string + func (i Matches) Int64() int64 + func (i Matches) MarshalText() ([]byte, error) + func (i Matches) String() string + func (i Matches) Values() []enums.Enum + type PassTwo struct + Backslash bool + DoEos bool + Eol bool + EolToks token.KeyTokenList + RBraceEos bool + Semi bool + func (pt *PassTwo) EosDetect(ts *TwoState) + func (pt *PassTwo) EosDetectPos(ts *TwoState, pos Pos, nln int) + func (pt *PassTwo) Error(ts *TwoState, msg string) + func (pt *PassTwo) HasErrs(ts *TwoState) bool + func (pt *PassTwo) MismatchError(ts *TwoState, tok token.Tokens) + func (pt *PassTwo) NestDepth(ts *TwoState) + func (pt *PassTwo) NestDepthLine(line Line, initDepth int) + func (pt *PassTwo) PopNest(ts *TwoState, tok token.Tokens) + func (pt *PassTwo) PushNest(ts *TwoState, tok token.Tokens) + type Pos struct + Ch int + Ln int + func BraceMatch(src [][]rune, tags []Line, r rune, st Pos, maxLns int) (en Pos, found bool) + func (ps *Pos) FromString(link string) bool + func (ps *Pos) IsLess(cmp Pos) bool + func (ps Pos) String() string + type Reg struct + Ed Pos + St Pos + func (tr Reg) Contains(ps Pos) bool + func (tr Reg) IsNil() bool + type Rule struct + Acts []Actions + Desc string + Match Matches + MatchLen int + NameMap bool + NmMap map[string]*Rule + Off bool + Offset int + Pos MatchPos + PushState string + SizeAdj int + String string + Token token.Tokens + Until string + func NewRule(parent tree.Node, name ...string) *Rule + func (lr *Rule) AsLexRule() *Rule + func (lr *Rule) BaseIface() reflect.Type + func (lr *Rule) Compile(ls *State) bool + func (lr *Rule) CompileAll(ls *State) bool + func (lr *Rule) CompileNameMap(ls *State) bool + func (lr *Rule) ComputeMatchLen(ls *State) + func (lr *Rule) DoAct(ls *State, act Actions, tok *token.KeyToken) + func (lr *Rule) Find(find string) []*Rule + func (lr *Rule) IsMatch(ls *State) bool + func (lr *Rule) IsMatchPos(ls *State) bool + func (lr *Rule) Lex(ls *State) *Rule + func (lr *Rule) LexStart(ls *State) *Rule + func (lr *Rule) TargetLen(ls *State) int + func (lr *Rule) Validate(ls *State) bool + func (lr *Rule) WriteGrammar(writer io.Writer, depth int) + func (t *Rule) New() tree.Node + func (t *Rule) NodeType() *types.Type + func (t *Rule) SetActs(v ...Actions) *Rule + func (t *Rule) SetDesc(v string) *Rule + func (t *Rule) SetMatch(v Matches) *Rule + func (t *Rule) SetMatchLen(v int) *Rule + func (t *Rule) SetNameMap(v bool) *Rule + func (t *Rule) SetNmMap(v map[string]*Rule) *Rule + func (t *Rule) SetOff(v bool) *Rule + func (t *Rule) SetOffset(v int) *Rule + func (t *Rule) SetPos(v MatchPos) *Rule + func (t *Rule) SetPushState(v string) *Rule + func (t *Rule) SetSizeAdj(v int) *Rule + func (t *Rule) SetString(v string) *Rule + func (t *Rule) SetToken(v token.Tokens) *Rule + func (t *Rule) SetUntil(v string) *Rule + type Stack []string + func (ss *Stack) Clone() Stack + func (ss *Stack) Pop() string + func (ss *Stack) Push(state string) + func (ss *Stack) Reset() + func (ss *Stack) Top() string + type State struct + Ch rune + Comments Line + Errs ErrorList + Filename string + GuestLex *Rule + KeepWS bool + LastName string + Lex Line + Ln int + Pos int + SaveStack Stack + Src []rune + Stack Stack + Time nptime.Time + func (ls *State) Add(tok token.KeyToken, st, ed int) + func (ls *State) AtEol() bool + func (ls *State) CurRune() bool + func (ls *State) CurState() string + func (ls *State) Error(pos int, msg string, rule *Rule) + func (ls *State) Init() + func (ls *State) LineString() string + func (ls *State) MatchState(st string) bool + func (ls *State) Next(inc int) bool + func (ls *State) NextRune() bool + func (ls *State) NextSrcLine() string + func (ls *State) PopState() string + func (ls *State) PushState(st string) + func (ls *State) ReadEscape(quote rune) bool + func (ls *State) ReadName() + func (ls *State) ReadNameTmp(off int) string + func (ls *State) ReadNumber() token.Tokens + func (ls *State) ReadQuoted() + func (ls *State) ReadUntil(until string) + func (ls *State) Rune(off int) (rune, bool) + func (ls *State) ScanMantissa(base int) + func (ls *State) SetLine(src []rune) + func (ls *State) String(off, sz int) (string, bool) + type TokenMap map[token.Tokens]struct + func (tm TokenMap) Has(tok token.Tokens) bool + func (tm TokenMap) Set(tok token.Tokens) + type TwoState struct + Errs ErrorList + NestStack []token.Tokens + Pos Pos + Src *File + func (ts *TwoState) Error(msg string) + func (ts *TwoState) Init() + func (ts *TwoState) NestStackStr() string + func (ts *TwoState) NextLine() + func (ts *TwoState) SetSrc(src *File)