-
Notifications
You must be signed in to change notification settings - Fork 181
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
Implement GATs, step 1 #118
Changes from 3 commits
e490665
23ec213
3a6169e
52c171e
0db2be9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -72,9 +72,24 @@ TraitDefn: TraitDefn = { | |
}; | ||
|
||
AssocTyDefn: AssocTyDefn = { | ||
"type" <name:Id> <p:Angle<ParameterKind>> ";" => AssocTyDefn { | ||
name: name, | ||
parameter_kinds: p | ||
"type" <name:Id> <p:Angle<ParameterKind>> <b:(":" <Plus<TraitBound>>)?> | ||
<w:QuantifiedWhereClauses> ";" => | ||
{ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok so currently we do not handle at all the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
AssocTyDefn { | ||
name: name, | ||
parameter_kinds: p, | ||
where_clauses: w, | ||
bounds: b.unwrap_or(vec![]), | ||
} | ||
} | ||
}; | ||
|
||
TraitBound: TraitBound = { | ||
<t:Id> <a:Angle<Parameter>> => { | ||
TraitBound { | ||
trait_name: t, | ||
args_no_self: a, | ||
} | ||
} | ||
}; | ||
|
||
|
@@ -102,11 +117,10 @@ ParameterKind: ParameterKind = { | |
}; | ||
|
||
AssocTyValue: AssocTyValue = { | ||
"type" <n:Id> <a:Angle<ParameterKind>> <wc:WhereClauses> "=" <v:Ty> ";" => AssocTyValue { | ||
"type" <n:Id> <a:Angle<ParameterKind>> "=" <v:Ty> ";" => AssocTyValue { | ||
name: n, | ||
parameter_kinds: a, | ||
value: v, | ||
where_clauses: wc, | ||
}, | ||
}; | ||
|
||
|
@@ -201,11 +215,6 @@ InlineClause: Clause = { | |
} | ||
}; | ||
|
||
WhereClauses: Vec<WhereClause> = { | ||
"where" <Comma<WhereClause>>, | ||
() => vec![], | ||
}; | ||
|
||
QuantifiedWhereClauses: Vec<QuantifiedWhereClause> = { | ||
"where" <Comma<QuantifiedWhereClause>>, | ||
() => vec![], | ||
|
@@ -290,6 +299,11 @@ SemiColon<T>: Vec<T> = { | |
<Separator<";", T>> | ||
}; | ||
|
||
#[inline] | ||
Plus<T>: Vec<T> = { | ||
<Separator<"+", T>> | ||
}; | ||
|
||
Angle<T>: Vec<T> = { | ||
"<" <Comma<T>> ">", | ||
() => vec![], | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be useful to add a comment here explaining what this represents and how it is used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done!