lex

package
v0.0.0-...-f60ce48 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	None                    = Options(0x0000)
	IgnoreCase              = Options(0x0001) // "i"
	Multiline               = Options(0x0002) // "m"
	ExplicitCapture         = Options(0x0004) // "n"
	Compiled                = Options(0x0008) // "c"
	Singleline              = Options(0x0010) // "s"
	IgnorePatternWhitespace = Options(0x0020) // "x"
	RightToLeft             = Options(0x0040) // "r"
	Debug                   = Options(0x0080) // "d"
	ECMAScript              = Options(0x0100) // "e"
	RE2                     = Options(0x0200) // RE2 (regexp package) compatibility mode
	Global                  = Options(0x0400) // "g"
)

Variables

This section is empty.

Functions

func IsEmpty

func IsEmpty(object interface{}) bool

Types

type Lexer

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

func NewLex

func NewLex() *Lexer

func (*Lexer) Lex

func (l *Lexer) Lex(text string) []Token
type Link struct {
	Href  string `json:"href"`
	Title string `json:"title"`
}

type Match

type Match = regexp2.Match

type Options

type Options int32

type Regex

type Regex struct {
	*regexp2.Regexp

	LastIndex  int
	Global     bool
	Multiline  bool
	IgnoreCase bool
	Source     string
	// contains filtered or unexported fields
}

func MustCompile

func MustCompile(source string, opt Options) *Regex

func (*Regex) Exec

func (r *Regex) Exec(src []rune) (*Match, error)

func (*Regex) ReplaceRune

func (r *Regex) ReplaceRune(input []rune, repl string, startAt, count int) []rune

func (*Regex) ReplaceStr

func (r *Regex) ReplaceStr(input string, repl string, startAt, count int) string

func (*Regex) Test

func (r *Regex) Test(src []rune) bool

type Token

type Token struct {
	Type string `json:"type"`
	Raw  string `json:"raw"`
	Text string `json:"text"`

	// list
	Ordered bool    `json:"ordered,omitempty"`
	Start   string  `json:"start,omitempty"`
	Loose   bool    `json:"loose,omitempty"`
	Task    bool    `json:"task,omitempty"`
	Items   []Token `json:"items,omitempty"`
	Checked string  `json:"checked,omitempty"`

	// heading
	Depth int `json:"depth,omitempty"`

	// link
	Href  string `json:"href,omitempty"`
	Title string `json:"title,omitempty"`

	// def
	Tag string `json:"tag,omitempty"`

	Tokens []Token `json:"tokens,omitempty"`

	// table
	Header   []string   `json:"header,omitempty"`
	Align    []string   `json:"align,omitempty"`
	Cells    [][]string `json:"cells,omitempty"`
	Elements struct {
		Header [][]Token   `json:"header,omitempty"`
		Cells  [][][]Token `json:"cells,omitempty"`
	} `json:"elements,omitempty"`
}

func (Token) String

func (t Token) String() string

Jump to

Keyboard shortcuts

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