allow backlash, carriage return in pql strings

This commit is contained in:
Yuce Tekol 2018-11-01 21:56:34 +03:00
parent 5d99f70589
commit 3cb3a065dd
No known key found for this signature in database
GPG key ID: CB59E46D2FB90573
3 changed files with 302 additions and 337 deletions

View file

@ -75,19 +75,20 @@ func TestParser_Parse(t *testing.T) {
// Parse with only arguments.
t.Run("ArgumentsOnly", func(t *testing.T) {
q, err := pql.ParseString(`MyCall( key= value, foo="bar", age = 12 , bool0=true, bool1=false, x=null )`)
q, err := pql.ParseString("MyCall( key= value, foo='bar', age = 12 , bool0=true, bool1=false, x=null, escape='\\escape\n' )")
if err != nil {
t.Fatal(err)
} else if !reflect.DeepEqual(q.Calls[0],
&pql.Call{
Name: "MyCall",
Args: map[string]interface{}{
"key": "value",
"foo": "bar",
"age": int64(12),
"bool0": true,
"bool1": false,
"x": nil,
"key": "value",
"foo": "bar",
"age": int64(12),
"bool0": true,
"bool1": false,
"x": nil,
"escape": "\\escape\n",
},
},
) {

View file

@ -49,8 +49,8 @@ item <- ( 'null' &(comma / sp close) { p.addVal(nil) }
/ '\'' < singlequotedstring > '\'' { p.addVal(buffer[begin:end]) }
)
doublequotedstring <- ( [^"\\\n] / '\\n' / '\\\"' / '\\\'' / '\\\\' )*
singlequotedstring <- ( [^'\\\n] / '\\n' / '\\\"' / '\\\'' / '\\\\' )*
doublequotedstring <- ( [^"] / '\\n' / '\\\"' / '\\\'' / '\\\\' )*
singlequotedstring <- ( [^'] / '\\n' / '\\\"' / '\\\'' / '\\\\' )*
fieldExpr <- [[A-Z]] ( [[A-Z]] / [0-9] / '_' / '-' )*
field <- <fieldExpr / reserved> { p.addField(buffer[begin:end]) }

File diff suppressed because it is too large Load diff