Disabled unquoting for single quoted attribute values; updated test

This commit is contained in:
Yuce Tekol 2018-11-06 22:58:37 +03:00
parent e9c1606a9d
commit 1e30a9372d
No known key found for this signature in database
GPG key ID: CB59E46D2FB90573
3 changed files with 13 additions and 14 deletions

View file

@ -88,7 +88,7 @@ func TestParser_Parse(t *testing.T) {
"bool0": true,
"bool1": false,
"x": nil,
"escape": `\" \\escape\n`,
"escape": "\" \\escape\n",
},
},
) {

View file

@ -46,7 +46,7 @@ item <- ( 'null' &(comma / sp close) { p.addVal(nil) }
/ < '-'? '.'[0-9]+ > { p.addNumVal(buffer[begin:end]) }
/ < ([[A-Z]] / [0-9] / '-' / '_' / ':')+ > { p.addVal(buffer[begin:end]) }
/ < '"' doublequotedstring '"' > { s, _ := strconv.Unquote(buffer[begin:end]); p.addVal(s) }
/ < '\'' singlequotedstring '\'' > { s, _ := strconv.Unquote(buffer[begin:end]); p.addVal(s) }
/ '\'' < singlequotedstring > '\'' { p.addVal(buffer[begin:end]) }
)
doublequotedstring <- ( '\\\"' / [^"] )*

View file

@ -486,8 +486,7 @@ func (p *PQL) Execute() {
s, _ := strconv.Unquote(buffer[begin:end])
p.addVal(s)
case ruleAction41:
s, _ := strconv.Unquote(buffer[begin:end])
p.addVal(s)
p.addVal(buffer[begin:end])
case ruleAction42:
p.addField(buffer[begin:end])
case ruleAction43:
@ -1723,7 +1722,7 @@ func (p *PQL) Init() {
position, tokenIndex = position136, tokenIndex136
return false
},
/* 13 item <- <(('n' 'u' 'l' 'l' &(comma / (sp close)) Action34) / ('t' 'r' 'u' 'e' &(comma / (sp close)) Action35) / ('f' 'a' 'l' 's' 'e' &(comma / (sp close)) Action36) / (<('-'? [0-9]+ ('.' [0-9]*)?)> Action37) / (<('-'? '.' [0-9]+)> Action38) / (<([a-z] / [A-Z] / [0-9] / '-' / '_' / ':')+> Action39) / (<('"' doublequotedstring '"')> Action40) / (<('\'' singlequotedstring '\'')> Action41))> */
/* 13 item <- <(('n' 'u' 'l' 'l' &(comma / (sp close)) Action34) / ('t' 'r' 'u' 'e' &(comma / (sp close)) Action35) / ('f' 'a' 'l' 's' 'e' &(comma / (sp close)) Action36) / (<('-'? [0-9]+ ('.' [0-9]*)?)> Action37) / (<('-'? '.' [0-9]+)> Action38) / (<([a-z] / [A-Z] / [0-9] / '-' / '_' / ':')+> Action39) / (<('"' doublequotedstring '"')> Action40) / ('\'' <singlequotedstring> '\'' Action41))> */
func() bool {
position140, tokenIndex140 := position, tokenIndex
{
@ -2082,21 +2081,21 @@ func (p *PQL) Init() {
goto l142
l193:
position, tokenIndex = position142, tokenIndex142
if buffer[position] != rune('\'') {
goto l140
}
position++
{
position196 := position
if buffer[position] != rune('\'') {
goto l140
}
position++
if !_rules[rulesinglequotedstring]() {
goto l140
}
if buffer[position] != rune('\'') {
goto l140
}
position++
add(rulePegText, position196)
}
if buffer[position] != rune('\'') {
goto l140
}
position++
{
add(ruleAction41, position)
}
@ -2909,7 +2908,7 @@ func (p *PQL) Init() {
nil,
/* 76 Action40 <- <{ s, _ := strconv.Unquote(buffer[begin:end]); p.addVal(s) }> */
nil,
/* 77 Action41 <- <{ s, _ := strconv.Unquote(buffer[begin:end]); p.addVal(s) }> */
/* 77 Action41 <- <{ p.addVal(buffer[begin:end]) }> */
nil,
/* 78 Action42 <- <{ p.addField(buffer[begin:end]) }> */
nil,