Opaques take @ : %s/\$\([A-Z]\)/@\1/g

This commit is contained in:
Ayaz Hafiz 2022-04-25 12:26:38 -04:00
parent e43994530f
commit f1dc9c8298
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58
20 changed files with 201 additions and 206 deletions

View file

@ -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

View file

@ -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();