mirror of
https://github.com/Dummi26/mers.git
synced 2025-03-10 14:13:52 +01:00
Change reference type syntax from &{t/y/p/e} to &[t/y/p/e] to avoid ambiguity with &{my: Int, object: String}
This commit is contained in:
parent
b85183d081
commit
c130678caf
@ -14,6 +14,7 @@ pub enum ParsedType {
|
||||
Tuple(Vec<Vec<Self>>),
|
||||
Object(Vec<(String, Vec<Self>)>),
|
||||
Type(String),
|
||||
Function(Vec<(Self, Self)>),
|
||||
TypeWithInfo(String, String),
|
||||
}
|
||||
|
||||
@ -24,18 +25,18 @@ pub fn parse_single_type(src: &mut Source, srca: &Arc<Source>) -> Result<ParsedT
|
||||
// Reference
|
||||
Some('&') => {
|
||||
src.next_char();
|
||||
if let Some('{') = src.peek_char() {
|
||||
if let Some('[') = src.peek_char() {
|
||||
src.next_char();
|
||||
let types = parse_type(src, srca)?;
|
||||
let nc = src.next_char();
|
||||
if !matches!(nc, Some('}')) {
|
||||
if !matches!(nc, Some(']')) {
|
||||
let nc = if let Some(nc) = nc {
|
||||
format!("'{nc}'")
|
||||
} else {
|
||||
format!("EOF")
|
||||
};
|
||||
return Err(CheckError::new().msg(format!(
|
||||
"No closing }} in reference type with opening {{! Found {nc} instead"
|
||||
"No closing ] in reference type with opening [! Found {nc} instead"
|
||||
)));
|
||||
}
|
||||
ParsedType::Reference(types)
|
||||
|
Loading…
Reference in New Issue
Block a user