Skip to content

Commit

Permalink
feat: limit stage name to plain_identifier.
Browse files Browse the repository at this point in the history
  • Loading branch information
youngsofun committed Sep 25, 2024
1 parent a402d6c commit 06b0979
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/query/ast/src/parser/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,13 @@ pub fn function_name(i: Input) -> IResult<Identifier> {
}

pub fn stage_name(i: Input) -> IResult<Identifier> {
let named_stage = rule! { #plain_identifier(|token| token.is_reserved_ident(false)) };
let anonymous_stage = map(consumed(rule! { "~" }), |(span, _)| {
Identifier::from_name(transform_span(span.tokens), "~")
});

rule!(
#ident
#named_stage
| #anonymous_stage
)(i)
}
Expand Down
2 changes: 1 addition & 1 deletion src/query/ast/src/parser/token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ pub enum TokenKind {
#[regex(r#"\$\$([^\$]|(\$[^\$]))*\$\$"#)]
LiteralCodeString,

#[regex(r#"@([^\s`;'"()]|\\\s|\\'|\\"|\\\\)+"#)]
#[regex(r#"@[_a-zA-Z][_$a-zA-Z0-9]*"#)]
LiteralAtString,

#[regex(r"[xX]'[a-fA-F0-9]*'")]
Expand Down

0 comments on commit 06b0979

Please sign in to comment.