Message sending
This commit is contained in:
parent
3c106dcb86
commit
0837606ca7
|
@ -50,6 +50,10 @@ pub enum Instruction {
|
||||||
target: String,
|
target: String,
|
||||||
template: AnyValue,
|
template: AnyValue,
|
||||||
},
|
},
|
||||||
|
Message {
|
||||||
|
target: String,
|
||||||
|
template: AnyValue,
|
||||||
|
},
|
||||||
React {
|
React {
|
||||||
target: String,
|
target: String,
|
||||||
pattern_template: AnyValue,
|
pattern_template: AnyValue,
|
||||||
|
@ -375,6 +379,9 @@ impl Env {
|
||||||
Instruction::Assert { target, template } => {
|
Instruction::Assert { target, template } => {
|
||||||
self.lookup_target(target)?.assert(t, &(), &self.instantiate_value(template)?);
|
self.lookup_target(target)?.assert(t, &(), &self.instantiate_value(template)?);
|
||||||
}
|
}
|
||||||
|
Instruction::Message { target, template } => {
|
||||||
|
self.lookup_target(target)?.message(t, &(), &self.instantiate_value(template)?);
|
||||||
|
}
|
||||||
Instruction::React { target, pattern_template, body } => {
|
Instruction::React { target, pattern_template, body } => {
|
||||||
let (binding_names, pattern) = self.instantiate_pattern(pattern_template)?;
|
let (binding_names, pattern) = self.instantiate_pattern(pattern_template)?;
|
||||||
let observer = during::entity(self.clone())
|
let observer = during::entity(self.clone())
|
||||||
|
@ -697,6 +704,15 @@ impl<'t> Parser<'t> {
|
||||||
} else {
|
} else {
|
||||||
return self.error("Invalid let statement");
|
return self.error("Invalid let statement");
|
||||||
}
|
}
|
||||||
|
} else if s == "!" {
|
||||||
|
self.drop();
|
||||||
|
if self.ateof() {
|
||||||
|
return self.error("Missing payload after '!'");
|
||||||
|
}
|
||||||
|
return Parsed::Value(Instruction::Message {
|
||||||
|
target: target.to_owned(),
|
||||||
|
template: self.shift(),
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
/* fall through */
|
/* fall through */
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue