parser

package
v0.0.0-...-9c067ca Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2015 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddStringToList

func AddStringToList(value *Value, s string) (modified bool)

func ListIsSorted

func ListIsSorted(value Value) bool

func Print

func Print(file *File) ([]byte, error)

func RemoveStringFromList

func RemoveStringFromList(value *Value, s string) (modified bool)

func SortList

func SortList(file *File, value Value)

func SortLists

func SortLists(file *File)

Types

type Assignment

type Assignment struct {
	Name       Ident
	Value      Value
	OrigValue  Value
	Pos        scanner.Position
	Assigner   string
	Referenced bool
}

func (*Assignment) String

func (a *Assignment) String() string

type Comment

type Comment struct {
	Comment []string
	Pos     scanner.Position
}

type Definition

type Definition interface {
	String() string
	// contains filtered or unexported methods
}

type Expression

type Expression struct {
	Args     [2]Value
	Operator rune
	Pos      scanner.Position
}

func (*Expression) String

func (e *Expression) String() string

type File

type File struct {
	Defs     []Definition
	Comments []Comment
}

func Parse

func Parse(filename string, r io.Reader, scope *Scope) (file *File, errs []error)

func ParseAndEval

func ParseAndEval(filename string, r io.Reader, scope *Scope) (file *File, errs []error)

type Ident

type Ident struct {
	Name string
	Pos  scanner.Position
}

func (Ident) String

func (i Ident) String() string

type Module

type Module struct {
	Type       Ident
	Properties []*Property
	LbracePos  scanner.Position
	RbracePos  scanner.Position
}

func (*Module) String

func (m *Module) String() string

type ParseError

type ParseError struct {
	Err error
	Pos scanner.Position
}

func (*ParseError) Error

func (e *ParseError) Error() string

type Property

type Property struct {
	Name  Ident
	Value Value
	Pos   scanner.Position
}

func (*Property) String

func (p *Property) String() string

type Scope

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

func NewScope

func NewScope(s *Scope) *Scope

func (*Scope) Add

func (s *Scope) Add(assignment *Assignment) error

func (*Scope) Get

func (s *Scope) Get(name string) (*Assignment, error)

func (*Scope) Remove

func (s *Scope) Remove(name string)

func (*Scope) String

func (s *Scope) String() string

type Value

type Value struct {
	Type        ValueType
	BoolValue   bool
	StringValue string
	ListValue   []Value
	MapValue    []*Property
	Expression  *Expression
	Variable    string
	Pos         scanner.Position
	EndPos      scanner.Position
}

func (Value) String

func (p Value) String() string

type ValueType

type ValueType int
const (
	Bool ValueType = iota
	String
	List
	Map
)

func (ValueType) String

func (p ValueType) String() string

Jump to

Keyboard shortcuts

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