From 6a1556a783b63dc005f13c4107394e59f8eb9a98 Mon Sep 17 00:00:00 2001 From: Karan Kajla Date: Mon, 10 Jun 2024 12:57:08 -0700 Subject: [PATCH] Add word boundary at beginning and end of all query language keywords in query lexer (#331) --- pkg/authz/query/parser.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pkg/authz/query/parser.go b/pkg/authz/query/parser.go index 2bcc885..fd5a3ac 100644 --- a/pkg/authz/query/parser.go +++ b/pkg/authz/query/parser.go @@ -46,12 +46,12 @@ type ast struct { } var participleLexer = lexer.MustSimple([]lexer.SimpleRule{ - {Name: "Select", Pattern: `(?i)select`}, - {Name: "Explicit", Pattern: `(?i)explicit`}, - {Name: "Where", Pattern: `(?i)where`}, - {Name: "Is", Pattern: `(?i)is`}, - {Name: "For", Pattern: `(?i)for`}, - {Name: "OfType", Pattern: `(?i)of type`}, + {Name: "Select", Pattern: `(?i)\bselect\b`}, + {Name: "Explicit", Pattern: `(?i)\bexplicit\b`}, + {Name: "Where", Pattern: `(?i)\bwhere\b`}, + {Name: "Is", Pattern: `(?i)\bis\b`}, + {Name: "For", Pattern: `(?i)\bfor\b`}, + {Name: "OfType", Pattern: `(?i)\bof type\b`}, {Name: "Resource", Pattern: `[a-zA-Z0-9_\-]+:[a-zA-Z0-9_\-\.@\|:]+`}, {Name: "TypeOrRelation", Pattern: `[a-zA-Z0-9_\-]+`}, {Name: "Wildcard", Pattern: `\*`},