Skip to content

Commit

Permalink
correct location for ".*"
Browse files Browse the repository at this point in the history
  • Loading branch information
aceforeverd committed Mar 11, 2024
1 parent 9da2289 commit a412b36
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
6 changes: 4 additions & 2 deletions zetasql/parser/bison_parser.y
Original file line number Diff line number Diff line change
Expand Up @@ -3403,7 +3403,8 @@ path_expression_with_asterisk:
{
auto* id = parser->MakeIdentifier(@2, "*");
auto location = parser->GetBisonLocation(id->GetParseLocationRange());
location.begin += 1;
// extra space allowed between DOT and STAR
location.begin = location.end - 1;
id = WithStartLocation(id, location);
auto* extended_path = WithEndLocation(WithExtraChildren($1, {id}), @2);
$$ = extended_path;
Expand All @@ -3418,7 +3419,8 @@ path_expression_with_asterisk:
auto* id1 = parser->MakeIdentifier(@1, parser->GetInputText(@1));
auto* id2 = parser->MakeIdentifier(@2, "*");
auto location = parser->GetBisonLocation(id2->GetParseLocationRange());
location.begin += 1;
// extra space allowed between DOT and STAR
location.begin = location.end - 1;
id2 = WithStartLocation(id2, location);
$$ = MAKE_NODE(ASTPathExpression, @$, {id1, id2});
}
Expand Down
12 changes: 6 additions & 6 deletions zetasql/parser/testdata/grant_and_revoke.test
Original file line number Diff line number Diff line change
Expand Up @@ -444,15 +444,15 @@ GrantStatement [0-77]
GRANT `select`, insert(col1, col2, col3), `update`(col2) ON foo TO 'mdbgroup/bar'
==

grant all on db1.* to 'bar'
grant all on db1. * to 'bar'
--
GrantStatement [0-27]
GrantStatement [0-28]
Privileges [6-9]
PathExpression [13-18]
PathExpression [13-19]
Identifier(db1) [13-16]
Identifier(`*`) [17-18]
GranteeList [22-27]
StringLiteral('bar') [22-27]
Identifier(`*`) [18-19]
GranteeList [23-28]
StringLiteral('bar') [23-28]
--
GRANT ALL PRIVILEGES ON db1.`*` TO 'bar'
==
Expand Down

0 comments on commit a412b36

Please sign in to comment.