mirror of
https://github.com/kubernetes/client-go.git
synced 2025-09-02 07:35:21 +00:00
manually sync with k8s.io/kubernetest at 17375fc59fff39135af63bd1750bb07c36ef873b, k8s.io/apimachinery at d90aa2c8531f13b0ca734845934c10dcb6a56ca7
This commit is contained in:
@@ -194,7 +194,18 @@ func (p *Parser) parseIdentifier(cur *ListNode) error {
|
||||
}
|
||||
}
|
||||
value := p.consumeText()
|
||||
cur.append(newIdentifier(value))
|
||||
|
||||
if isBool(value) {
|
||||
v, err := strconv.ParseBool(value)
|
||||
if err != nil {
|
||||
return fmt.Errorf("can not parse bool '%s': %s", value, err.Error())
|
||||
}
|
||||
|
||||
cur.append(newBool(v))
|
||||
} else {
|
||||
cur.append(newIdentifier(value))
|
||||
}
|
||||
|
||||
return p.parseInsideAction(cur)
|
||||
}
|
||||
|
||||
@@ -431,3 +442,8 @@ func isEndOfLine(r rune) bool {
|
||||
func isAlphaNumeric(r rune) bool {
|
||||
return r == '_' || unicode.IsLetter(r) || unicode.IsDigit(r)
|
||||
}
|
||||
|
||||
// isBool reports whether s is a boolean value.
|
||||
func isBool(s string) bool {
|
||||
return s == "true" || s == "false"
|
||||
}
|
||||
|
Reference in New Issue
Block a user