Source File
visitor.go
Belonging Package
github.com/aws/aws-sdk-go/internal/ini
package ini
import (
)
type DefaultVisitor struct {
scope string
Sections Sections
}
func () *DefaultVisitor {
return &DefaultVisitor{
Sections: Sections{
container: map[string]Section{},
},
}
}
func ( *DefaultVisitor) ( AST) error {
:= .Sections.container[.scope]
if .values == nil {
.values = values{}
}
switch .Kind {
case ASTKindExprStatement:
:= .GetRoot()
switch .Kind {
case ASTKindEqualExpr:
:= .GetChildren()
if len() <= 1 {
return NewParseError("unexpected token type")
}
:= [1]
if .Root.Type() != TokenLit {
return NewParseError("unexpected token type")
}
:= EqualExprKey()
, := newValue(.Root.ValueType, .Root.base, .Root.Raw())
if != nil {
return
}
.values[] =
default:
return NewParseError(fmt.Sprintf("unsupported expression %v", ))
}
default:
return NewParseError(fmt.Sprintf("unsupported expression %v", ))
}
.Sections.container[.scope] =
return nil
}
func ( *DefaultVisitor) ( AST) error {
switch .Kind {
case ASTKindCompletedSectionStatement:
:= .GetRoot()
if .Kind != ASTKindSectionStatement {
return NewParseError(fmt.Sprintf("unsupported child statement: %T", ))
}
:= string(.Root.Raw())
.Sections.container[] = Section{}
.scope =
default:
return NewParseError(fmt.Sprintf("unsupported statement: %s", .Kind))
}
return nil
}
func ( Section) ( string) float64 {
return .values[].FloatValue()
}
![]() |
The pages are generated with Golds v0.3.2-preview. (GOOS=darwin GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |