mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-29 23:04:49 +00:00
Opaques take @ : %s/\$\([A-Z]\)/@\1/g
This commit is contained in:
parent
e43994530f
commit
f1dc9c8298
20 changed files with 201 additions and 206 deletions
|
@ -190,8 +190,7 @@ pub enum Expr<'a> {
|
|||
// Tags
|
||||
GlobalTag(&'a str),
|
||||
|
||||
// Reference to an opaque type, e.g. $Opaq
|
||||
// TODO(opaques): $->@ in the above comment
|
||||
// Reference to an opaque type, e.g. @Opaq
|
||||
OpaqueRef(&'a str),
|
||||
|
||||
// Pattern Matching
|
||||
|
|
|
@ -36,8 +36,7 @@ impl<'a> From<&'a UppercaseIdent<'a>> for &'a str {
|
|||
pub enum Ident<'a> {
|
||||
/// Foo or Bar
|
||||
GlobalTag(&'a str),
|
||||
/// $Foo or $Bar
|
||||
// TODO(opaques): $->@ in the above comment
|
||||
/// @Foo or @Bar
|
||||
OpaqueRef(&'a str),
|
||||
/// foo or foo.bar or Foo.Bar.baz.qux
|
||||
Access {
|
||||
|
@ -291,10 +290,10 @@ fn chomp_accessor(buffer: &[u8], pos: Position) -> Result<&str, BadIdent> {
|
|||
}
|
||||
}
|
||||
|
||||
/// a `$Token` opaque
|
||||
/// a `@Token` opaque
|
||||
fn chomp_opaque_ref(buffer: &[u8], pos: Position) -> Result<&str, BadIdent> {
|
||||
// assumes the leading `$` has NOT been chomped already
|
||||
debug_assert_eq!(buffer.get(0), Some(&b'$'));
|
||||
// assumes the leading `@` has NOT been chomped already
|
||||
debug_assert_eq!(buffer.get(0), Some(&b'@'));
|
||||
use encode_unicode::CharExt;
|
||||
|
||||
let bad_ident = BadIdent::BadOpaqueRef;
|
||||
|
@ -334,7 +333,7 @@ fn chomp_identifier_chain<'a>(
|
|||
}
|
||||
Err(fail) => return Err((1, fail)),
|
||||
},
|
||||
'$' => match chomp_opaque_ref(buffer, pos) {
|
||||
'@' => match chomp_opaque_ref(buffer, pos) {
|
||||
Ok(tagname) => {
|
||||
let bytes_parsed = tagname.len();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue