diff --git a/src/language/types.rs b/src/language/types.rs index a1f68dd1..da453bbb 100644 --- a/src/language/types.rs +++ b/src/language/types.rs @@ -131,7 +131,7 @@ impl<'i> Identifier<'i> { } } -#[derive(Eq, Debug)] +#[derive(Clone, Copy, Eq, Debug)] pub struct External<'i> { pub value: &'i str, pub span: Span, diff --git a/src/problem/messages.rs b/src/problem/messages.rs index e1397bf6..95fa7add 100644 --- a/src/problem/messages.rs +++ b/src/problem/messages.rs @@ -1137,10 +1137,7 @@ functions calls: function: Identifier { value: name, .. }, } => ( format!("Unknown function {}()", name), - format!( - "The function {}() is neither builtin nor provided by the selected domain.", - name - ), + "The function is neither builtin nor provided by the selected domain.".to_string(), ), } } diff --git a/src/program/types.rs b/src/program/types.rs index 619d1f26..a0515366 100644 --- a/src/program/types.rs +++ b/src/program/types.rs @@ -145,11 +145,13 @@ pub struct Invocable<'i> { /// subroutine into `Program.subroutines`; the resolve pass walks the /// translated tree replacing matching `Unresolved` references with /// `Resolved`. Names that don't match any declared subroutine become a -/// translation error. +/// translation error. `Deferred` references (ie URLs) are left as-is; they +/// are resolved at a later phase or at runtime. #[derive(Debug, Eq, PartialEq)] pub enum SubroutineRef<'i> { Unresolved(language::Identifier<'i>), Resolved(SubroutineId), + Deferred(language::External<'i>), } /// Lowered form of `language::Function`. Functions live in a separate diff --git a/src/runner/runner.rs b/src/runner/runner.rs index 046262c4..037a6b63 100644 --- a/src/runner/runner.rs +++ b/src/runner/runner.rs @@ -472,6 +472,11 @@ impl<'i, D: Driver> Runner<'i, D> { .announce(&format!("<{}>", id.value)); Ok(Outcome::Done(Value::Unitus)) } + SubroutineRef::Deferred(ext) => { + self.driver + .announce(&format!("<{}>", ext.value)); + Ok(Outcome::Done(Value::Unitus)) + } } } diff --git a/src/translation/translator.rs b/src/translation/translator.rs index b61205bd..32a8e76d 100644 --- a/src/translation/translator.rs +++ b/src/translation/translator.rs @@ -745,7 +745,7 @@ impl<'i> Translator<'i> { fn translate_invocation(&mut self, invocation: &'i language::Invocation<'i>) -> Invocable<'i> { let target = match &invocation.target { language::Target::Local(id) => SubroutineRef::Unresolved(*id), - language::Target::Remote(_) => todo!("remote invocation target"), + language::Target::Remote(external) => SubroutineRef::Deferred(*external), }; let arguments = match &invocation.parameters { Some(params) => params