Compare commits

..

No commits in common. "feature/add-method-jugde" and "master" have entirely different histories.

2 changed files with 0 additions and 57 deletions

View File

@ -1,26 +0,0 @@
package gjson
import (
"fmt"
"testing"
)
func TestMethodCase(t *testing.T) {
content := `{"name":{"first":"int ","last":"Prichard"}, "age":(47)}`
r := Parse(content)
t.Error(r.Get("age"))
t.Error(fmt.Sprintf("%#v", r))
content = `(12+23)`
r = Parse(content)
t.Error(fmt.Sprintf("%#v", r))
content = `[(12+2), 213, {"name": "das", "key": (23+4)}]`
r = Parse(content)
t.Error(fmt.Sprintf("%#v", r))
}

View File

@ -31,8 +31,6 @@ const (
True
// JSON is a raw block of JSON
JSON
// Method is for query fucntion
Method
)
// String returns a string representation of the type.
@ -52,8 +50,6 @@ func (t Type) String() string {
return "True"
case JSON:
return "JSON"
case Method:
return "Method"
}
}
@ -99,8 +95,6 @@ func (t Result) String() string {
return t.Raw
case True:
return "true"
case Method:
return t.Raw
}
}
@ -454,10 +448,6 @@ func Parse(json string) Result {
case '"':
value.Type = String
value.Raw, value.Str = tostr(json[i:])
case '(':
value.Type = Method
value.Raw = json[i:]
value.Str = json[i+1 : len(json)-1]
}
break
}
@ -656,9 +646,6 @@ func parseString(json string, i int) (int, string, bool, bool) {
if json[i] == '"' {
return i + 1, json[s-1 : i+1], false, true
}
if json[i] == ')' {
return i + 1, json[s-1 : i+1], false, true
}
if json[i] == '\\' {
i++
for ; i < len(json); i++ {
@ -2138,24 +2125,6 @@ func parseAny(json string, i int, hit bool) (int, Result, bool) {
continue
}
switch json[i] {
case '(':
i++
var vesc bool
var ok bool
i, val, vesc, ok = parseString(json, i)
if !ok {
return i, res, false
}
if hit {
res.Type = Method
res.Raw = val
if vesc {
res.Str = unescape(val[1 : len(val)-1])
} else {
res.Str = val[1 : len(val)-1]
}
}
return i, res, true
case '"':
i++
var vesc bool