Versions in this module Expand all Collapse all v0 v0.2.2 Oct 13, 2026 v0.2.1 Oct 11, 2026 Changes in this version type Document + func (d *Document) MaterializedLines() int v0.2.0 Oct 6, 2026 v0.1.0 Sep 26, 2026 Changes in this version + const DefaultDocumentCacheCapacity + var ErrInvalidLineRange = errors.New("textmate: invalid document line range") + var InitialState = newStateStack(nil, 0, 0, 0, false, nil, nil, nil) + type Document struct + func NewDocument(grammar *Grammar, options DocumentOptions) *Document + func (d *Document) InvalidateFrom(index int) error + func (d *Document) Len() int + func (d *Document) Line(index int) (LineResult, bool) + func (d *Document) ReplaceLines(start, end int, replacement []string) error + func (d *Document) SetLines(lines []string) + func (d *Document) StateAt(index int) (*StateStack, bool) + type DocumentOptions struct + CacheCapacity int + TokenizeOptions TokenizeOptions + type Grammar struct + func (g *Grammar) Diagnostics() []oniguruma.Diagnostic + func (g *Grammar) TokenizeLine(line string, prev *StateStack) LineResult + func (g *Grammar) TokenizeLineWithOptions(line string, prev *StateStack, options TokenizeOptions) LineResult + type IncludeString = string + type LineResult struct + RuleStack *StateStack + Stopped bool + StoppedAt int + StoppedReason StopReason + Tokens []Token + type Location struct + Char int + Filename string + Line int + type RawCaptures map[string]*RawRule + func (captures *RawCaptures) UnmarshalJSON(data []byte) error + type RawGrammar struct + FileTypes []string + FirstLineMatch RegExpString + InjectionSelector string + Injections RawInjections + Location *Location + Name string + Patterns []*RawRule + Repository RawRepository + ScopeName string + func ParseRawGrammar(data []byte) (*RawGrammar, error) + type RawInjections map[string]*RawRule + type RawRepository map[string]*RawRule + func (repository *RawRepository) UnmarshalJSON(data []byte) error + type RawRule struct + ApplyEndPatternLast bool + Begin *RegExpString + BeginCaptures RawCaptures + Captures RawCaptures + ContentName *string + End *RegExpString + EndCaptures RawCaptures + Include *IncludeString + Location *Location + Match *RegExpString + Name *string + Patterns []*RawRule + Repository RawRepository + While *RegExpString + WhileCaptures RawCaptures + func (r *RawRule) UnmarshalJSON(data []byte) error + type RegExpString = string + type Registry struct + func NewRegistry(options RegistryOptions) *Registry + func (r *Registry) Dispose() + func (r *Registry) LoadGrammar(scopeName string) (*Grammar, error) + type RegistryOptions struct + GetInjections func(scopeName string) []string + LoadGrammar func(scopeName string) (*RawGrammar, error) + type RuleFactory struct + type ScopeStack struct + func (s *ScopeStack) At(index int) (string, bool) + func (s *ScopeStack) Category() TokenCategory + func (s *ScopeStack) ID() ScopeStackID + func (s *ScopeStack) Len() int + func (s *ScopeStack) Names() []string + func (s *ScopeStack) Range(yield func(string) bool) + type ScopeStackID struct + func (id ScopeStackID) IsZero() bool + type StateStack struct + func (s *StateStack) Equal(other *StateStack) bool + func (s *StateStack) String() string + type StopReason uint8 + const StopReasonLineLimit + const StopReasonNone + const StopReasonTimeLimit + func (r StopReason) String() string + type Token struct + End int + ScopeStack *ScopeStack + Scopes []string + Start int + func (token Token) Category() TokenCategory + type TokenCategory uint8 + const TokenCategoryAttribute + const TokenCategoryBold + const TokenCategoryBuiltin + const TokenCategoryComment + const TokenCategoryDeleted + const TokenCategoryFunction + const TokenCategoryHeading + const TokenCategoryInserted + const TokenCategoryInvalid + const TokenCategoryItalic + const TokenCategoryKeyword + const TokenCategoryNumber + const TokenCategoryOperator + const TokenCategoryPlain + const TokenCategoryPunctuation + const TokenCategoryQuote + const TokenCategoryRegexp + const TokenCategoryString + const TokenCategoryTag + const TokenCategoryType + const TokenCategoryVariable + func ClassifyScopes(scopes []string) TokenCategory + func (category TokenCategory) String() string + type TokenizeOptions struct + MaxLineBytes int + MaxLineRunes int + TimeLimit time.Duration