Fixed .a!= parsing issue #1711

This commit is contained in:
Mike Farah 2023-08-30 09:40:43 +10:00
parent 1e84d7ef1f
commit 71f95ab87b
2 changed files with 24 additions and 1 deletions

View File

@ -201,7 +201,7 @@ var participleYqRules = []*participleYqRule{
{`whitespace`, `[ \t\n]+`, nil, 0}, {`whitespace`, `[ \t\n]+`, nil, 0},
{"WrappedPathElement", `\."[^ "]+"\??`, pathToken(true), 0}, {"WrappedPathElement", `\."[^ "]+"\??`, pathToken(true), 0},
{"PathElement", `\.[^ ;\}\{\:\[\],\|\.\[\(\)=\n]+\??`, pathToken(false), 0}, {"PathElement", `\.[^ ;\}\{\:\[\],\|\.\[\(\)=\n!]+\??`, pathToken(false), 0},
{"Pipe", `\|`, opToken(pipeOpType), 0}, {"Pipe", `\|`, opToken(pipeOpType), 0},
{"Self", `\.`, opToken(selfReferenceOpType), 0}, {"Self", `\.`, opToken(selfReferenceOpType), 0},

View File

@ -14,6 +14,29 @@ type participleLexerScenario struct {
} }
var participleLexerScenarios = []participleLexerScenario{ var participleLexerScenarios = []participleLexerScenario{
{
expression: ".a!=",
tokens: []*token{
{
TokenType: operationToken,
Operation: &Operation{
OperationType: traversePathOpType,
Value: "a",
StringValue: "a",
Preferences: traversePreferences{},
},
CheckForPostTraverse: true,
},
{
TokenType: operationToken,
Operation: &Operation{
OperationType: notEqualsOpType,
Value: "NOT_EQUALS",
StringValue: "!=",
},
},
},
},
{ {
expression: ".[:3]", expression: ".[:3]",
tokens: []*token{ tokens: []*token{