]> git.immae.eu Git - github/fretlink/terraform-provider-statuscake.git/blob - vendor/github.com/aws/aws-sdk-go/internal/ini/skipper.go
Upgrade to 0.12
[github/fretlink/terraform-provider-statuscake.git] / vendor / github.com / aws / aws-sdk-go / internal / ini / skipper.go
1 package ini
2
3 // skipper is used to skip certain blocks of an ini file.
4 // Currently skipper is used to skip nested blocks of ini
5 // files. See example below
6 //
7 // [ foo ]
8 // nested = ; this section will be skipped
9 // a=b
10 // c=d
11 // bar=baz ; this will be included
12 type skipper struct {
13 shouldSkip bool
14 TokenSet bool
15 prevTok Token
16 }
17
18 func newSkipper() skipper {
19 return skipper{
20 prevTok: emptyToken,
21 }
22 }
23
24 func (s *skipper) ShouldSkip(tok Token) bool {
25 if s.shouldSkip &&
26 s.prevTok.Type() == TokenNL &&
27 tok.Type() != TokenWS {
28
29 s.Continue()
30 return false
31 }
32 s.prevTok = tok
33
34 return s.shouldSkip
35 }
36
37 func (s *skipper) Skip() {
38 s.shouldSkip = true
39 s.prevTok = emptyToken
40 }
41
42 func (s *skipper) Continue() {
43 s.shouldSkip = false
44 s.prevTok = emptyToken
45 }