source: code/trunk/vendor/github.com/yosssi/gcss/element.go@ 67

Last change on this file since 67 was 67, checked in by Izuru Yakumo, 23 months ago

Use vendored modules

Signed-off-by: Izuru Yakumo <yakumo.izuru@…>

File size: 1007 bytes
Line 
1package gcss
2
3import "io"
4
5// element represents an element of GCSS source codes.
6type element interface {
7 io.WriterTo
8 AppendChild(child element)
9 Base() *elementBase
10 SetContext(*context)
11 Context() *context
12}
13
14// newElement creates and returns an element.
15func newElement(ln *line, parent element) (element, error) {
16 var e element
17 var err error
18
19 switch {
20 case ln.isComment():
21 e = newComment(ln, parent)
22 case ln.isAtRule():
23 e = newAtRule(ln, parent)
24 case ln.isMixinDeclaration():
25 // error can be ignored becuase the line is checked beforehand
26 // by calling `ln.isMixinDeclaration()`.
27 e, _ = newMixinDeclaration(ln, parent)
28 case ln.isMixinInvocation():
29 // error can be ignored becuase the line is checked beforehand
30 // by calling `ln.isMixinInvocation()`.
31 e, _ = newMixinInvocation(ln, parent)
32 case ln.isVariable():
33 e, err = newVariable(ln, parent)
34 case ln.isDeclaration():
35 e, err = newDeclaration(ln, parent)
36 default:
37 e, err = newSelector(ln, parent)
38 }
39
40 return e, err
41}
Note: See TracBrowser for help on using the repository browser.