Skip to content

Commit 13001a8

Browse files
committed
Handle special $* role
1 parent 7ab9345 commit 13001a8

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/parsing/parser.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2279,8 +2279,13 @@ impl<'i> Parser<'i> {
22792279
for part in parts {
22802280
let trimmed = part.trim_ascii();
22812281

2282-
// Check if it's a role '@'
2283-
if let Some(captures) = regex!(r"^@([a-z][a-z0-9_]*)$").captures(trimmed) {
2282+
// Check if it's the special @* "reset attribute" role
2283+
if trimmed == "@*" {
2284+
let identifier = Identifier("*");
2285+
attributes.push(Attribute::Role(identifier));
2286+
}
2287+
// Check if it's a regular role '@'
2288+
else if let Some(captures) = regex!(r"^@([a-z][a-z0-9_]*)$").captures(trimmed) {
22842289
let role_name = captures
22852290
.get(1)
22862291
.ok_or(ParsingError::Expected(inner.offset, "role name after @"))?
@@ -2830,7 +2835,8 @@ fn is_string_literal(content: &str) -> bool {
28302835

28312836
fn is_attribute_assignment(input: &str) -> bool {
28322837
// Matches any combination of @ and ^ attributes separated by +
2833-
let re = regex!(r"^\s*[@^][a-z][a-z0-9_]*(\s*\+\s*[@^][a-z][a-z0-9_]*)*");
2838+
// Also matches the special @* "reset to all" role
2839+
let re = regex!(r"^\s*(@\*|[@^][a-z][a-z0-9_]*)(\s*\+\s*[@^][a-z][a-z0-9_]*)*");
28342840
re.is_match(input)
28352841
}
28362842

0 commit comments

Comments
 (0)