revert #903 'feat: Emit keyword'
While we agree on the idea of having some ways of emitting events, the design hasn't been completely fleshed out and it is unclear whether events should have a well-defined format independent of the framework / compiler and what this format should be. So we need more time discussing and agreeing about what use case we are actually trying to solve with that. Irrespective of that, some cleanup was also needed on the UPLC side anyway since the PR introduced a lot of needless duplications.
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
use chumsky::prelude::*;
|
||||
|
||||
use crate::{
|
||||
ast::TraceKind,
|
||||
expr::UntypedExpr,
|
||||
@@ -9,6 +7,7 @@ use crate::{
|
||||
token::Token,
|
||||
},
|
||||
};
|
||||
use chumsky::prelude::*;
|
||||
|
||||
pub fn parser<'a>(
|
||||
expression: Recursive<'a, Token, UntypedExpr, ParseError>,
|
||||
@@ -36,15 +35,6 @@ pub fn parser<'a>(
|
||||
then: Box::new(then_.unwrap_or_else(|| UntypedExpr::todo(None, span))),
|
||||
text: Box::new(text),
|
||||
}),
|
||||
just(Token::Emit)
|
||||
.ignore_then(choice((string::hybrid(), expression.clone())))
|
||||
.then(sequence.clone().or_not())
|
||||
.map_with_span(|(text, then_), span| UntypedExpr::Trace {
|
||||
kind: TraceKind::Emit,
|
||||
location: span,
|
||||
then: Box::new(then_.unwrap_or_else(|| UntypedExpr::todo(None, span))),
|
||||
text: Box::new(text),
|
||||
}),
|
||||
))
|
||||
}
|
||||
|
||||
@@ -138,7 +128,7 @@ mod tests {
|
||||
fn trace_expr_todo() {
|
||||
assert_expr!(
|
||||
r#"
|
||||
trace some_var
|
||||
trace some_var
|
||||
"#
|
||||
);
|
||||
}
|
||||
|
||||
@@ -220,7 +220,6 @@ pub fn lexer() -> impl Parser<char, Vec<(Token, Span)>, Error = ParseError> {
|
||||
|
||||
let keyword = text::ident().map(|s: String| match s.as_str() {
|
||||
"trace" => Token::Trace,
|
||||
"emit" => Token::Emit,
|
||||
// TODO: remove this in a future release
|
||||
"error" => Token::Fail,
|
||||
"fail" => Token::Fail,
|
||||
|
||||
@@ -89,7 +89,6 @@ pub enum Token {
|
||||
Type,
|
||||
When,
|
||||
Trace,
|
||||
Emit,
|
||||
Validator,
|
||||
Via,
|
||||
}
|
||||
@@ -176,7 +175,6 @@ impl fmt::Display for Token {
|
||||
Token::Pub => "pub",
|
||||
Token::Todo => "todo",
|
||||
Token::Trace => "trace",
|
||||
Token::Emit => "emit",
|
||||
Token::Type => "type",
|
||||
Token::Test => "test",
|
||||
Token::Fail => "fail",
|
||||
|
||||
Reference in New Issue
Block a user