/[aya]/vendor/github.com/yosssi/gcss/element.go
ViewVC logotype

Annotation of /vendor/github.com/yosssi/gcss/element.go

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (hide annotations)
Mon Sep 30 00:42:06 2024 UTC (6 weeks, 4 days ago) by yakumo_izuru
Branch: MAIN
CVS Tags: HEAD
Mirrored from https://git.chaotic.ninja/git/yakumo_izuru/aya

1 yakumo_izuru 1.1 package gcss
2    
3     import "io"
4    
5     // element represents an element of GCSS source codes.
6     type 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.
15     func 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     }

nishi@chaotic.ninja
ViewVC Help
Powered by ViewVC 1.3.0-dev