compiler

package
v0.0.0-...-cab90b3 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2016 License: BSD-2-Clause, BSD-3-Clause Imports: 10 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMixinNotFound = errors.New("mixin by name not found")
)

Functions

func Compile

func Compile(input []byte) ([]byte, error)

Compile accepts a byte slice and returns a byte slice

func Run

func Run(path string) (string, error)

Run accepts a path to a Sass file and outputs a string

Types

type Context

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

Context maintains the state of the compiler and handles the output of the parser.

func NewContext

func NewContext() *Context

NewContext returns a new, initialized context

func (*Context) SetMode

func (ctx *Context) SetMode(mode parser.Mode) error

SetMode modifies the mode that the parser runs in. See parser.Mode for available options

func (*Context) Visit

func (ctx *Context) Visit(node ast.Node) ast.Visitor

Visit is an internal compiler method. It is exported to allow ast.Walk to walk through the parser AST tree.

type MixFn

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

type Scope

type Scope interface {
	// OpenScope() Typ
	// CloseScope() Typ
	// Lookup(string) interface{}
	// Insert(string, interface{})
	// Number of Rules in this scope
	RuleAdd(*ast.RuleSpec)
	RuleLen() int

	RegisterMixin(string, int, *MixFn)
	Mixin(string, int) (*MixFn, error)
}

stores types and values with scoping. To remove a scope use CloseScope(), to open a new Scope use OpenScope().

func CloseScope

func CloseScope(typ Scope) Scope

func NewScope

func NewScope(s Scope) Scope

Jump to

Keyboard shortcuts

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