mirror of
https://github.com/v2fly/v2ray-core.git
synced 2025-01-03 07:56:42 -05:00
fix parser for escape
This commit is contained in:
parent
1ab02e0a6b
commit
4e3ed19308
@ -4,6 +4,7 @@ import (
|
|||||||
"io"
|
"io"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// State is the internal state of parser.
|
||||||
type State byte
|
type State byte
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -50,7 +51,7 @@ func (v *Reader) Read(b []byte) (int, error) {
|
|||||||
p = append(p, x)
|
p = append(p, x)
|
||||||
}
|
}
|
||||||
case StateEscape:
|
case StateEscape:
|
||||||
p = append(p, x)
|
p = append(p, '\\', x)
|
||||||
v.state = StateContent
|
v.state = StateContent
|
||||||
case StateDoubleQuote:
|
case StateDoubleQuote:
|
||||||
switch x {
|
switch x {
|
||||||
|
@ -4,6 +4,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"bytes"
|
"bytes"
|
||||||
|
|
||||||
"v2ray.com/core/testing/assert"
|
"v2ray.com/core/testing/assert"
|
||||||
. "v2ray.com/core/tools/conf/json"
|
. "v2ray.com/core/tools/conf/json"
|
||||||
)
|
)
|
||||||
@ -33,6 +34,7 @@ text text 2*`},
|
|||||||
{`"//"content`, `"//"content`},
|
{`"//"content`, `"//"content`},
|
||||||
{`abcd'//'abcd`, `abcd'//'abcd`},
|
{`abcd'//'abcd`, `abcd'//'abcd`},
|
||||||
{`"\""`, `"\""`},
|
{`"\""`, `"\""`},
|
||||||
|
{`\"/*abcd*/\"`, `\"\"`},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, testCase := range data {
|
for _, testCase := range data {
|
||||||
|
Loading…
Reference in New Issue
Block a user