parser

package
v0.12.8 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package parser implements a parser for a template string.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Error

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

Error represents a parse error.

func (*Error) Error

func (e *Error) Error() string

Error returns error string.

type Errors

type Errors []*Error

Errors represents parse errors.

func (*Errors) Append

func (errs *Errors) Append(pos int, msg string)

Append appends a parse error to errs.

func (Errors) Err

func (errs Errors) Err() error

Err returns an error equivalent to this errors. If the list is empty, Err returns nil.

func (Errors) Error

func (errs Errors) Error() string

Error returns error string.

type Parser

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

Parser represents a parser.

func NewParser

func NewParser(r io.Reader) *Parser

NewParser returns a new parser.

func (*Parser) Parse

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

Parse parses the template string and returns the corresponding ast.Node.

func (*Parser) Pos

func (p *Parser) Pos(pos int) *Position

Pos returns the Position value for the given offset.

type Position

type Position struct {
	Line   int
	Column int
	Offset int
}

Position describes an arbitrary source position.

Jump to

Keyboard shortcuts

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