From 48f2d7977b714f7bead73159b869f5f95df444cc Mon Sep 17 00:00:00 2001 From: Radek Simko Date: Fri, 16 Feb 2024 12:13:58 +0000 Subject: [PATCH 1/4] deps: Track stringer@v0.6.0 as 'tools' dependency In theory we could use the latest (v0.18.0) version of the x/tools module but that would also bring upgrade of x/sys (transitive dependency of go-cty) from current v0.5.0 and full understanding of implications of that upgrade. --- go.mod | 2 ++ go.sum | 5 +++++ tools.go | 11 +++++++++++ 3 files changed, 18 insertions(+) create mode 100644 tools.go diff --git a/go.mod b/go.mod index 4c0c18c7..a8005025 100644 --- a/go.mod +++ b/go.mod @@ -17,6 +17,7 @@ require ( github.com/zclconf/go-cty v1.13.0 github.com/zclconf/go-cty-debug v0.0.0-20191215020915-b22d67c1ba0b golang.org/x/crypto v0.0.0-20220517005047-85d78b3ac167 + golang.org/x/tools v0.6.0 ) require ( @@ -24,6 +25,7 @@ require ( github.com/kr/text v0.1.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/stretchr/testify v1.2.2 // indirect + golang.org/x/mod v0.8.0 // indirect golang.org/x/sys v0.5.0 // indirect golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 // indirect golang.org/x/text v0.11.0 // indirect diff --git a/go.sum b/go.sum index a7ce4583..62014eb6 100644 --- a/go.sum +++ b/go.sum @@ -39,8 +39,11 @@ github.com/zclconf/go-cty-debug v0.0.0-20191215020915-b22d67c1ba0b h1:FosyBZYxY3 github.com/zclconf/go-cty-debug v0.0.0-20191215020915-b22d67c1ba0b/go.mod h1:ZRKQfBXbGkpdV6QMzT3rU1kSTAnfu1dO8dPKjYprgj8= golang.org/x/crypto v0.0.0-20220517005047-85d78b3ac167 h1:O8uGbHCqlTp2P6QJSLmCojM4mN6UemYv8K+dCnmHmu0= golang.org/x/crypto v0.0.0-20220517005047-85d78b3ac167/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/mod v0.8.0 h1:LUYupSeNrTNCGzR/hVBk2NHZO4hXcVaW1k4Qx7rjPx8= +golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20180811021610-c39426892332/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -49,5 +52,7 @@ golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9sn golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.11.0 h1:LAntKIrcmeSKERyiOh0XMV39LXS8IE9UL2yP7+f5ij4= golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/tools v0.6.0 h1:BOw41kyTf3PuCW1pVQf8+Cyg8pMlkYB1oo9iJ6D/lKM= +golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/tools.go b/tools.go new file mode 100644 index 00000000..e8c42ad1 --- /dev/null +++ b/tools.go @@ -0,0 +1,11 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +//go:build tools +// +build tools + +package hcl + +import ( + _ "golang.org/x/tools/cmd/stringer" +) From 2f101e25ef30214dda9bf95fa84a3f68123cf717 Mon Sep 17 00:00:00 2001 From: Radek Simko Date: Fri, 16 Feb 2024 11:20:40 +0000 Subject: [PATCH 2/4] hclsyntax: Add license headers to generated code --- hclsyntax/expression_vars_gen.go | 5 ++++- hclsyntax/scan_string_lit.rl | 2 ++ hclsyntax/scan_tokens.rl | 2 ++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/hclsyntax/expression_vars_gen.go b/hclsyntax/expression_vars_gen.go index 6ab79276..efbc2d82 100644 --- a/hclsyntax/expression_vars_gen.go +++ b/hclsyntax/expression_vars_gen.go @@ -87,7 +87,10 @@ func main() { } -const outputPreamble = `package hclsyntax +const outputPreamble = `// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package hclsyntax // Generated by expression_vars_get.go. DO NOT EDIT. // Run 'go generate' on this package to update the set of functions here. diff --git a/hclsyntax/scan_string_lit.rl b/hclsyntax/scan_string_lit.rl index f8ac1175..21d2c8bc 100644 --- a/hclsyntax/scan_string_lit.rl +++ b/hclsyntax/scan_string_lit.rl @@ -1,3 +1,5 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 package hclsyntax diff --git a/hclsyntax/scan_tokens.rl b/hclsyntax/scan_tokens.rl index 8d1e08af..66bb4714 100644 --- a/hclsyntax/scan_tokens.rl +++ b/hclsyntax/scan_tokens.rl @@ -1,3 +1,5 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 package hclsyntax From a5c83525bd12ef63dbcaed9fef7e77ab9cdecdf5 Mon Sep 17 00:00:00 2001 From: Radek Simko Date: Fri, 16 Feb 2024 12:04:58 +0000 Subject: [PATCH 3/4] go generate ./... --- hclsyntax/scan_string_lit.go | 25 +++-- hclsyntax/scan_tokens.go | 187 ++++++++++++++++----------------- hclsyntax/token_type_string.go | 63 ++++++++++- json/tokentype_string.go | 18 ++++ 4 files changed, 185 insertions(+), 108 deletions(-) diff --git a/hclsyntax/scan_string_lit.go b/hclsyntax/scan_string_lit.go index 5d60ff5a..6b44d992 100644 --- a/hclsyntax/scan_string_lit.go +++ b/hclsyntax/scan_string_lit.go @@ -1,13 +1,12 @@ +//line scan_string_lit.rl:1 // Copyright (c) HashiCorp, Inc. // SPDX-License-Identifier: MPL-2.0 -//line scan_string_lit.rl:1 - package hclsyntax // This file is generated from scan_string_lit.rl. DO NOT EDIT. -//line scan_string_lit.go:9 +//line scan_string_lit.go:11 var _hclstrtok_actions []byte = []byte{ 0, 1, 0, 1, 1, 2, 1, 0, } @@ -117,12 +116,12 @@ const hclstrtok_error int = 0 const hclstrtok_en_quoted int = 10 const hclstrtok_en_unquoted int = 4 -//line scan_string_lit.rl:10 +//line scan_string_lit.rl:12 func scanStringLit(data []byte, quoted bool) [][]byte { var ret [][]byte -//line scan_string_lit.rl:61 +//line scan_string_lit.rl:63 // Ragel state p := 0 // "Pointer" into data @@ -147,11 +146,11 @@ func scanStringLit(data []byte, quoted bool) [][]byte { ret = append(ret, data[ts:te]) }*/ -//line scan_string_lit.go:154 +//line scan_string_lit.go:156 { } -//line scan_string_lit.go:158 +//line scan_string_lit.go:160 { var _klen int var _trans int @@ -232,7 +231,7 @@ func scanStringLit(data []byte, quoted bool) [][]byte { _acts++ switch _hclstrtok_actions[_acts-1] { case 0: -//line scan_string_lit.rl:40 +//line scan_string_lit.rl:42 // If te is behind p then we've skipped over some literal // characters which we must now return. @@ -242,12 +241,12 @@ func scanStringLit(data []byte, quoted bool) [][]byte { ts = p case 1: -//line scan_string_lit.rl:48 +//line scan_string_lit.rl:50 te = p ret = append(ret, data[ts:te]) -//line scan_string_lit.go:253 +//line scan_string_lit.go:255 } } @@ -270,12 +269,12 @@ func scanStringLit(data []byte, quoted bool) [][]byte { __acts++ switch _hclstrtok_actions[__acts-1] { case 1: -//line scan_string_lit.rl:48 +//line scan_string_lit.rl:50 te = p ret = append(ret, data[ts:te]) -//line scan_string_lit.go:278 +//line scan_string_lit.go:280 } } } @@ -285,7 +284,7 @@ func scanStringLit(data []byte, quoted bool) [][]byte { } } -//line scan_string_lit.rl:89 +//line scan_string_lit.rl:91 if te < p { // Collect any leftover literal characters at the end of the input diff --git a/hclsyntax/scan_tokens.go b/hclsyntax/scan_tokens.go index 3691f115..3ed8455f 100644 --- a/hclsyntax/scan_tokens.go +++ b/hclsyntax/scan_tokens.go @@ -1,8 +1,7 @@ +//line scan_tokens.rl:1 // Copyright (c) HashiCorp, Inc. // SPDX-License-Identifier: MPL-2.0 -//line scan_tokens.rl:1 - package hclsyntax import ( @@ -13,7 +12,7 @@ import ( // This file is generated from scan_tokens.rl. DO NOT EDIT. -//line scan_tokens.go:15 +//line scan_tokens.go:17 var _hcltok_actions []byte = []byte{ 0, 1, 0, 1, 1, 1, 3, 1, 4, 1, 7, 1, 8, 1, 9, 1, 10, @@ -263,7 +262,7 @@ var _hcltok_trans_keys []byte = []byte{ 233, 234, 237, 239, 240, 243, 48, 57, 65, 90, 97, 122, 196, 218, 229, 236, 10, 170, 181, 183, 186, 128, 150, 152, - 182, 184, 255, 192, 255, 128, 255, 173, + 182, 184, 255, 192, 255, 0, 127, 173, 130, 133, 146, 159, 165, 171, 175, 255, 181, 190, 184, 185, 192, 255, 140, 134, 138, 142, 161, 163, 255, 182, 130, 136, @@ -572,7 +571,7 @@ var _hcltok_trans_keys []byte = []byte{ 150, 153, 131, 140, 255, 160, 163, 164, 165, 184, 185, 186, 161, 162, 133, 255, 170, 181, 183, 186, 128, 150, 152, 182, - 184, 255, 192, 255, 128, 255, 173, 130, + 184, 255, 192, 255, 0, 127, 173, 130, 133, 146, 159, 165, 171, 175, 255, 181, 190, 184, 185, 192, 255, 140, 134, 138, 142, 161, 163, 255, 182, 130, 136, 137, @@ -2165,7 +2164,7 @@ var _hcltok_indicies []int16 = []int16{ 61, 62, 37, 39, 63, 41, 64, 65, 66, 11, 11, 11, 14, 38, 0, 44, 0, 11, 11, 11, 11, 0, 11, 11, - 11, 0, 11, 0, 11, 11, 0, 0, + 11, 0, 11, 0, 11, 0, 11, 0, 0, 0, 0, 0, 11, 0, 0, 0, 0, 11, 11, 11, 11, 11, 0, 0, 11, 0, 0, 11, 0, 11, 0, 0, @@ -2418,7 +2417,7 @@ var _hcltok_indicies []int16 = []int16{ 11, 16, 417, 16, 265, 300, 301, 302, 14, 0, 0, 11, 419, 419, 419, 419, 418, 419, 419, 419, 418, 419, 418, 419, - 419, 418, 418, 418, 418, 418, 418, 419, + 418, 419, 418, 418, 418, 418, 418, 419, 418, 418, 418, 418, 419, 419, 419, 419, 419, 418, 418, 419, 418, 418, 419, 418, 419, 418, 418, 419, 418, 418, 418, 419, @@ -4218,7 +4217,7 @@ const hcltok_en_bareTemplate int = 1535 const hcltok_en_identOnly int = 1546 const hcltok_en_main int = 1459 -//line scan_tokens.rl:16 +//line scan_tokens.rl:18 func scanTokens(data []byte, filename string, start hcl.Pos, mode scanMode) []Token { stripData := stripUTF8BOM(data) @@ -4232,7 +4231,7 @@ func scanTokens(data []byte, filename string, start hcl.Pos, mode scanMode) []To StartByte: start.Byte, } -//line scan_tokens.rl:315 +//line scan_tokens.rl:317 // Ragel state p := 0 // "Pointer" into data @@ -4260,7 +4259,7 @@ func scanTokens(data []byte, filename string, start hcl.Pos, mode scanMode) []To var retBraces []int // stack of brace levels that cause us to use fret var heredocs []heredocInProgress // stack of heredocs we're currently processing -//line scan_tokens.rl:350 +//line scan_tokens.rl:352 // Make Go compiler happy _ = ts @@ -4280,7 +4279,7 @@ func scanTokens(data []byte, filename string, start hcl.Pos, mode scanMode) []To f.emitToken(TokenType(b[0]), ts, te) } -//line scan_tokens.go:4290 +//line scan_tokens.go:4292 { top = 0 ts = 0 @@ -4288,7 +4287,7 @@ func scanTokens(data []byte, filename string, start hcl.Pos, mode scanMode) []To act = 0 } -//line scan_tokens.go:4298 +//line scan_tokens.go:4300 { var _klen int var _trans int @@ -4312,7 +4311,7 @@ func scanTokens(data []byte, filename string, start hcl.Pos, mode scanMode) []To //line NONE:1 ts = p -//line scan_tokens.go:4321 +//line scan_tokens.go:4323 } } @@ -4384,7 +4383,7 @@ func scanTokens(data []byte, filename string, start hcl.Pos, mode scanMode) []To _acts++ switch _hcltok_actions[_acts-1] { case 0: -//line scan_tokens.rl:233 +//line scan_tokens.rl:235 p-- case 4: @@ -4392,13 +4391,13 @@ func scanTokens(data []byte, filename string, start hcl.Pos, mode scanMode) []To te = p + 1 case 5: -//line scan_tokens.rl:257 +//line scan_tokens.rl:259 act = 4 case 6: -//line scan_tokens.rl:259 +//line scan_tokens.rl:261 act = 6 case 7: -//line scan_tokens.rl:169 +//line scan_tokens.rl:171 te = p + 1 { token(TokenTemplateInterp) @@ -4416,7 +4415,7 @@ func scanTokens(data []byte, filename string, start hcl.Pos, mode scanMode) []To } } case 8: -//line scan_tokens.rl:179 +//line scan_tokens.rl:181 te = p + 1 { token(TokenTemplateControl) @@ -4434,7 +4433,7 @@ func scanTokens(data []byte, filename string, start hcl.Pos, mode scanMode) []To } } case 9: -//line scan_tokens.rl:93 +//line scan_tokens.rl:95 te = p + 1 { token(TokenCQuote) @@ -4447,19 +4446,19 @@ func scanTokens(data []byte, filename string, start hcl.Pos, mode scanMode) []To } case 10: -//line scan_tokens.rl:257 +//line scan_tokens.rl:259 te = p + 1 { token(TokenQuotedLit) } case 11: -//line scan_tokens.rl:260 +//line scan_tokens.rl:262 te = p + 1 { token(TokenBadUTF8) } case 12: -//line scan_tokens.rl:169 +//line scan_tokens.rl:171 te = p p-- { @@ -4478,7 +4477,7 @@ func scanTokens(data []byte, filename string, start hcl.Pos, mode scanMode) []To } } case 13: -//line scan_tokens.rl:179 +//line scan_tokens.rl:181 te = p p-- { @@ -4497,41 +4496,41 @@ func scanTokens(data []byte, filename string, start hcl.Pos, mode scanMode) []To } } case 14: -//line scan_tokens.rl:257 +//line scan_tokens.rl:259 te = p p-- { token(TokenQuotedLit) } case 15: -//line scan_tokens.rl:258 +//line scan_tokens.rl:260 te = p p-- { token(TokenQuotedNewline) } case 16: -//line scan_tokens.rl:259 +//line scan_tokens.rl:261 te = p p-- { token(TokenInvalid) } case 17: -//line scan_tokens.rl:260 +//line scan_tokens.rl:262 te = p p-- { token(TokenBadUTF8) } case 18: -//line scan_tokens.rl:257 +//line scan_tokens.rl:259 p = (te) - 1 { token(TokenQuotedLit) } case 19: -//line scan_tokens.rl:260 +//line scan_tokens.rl:262 p = (te) - 1 { token(TokenBadUTF8) @@ -4552,13 +4551,13 @@ func scanTokens(data []byte, filename string, start hcl.Pos, mode scanMode) []To } case 21: -//line scan_tokens.rl:157 +//line scan_tokens.rl:159 act = 11 case 22: -//line scan_tokens.rl:268 +//line scan_tokens.rl:270 act = 12 case 23: -//line scan_tokens.rl:169 +//line scan_tokens.rl:171 te = p + 1 { token(TokenTemplateInterp) @@ -4576,7 +4575,7 @@ func scanTokens(data []byte, filename string, start hcl.Pos, mode scanMode) []To } } case 24: -//line scan_tokens.rl:179 +//line scan_tokens.rl:181 te = p + 1 { token(TokenTemplateControl) @@ -4594,7 +4593,7 @@ func scanTokens(data []byte, filename string, start hcl.Pos, mode scanMode) []To } } case 25: -//line scan_tokens.rl:120 +//line scan_tokens.rl:122 te = p + 1 { // This action is called specificially when a heredoc literal @@ -4639,13 +4638,13 @@ func scanTokens(data []byte, filename string, start hcl.Pos, mode scanMode) []To token(TokenStringLit) } case 26: -//line scan_tokens.rl:268 +//line scan_tokens.rl:270 te = p + 1 { token(TokenBadUTF8) } case 27: -//line scan_tokens.rl:169 +//line scan_tokens.rl:171 te = p p-- { @@ -4664,7 +4663,7 @@ func scanTokens(data []byte, filename string, start hcl.Pos, mode scanMode) []To } } case 28: -//line scan_tokens.rl:179 +//line scan_tokens.rl:181 te = p p-- { @@ -4683,7 +4682,7 @@ func scanTokens(data []byte, filename string, start hcl.Pos, mode scanMode) []To } } case 29: -//line scan_tokens.rl:157 +//line scan_tokens.rl:159 te = p p-- { @@ -4694,14 +4693,14 @@ func scanTokens(data []byte, filename string, start hcl.Pos, mode scanMode) []To token(TokenStringLit) } case 30: -//line scan_tokens.rl:268 +//line scan_tokens.rl:270 te = p p-- { token(TokenBadUTF8) } case 31: -//line scan_tokens.rl:157 +//line scan_tokens.rl:159 p = (te) - 1 { // This action is called when a heredoc literal _doesn't_ end @@ -4736,13 +4735,13 @@ func scanTokens(data []byte, filename string, start hcl.Pos, mode scanMode) []To } case 33: -//line scan_tokens.rl:165 +//line scan_tokens.rl:167 act = 15 case 34: -//line scan_tokens.rl:275 +//line scan_tokens.rl:277 act = 16 case 35: -//line scan_tokens.rl:169 +//line scan_tokens.rl:171 te = p + 1 { token(TokenTemplateInterp) @@ -4760,7 +4759,7 @@ func scanTokens(data []byte, filename string, start hcl.Pos, mode scanMode) []To } } case 36: -//line scan_tokens.rl:179 +//line scan_tokens.rl:181 te = p + 1 { token(TokenTemplateControl) @@ -4778,19 +4777,19 @@ func scanTokens(data []byte, filename string, start hcl.Pos, mode scanMode) []To } } case 37: -//line scan_tokens.rl:165 +//line scan_tokens.rl:167 te = p + 1 { token(TokenStringLit) } case 38: -//line scan_tokens.rl:275 +//line scan_tokens.rl:277 te = p + 1 { token(TokenBadUTF8) } case 39: -//line scan_tokens.rl:169 +//line scan_tokens.rl:171 te = p p-- { @@ -4809,7 +4808,7 @@ func scanTokens(data []byte, filename string, start hcl.Pos, mode scanMode) []To } } case 40: -//line scan_tokens.rl:179 +//line scan_tokens.rl:181 te = p p-- { @@ -4828,21 +4827,21 @@ func scanTokens(data []byte, filename string, start hcl.Pos, mode scanMode) []To } } case 41: -//line scan_tokens.rl:165 +//line scan_tokens.rl:167 te = p p-- { token(TokenStringLit) } case 42: -//line scan_tokens.rl:275 +//line scan_tokens.rl:277 te = p p-- { token(TokenBadUTF8) } case 43: -//line scan_tokens.rl:165 +//line scan_tokens.rl:167 p = (te) - 1 { token(TokenStringLit) @@ -4869,45 +4868,45 @@ func scanTokens(data []byte, filename string, start hcl.Pos, mode scanMode) []To } case 45: -//line scan_tokens.rl:279 +//line scan_tokens.rl:281 act = 17 case 46: -//line scan_tokens.rl:280 +//line scan_tokens.rl:282 act = 18 case 47: -//line scan_tokens.rl:280 +//line scan_tokens.rl:282 te = p + 1 { token(TokenBadUTF8) } case 48: -//line scan_tokens.rl:281 +//line scan_tokens.rl:283 te = p + 1 { token(TokenInvalid) } case 49: -//line scan_tokens.rl:279 +//line scan_tokens.rl:281 te = p p-- { token(TokenIdent) } case 50: -//line scan_tokens.rl:280 +//line scan_tokens.rl:282 te = p p-- { token(TokenBadUTF8) } case 51: -//line scan_tokens.rl:279 +//line scan_tokens.rl:281 p = (te) - 1 { token(TokenIdent) } case 52: -//line scan_tokens.rl:280 +//line scan_tokens.rl:282 p = (te) - 1 { token(TokenBadUTF8) @@ -4928,92 +4927,92 @@ func scanTokens(data []byte, filename string, start hcl.Pos, mode scanMode) []To } case 54: -//line scan_tokens.rl:287 +//line scan_tokens.rl:289 act = 22 case 55: -//line scan_tokens.rl:311 +//line scan_tokens.rl:313 act = 40 case 56: -//line scan_tokens.rl:289 +//line scan_tokens.rl:291 te = p + 1 { token(TokenComment) } case 57: -//line scan_tokens.rl:290 +//line scan_tokens.rl:292 te = p + 1 { token(TokenNewline) } case 58: -//line scan_tokens.rl:292 +//line scan_tokens.rl:294 te = p + 1 { token(TokenEqualOp) } case 59: -//line scan_tokens.rl:293 +//line scan_tokens.rl:295 te = p + 1 { token(TokenNotEqual) } case 60: -//line scan_tokens.rl:294 +//line scan_tokens.rl:296 te = p + 1 { token(TokenGreaterThanEq) } case 61: -//line scan_tokens.rl:295 +//line scan_tokens.rl:297 te = p + 1 { token(TokenLessThanEq) } case 62: -//line scan_tokens.rl:296 +//line scan_tokens.rl:298 te = p + 1 { token(TokenAnd) } case 63: -//line scan_tokens.rl:297 +//line scan_tokens.rl:299 te = p + 1 { token(TokenOr) } case 64: -//line scan_tokens.rl:298 +//line scan_tokens.rl:300 te = p + 1 { token(TokenDoubleColon) } case 65: -//line scan_tokens.rl:299 +//line scan_tokens.rl:301 te = p + 1 { token(TokenEllipsis) } case 66: -//line scan_tokens.rl:300 +//line scan_tokens.rl:302 te = p + 1 { token(TokenFatArrow) } case 67: -//line scan_tokens.rl:301 +//line scan_tokens.rl:303 te = p + 1 { selfToken() } case 68: -//line scan_tokens.rl:189 +//line scan_tokens.rl:191 te = p + 1 { token(TokenOBrace) braces++ } case 69: -//line scan_tokens.rl:194 +//line scan_tokens.rl:196 te = p + 1 { if len(retBraces) > 0 && retBraces[len(retBraces)-1] == braces { @@ -5033,7 +5032,7 @@ func scanTokens(data []byte, filename string, start hcl.Pos, mode scanMode) []To } } case 70: -//line scan_tokens.rl:206 +//line scan_tokens.rl:208 te = p + 1 { // Only consume from the retBraces stack and return if we are at @@ -5062,7 +5061,7 @@ func scanTokens(data []byte, filename string, start hcl.Pos, mode scanMode) []To } } case 71: -//line scan_tokens.rl:88 +//line scan_tokens.rl:90 te = p + 1 { token(TokenOQuote) @@ -5075,7 +5074,7 @@ func scanTokens(data []byte, filename string, start hcl.Pos, mode scanMode) []To } } case 72: -//line scan_tokens.rl:98 +//line scan_tokens.rl:100 te = p + 1 { token(TokenOHeredoc) @@ -5105,84 +5104,84 @@ func scanTokens(data []byte, filename string, start hcl.Pos, mode scanMode) []To } } case 73: -//line scan_tokens.rl:311 +//line scan_tokens.rl:313 te = p + 1 { token(TokenBadUTF8) } case 74: -//line scan_tokens.rl:312 +//line scan_tokens.rl:314 te = p + 1 { token(TokenInvalid) } case 75: -//line scan_tokens.rl:285 +//line scan_tokens.rl:287 te = p p-- case 76: -//line scan_tokens.rl:286 +//line scan_tokens.rl:288 te = p p-- { token(TokenNumberLit) } case 77: -//line scan_tokens.rl:287 +//line scan_tokens.rl:289 te = p p-- { token(TokenIdent) } case 78: -//line scan_tokens.rl:289 +//line scan_tokens.rl:291 te = p p-- { token(TokenComment) } case 79: -//line scan_tokens.rl:301 +//line scan_tokens.rl:303 te = p p-- { selfToken() } case 80: -//line scan_tokens.rl:311 +//line scan_tokens.rl:313 te = p p-- { token(TokenBadUTF8) } case 81: -//line scan_tokens.rl:312 +//line scan_tokens.rl:314 te = p p-- { token(TokenInvalid) } case 82: -//line scan_tokens.rl:286 +//line scan_tokens.rl:288 p = (te) - 1 { token(TokenNumberLit) } case 83: -//line scan_tokens.rl:287 +//line scan_tokens.rl:289 p = (te) - 1 { token(TokenIdent) } case 84: -//line scan_tokens.rl:301 +//line scan_tokens.rl:303 p = (te) - 1 { selfToken() } case 85: -//line scan_tokens.rl:311 +//line scan_tokens.rl:313 p = (te) - 1 { token(TokenBadUTF8) @@ -5202,7 +5201,7 @@ func scanTokens(data []byte, filename string, start hcl.Pos, mode scanMode) []To } } -//line scan_tokens.go:5060 +//line scan_tokens.go:5062 } } @@ -5221,7 +5220,7 @@ func scanTokens(data []byte, filename string, start hcl.Pos, mode scanMode) []To //line NONE:1 act = 0 -//line scan_tokens.go:5078 +//line scan_tokens.go:5080 } } @@ -5247,7 +5246,7 @@ func scanTokens(data []byte, filename string, start hcl.Pos, mode scanMode) []To } } -//line scan_tokens.rl:373 +//line scan_tokens.rl:375 // If we fall out here without being in a final state then we've // encountered something that the scanner can't match, which we'll diff --git a/hclsyntax/token_type_string.go b/hclsyntax/token_type_string.go index 5a2cd4eb..1453389c 100644 --- a/hclsyntax/token_type_string.go +++ b/hclsyntax/token_type_string.go @@ -1,9 +1,70 @@ -// Code generated by "stringer -type TokenType -output token_type_string.go"; DO NOT EDIT. +// Code generated by "stringer -type TokenType -output token_type_string.go token_type.go"; DO NOT EDIT. package hclsyntax import "strconv" +func _() { + // An "invalid array index" compiler error signifies that the constant values (55) have changed. + // Re-run the stringer command to generate them again. + var x [1]struct{} + _ = x[TokenOBrace-123] + _ = x[TokenCBrace-125] + _ = x[TokenOBrack-91] + _ = x[TokenCBrack-93] + _ = x[TokenOParen-40] + _ = x[TokenCParen-41] + _ = x[TokenOQuote-171] + _ = x[TokenCQuote-187] + _ = x[TokenOHeredoc-72] + _ = x[TokenCHeredoc-104] + _ = x[TokenStar-42] + _ = x[TokenSlash-47] + _ = x[TokenPlus-43] + _ = x[TokenMinus-45] + _ = x[TokenPercent-37] + _ = x[TokenEqual-61] + _ = x[TokenEqualOp-8788] + _ = x[TokenNotEqual-8800] + _ = x[TokenLessThan-60] + _ = x[TokenLessThanEq-8804] + _ = x[TokenGreaterThan-62] + _ = x[TokenGreaterThanEq-8805] + _ = x[TokenAnd-8743] + _ = x[TokenOr-8744] + _ = x[TokenBang-33] + _ = x[TokenDot-46] + _ = x[TokenComma-44] + _ = x[TokenDoubleColon-11820] + _ = x[TokenEllipsis-8230] + _ = x[TokenFatArrow-8658] + _ = x[TokenQuestion-63] + _ = x[TokenColon-58] + _ = x[TokenTemplateInterp-8747] + _ = x[TokenTemplateControl-955] + _ = x[TokenTemplateSeqEnd-8718] + _ = x[TokenQuotedLit-81] + _ = x[TokenStringLit-83] + _ = x[TokenNumberLit-78] + _ = x[TokenIdent-73] + _ = x[TokenComment-67] + _ = x[TokenNewline-10] + _ = x[TokenEOF-9220] + _ = x[TokenBitwiseAnd-38] + _ = x[TokenBitwiseOr-124] + _ = x[TokenBitwiseNot-126] + _ = x[TokenBitwiseXor-94] + _ = x[TokenStarStar-10138] + _ = x[TokenApostrophe-39] + _ = x[TokenBacktick-96] + _ = x[TokenSemicolon-59] + _ = x[TokenTabs-9225] + _ = x[TokenInvalid-65533] + _ = x[TokenBadUTF8-128169] + _ = x[TokenQuotedNewline-9252] + _ = x[TokenNil-0] +} + const _TokenType_name = "TokenNilTokenNewlineTokenBangTokenPercentTokenBitwiseAndTokenApostropheTokenOParenTokenCParenTokenStarTokenPlusTokenCommaTokenMinusTokenDotTokenSlashTokenColonTokenSemicolonTokenLessThanTokenEqualTokenGreaterThanTokenQuestionTokenCommentTokenOHeredocTokenIdentTokenNumberLitTokenQuotedLitTokenStringLitTokenOBrackTokenCBrackTokenBitwiseXorTokenBacktickTokenCHeredocTokenOBraceTokenBitwiseOrTokenCBraceTokenBitwiseNotTokenOQuoteTokenCQuoteTokenTemplateControlTokenEllipsisTokenFatArrowTokenTemplateSeqEndTokenAndTokenOrTokenTemplateInterpTokenEqualOpTokenNotEqualTokenLessThanEqTokenGreaterThanEqTokenEOFTokenTabsTokenQuotedNewlineTokenStarStarTokenDoubleColonTokenInvalidTokenBadUTF8" var _TokenType_map = map[TokenType]string{ diff --git a/json/tokentype_string.go b/json/tokentype_string.go index bbcce5b3..82bd7407 100644 --- a/json/tokentype_string.go +++ b/json/tokentype_string.go @@ -4,6 +4,24 @@ package json import "strconv" +func _() { + // An "invalid array index" compiler error signifies that the constant values have changed. + // Re-run the stringer command to generate them again. + var x [1]struct{} + _ = x[tokenBraceO-123] + _ = x[tokenBraceC-125] + _ = x[tokenBrackO-91] + _ = x[tokenBrackC-93] + _ = x[tokenComma-44] + _ = x[tokenColon-58] + _ = x[tokenKeyword-75] + _ = x[tokenString-83] + _ = x[tokenNumber-78] + _ = x[tokenEOF-9220] + _ = x[tokenInvalid-0] + _ = x[tokenEquals-61] +} + const _tokenType_name = "tokenInvalidtokenCommatokenColontokenEqualstokenKeywordtokenNumbertokenStringtokenBrackOtokenBrackCtokenBraceOtokenBraceCtokenEOF" var _tokenType_map = map[tokenType]string{ From 0f84b5260517f5ee4a2abdb0fb8da7f6d9c53662 Mon Sep 17 00:00:00 2001 From: Radek Simko Date: Fri, 16 Feb 2024 12:20:40 +0000 Subject: [PATCH 4/4] add missing copywrite headers --- ext/dynblock/options.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ext/dynblock/options.go b/ext/dynblock/options.go index fc7dc0bd..82d85865 100644 --- a/ext/dynblock/options.go +++ b/ext/dynblock/options.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package dynblock import (