1
0
Fork 0
mirror of https://github.com/Luzifer/yaml-vault.git synced 2024-12-30 16:51:21 +00:00
yaml-vault/vendor/github.com/hashicorp/hcl/lex.go

32 lines
417 B
Go
Raw Normal View History

2016-07-11 14:57:04 +00:00
package hcl
import (
"unicode"
)
type lexModeValue byte
const (
lexModeUnknown lexModeValue = iota
lexModeHcl
lexModeJson
)
// lexMode returns whether we're going to be parsing in JSON
// mode or HCL mode.
func lexMode(v string) lexModeValue {
for _, r := range v {
if unicode.IsSpace(r) {
continue
}
if r == '{' {
return lexModeJson
} else {
return lexModeHcl
}
}
return lexModeHcl
}