Skip to content

Commit

Permalink
Wrote Wildcard variant of extended attributes (#54)
Browse files Browse the repository at this point in the history
  • Loading branch information
rozbb committed Aug 31, 2022
1 parent 9bcb6b6 commit c704b30
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
7 changes: 7 additions & 0 deletions src/attribute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@ ast_types! {
assign: term!(=),
rhs: IdentifierOrString<'a>,
}),
/// Parses an attribute with a wildcard. Ex: `Exposed=*`
#[derive(Copy)]
Wildcard(struct ExtendedAttributeWildCard<'a> {
lhs_identifier: Identifier<'a>,
assign: term!(=),
rhs: term!(*),
}),
/// Parses a plain attribute. Ex: `Replaceable`
#[derive(Copy)]
NoArgs(struct ExtendedAttributeNoArgs<'a>(
Expand Down
9 changes: 8 additions & 1 deletion src/term.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,10 @@ generate_terms! {
GreaterThan => ">",

/// Represents the terminal symbol `?`
QMark => "?"
QMark => "?",

/// Represents the asterisk symbol `*`
Asterisk => "*"
}

generate_terms_for_names! {
Expand Down Expand Up @@ -358,6 +361,9 @@ macro_rules! term {
(?) => {
$crate::term::QMark
};
(*) => {
$crate::term::Asterisk
};
(or) => {
$crate::term::Or
};
Expand Down Expand Up @@ -629,6 +635,7 @@ mod test {
assign, Assign, "=";
greaterthan, GreaterThan, ">";
qmark, QMark, "?";
asterisk, Asterisk, "*";
or, Or, "or";
optional, Optional, "optional";
async_, Async, "async";
Expand Down

0 comments on commit c704b30

Please sign in to comment.