summaryrefslogtreecommitdiff
path: root/vendor/github.com/bytedance/sonic/ast
diff options
context:
space:
mode:
authorLibravatar kim <grufwub@gmail.com>2025-06-30 15:19:09 +0200
committerLibravatar kim <gruf@noreply.codeberg.org>2025-06-30 15:19:09 +0200
commit8b0ea560279a5bf4479555d3924c763ddeecfcad (patch)
tree005e26d4a658e565594fb259cc17948659195822 /vendor/github.com/bytedance/sonic/ast
parent[chore] bumps ncruces/go-sqlite3 v0.26.1 => v0.26.3 (#4302) (diff)
downloadgotosocial-8b0ea560279a5bf4479555d3924c763ddeecfcad.tar.xz
[chore] update go dependencies (#4304)
- github.com/KimMachineGun/automemlimit v0.7.2 => v0.7.3 - github.com/gin-contrib/cors v1.7.5 => v1.7.6 - github.com/minio/minio-go/v7 v7.0.92 => v7.0.94 - github.com/spf13/cast v1.8.0 => v1.9.2 - github.com/uptrace/bun{,/*} v1.2.11 => v1.2.14 - golang.org/x/image v0.27.0 => v0.28.0 - golang.org/x/net v0.40.0 => v0.41.0 - code.superseriousbusiness.org/go-swagger v0.31.0-gts-go1.23-fix => v0.32.3-gts-go1.23-fix Reviewed-on: https://codeberg.org/superseriousbusiness/gotosocial/pulls/4304 Co-authored-by: kim <grufwub@gmail.com> Co-committed-by: kim <grufwub@gmail.com>
Diffstat (limited to 'vendor/github.com/bytedance/sonic/ast')
-rw-r--r--vendor/github.com/bytedance/sonic/ast/iterator.go2
-rw-r--r--vendor/github.com/bytedance/sonic/ast/node.go29
-rw-r--r--vendor/github.com/bytedance/sonic/ast/parser.go8
-rw-r--r--vendor/github.com/bytedance/sonic/ast/visitor.go6
4 files changed, 31 insertions, 14 deletions
diff --git a/vendor/github.com/bytedance/sonic/ast/iterator.go b/vendor/github.com/bytedance/sonic/ast/iterator.go
index 1052dd0a0..978028a65 100644
--- a/vendor/github.com/bytedance/sonic/ast/iterator.go
+++ b/vendor/github.com/bytedance/sonic/ast/iterator.go
@@ -176,7 +176,7 @@ type Scanner func(path Sequence, node *Node) bool
// Especially, if the node is not V_ARRAY or V_OBJECT,
// the node itself will be returned and Sequence.Index == -1.
//
-// NOTICE: A unsetted node WON'T trigger sc, but its index still counts into Path.Index
+// NOTICE: An unset node WON'T trigger sc, but its index still counts into Path.Index
func (self *Node) ForEach(sc Scanner) error {
if err := self.checkRaw(); err != nil {
return err
diff --git a/vendor/github.com/bytedance/sonic/ast/node.go b/vendor/github.com/bytedance/sonic/ast/node.go
index 17964c32f..1c5ff6439 100644
--- a/vendor/github.com/bytedance/sonic/ast/node.go
+++ b/vendor/github.com/bytedance/sonic/ast/node.go
@@ -509,6 +509,23 @@ func (self *Node) Float64() (float64, error) {
}
}
+func (self *Node) StrictBool() (bool, error) {
+ if err := self.checkRaw(); err!= nil {
+ return false, err
+ }
+ switch self.t {
+ case types.V_TRUE : return true, nil
+ case types.V_FALSE : return false, nil
+ case _V_ANY :
+ any := self.packAny()
+ switch v := any.(type) {
+ case bool : return v, nil
+ default : return false, ErrUnsupportType
+ }
+ default : return false, ErrUnsupportType
+ }
+}
+
// Float64 exports underlying float64 value, including V_NUMBER, V_ANY
func (self *Node) StrictFloat64() (float64, error) {
if err := self.checkRaw(); err != nil {
@@ -776,7 +793,7 @@ func (self *Node) Pop() error {
}
// Move moves the child at src index to dst index,
-// meanwhile slides sliblings from src+1 to dst.
+// meanwhile slides siblings from src+1 to dst.
//
// WARN: this will change address of elements, which is a dangerous action.
func (self *Node) Move(dst, src int) error {
@@ -816,7 +833,7 @@ func (self *Node) Move(dst, src int) error {
return nil
}
-// SetAny wraps val with V_ANY node, and Add() the node.
+// AddAny wraps val with V_ANY node, and Add() the node.
func (self *Node) AddAny(val interface{}) error {
return self.Add(NewAny(val))
}
@@ -938,7 +955,7 @@ func (self *Node) Map() (map[string]interface{}, error) {
return self.toGenericObject()
}
-// MapUseNumber loads all keys of an object node, with numeric nodes casted to json.Number
+// MapUseNumber loads all keys of an object node, with numeric nodes cast to json.Number
func (self *Node) MapUseNumber() (map[string]interface{}, error) {
if self.isAny() {
any := self.packAny()
@@ -1083,7 +1100,7 @@ func (self *Node) Array() ([]interface{}, error) {
return self.toGenericArray()
}
-// ArrayUseNumber loads all indexes of an array node, with numeric nodes casted to json.Number
+// ArrayUseNumber loads all indexes of an array node, with numeric nodes cast to json.Number
func (self *Node) ArrayUseNumber() ([]interface{}, error) {
if self.isAny() {
any := self.packAny()
@@ -1149,7 +1166,7 @@ func (self *Node) unsafeArray() (*linkedNodes, error) {
// Interface loads all children under all paths from this node,
// and converts itself as generic type.
-// WARN: all numeric nodes are casted to float64
+// WARN: all numeric nodes are cast to float64
func (self *Node) Interface() (interface{}, error) {
if err := self.checkRaw(); err != nil {
return nil, err
@@ -1193,7 +1210,7 @@ func (self *Node) packAny() interface{} {
}
// InterfaceUseNumber works same with Interface()
-// except numeric nodes are casted to json.Number
+// except numeric nodes are cast to json.Number
func (self *Node) InterfaceUseNumber() (interface{}, error) {
if err := self.checkRaw(); err != nil {
return nil, err
diff --git a/vendor/github.com/bytedance/sonic/ast/parser.go b/vendor/github.com/bytedance/sonic/ast/parser.go
index 30bd1f451..aee96f86a 100644
--- a/vendor/github.com/bytedance/sonic/ast/parser.go
+++ b/vendor/github.com/bytedance/sonic/ast/parser.go
@@ -63,7 +63,7 @@ func (self *Parser) delim() types.ParsingError {
return types.ERR_EOF
}
- /* check for the delimtier */
+ /* check for the delimiter */
if self.s[p] != ':' {
return types.ERR_INVALID_CHAR
}
@@ -82,7 +82,7 @@ func (self *Parser) object() types.ParsingError {
return types.ERR_EOF
}
- /* check for the delimtier */
+ /* check for the delimiter */
if self.s[p] != '{' {
return types.ERR_INVALID_CHAR
}
@@ -101,7 +101,7 @@ func (self *Parser) array() types.ParsingError {
return types.ERR_EOF
}
- /* check for the delimtier */
+ /* check for the delimiter */
if self.s[p] != '[' {
return types.ERR_INVALID_CHAR
}
@@ -638,7 +638,7 @@ func Loads(src string) (int, interface{}, error) {
}
}
-// LoadsUseNumber parse all json into interface{}, with numeric nodes casted to json.Number
+// LoadsUseNumber parse all json into interface{}, with numeric nodes cast to json.Number
func LoadsUseNumber(src string) (int, interface{}, error) {
ps := &Parser{s: src}
np, err := ps.Parse()
diff --git a/vendor/github.com/bytedance/sonic/ast/visitor.go b/vendor/github.com/bytedance/sonic/ast/visitor.go
index dc0478513..fc71d40cb 100644
--- a/vendor/github.com/bytedance/sonic/ast/visitor.go
+++ b/vendor/github.com/bytedance/sonic/ast/visitor.go
@@ -178,7 +178,7 @@ func (self *traverser) decodeArray() error {
/* allocate array space and parse every element */
if err := self.visitor.OnArrayBegin(_DEFAULT_NODE_CAP); err != nil {
if err == VisitOPSkip {
- // NOTICE: for user needs to skip entiry object
+ // NOTICE: for user needs to skip entry object
self.parser.p -= 1
if _, e := self.parser.skipFast(); e != 0 {
return e
@@ -233,7 +233,7 @@ func (self *traverser) decodeObject() error {
/* allocate object space and decode each pair */
if err := self.visitor.OnObjectBegin(_DEFAULT_NODE_CAP); err != nil {
if err == VisitOPSkip {
- // NOTICE: for user needs to skip entiry object
+ // NOTICE: for user needs to skip entry object
self.parser.p -= 1
if _, e := self.parser.skipFast(); e != 0 {
return e
@@ -328,5 +328,5 @@ func (self *traverser) decodeString(iv int64, ep int) error {
}
// If visitor return this error on `OnObjectBegin()` or `OnArrayBegin()`,
-// the transverer will skip entiry object or array
+// the traverser will skip entry object or array
var VisitOPSkip = errors.New("")