syntax

package
v0.0.0-...-ab26969 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2017 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Error = errors.NewClass("syntax")
)

Functions

func Format

func Format(path string, data []byte) (formatted []byte, err error)

func Parse

func Parse(path string, data []byte) (root *ast.Root, err error)

Types

type Scanner

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

func NewScanner

func NewScanner(filename string, data []byte) (*Scanner, error)

func (*Scanner) Peek

func (s *Scanner) Peek() (token Token)

func (*Scanner) Pos

func (s *Scanner) Pos() scanner.Position

func (*Scanner) Scan

func (s *Scanner) Scan() (token Token, pos scanner.Position, text string)

func (*Scanner) ScanExact

func (s *Scanner) ScanExact(token Token) (pos scanner.Position, text string,
	err error)

func (*Scanner) ScanIf

func (s *Scanner) ScanIf(token Token) (pos scanner.Position, text string,
	ok bool)

func (*Scanner) ScanOneOf

func (s *Scanner) ScanOneOf(tokens ...Token) (token Token,
	pos scanner.Position, text string, err error)

func (*Scanner) ScanTo

func (s *Scanner) ScanTo(token Token)

func (*Scanner) ScanWhile

func (s *Scanner) ScanWhile(token Token)

type Token

type Token string
const (
	Ident       Token = "Ident"
	Int         Token = "Int"
	EOF         Token = "EOF"
	Colon       Token = ":"
	Dot         Token = "."
	Comma       Token = ","
	Equal       Token = "="
	LeftAngle   Token = "<"
	RightAngle  Token = ">"
	Question    Token = "?"
	OpenParen   Token = "("
	CloseParen  Token = ")"
	Exclamation Token = "!"
	String      Token = "String"
	Float       Token = "Float"
	Illegal     Token = "Illegal"
)

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