diff --git a/src/query/ast/src/parser/common.rs b/src/query/ast/src/parser/common.rs index 7b4abc56b4849..34876a9e67f06 100644 --- a/src/query/ast/src/parser/common.rs +++ b/src/query/ast/src/parser/common.rs @@ -97,12 +97,13 @@ pub fn function_name(i: Input) -> IResult { } pub fn stage_name(i: Input) -> IResult { + 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) } diff --git a/src/query/ast/src/parser/token.rs b/src/query/ast/src/parser/token.rs index 5b9f26ed6bcbc..6175da3e388da 100644 --- a/src/query/ast/src/parser/token.rs +++ b/src/query/ast/src/parser/token.rs @@ -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]*'")]