feat: add test def and test token
This commit is contained in:
parent
80a9b7b36a
commit
a65b4aa471
|
@ -138,6 +138,8 @@ pub enum Definition<T, Expr, ConstantRecordTag, PackageName> {
|
||||||
Use(Use<PackageName>),
|
Use(Use<PackageName>),
|
||||||
|
|
||||||
ModuleConstant(ModuleConstant<T, ConstantRecordTag>),
|
ModuleConstant(ModuleConstant<T, ConstantRecordTag>),
|
||||||
|
|
||||||
|
Test(Function<T, Expr>),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<A, B, C, E> Definition<A, B, C, E> {
|
impl<A, B, C, E> Definition<A, B, C, E> {
|
||||||
|
@ -147,7 +149,8 @@ impl<A, B, C, E> Definition<A, B, C, E> {
|
||||||
| Definition::Use(Use { location, .. })
|
| Definition::Use(Use { location, .. })
|
||||||
| Definition::TypeAlias(TypeAlias { location, .. })
|
| Definition::TypeAlias(TypeAlias { location, .. })
|
||||||
| Definition::DataType(DataType { location, .. })
|
| Definition::DataType(DataType { location, .. })
|
||||||
| Definition::ModuleConstant(ModuleConstant { location, .. }) => *location,
|
| Definition::ModuleConstant(ModuleConstant { location, .. })
|
||||||
|
| Definition::Test(Function { location, .. }) => *location,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -157,7 +160,8 @@ impl<A, B, C, E> Definition<A, B, C, E> {
|
||||||
Definition::Fn(Function { doc, .. })
|
Definition::Fn(Function { doc, .. })
|
||||||
| Definition::TypeAlias(TypeAlias { doc, .. })
|
| Definition::TypeAlias(TypeAlias { doc, .. })
|
||||||
| Definition::DataType(DataType { doc, .. })
|
| Definition::DataType(DataType { doc, .. })
|
||||||
| Definition::ModuleConstant(ModuleConstant { doc, .. }) => {
|
| Definition::ModuleConstant(ModuleConstant { doc, .. })
|
||||||
|
| Definition::Test(Function { doc, .. }) => {
|
||||||
let _ = std::mem::replace(doc, Some(new_doc));
|
let _ = std::mem::replace(doc, Some(new_doc));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,6 +67,7 @@ pub fn lexer() -> impl Parser<char, Vec<(Token, Span)>, Error = ParseError> {
|
||||||
"check" => Token::Assert,
|
"check" => Token::Assert,
|
||||||
"const" => Token::Const,
|
"const" => Token::Const,
|
||||||
"fn" => Token::Fn,
|
"fn" => Token::Fn,
|
||||||
|
"test" => Token::Test,
|
||||||
"if" => Token::If,
|
"if" => Token::If,
|
||||||
"else" => Token::Else,
|
"else" => Token::Else,
|
||||||
"is" => Token::Is,
|
"is" => Token::Is,
|
||||||
|
|
|
@ -68,6 +68,7 @@ pub enum Token {
|
||||||
Opaque,
|
Opaque,
|
||||||
Pub,
|
Pub,
|
||||||
Use,
|
Use,
|
||||||
|
Test,
|
||||||
Todo,
|
Todo,
|
||||||
Trace,
|
Trace,
|
||||||
Type,
|
Type,
|
||||||
|
@ -145,6 +146,7 @@ impl fmt::Display for Token {
|
||||||
Token::Todo => "todo",
|
Token::Todo => "todo",
|
||||||
Token::Trace => "try",
|
Token::Trace => "try",
|
||||||
Token::Type => "type",
|
Token::Type => "type",
|
||||||
|
Token::Test => "test",
|
||||||
};
|
};
|
||||||
write!(f, "\"{}\"", s)
|
write!(f, "\"{}\"", s)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue