feat: new check for valid purpose names

This commit is contained in:
rvcas
2024-08-15 12:15:45 -04:00
committed by KtorZ
parent 5cf0a4d294
commit c2c4bddfb3
9 changed files with 60 additions and 13 deletions

View File

@@ -54,7 +54,7 @@ Validator(
name: "True",
},
doc: None,
location: 26..44,
location: 20..44,
name: "spend",
public: true,
return_annotation: None,
@@ -96,7 +96,7 @@ Validator(
name: "True",
},
doc: None,
location: 68..79,
location: 63..79,
name: "mint",
public: true,
return_annotation: None,

View File

@@ -54,7 +54,7 @@ Validator(
name: "True",
},
doc: None,
location: 26..44,
location: 20..44,
name: "spend",
public: true,
return_annotation: None,
@@ -96,7 +96,7 @@ Validator(
name: "True",
},
doc: None,
location: 68..79,
location: 63..79,
name: "mint",
public: true,
return_annotation: None,

View File

@@ -54,7 +54,7 @@ Validator(
name: "True",
},
doc: None,
location: 26..44,
location: 20..44,
name: "spend",
public: true,
return_annotation: None,

View File

@@ -23,16 +23,18 @@ pub fn parser() -> impl Parser<Token, ast::UntypedDefinition, Error = ParseError
.then(
select! {Token::Name {name} => name}
.then(args_and_body())
.map(|(name, mut function)| {
.map_with_span(|(name, mut function), span| {
function.name = name;
function.location.start = span.start;
function
})
.repeated()
.then(
just(Token::Else)
.ignore_then(args_and_body().map(|mut function| {
.ignore_then(args_and_body().map_with_span(|mut function, span| {
function.name = "else".to_string();
function.location.start = span.start;
function
}))