]> git.immae.eu Git - github/fretlink/terraform-provider-statuscake.git/blobdiff - vendor/github.com/hashicorp/hcl2/hcl/json/scanner.go
Upgrade to 0.12
[github/fretlink/terraform-provider-statuscake.git] / vendor / github.com / hashicorp / hcl2 / hcl / json / scanner.go
index 0a8378b9ca431ed8640577989fad8ce6ff3aa338..da728842391cbd01b38d7a4ab5747a1feae49896 100644 (file)
@@ -153,7 +153,7 @@ func byteCanStartKeyword(b byte) bool {
        // in the parser, where we can generate better diagnostics.
        // So e.g. we want to be able to say:
        //   unrecognized keyword "True". Did you mean "true"?
-       case b >= 'a' || b <= 'z' || b >= 'A' || b <= 'Z':
+       case isAlphabetical(b):
                return true
        default:
                return false
@@ -167,7 +167,7 @@ Byte:
        for i = 0; i < len(buf); i++ {
                b := buf[i]
                switch {
-               case (b >= 'a' && b <= 'z') || (b >= 'A' && b <= 'Z') || b == '_':
+               case isAlphabetical(b) || b == '_':
                        p.Pos.Byte++
                        p.Pos.Column++
                default:
@@ -291,3 +291,7 @@ func posRange(start, end pos) hcl.Range {
 func (t token) GoString() string {
        return fmt.Sprintf("json.token{json.%s, []byte(%q), %#v}", t.Type, t.Bytes, t.Range)
 }
+
+func isAlphabetical(b byte) bool {
+       return (b >= 'a' && b <= 'z') || (b >= 'A' && b <= 'Z')
+}