token

package
v0.10.1 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 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 Scanner

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

Scanner transforms a mustache text template into a stream of tokens.

func NewScanner

func NewScanner(name, src, ldelim, rdelim string) *Scanner

NewScanner returns a new scanner instance

func (*Scanner) LeftDelim

func (s *Scanner) LeftDelim() string

func (*Scanner) Next

func (s *Scanner) Next() (Token, error)

func (*Scanner) RightDelim

func (s *Scanner) RightDelim() string

type Token

type Token struct {
	Type      Type
	Text      string
	Indent    string
	Offset    int
	EndOffset int
	Column    int
	Line      int
}

type Type

type Type int

Type of a token

const (
	TEXT Type = iota
	TEXT_EOL
	VARIABLE
	UNESCAPED_VARIABLE
	UNESCAPED_VARIABLE_SYM
	SECTION
	INVERTED_SECTION
	SECTION_END
	PARTIAL
	COMMENT
	SET_DELIMETERS
)

Types of tokens

Jump to

Keyboard shortcuts

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