syntax

package
v0.0.0-...-dbc7887 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2019 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Highlight

type Highlight struct {
	// At is the addressed string.
	At [2]int64
	// Style is the style to apply to the string.
	text.Style
}

A Highlight is a style applied to an addressed string of text.

type Regexp

type Regexp struct {
	// Regexp is the re1 regular expression to match the element.
	Regexp string
	// Group is the numbered capture group of the element text.
	Group int
	Style text.Style
}

A Regexp describes a syntactic element using a regular expression.

type Tokenizer

type Tokenizer interface {
	// NextToken next token or false.
	NextToken(rope.Rope) (Highlight, bool)
}

Tokenizer returns tokens from a rope.

func NewRegexpTokenizer

func NewRegexpTokenizer(regexps ...Regexp) (Tokenizer, error)

NewRegexpTokenizer returns a new Tokenizer defined by a set of re1 regular expressions.

Directories

Path Synopsis
Package dirsyntax implements a syntax.Highlighter for directory entries.
Package dirsyntax implements a syntax.Highlighter for directory entries.
Package gosyntax implements a syntax.Highlighter for Go syntax.
Package gosyntax implements a syntax.Highlighter for Go syntax.

Jump to

Keyboard shortcuts

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