Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: limit stage name to plain_identifier #16522

Merged
merged 2 commits into from
Sep 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions src/query/ast/src/parser/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ pub fn ident(i: Input) -> IResult<Identifier> {
non_reserved_identifier(|token| token.is_reserved_ident(false))(i)
}

pub fn plain_ident(i: Input) -> IResult<Identifier> {
plain_identifier(|token| token.is_reserved_ident(false))(i)
}

pub fn ident_after_as(i: Input) -> IResult<Identifier> {
non_reserved_identifier(|token| token.is_reserved_ident(true))(i)
}
Expand All @@ -102,7 +106,7 @@ pub fn stage_name(i: Input) -> IResult<Identifier> {
});

rule!(
#ident
#plain_ident
| #anonymous_stage
)(i)
}
Expand Down Expand Up @@ -290,10 +294,7 @@ pub fn column_id(i: Input) -> IResult<ColumnID> {
}

pub fn variable_ident(i: Input) -> IResult<String> {
map(
rule! { "$" ~ ^#plain_identifier(|token| token.is_reserved_ident(false)) },
|(_, name)| name.name,
)(i)
map(rule! { "$" ~ ^#plain_ident }, |(_, name)| name.name)(i)
}

/// Parse one to two idents separated by a dot, fulfilling from the right.
Expand Down Expand Up @@ -586,7 +587,7 @@ where F: nom::Parser<Input<'a>, O, Error<'a>> {
pub fn template_hole(i: Input) -> IResult<String> {
check_template_mode(map(
rule! {
":" ~ ^#plain_identifier(|token| token.is_reserved_ident(false))
":" ~ ^#plain_ident
},
|(_, name)| name.name,
))(i)
Expand Down
Loading