parser

package
v0.0.0-...-41a4f88 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2016 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
}

func (Comment) EndLine

func (c Comment) EndLine() int

Return the line number that the comment ends on

func (Comment) String

func (c Comment) String() string

func (Comment) Text

func (c Comment) Text() string

Return the text of the comment with // or /* and */ stripped

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) Copy

func (e *Expression) Copy() *Expression

func (*Expression) String

func (e *Expression) String() string

type File

type File struct {
	Name     string
	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) Copy

func (m *Module) Copy() *Module

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) Copy

func (p *Property) Copy() *Property

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, bool)

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) Copy

func (p Value) Copy() Value

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