Merge pull request #18826 from containers/renovate/github.com-burntsushi-toml-1.x

fix(deps): update module github.com/burntsushi/toml to v1.3.2
This commit is contained in:
OpenShift Merge Robot
2023-06-08 10:08:44 -04:00
committed by GitHub
6 changed files with 33 additions and 32 deletions

2
go.mod
View File

@ -3,7 +3,7 @@ module github.com/containers/podman/v4
go 1.18 go 1.18
require ( require (
github.com/BurntSushi/toml v1.3.1 github.com/BurntSushi/toml v1.3.2
github.com/Microsoft/go-winio v0.6.1 github.com/Microsoft/go-winio v0.6.1
github.com/blang/semver/v4 v4.0.0 github.com/blang/semver/v4 v4.0.0
github.com/buger/goterm v1.0.4 github.com/buger/goterm v1.0.4

4
go.sum
View File

@ -43,8 +43,8 @@ github.com/Azure/go-autorest/tracing v0.6.0/go.mod h1:+vhtPC754Xsa23ID7GlGsrdKBp
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/toml v1.2.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= github.com/BurntSushi/toml v1.2.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
github.com/BurntSushi/toml v1.2.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= github.com/BurntSushi/toml v1.2.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
github.com/BurntSushi/toml v1.3.1 h1:rHnDkSK+/g6DlREUK73PkmIs60pqrnuduK+JmP++JmU= github.com/BurntSushi/toml v1.3.2 h1:o7IhLm0Msx3BaB+n3Ag7L8EVlByGnpq14C4YWiu/gL8=
github.com/BurntSushi/toml v1.3.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= github.com/BurntSushi/toml v1.3.2/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/Microsoft/go-winio v0.4.11/go.mod h1:VhR8bwka0BXejwEJY73c50VrPtXAaKcyvVC4A4RozmA= github.com/Microsoft/go-winio v0.4.11/go.mod h1:VhR8bwka0BXejwEJY73c50VrPtXAaKcyvVC4A4RozmA=
github.com/Microsoft/go-winio v0.4.14/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA= github.com/Microsoft/go-winio v0.4.14/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA=

View File

@ -52,6 +52,7 @@ type lexer struct {
line int line int
state stateFn state stateFn
items chan item items chan item
tomlNext bool
// Allow for backing up up to 4 runes. This is necessary because TOML // Allow for backing up up to 4 runes. This is necessary because TOML
// contains 3-rune tokens (""" and '''). // contains 3-rune tokens (""" and ''').
@ -87,13 +88,14 @@ func (lx *lexer) nextItem() item {
} }
} }
func lex(input string) *lexer { func lex(input string, tomlNext bool) *lexer {
lx := &lexer{ lx := &lexer{
input: input, input: input,
state: lexTop, state: lexTop,
items: make(chan item, 10), items: make(chan item, 10),
stack: make([]stateFn, 0, 10), stack: make([]stateFn, 0, 10),
line: 1, line: 1,
tomlNext: tomlNext,
} }
return lx return lx
} }
@ -408,7 +410,7 @@ func lexTableNameEnd(lx *lexer) stateFn {
// Lexes only one part, e.g. only 'a' inside 'a.b'. // Lexes only one part, e.g. only 'a' inside 'a.b'.
func lexBareName(lx *lexer) stateFn { func lexBareName(lx *lexer) stateFn {
r := lx.next() r := lx.next()
if isBareKeyChar(r) { if isBareKeyChar(r, lx.tomlNext) {
return lexBareName return lexBareName
} }
lx.backup() lx.backup()
@ -618,7 +620,7 @@ func lexInlineTableValue(lx *lexer) stateFn {
case isWhitespace(r): case isWhitespace(r):
return lexSkip(lx, lexInlineTableValue) return lexSkip(lx, lexInlineTableValue)
case isNL(r): case isNL(r):
if tomlNext { if lx.tomlNext {
return lexSkip(lx, lexInlineTableValue) return lexSkip(lx, lexInlineTableValue)
} }
return lx.errorPrevLine(errLexInlineTableNL{}) return lx.errorPrevLine(errLexInlineTableNL{})
@ -643,7 +645,7 @@ func lexInlineTableValueEnd(lx *lexer) stateFn {
case isWhitespace(r): case isWhitespace(r):
return lexSkip(lx, lexInlineTableValueEnd) return lexSkip(lx, lexInlineTableValueEnd)
case isNL(r): case isNL(r):
if tomlNext { if lx.tomlNext {
return lexSkip(lx, lexInlineTableValueEnd) return lexSkip(lx, lexInlineTableValueEnd)
} }
return lx.errorPrevLine(errLexInlineTableNL{}) return lx.errorPrevLine(errLexInlineTableNL{})
@ -654,7 +656,7 @@ func lexInlineTableValueEnd(lx *lexer) stateFn {
lx.ignore() lx.ignore()
lx.skip(isWhitespace) lx.skip(isWhitespace)
if lx.peek() == '}' { if lx.peek() == '}' {
if tomlNext { if lx.tomlNext {
return lexInlineTableValueEnd return lexInlineTableValueEnd
} }
return lx.errorf("trailing comma not allowed in inline tables") return lx.errorf("trailing comma not allowed in inline tables")
@ -838,7 +840,7 @@ func lexStringEscape(lx *lexer) stateFn {
r := lx.next() r := lx.next()
switch r { switch r {
case 'e': case 'e':
if !tomlNext { if !lx.tomlNext {
return lx.error(errLexEscape{r}) return lx.error(errLexEscape{r})
} }
fallthrough fallthrough
@ -861,7 +863,7 @@ func lexStringEscape(lx *lexer) stateFn {
case '\\': case '\\':
return lx.pop() return lx.pop()
case 'x': case 'x':
if !tomlNext { if !lx.tomlNext {
return lx.error(errLexEscape{r}) return lx.error(errLexEscape{r})
} }
return lexHexEscape return lexHexEscape
@ -1258,7 +1260,7 @@ func isHexadecimal(r rune) bool {
return (r >= '0' && r <= '9') || (r >= 'a' && r <= 'f') || (r >= 'A' && r <= 'F') return (r >= '0' && r <= '9') || (r >= 'a' && r <= 'f') || (r >= 'A' && r <= 'F')
} }
func isBareKeyChar(r rune) bool { func isBareKeyChar(r rune, tomlNext bool) bool {
if tomlNext { if tomlNext {
return (r >= 'A' && r <= 'Z') || return (r >= 'A' && r <= 'Z') ||
(r >= 'a' && r <= 'z') || (r >= 'a' && r <= 'z') ||

View File

@ -106,7 +106,7 @@ func (k Key) maybeQuoted(i int) string {
return `""` return `""`
} }
for _, c := range k[i] { for _, c := range k[i] {
if !isBareKeyChar(c) { if !isBareKeyChar(c, false) {
return `"` + dblQuotedReplacer.Replace(k[i]) + `"` return `"` + dblQuotedReplacer.Replace(k[i]) + `"`
} }
} }

View File

@ -11,13 +11,12 @@ import (
"github.com/BurntSushi/toml/internal" "github.com/BurntSushi/toml/internal"
) )
var tomlNext bool
type parser struct { type parser struct {
lx *lexer lx *lexer
context Key // Full key for the current hash in scope. context Key // Full key for the current hash in scope.
currentKey string // Base key name for everything except hashes. currentKey string // Base key name for everything except hashes.
pos Position // Current position in the TOML file. pos Position // Current position in the TOML file.
tomlNext bool
ordered []Key // List of keys in the order that they appear in the TOML data. ordered []Key // List of keys in the order that they appear in the TOML data.
@ -32,8 +31,7 @@ type keyInfo struct {
} }
func parse(data string) (p *parser, err error) { func parse(data string) (p *parser, err error) {
_, ok := os.LookupEnv("BURNTSUSHI_TOML_110") _, tomlNext := os.LookupEnv("BURNTSUSHI_TOML_110")
tomlNext = ok
defer func() { defer func() {
if r := recover(); r != nil { if r := recover(); r != nil {
@ -74,9 +72,10 @@ func parse(data string) (p *parser, err error) {
p = &parser{ p = &parser{
keyInfo: make(map[string]keyInfo), keyInfo: make(map[string]keyInfo),
mapping: make(map[string]interface{}), mapping: make(map[string]interface{}),
lx: lex(data), lx: lex(data, tomlNext),
ordered: make([]Key, 0), ordered: make([]Key, 0),
implicits: make(map[string]struct{}), implicits: make(map[string]struct{}),
tomlNext: tomlNext,
} }
for { for {
item := p.next() item := p.next()
@ -361,7 +360,7 @@ func (p *parser) valueDatetime(it item) (interface{}, tomlType) {
err error err error
) )
for _, dt := range dtTypes { for _, dt := range dtTypes {
if dt.next && !tomlNext { if dt.next && !p.tomlNext {
continue continue
} }
t, err = time.ParseInLocation(dt.fmt, it.val, dt.zone) t, err = time.ParseInLocation(dt.fmt, it.val, dt.zone)
@ -764,7 +763,7 @@ func (p *parser) replaceEscapes(it item, str string) string {
replaced = append(replaced, rune(0x000D)) replaced = append(replaced, rune(0x000D))
r += 1 r += 1
case 'e': case 'e':
if tomlNext { if p.tomlNext {
replaced = append(replaced, rune(0x001B)) replaced = append(replaced, rune(0x001B))
r += 1 r += 1
} }
@ -775,7 +774,7 @@ func (p *parser) replaceEscapes(it item, str string) string {
replaced = append(replaced, rune(0x005C)) replaced = append(replaced, rune(0x005C))
r += 1 r += 1
case 'x': case 'x':
if tomlNext { if p.tomlNext {
escaped := p.asciiEscapeToUnicode(it, s[r+1:r+3]) escaped := p.asciiEscapeToUnicode(it, s[r+1:r+3])
replaced = append(replaced, escaped) replaced = append(replaced, escaped)
r += 3 r += 3

2
vendor/modules.txt vendored
View File

@ -2,7 +2,7 @@
## explicit; go 1.16 ## explicit; go 1.16
github.com/Azure/go-ansiterm github.com/Azure/go-ansiterm
github.com/Azure/go-ansiterm/winterm github.com/Azure/go-ansiterm/winterm
# github.com/BurntSushi/toml v1.3.1 # github.com/BurntSushi/toml v1.3.2
## explicit; go 1.16 ## explicit; go 1.16
github.com/BurntSushi/toml github.com/BurntSushi/toml
github.com/BurntSushi/toml/internal github.com/BurntSushi/toml/internal