c6: github.com/c9s/c6/ast Index | Files

package ast

import "github.com/c9s/c6/ast"


Package Files

argument.go argument_list.go block.go boolean.go charset_stmt.go color.go color_hsl.go color_hsv.go color_keywords.go color_rgba.go complex_selector.go complex_selector_list.go compliant.go compound_selector.go compute.go concat.go content_stmt.go declaration.go declaration_block.go expr.go extend_stmt.go file.go font_face_stmt.go for_stmt.go function.go function_call.go function_call_argument.go ident.go if_stmt.go import_stmt.go include_stmt.go interpolation.go list.go log_stmt.go map.go media_query_stmt.go media_type.go mixin_stmt.go node.go null.go number.go op.go parent_selector.go position.go property.go return_stmt.go ruleset.go scope.go selector.go selector_combinator.go selector_list.go statement.go string.go token.go tokentype_string.go unit.go value.go variable.go variable_assignment.go while_stmt.go


const (
    NumberValue    ValueType = 0
    HexColorValue            = 1
    RGBAColorValue           = 2
    RGBColorValue            = 3
    ListValue                = 4
    MapValue                 = 5
const (
    MediaTypeAll = iota

media_type: all | aural | braille | handheld | print | projection | screen | tty | tv | embossed

const CR = '\n'
const LF = '\r'


var ColorKeywords = map[string]string{ /* 144 elements not displayed */


CSS Level 1

var ExprTokenList = KeywordTokenList{
    KeywordToken{"true", T_TRUE},
    KeywordToken{"false", T_FALSE},
    KeywordToken{"null", T_NULL},
    KeywordToken{"only", T_ONLY},
    KeywordToken{"and", T_LOGICAL_AND},
    KeywordToken{"not", T_LOGICAL_NOT},
    KeywordToken{"or", T_LOGICAL_OR},
    KeywordToken{"xor", T_LOGICAL_XOR},
    KeywordToken{"odd", T_ODD},
    KeywordToken{"even", T_EVEN},
var FlagTokenList = KeywordTokenList{
    KeywordToken{"!global", T_FLAG_GLOBAL},
    KeywordToken{"!default", T_FLAG_DEFAULT},
    KeywordToken{"!important", T_FLAG_IMPORTANT},
    KeywordToken{"!optional", T_FLAG_OPTIONAL},
    KeywordToken{"!constant", T_FLAG_CONSTANT},
var ForRangeKeywordTokenList = KeywordTokenList{
    KeywordToken{"from", T_FOR_FROM},
    KeywordToken{"through", T_FOR_THROUGH},
    KeywordToken{"to", T_FOR_TO},
    KeywordToken{"in", T_FOR_IN},
var KeywordList = []KeywordToken{
    KeywordToken{"@else if", T_ELSE_IF},
    KeywordToken{"@else", T_ELSE},
    KeywordToken{"@if", T_IF},
    KeywordToken{"@import", T_IMPORT},
    KeywordToken{"@media", T_MEDIA},
    KeywordToken{"@page", T_PAGE},
    KeywordToken{"@return", T_RETURN},
    KeywordToken{"@each", T_EACH},
    KeywordToken{"@when", T_WHEN},
    KeywordToken{"@include", T_INCLUDE},
    KeywordToken{"@function", T_FUNCTION},
    KeywordToken{"@mixin", T_MIXIN},
    KeywordToken{"@font-face", T_FONT_FACE},
    KeywordToken{"@for", T_FOR},
    KeywordToken{"@error", T_ERROR},
    KeywordToken{"@warn", T_WARN},
    KeywordToken{"@info", T_INFO},
    KeywordToken{"@while", T_WHILE},
    KeywordToken{"@content", T_CONTENT},
    KeywordToken{"@extend", T_EXTEND},
    KeywordToken{"@namespace", T_NAMESPACE},

TODO: sort by frequency

var UnitTokenList = KeywordTokenList{
    KeywordToken{"px", T_UNIT_PX},
    KeywordToken{"pt", T_UNIT_PT},
    KeywordToken{"pc", T_UNIT_PC},
    KeywordToken{"em", T_UNIT_EM},
    KeywordToken{"cm", T_UNIT_CM},
    KeywordToken{"ex", T_UNIT_EX},
    KeywordToken{"ch", T_UNIT_CH},
    KeywordToken{"in", T_UNIT_IN},
    KeywordToken{"mm", T_UNIT_MM},
    KeywordToken{"rem", T_UNIT_REM},
    KeywordToken{"vh", T_UNIT_VH},
    KeywordToken{"vw", T_UNIT_VW},

    KeywordToken{"Hz", T_UNIT_HZ},
    KeywordToken{"kHz", T_UNIT_KHZ},

    KeywordToken{"vmin", T_UNIT_VMIN},
    KeywordToken{"vmax", T_UNIT_VMAX},
    KeywordToken{"deg", T_UNIT_DEG},
    KeywordToken{"grad", T_UNIT_GRAD},
    KeywordToken{"rad", T_UNIT_RAD},
    KeywordToken{"turn", T_UNIT_TURN},
    KeywordToken{"dpi", T_UNIT_DPI},
    KeywordToken{"dpcm", T_UNIT_DPCM},
    KeywordToken{"dppx", T_UNIT_DPPX},
    KeywordToken{"s", T_UNIT_SECOND},
    KeywordToken{"ms", T_UNIT_MILLISECOND},
    KeywordToken{"%", T_UNIT_PERCENT},

func ConvertHUE Uses

func ConvertHUE(p, q, t float64) float64

func HSLToRGB Uses

func HSLToRGB(h, s, l float64) (r, g, b uint32)

h = 0~360 s = 0~1 l = 0~1

func HSVToRGB Uses

func HSVToRGB(h, s, v float64) (r, g, b uint32)

func HexToRGBA Uses

func HexToRGBA(h string) (uint32, uint32, uint32, float32)

HexToRGB converts an Hex string to a RGB triple.

func OpTokenName Uses

func OpTokenName(tokType TokenType) string

func RGBToHSL Uses

func RGBToHSL(r, g, b uint32) (h, s, l float64)

func RGBToHSV Uses

func RGBToHSV(ir, ig, ib uint32) (h, s, v float64)

type AbsoluteUrl Uses

type AbsoluteUrl string

For url(http:....)

type AdjacentCombinator Uses

type AdjacentCombinator struct {
    Token *Token

Selectors present: E '+' F

func NewAdjacentCombinatorWithToken Uses

func NewAdjacentCombinatorWithToken(token *Token) *AdjacentCombinator

func (AdjacentCombinator) CSSString Uses

func (self AdjacentCombinator) CSSString() string

func (AdjacentCombinator) String Uses

func (self AdjacentCombinator) String() string

type Argument Uses

type Argument struct {
    Name           *Token
    DefaultValue   Expr
    VariableLength bool
    Position       int

func NewArgumentWithToken Uses

func NewArgumentWithToken(name *Token) *Argument

func (Argument) String Uses

func (arg Argument) String() string

type ArgumentList Uses

type ArgumentList struct {
    Arguments []*Argument
    Keywords  map[string]*Argument

func NewArgumentList Uses

func NewArgumentList() *ArgumentList

func (*ArgumentList) Add Uses

func (self *ArgumentList) Add(arg *Argument)

func (*ArgumentList) Lookup Uses

func (self *ArgumentList) Lookup(name string) *Argument

type AssignStmt Uses

type AssignStmt struct {
    Variable *Variable
    Expr     Expr

    Default   bool
    Optional  bool
    Global    bool
    Important bool

* Variable can be used in block as statement and declaration block

func NewAssignStmt Uses

func NewAssignStmt(variable *Variable, expr Expr) *AssignStmt

func (AssignStmt) CanBeDeclaration Uses

func (self AssignStmt) CanBeDeclaration()

Property is one of the declaration

func (AssignStmt) CanBeStmt Uses

func (self AssignStmt) CanBeStmt()

func (AssignStmt) String Uses

func (self AssignStmt) String() string

type AttributeSelector Uses

type AttributeSelector struct {
    Name    *Token
    Match   *Token
    Pattern *Token

func NewAttributeSelector Uses

func NewAttributeSelector(name, match, pattern *Token) *AttributeSelector

func NewAttributeSelectorNameOnly Uses

func NewAttributeSelectorNameOnly(name *Token) *AttributeSelector

func (AttributeSelector) CSSString Uses

func (self AttributeSelector) CSSString() (out string)

func (AttributeSelector) String Uses

func (self AttributeSelector) String() (out string)

type BinaryExpr Uses

type BinaryExpr struct {
    Op      *Op
    Left    Expr
    Right   Expr
    Grouped bool

func NewBinaryExpr Uses

func NewBinaryExpr(op *Op, left Expr, right Expr, grouped bool) *BinaryExpr

func (*BinaryExpr) IsCssSlash Uses

func (self *BinaryExpr) IsCssSlash() bool

* The the divide expression will only be evaluated in the following 3 conditions:

1. If the value, or any part of it, is stored in a variable or returned by a function.
2. If the value is surrounded by parentheses.
3. If the value is used as part of another arithmetic expression.

This method needs to be called on the top caller to prevent unexpected result.

@see http://sass-lang.com/documentation/file.SASS_REFERENCE.html#division-and-slash

func (BinaryExpr) IsSimpleExpr Uses

func (self BinaryExpr) IsSimpleExpr() bool

If any of left or right is variable, than it's constant expression. this is used to eliminate simple expression when the parser is parsing...

Please note thist method does not test CSS slash, the caller should handle by itself.

This works for both boolean evaluation and arithmetic evaluation.

func (BinaryExpr) String Uses

func (self BinaryExpr) String() string

type Block Uses

type Block struct {
    Scope *Scope
    Stmts *StmtList

func NewBlock Uses

func NewBlock() *Block

func (*Block) MergeBlock Uses

func (self *Block) MergeBlock(block *Block)

func (*Block) MergeStmts Uses

func (self *Block) MergeStmts(stmts *StmtList)

func (*Block) SetStmts Uses

func (self *Block) SetStmts(stms *StmtList)

Override the statements

type BlockNode Uses

type BlockNode interface {
    MergeStmts(stmts *StmtList)

type Boolean Uses

type Boolean struct {
    Value bool
    Token *Token

func NewBoolean Uses

func NewBoolean(val bool) *Boolean

func NewBooleanFalse Uses

func NewBooleanFalse(token *Token) *Boolean

func NewBooleanTrue Uses

func NewBooleanTrue(token *Token) *Boolean

func NewBooleanWithToken Uses

func NewBooleanWithToken(tok *Token) *Boolean

func (Boolean) Boolean Uses

func (self Boolean) Boolean() bool

func (Boolean) String Uses

func (self Boolean) String() string

type BooleanValue Uses

type BooleanValue interface {
    Boolean() bool

type CSS3Compliant Uses

type CSS3Compliant interface {
    	Output CSS3 compliant syntax
    CSS3String() string

type CSS4Compliant Uses

type CSS4Compliant interface {
    	Output CSS3 compliant syntax
    CSS4String() string

type CSSCompliant Uses

type CSSCompliant interface {
    CSSString() string

* The basic CSS compliant

type CharsetStmt Uses

type CharsetStmt struct {
    Encoding string
    Token    *Token

func NewCharsetStmtWithToken Uses

func NewCharsetStmtWithToken(token *Token) *CharsetStmt

func (CharsetStmt) CanBeStmt Uses

func (self CharsetStmt) CanBeStmt()

func (CharsetStmt) String Uses

func (self CharsetStmt) String() string

type ChildCombinator Uses

type ChildCombinator struct {
    Token *Token

func NewChildCombinator Uses

func NewChildCombinator() *ChildCombinator

func NewChildCombinatorWithToken Uses

func NewChildCombinatorWithToken(token *Token) *ChildCombinator

func (ChildCombinator) CSSString Uses

func (self ChildCombinator) CSSString() string

func (ChildCombinator) String Uses

func (self ChildCombinator) String() string

type ClassSelector Uses

type ClassSelector struct {
    ClassName string
    Token     *Token

func NewClassSelector Uses

func NewClassSelector(className string) *ClassSelector

func NewClassSelectorWithToken Uses

func NewClassSelectorWithToken(token *Token) *ClassSelector

func (ClassSelector) CSSString Uses

func (self ClassSelector) CSSString() string

func (ClassSelector) String Uses

func (self ClassSelector) String() string

type Color Uses

type Color interface {

type Combinator Uses

type Combinator interface {
    String() string

type ComplexSelector Uses

type ComplexSelector struct {
    CompoundSelector     *CompoundSelector
    ComplexSelectorItems []*ComplexSelectorItem

func NewComplexSelector Uses

func NewComplexSelector(sel *CompoundSelector) *ComplexSelector

func (*ComplexSelector) AppendCompoundSelector Uses

func (self *ComplexSelector) AppendCompoundSelector(comb Combinator, sel *CompoundSelector)

func (*ComplexSelector) CSSString Uses

func (self *ComplexSelector) CSSString() string

func (*ComplexSelector) String Uses

func (self *ComplexSelector) String() (css string)

type ComplexSelectorItem Uses

type ComplexSelectorItem struct {
    Combinator       Combinator
    CompoundSelector *CompoundSelector

func (*ComplexSelectorItem) CSSString Uses

func (item *ComplexSelectorItem) CSSString() (css string)

func (*ComplexSelectorItem) String Uses

func (item *ComplexSelectorItem) String() (css string)

type ComplexSelectorList Uses

type ComplexSelectorList []*ComplexSelector

func (*ComplexSelectorList) Append Uses

func (self *ComplexSelectorList) Append(sel *ComplexSelector)

func (ComplexSelectorList) String Uses

func (self ComplexSelectorList) String() (css string)

type CompoundSelector Uses

type CompoundSelector []Selector

one or more simple selector

func NewCompoundSelector Uses

func NewCompoundSelector() *CompoundSelector

func (*CompoundSelector) Append Uses

func (self *CompoundSelector) Append(sel Selector)

func (CompoundSelector) Length Uses

func (self CompoundSelector) Length() int

func (CompoundSelector) String Uses

func (self CompoundSelector) String() (css string)

type ComputableValue Uses

type ComputableValue interface {
    GetValueType() ValueType

type ContentStmt Uses

type ContentStmt struct {
    Token *Token

func NewContentStmtWithToken Uses

func NewContentStmtWithToken(tok *Token) *ContentStmt

func (ContentStmt) CanBeStmt Uses

func (stm ContentStmt) CanBeStmt()

func (ContentStmt) String Uses

func (stm ContentStmt) String() string

type DeclBlock Uses

type DeclBlock struct {
    ParentRuleSet *RuleSet

    Scope *Scope

    // The symbol table for storing constant values
    // Only constants can be stored here...
    Stmts *StmtList

    // Nested rulesets
    SubRuleSets []*RuleSet


.foo {

property-name: property-value;


func NewDeclBlock Uses

func NewDeclBlock(parentRuleSet *RuleSet) *DeclBlock

func (*DeclBlock) Append Uses

func (self *DeclBlock) Append(decl Stmt)

* Append a Declaration

func (*DeclBlock) AppendSubRuleSet Uses

func (self *DeclBlock) AppendSubRuleSet(ruleset *RuleSet)

func (*DeclBlock) MergeStmts Uses

func (self *DeclBlock) MergeStmts(stmts *StmtList)

func (DeclBlock) String Uses

func (self DeclBlock) String() (out string)

type Declaration Uses

type Declaration interface {
    String() string

A declaration can be a property or a ruleset

type DescendantCombinator Uses

type DescendantCombinator struct {
    Token *Token

func NewDescendantCombinator Uses

func NewDescendantCombinator() *DescendantCombinator

func NewDescendantCombinatorWithToken Uses

func NewDescendantCombinatorWithToken(token *Token) *DescendantCombinator

func (DescendantCombinator) CSSString Uses

func (self DescendantCombinator) CSSString() string

func (DescendantCombinator) String Uses

func (self DescendantCombinator) String() string

type Expr Uses

type Expr interface {
    String() string

type ExtendStmt Uses

type ExtendStmt struct {
    Selectors *ComplexSelectorList

func NewExtendStmt Uses

func NewExtendStmt() *ExtendStmt

func (ExtendStmt) CanBeStmt Uses

func (stm ExtendStmt) CanBeStmt()

func (ExtendStmt) String Uses

func (stm ExtendStmt) String() string

type File Uses

type File struct {
    Scope    *Scope
    FileName string
    FileInfo os.FileInfo

func NewFile Uses

func NewFile(filename string) (*File, error)

NewFile stat the file to get the file info

func (*File) ReadFile Uses

func (f *File) ReadFile() ([]byte, error)

func (*File) String Uses

func (f *File) String() string

type FontFaceStmt Uses

type FontFaceStmt struct {
    Block *DeclBlock

func (FontFaceStmt) CanBeStmt Uses

func (stm FontFaceStmt) CanBeStmt()

func (FontFaceStmt) String Uses

func (stm FontFaceStmt) String() string

type ForStmt Uses

type ForStmt struct {
    Variable *Variable
    From     Expr
    Through  Expr
    To       Expr
    Block    *DeclBlock

func NewForStmt Uses

func NewForStmt(variable *Variable) *ForStmt

func (ForStmt) CanBeStmt Uses

func (stm ForStmt) CanBeStmt()

func (ForStmt) String Uses

func (stm ForStmt) String() string

type Function Uses

type Function struct {
    Ident        *Token
    ArgumentList *ArgumentList
    Block        *Block

func NewFunctionWithToken Uses

func NewFunctionWithToken(tok *Token) *Function

func (Function) CanBeStmt Uses

func (f Function) CanBeStmt()

func (Function) String Uses

func (f Function) String() string

type FunctionCall Uses

type FunctionCall struct {
    Ident     *Token
    Arguments FunctionCallArguments

func NewFunctionCallWithToken Uses

func NewFunctionCallWithToken(token *Token) *FunctionCall

func (*FunctionCall) AppendArgument Uses

func (self *FunctionCall) AppendArgument(arg Expr)

func (FunctionCall) CanBeNode Uses

func (self FunctionCall) CanBeNode()

func (FunctionCall) String Uses

func (self FunctionCall) String() (out string)

type FunctionCallArgument Uses

type FunctionCallArgument struct {
    Argument                Expr
    ArgumentDefineReference *Argument

type FunctionCallArgument Expr

func NewFunctionCallArgument Uses

func NewFunctionCallArgument(expr Expr) *FunctionCallArgument

func (FunctionCallArgument) String Uses

func (arg FunctionCallArgument) String() (out string)

type FunctionCallArguments Uses

type FunctionCallArguments []*FunctionCallArgument

func (*FunctionCallArguments) Sort Uses

func (args *FunctionCallArguments) Sort()

type FunctionCallArgumentsSorter Uses

type FunctionCallArgumentsSorter struct {
    Arguments FunctionCallArguments

func (*FunctionCallArgumentsSorter) Len Uses

func (s *FunctionCallArgumentsSorter) Len() int

Len is part of sort.Interface.

func (*FunctionCallArgumentsSorter) Less Uses

func (s *FunctionCallArgumentsSorter) Less(i, j int) bool

Less is part of sort.Interface. It is implemented by calling the "by" closure in the sorter.

func (*FunctionCallArgumentsSorter) Swap Uses

func (s *FunctionCallArgumentsSorter) Swap(i, j int)

Swap is part of sort.Interface.

type FunctionalPseudoSelector Uses

type FunctionalPseudoSelector struct {
    PseudoClass string
    C           string // for dynamic language pseudo selector like :lang(C)
    Token       *Token

Selectors presents: E:pseudo

func NewFunctionalPseudoSelectorWithToken Uses

func NewFunctionalPseudoSelectorWithToken(token *Token) *FunctionalPseudoSelector

func (FunctionalPseudoSelector) CSSString Uses

func (self FunctionalPseudoSelector) CSSString() string

func (FunctionalPseudoSelector) String Uses

func (self FunctionalPseudoSelector) String() (out string)

type GeneralSiblingCombinator Uses

type GeneralSiblingCombinator struct{ Token *Token }

func NewGeneralSiblingCombinator Uses

func NewGeneralSiblingCombinator() *GeneralSiblingCombinator

func NewGeneralSiblingCombinatorWithToken Uses

func NewGeneralSiblingCombinatorWithToken(token *Token) *GeneralSiblingCombinator

func (GeneralSiblingCombinator) CSSString Uses

func (self GeneralSiblingCombinator) CSSString() string

func (GeneralSiblingCombinator) String Uses

func (self GeneralSiblingCombinator) String() string

type HSLAColor Uses

type HSLAColor struct {
    H     float64
    S     float64
    L     float64
    A     float64
    Token *Token

func NewHSLAColor Uses

func NewHSLAColor(h, s, v, a float64, token *Token) *HSLAColor

func (HSLAColor) Boolean Uses

func (self HSLAColor) Boolean() bool

func (HSLAColor) CanBeColor Uses

func (self HSLAColor) CanBeColor()

func (HSLAColor) CanBeNode Uses

func (self HSLAColor) CanBeNode()

func (HSLAColor) String Uses

func (self HSLAColor) String() string

type HSLColor Uses

type HSLColor struct {
    H     float64
    S     float64
    L     float64
    Token *Token

func NewHSLColor Uses

func NewHSLColor(h, s, v float64, token *Token) *HSLColor

func (HSLColor) CanBeColor Uses

func (self HSLColor) CanBeColor()

func (HSLColor) CanBeNode Uses

func (self HSLColor) CanBeNode()

func (HSLColor) HSLAColor Uses

func (self HSLColor) HSLAColor() *HSLAColor

func (HSLColor) RGBAColor Uses

func (c HSLColor) RGBAColor() *RGBAColor

func (HSLColor) RGBColor Uses

func (c HSLColor) RGBColor() *RGBColor

func (HSLColor) String Uses

func (self HSLColor) String() string

type HSVColor Uses

type HSVColor struct {
    H     float64
    S     float64
    V     float64
    Token *Token

func NewHSVColor Uses

func NewHSVColor(h, s, v float64, token *Token) *HSVColor

func (HSVColor) Boolean Uses

func (self HSVColor) Boolean() bool

func (HSVColor) CanBeColor Uses

func (self HSVColor) CanBeColor()

func (HSVColor) CanBeNode Uses

func (self HSVColor) CanBeNode()

func (HSVColor) RGBAColor Uses

func (c HSVColor) RGBAColor() *RGBAColor

func (HSVColor) RGBColor Uses

func (c HSVColor) RGBColor() *RGBColor

func (HSVColor) String Uses

func (self HSVColor) String() string

hsv() is not supported in CSS3, we need to convert it to hex color

type Hex Uses

type Hex string

func (Hex) String Uses

func (hex Hex) String() string

type HexColor Uses

type HexColor struct {
    Hex   Hex
    R     uint32
    G     uint32
    B     uint32
    Token *Token

func NewHexColor Uses

func NewHexColor(hex string, token *Token) *HexColor

func NewHexColorFromToken Uses

func NewHexColorFromToken(token *Token) *HexColor

func (HexColor) Boolean Uses

func (self HexColor) Boolean() bool

func (HexColor) CanBeColor Uses

func (self HexColor) CanBeColor()

func (HexColor) CanBeNode Uses

func (self HexColor) CanBeNode()

func (HexColor) String Uses

func (self HexColor) String() string

type IdSelector Uses

type IdSelector struct {
    Id    string
    Token *Token

func NewIdSelector Uses

func NewIdSelector(id string) *IdSelector

func NewIdSelectorWithToken Uses

func NewIdSelectorWithToken(token *Token) *IdSelector

func (IdSelector) CSSString Uses

func (self IdSelector) CSSString() string

func (IdSelector) String Uses

func (self IdSelector) String() string

type Ident Uses

type Ident struct {
    Ident string
    Token *Token

func NewIdentWithToken Uses

func NewIdentWithToken(token *Token) *Ident

func (Ident) CanBeNode Uses

func (self Ident) CanBeNode()

func (Ident) String Uses

func (self Ident) String() string

type IfStmt Uses

type IfStmt struct {
    Condition Expr
    Block     *DeclBlock
    ElseIfs   []*IfStmt
    ElseBlock *DeclBlock

func NewIfStmt Uses

func NewIfStmt(condition Expr, block *DeclBlock) *IfStmt

func (IfStmt) AppendElseIf Uses

func (stm IfStmt) AppendElseIf(ifStm *IfStmt)

func (IfStmt) CanBeStmt Uses

func (stm IfStmt) CanBeStmt()

func (IfStmt) SetElseBlock Uses

func (stm IfStmt) SetElseBlock(block *DeclBlock)

func (IfStmt) String Uses

func (stm IfStmt) String() string

type ImportStmt Uses

type ImportStmt struct {
    Url            Url // if it's wrapped with url(...) or "string"
    MediaQueryList []*MediaQuery

* The @import rule syntax is described here:

@see http://www.w3.org/TR/2015/CR-css-cascade-3-20150416/#at-import

hides the style sheet from Netscape 4, IE 3 and 4 (not 4.72)

@import url(../style.css);

hides the style sheet from Netscape 4, IE 3 and 4 (not 4.72), Konqueror 2, and Amaya 5.1

@import url("../style.css");

hides the style sheet from Netscape 4, IE 6 and below

@import url(../style.css) screen;

hides the style sheet from Netscape 4, IE 4 and below, Konqueror 2

@import "../styles.css";

func NewImportStmt Uses

func NewImportStmt() *ImportStmt

func (ImportStmt) CanBeStmt Uses

func (self ImportStmt) CanBeStmt()

func (ImportStmt) String Uses

func (self ImportStmt) String() string

type IncludeStmt Uses

type IncludeStmt struct {
    Token        *Token // @include
    MixinIdent   *Token // mixin identitfier
    ArgumentList *ArgumentList
    ContentBlock *DeclBlock // if any

func NewIncludeStmtWithToken Uses

func NewIncludeStmtWithToken(token *Token) *IncludeStmt

func (IncludeStmt) CanBeStmt Uses

func (stm IncludeStmt) CanBeStmt()

func (IncludeStmt) String Uses

func (stm IncludeStmt) String() string

type Interpolation Uses

type Interpolation struct {
    Expr       Expr
    StartToken *Token
    EndToken   *Token

func NewInterpolation Uses

func NewInterpolation(expr Expr, startToken *Token, endToken *Token) *Interpolation

func (Interpolation) CanBeNode Uses

func (self Interpolation) CanBeNode()

func (Interpolation) String Uses

func (self Interpolation) String() string

type KeywordToken Uses

type KeywordToken struct {
    Keyword   string
    TokenType TokenType

type KeywordTokenList Uses

type KeywordTokenList []KeywordToken

type KeywordTokenMap Uses

type KeywordTokenMap map[string]TokenType

type List Uses

type List struct {
    Separator string
    Exprs     []Expr

func NewCommaSepList Uses

func NewCommaSepList() *List

func NewList Uses

func NewList(sep string) *List

By the default, the separator is space

func NewSpaceSepList Uses

func NewSpaceSepList() *List

func (*List) Append Uses

func (list *List) Append(expr Expr)

func (List) Boolean Uses

func (self List) Boolean() bool

When there is more than one item, we return true for boolean context

func (List) GetValueType Uses

func (self List) GetValueType() ValueType

func (*List) Len Uses

func (list *List) Len() int

func (List) String Uses

func (list List) String() string

type LiteralConcat Uses

type LiteralConcat struct {
    Left  Expr
    Right Expr

* A struct that contains many concatable strings


func NewLiteralConcat Uses

func NewLiteralConcat(left, right Expr) *LiteralConcat

func (LiteralConcat) String Uses

func (self LiteralConcat) String() string

type LogStmt Uses

type LogStmt struct {
    Directive *Token
    Expr      Expr

func (LogStmt) CanBeStmt Uses

func (stm LogStmt) CanBeStmt()

func (LogStmt) String Uses

func (stm LogStmt) String() string

type Map Uses

type Map struct {
    Items []*MapItem
    Map   map[string]Expr

func NewMap Uses

func NewMap() *Map

func (*Map) Get Uses

func (self *Map) Get(key Expr) Expr

func (Map) GetValueType Uses

func (self Map) GetValueType() ValueType

func (*Map) Set Uses

func (self *Map) Set(key Expr, val Expr)

func (Map) String Uses

func (self Map) String() string

type MapItem Uses

type MapItem struct {
    Key   Expr
    Value Expr

type MediaFeature Uses

type MediaFeature struct {
    Feature Expr
    Value   Expr
    Open    *Token
    Close   *Token

func NewMediaFeature Uses

func NewMediaFeature(feature, value Expr) *MediaFeature

func (MediaFeature) String Uses

func (self MediaFeature) String() (out string)

type MediaQuery Uses

type MediaQuery struct {
    MediaType Expr
    MediaExpr Expr

One MediaQuery may contain media type or media expression.

func NewMediaQuery Uses

func NewMediaQuery(mediaType Expr, expr Expr) *MediaQuery

func (MediaQuery) CSS3String Uses

func (stm MediaQuery) CSS3String() string

func (MediaQuery) String Uses

func (stm MediaQuery) String() (out string)

type MediaQueryList Uses

type MediaQueryList []*MediaQuery

func NewMediaQueryList Uses

func NewMediaQueryList() *MediaQueryList

func (MediaQueryList) Append Uses

func (list MediaQueryList) Append(query *MediaQuery)

type MediaQueryStmt Uses

type MediaQueryStmt struct {
    MediaQueryList *MediaQueryList
    Block          *DeclBlock
    Scope          *Scope

func NewMediaQueryStmt Uses

func NewMediaQueryStmt() *MediaQueryStmt

func (MediaQueryStmt) CanBeStmt Uses

func (stm MediaQueryStmt) CanBeStmt()

func (MediaQueryStmt) String Uses

func (stm MediaQueryStmt) String() (out string)

type MediaType Uses

type MediaType struct {
    Expr Expr

func NewMediaType Uses

func NewMediaType(expr Expr) *MediaType

func (MediaType) String Uses

func (self MediaType) String() string

type MixinStmt Uses

type MixinStmt struct {
    Token        *Token
    Ident        *Token
    Block        *DeclBlock
    ArgumentList *ArgumentList

func NewMixinStmtWithToken Uses

func NewMixinStmtWithToken(tok *Token) *MixinStmt

func (MixinStmt) CanBeStmt Uses

func (stm MixinStmt) CanBeStmt()

func (MixinStmt) String Uses

func (stm MixinStmt) String() string

type NestedStmt Uses

type NestedStmt struct{}

The nested statement allows declaration block and statements

func (NestedStmt) CanBeStmt Uses

func (stm NestedStmt) CanBeStmt()

type Node Uses

type Node interface{}

type Null Uses

type Null struct {
    Token *Token

Null struct presents Null value

func NewNullWithToken Uses

func NewNullWithToken(tok *Token) *Null

func (Null) Boolean Uses

func (self Null) Boolean() bool

func (Null) String Uses

func (self Null) String() string

type Number Uses

type Number struct {
    Value float64

    Unit  *Unit
    Token *Token
    // contains filtered or unexported fields

func NewNumber Uses

func NewNumber(num float64, unit *Unit, token *Token) *Number

func (Number) Boolean Uses

func (num Number) Boolean() bool

func (Number) Double Uses

func (num Number) Double() float64

func (Number) GetValueType Uses

func (self Number) GetValueType() ValueType

func (Number) Integer Uses

func (num Number) Integer() int

func (*Number) IsDouble Uses

func (num *Number) IsDouble() bool

Check if the number is a floating value.

func (*Number) SetDouble Uses

func (num *Number) SetDouble()

Mark the number as an double (value with precision)

func (Number) String Uses

func (self Number) String() (out string)

type Object Uses

type Object struct {
    Name string
    Kind ObjectKind
    Decl interface{}

func NewObject Uses

func NewObject(kind ObjectKind, name string) *Object

This function creates a new object of a given kind and name.

type ObjectKind Uses

type ObjectKind int

ObjectKind describes what an object represents.

const (
    Bad   ObjectKind = iota // for error handling
    Pkg                     // package
    Var                     // variable
    Fun                     // function
    Mixin                   // mixin

The list of possible Object kinds.

func (ObjectKind) String Uses

func (kind ObjectKind) String() string

type Op Uses

type Op struct {
    Type  TokenType
    Token *Token

func NewOp Uses

func NewOp(opType TokenType) *Op

func NewOpWithToken Uses

func NewOpWithToken(token *Token) *Op

func (Op) String Uses

func (op Op) String() string

type ParentSelector Uses

type ParentSelector struct {
    ParentRuleSet *RuleSet
    Token         *Token

This is a SCSS only selector

func NewParentSelectorWithToken Uses

func NewParentSelectorWithToken(parentRuleSet *RuleSet, token *Token) *ParentSelector

func (ParentSelector) String Uses

func (self ParentSelector) String() string

type Position Uses

type Position struct {
    Filename string // filename, if any
    Offset   int    // offset, starting at 0
    Line     int    // line number, starting at 1
    Column   int    // column number, starting at 1 (byte count)

func (Position) IsValid Uses

func (pos Position) IsValid() bool

func (Position) String Uses

func (pos Position) String() string

type PositionProvider Uses

type PositionProvider interface {
    Position() Position

type Property Uses

type Property struct {
    Name *PropertyName
    property value can be something like:

    	`padding: 3px 3px;`
    Values []Expr

* An property may contains interpolation

func NewProperty Uses

func NewProperty(nameTok *Token) *Property

func (Property) AppendValue Uses

func (self Property) AppendValue(value Expr)

func (Property) CanBeDeclaration Uses

func (self Property) CanBeDeclaration()

* Property is one of the declaration

func (Property) CanBeStmt Uses

func (self Property) CanBeStmt()

func (Property) String Uses

func (self Property) String() (out string)

type PropertyName Uses

type PropertyName struct {
    Name string
    // If there is an interpolation in the property name
    Interpolation bool
    Token         *Token

func NewPropertyName Uses

func NewPropertyName(tok *Token) *PropertyName

func (PropertyName) String Uses

func (self PropertyName) String() string

type PseudoSelector Uses

type PseudoSelector struct {
    PseudoClass string
    Token       *Token

Selectors presents: E:pseudo

func NewPseudoSelectorWithToken Uses

func NewPseudoSelectorWithToken(token *Token) *PseudoSelector

func (PseudoSelector) CSSString Uses

func (self PseudoSelector) CSSString() (out string)

func (PseudoSelector) String Uses

func (self PseudoSelector) String() (out string)

type RGBAColor Uses

type RGBAColor struct {
    R     uint32
    G     uint32
    B     uint32
    A     float32
    Token *Token

func NewRGBAColor Uses

func NewRGBAColor(r, g, b uint32, a float32, token *Token) *RGBAColor

func NewRGBAColorWithHexCode Uses

func NewRGBAColorWithHexCode(hex string, token *Token) *RGBAColor

Factor functions

func (RGBAColor) Boolean Uses

func (self RGBAColor) Boolean() bool

func (RGBAColor) CanBeColor Uses

func (self RGBAColor) CanBeColor()

func (RGBAColor) CanBeNode Uses

func (self RGBAColor) CanBeNode()

func (RGBAColor) Hex Uses

func (self RGBAColor) Hex() Hex

NOTE: 8 char hex color is only supported by IE.

func (RGBAColor) String Uses

func (self RGBAColor) String() string

type RGBColor Uses

type RGBColor struct {
    R     uint32
    G     uint32
    B     uint32
    Token *Token

RGBColor can present rgb(....)

func NewRGBColor Uses

func NewRGBColor(r, g, b uint32, token *Token) *RGBColor

func NewRGBColorWithHexCode Uses

func NewRGBColorWithHexCode(hex string, token *Token) *RGBColor

func (RGBColor) Boolean Uses

func (self RGBColor) Boolean() bool

func (RGBColor) CanBeColor Uses

func (self RGBColor) CanBeColor()

func (RGBColor) CanBeNode Uses

func (self RGBColor) CanBeNode()

func (RGBColor) Hex Uses

func (self RGBColor) Hex() Hex

func (RGBColor) String Uses

func (self RGBColor) String() string

type RelativeUrl Uses

type RelativeUrl string

For relative Url: url(../)

type ReturnStmt Uses

type ReturnStmt struct {
    Token *Token
    Value Expr

func NewReturnStmtWithToken Uses

func NewReturnStmtWithToken(tok *Token, expr Expr) *ReturnStmt

func (ReturnStmt) CanBeStmt Uses

func (stm ReturnStmt) CanBeStmt()

func (ReturnStmt) String Uses

func (stm ReturnStmt) String() string

type RuleSet Uses

type RuleSet struct {
    Selectors *ComplexSelectorList
    Block     *DeclBlock

func NewRuleSet Uses

func NewRuleSet() *RuleSet

func (*RuleSet) AppendSubRuleSet Uses

func (self *RuleSet) AppendSubRuleSet(ruleset *RuleSet)

func (*RuleSet) CanBeStmt Uses

func (self *RuleSet) CanBeStmt()

Complete the statement interface

func (*RuleSet) GetSubRuleSets Uses

func (self *RuleSet) GetSubRuleSets() []*RuleSet

func (RuleSet) String Uses

func (self RuleSet) String() string

type Scope Uses

type Scope struct {
    Parent  *Scope
    Objects map[string]*Object

func NewScope Uses

func NewScope(parent *Scope) *Scope

func (*Scope) Insert Uses

func (s *Scope) Insert(obj *Object) (alt *Object)

func (*Scope) Lookup Uses

func (s *Scope) Lookup(name string) *Object

func (*Scope) String Uses

func (s *Scope) String() string

Debugging support

type ScssImportUrl Uses

type ScssImportUrl string

For import like this:

@import "component/list"; // => component/_list.scss

type Selector Uses

type Selector interface {
    String() string

* @see http://www.w3.org/TR/CSS21/grammar.html

UniversalSelector TypeSelector PseudoSelector ClassSelector IdSelector AttributeSelector

type SelectorList Uses

type SelectorList []Selector

Gernal SelectorList struct

func NewSelectorList Uses

func NewSelectorList() *SelectorList

func (*SelectorList) Append Uses

func (self *SelectorList) Append(sel Selector)

func (SelectorList) Length Uses

func (self SelectorList) Length() int

func (SelectorList) String Uses

func (self SelectorList) String() (out string)

type Stmt Uses

type Stmt interface {
    String() string

type StmtList Uses

type StmtList []Stmt

func (StmtList) Append Uses

func (list StmtList) Append(stm Stmt)

type String Uses

type String struct {
    // Can be `"`, `'` or ``
    Quote byte
    Value string
    Token *Token

func NewString Uses

func NewString(quote byte, value string, token *Token) *String

func NewStringWithQuote Uses

func NewStringWithQuote(quote byte, token *Token) *String

Create a string object with quote byte

func NewStringWithToken Uses

func NewStringWithToken(token *Token) *String

func (String) Boolean Uses

func (str String) Boolean() bool

When string length is greater than 0, return true for boolean context

func (String) String Uses

func (self String) String() string

type StringUrl Uses

type StringUrl string

For @import "../string";

Which may present absolute or relative url

type Token Uses

type Token struct {
    Type                  TokenType
    Str                   string
    Pos                   int
    Line                  int
    LineOffset            int
    ContainsInterpolation bool

func (Token) IsAttributeMatchOperator Uses

func (tok Token) IsAttributeMatchOperator() bool

func (Token) IsComparisonOperator Uses

func (tok Token) IsComparisonOperator() bool

func (Token) IsFlagKeyword Uses

func (tok Token) IsFlagKeyword() bool

func (Token) IsOneOfTypes Uses

func (tok Token) IsOneOfTypes(types []TokenType) bool

func (Token) IsSelector Uses

func (tok Token) IsSelector() bool

func (Token) IsSelectorCombinator Uses

func (tok Token) IsSelectorCombinator() bool

func (Token) IsString Uses

func (tok Token) IsString() bool

func (Token) IsUnit Uses

func (tok Token) IsUnit() bool

func (Token) String Uses

func (tok Token) String() string

* Implement the stringer interface

type TokenStream Uses

type TokenStream chan *Token

type TokenType Uses

type TokenType int

go:generate stringer -type=TokenType token.go

const (
    T_SPACE TokenType = iota

    T_ODD  // for nth-child(odd)
    T_EVEN // for nth-child(even)
    T_N    // for nth-child(3n+3)


    // selector tokens
    T_PARENT_SELECTOR   // SASS parent selector
    T_PSEUDO_SELECTOR   // :hover, :visited , ...
    T_FUNCTIONAL_PSEUDO // lang(...), nth(...)

    	An interpolation selector token presents one or two more selector strings,
    	which may contains an expression that change the type of the selector.
    T_INTERPOLATION_SELECTOR // selector with interpolation: '#{ ... }'

    	The literal concat means we would concat two string without quotes.
    	This is used for concating strings or expression with interpolation sections.
    T_LITERAL_CONCAT // used to concat selectors and interpolation

    	This is for normal string concat

    // for Microsoft 'progid:' token, we don't have choice.

    // Selector relationship
    T_CHILD_COMBINATOR            // E '>' F


    T_IF       // @if
    T_ELSE     // @else
    T_ELSE_IF  // @else if
    T_INCLUDE  // for @include
    T_EACH     // for @each
    T_WHEN     // for @when
    T_MIXIN    // for @mixin
    T_EXTEND   // for @extend
    T_FUNCTION // for @function
    T_WARN     // @warn
    T_ERROR    // @error
    T_INFO     // @info
    T_FOR_IN  // for @for ... in
    T_WHILE   // for @while
    T_RETURN  // for @return
    T_RANGE   // for '..'
    T_CONTENT // for '@content'

    // Flag token types


    T_LOGICAL_NOT // 'not' used in conditions
    T_LOGICAL_OR  // 'or' used in conditions query
    T_LOGICAL_AND // 'and' used in conditions query

    	expression operators
    T_PLUS  // for '+'
    T_DIV   // for '-'
    T_MUL   // for '*'
    T_MINUS // for '-'
    T_MOD   // for '%'
    T_LANG_CODE // 'en', 'fr', 'fr-ca'

    T_EQUAL   // for '=='
    T_UNEQUAL // for '!='
    T_GT      // greater than for '>'
    T_LT      // less than for '<'
    T_GE      // for '>='
    T_LE      // for '<='

    T_ASSIGN     // for '='
    T_ATTR_EQUAL // for '=' inside attribute selecctors

    T_INCLUDE_MATCH   // for '~='
    T_PREFIX_MATCH    // for '^='
    T_DASH_MATCH      // for '|='
    T_SUFFIX_MATCH    // for '$='
    T_SUBSTRING_MATCH // for '*='

    T_VARIABLE                  // for $[a-z]*



    T_CDOPEN  // for <!--
    T_CDCLOSE // for -->

    	unit tokens

    	Time Unit
    	@see https://developer.mozilla.org/zh-TW/docs/Web/CSS/time

    	Length Unit
    	@see https://developer.mozilla.org/en-US/docs/Web/CSS/length

    // Absolute length

    // Viewport-percentage lengths

    	Frequency unit
    	@see https://developer.mozilla.org/en-US/docs/Web/CSS/frequency

    	Resolution Unit
    	@see https://developer.mozilla.org/en-US/docs/Web/CSS/resolution

    	@see https://developer.mozilla.org/en-US/docs/Web/CSS/angle


func (TokenType) String Uses

func (i TokenType) String() string

type TypeSelector Uses

type TypeSelector struct {
    Type  string
    Token *Token

* TypeSelector

func NewTypeSelector Uses

func NewTypeSelector(typename string) *TypeSelector

func NewTypeSelectorWithToken Uses

func NewTypeSelectorWithToken(token *Token) *TypeSelector

func (TypeSelector) CSSString Uses

func (self TypeSelector) CSSString() string

func (TypeSelector) String Uses

func (self TypeSelector) String() string

type UnaryExpr Uses

type UnaryExpr struct {
    Op   *Op
    Expr Expr

func NewUnaryExpr Uses

func NewUnaryExpr(op *Op, expr Expr) *UnaryExpr

func (UnaryExpr) String Uses

func (self UnaryExpr) String() string

type Unit Uses

type Unit struct {
    Type  TokenType
    Token *Token

func NewUnit Uses

func NewUnit(unitType TokenType, token *Token) *Unit

func NewUnitWithToken Uses

func NewUnitWithToken(token *Token) *Unit

func (Unit) String Uses

func (unit Unit) String() string

type UniversalSelector Uses

type UniversalSelector struct {
    Token *Token

func NewUniversalSelector Uses

func NewUniversalSelector() *UniversalSelector

func NewUniversalSelectorWithToken Uses

func NewUniversalSelectorWithToken(token *Token) *UniversalSelector

func (UniversalSelector) CSSString Uses

func (self UniversalSelector) CSSString() string

func (UniversalSelector) String Uses

func (self UniversalSelector) String() string

type Url Uses

type Url interface{}

type Value Uses

type Value interface {
    String() string

type Value struct {}

type ValueType Uses

type ValueType uint16

type Variable Uses

type Variable struct {
    Name  string
    Value Expr
    Token *Token

func NewVariable Uses

func NewVariable(name string) *Variable

func NewVariableWithToken Uses

func NewVariableWithToken(token *Token) *Variable

func (Variable) CanBeNode Uses

func (self Variable) CanBeNode()

func (*Variable) SetValue Uses

func (self *Variable) SetValue(val Expr)

func (Variable) String Uses

func (self Variable) String() string

type WhileStmt Uses

type WhileStmt struct {
    Condition Expr
    Block     *DeclBlock
    ElseBlock *DeclBlock

func NewWhileStmt Uses

func NewWhileStmt(condition Expr, block *DeclBlock) *WhileStmt

func (WhileStmt) CanBeStmt Uses

func (stm WhileStmt) CanBeStmt()

func (WhileStmt) SetElseBlock Uses

func (stm WhileStmt) SetElseBlock(block *DeclBlock)

func (WhileStmt) String Uses

func (stm WhileStmt) String() string

Package ast imports 8 packages (graph) and is imported by 10 packages. Updated 2018-08-20. Refresh now. Tools for package owners.