mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-27 05:49:08 +00:00
Implement parsing for tuple accessor functions (.1, .2, etc)
Step 2 of N toward implementing #4465
This commit is contained in:
parent
07efb32173
commit
f4ce4bf983
19 changed files with 144 additions and 55 deletions
|
@ -163,13 +163,19 @@ pub enum Expr<'a> {
|
|||
|
||||
// String Literals
|
||||
Str(StrLiteral<'a>), // string without escapes in it
|
||||
/// Look up exactly one field on a record, e.g. (expr).foo.
|
||||
Access(&'a Expr<'a>, &'a str),
|
||||
/// e.g. `.foo`
|
||||
AccessorFunction(&'a str),
|
||||
/// eg 'b'
|
||||
SingleQuote(&'a str),
|
||||
|
||||
/// Look up exactly one field on a record, e.g. `x.foo`.
|
||||
RecordAccess(&'a Expr<'a>, &'a str),
|
||||
/// e.g. `.foo`
|
||||
RecordAccessorFunction(&'a str),
|
||||
|
||||
/// Look up exactly one field on a tuple, e.g. `(x, y).1`.
|
||||
TupleAccess(&'a Expr<'a>, &'a str),
|
||||
/// e.g. `.1`
|
||||
TupleAccessorFunction(&'a str),
|
||||
|
||||
// Collection Literals
|
||||
List(Collection<'a, &'a Loc<Expr<'a>>>),
|
||||
|
||||
|
@ -731,7 +737,8 @@ impl<'a> Pattern<'a> {
|
|||
Pattern::Malformed(buf.into_bump_str())
|
||||
}
|
||||
}
|
||||
Ident::AccessorFunction(string) => Pattern::Malformed(string),
|
||||
Ident::RecordAccessorFunction(string) => Pattern::Malformed(string),
|
||||
Ident::TupleAccessorFunction(string) => Pattern::Malformed(string),
|
||||
Ident::Malformed(string, _problem) => Pattern::Malformed(string),
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue