Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implemented parsing of ExtendedAttributeWildcard #54

Merged
merged 1 commit into from
Aug 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/attribute.rs
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
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