MCPcopy Index your code
hub / github.com/endbasic/endbasic / syntax

Method syntax

core/src/callable.rs:610–628  ·  view source on GitHub ↗

Gets the callable's syntax specification.

(&self)

Source from the content-addressed store, hash-verified

608
609 /// Gets the callable's syntax specification.
610 pub fn syntax(&self) -> String {
611 fn format_one(cs: &CallableSyntax) -> String {
612 let mut syntax = cs.describe();
613 if syntax.is_empty() {
614 syntax.push_str("no arguments");
615 }
616 syntax
617 }
618
619 match self.syntaxes.as_slice() {
620 [] => panic!("Callables without syntaxes are not allowed at construction time"),
621 [one] => format_one(one),
622 many => many
623 .iter()
624 .map(|syn| format!("<{}>", syn.describe()))
625 .collect::<Vec<String>>()
626 .join(" | "),
627 }
628 }
629
630 /// Returns true if `sep` is valid for a function call (only `Long` and `End` are allowed because
631 /// the parser only produces comma separators for function arguments).

Callers

nothing calls this directly

Calls 2

iterMethod · 0.80
as_sliceMethod · 0.45

Tested by

no test coverage detected