language

package
v0.0.0-...-586e974 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 24, 2019 License: BSD-2-Clause, BSD-2-Clause Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Language

type Language struct {
	UnpatchedLanguage
}

For loading tmLanguage files https://manual.macromates.com/en/language_grammars

func Load

func Load(filename string) (*Language, error)

func (*Language) Copy

func (l *Language) Copy() *Language

func (*Language) String

func (s *Language) String() string

func (*Language) UnmarshalJSON

func (l *Language) UnmarshalJSON(data []byte) error

type Parser

type Parser struct {
	// contains filtered or unexported fields
}

implements parser.Parser + parser.DataSource

func NewParser

func NewParser(l *Language, data []rune) *Parser

func (*Parser) Data

func (p *Parser) Data(a, b int) string

func (*Parser) Parse

func (p *Parser) Parse() (*parser.Node, error)

Creates a directed acyclic graph from the data using the language finds the match pattern starting from each character in data then creates a node from the matched pattern and appends it to the root node

type Pattern

type Pattern struct {
	textmate.Named
	Include       string
	Match         textmate.Regex
	Captures      textmate.Captures
	Begin         textmate.Regex
	BeginCaptures textmate.Captures
	End           textmate.Regex
	EndCaptures   textmate.Captures
	Patterns      []Pattern
	// contains filtered or unexported fields
}

func (*Pattern) Cache

func (p *Pattern) Cache(data string, pos int) (pat *Pattern, ret textmate.MatchObject)

Finds what does this pattern match also caches the match for the next uses. Searches in order Match, Begin, Include, sub patterns.

func (*Pattern) CreateCaptureNodes

func (p *Pattern) CreateCaptureNodes(data string, pos int, d parser.DataSource,
	mo textmate.MatchObject, parent *parser.Node, capt textmate.Captures)

Creates a node for each capture also takse care of parent child relationship

func (*Pattern) CreateNode

func (p *Pattern) CreateNode(data string, pos int, d parser.DataSource, mo textmate.MatchObject) (ret *parser.Node)

Creates a root node for the pattern then creates a node for each capture and appends them as child of root node

func (*Pattern) FirstMatch

func (p *Pattern) FirstMatch(data string, pos int) (pat *Pattern, ret textmate.MatchObject)

Finds the first sub pattern that has match for data after pos

func (Pattern) String

func (p Pattern) String() (ret string)

type Provider

type Provider struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func (*Provider) Add

func (t *Provider) Add(scope, filename string)

func (*Provider) GetLanguage

func (t *Provider) GetLanguage(id string) (*Language, error)

func (*Provider) LanguageFromScope

func (t *Provider) LanguageFromScope(id string) (*Language, error)

type RootPattern

type RootPattern struct {
	Pattern
}

func (*RootPattern) String

func (r *RootPattern) String() (ret string)

func (*RootPattern) UnmarshalJSON

func (r *RootPattern) UnmarshalJSON(data []byte) error

type UnpatchedLanguage

type UnpatchedLanguage struct {
	FileTypes      []string
	FirstLineMatch string
	Name           string
	RootPattern    RootPattern `json:"patterns"`
	Repository     map[string]*Pattern
	ScopeName      string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL