Skip to content

Commit

Permalink
feat: limit stage name to plain_identifier (#16522)
Browse files Browse the repository at this point in the history
* feat: limit stage name to plain_identifier.

* extract plain_ident.
  • Loading branch information
youngsofun authored Sep 26, 2024
1 parent 41914ef commit bb92fdc
Showing 1 changed file with 7 additions and 6 deletions.
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

0 comments on commit bb92fdc

Please sign in to comment.