Fix examples; Clean up
This commit is contained in:
parent
c4dd68c293
commit
97447d6d8b
@ -1,13 +1,9 @@
|
||||
raw_data = async {
|
||||
{
|
||||
cast = (download "https://api.sampleapis.com/futurama/cast")
|
||||
characters = (download "https://api.sampleapis.com/futurama/characters")
|
||||
episodes = (download "https://api.sampleapis.com/futurama/episodes")
|
||||
}
|
||||
}
|
||||
|
||||
cast_len = (length (from_json data:cast))
|
||||
characters_len = (length (from_json data:characters))
|
||||
episodes_len = (length (from_json data:episodes))
|
||||
cast_len = (length (from_json cast))
|
||||
characters_len = (length (from_json characters))
|
||||
episodes_len = (length (from_json episodes))
|
||||
|
||||
(output [cast_len, characters_len, episodes_len])
|
||||
|
9
examples/download.ds
Normal file
9
examples/download.ds
Normal file
@ -0,0 +1,9 @@
|
||||
cast = (download "https://api.sampleapis.com/futurama/cast")
|
||||
characters = (download "https://api.sampleapis.com/futurama/characters")
|
||||
episodes = (download "https://api.sampleapis.com/futurama/episodes")
|
||||
|
||||
cast_len = (length (from_json cast))
|
||||
characters_len = (length (from_json characters))
|
||||
episodes_len = (length (from_json episodes))
|
||||
|
||||
(output [cast_len, characters_len, episodes_len])
|
@ -1,8 +1,10 @@
|
||||
raw_data = (download "https://api.sampleapis.com/futurama/cast")
|
||||
cast_data = (from_json raw_data)
|
||||
|
||||
names = transform cast_member in cast_data {
|
||||
cast_member.name
|
||||
names = []
|
||||
|
||||
for cast_member in cast_data {
|
||||
names += cast_member:name
|
||||
}
|
||||
|
||||
(assert_equal "Billy West", names.0)
|
||||
(assert_equal "Billy West", names:0)
|
||||
|
@ -42,8 +42,6 @@ impl AbstractTree for Block {
|
||||
}
|
||||
|
||||
fn run(&self, source: &str, context: &mut Map) -> Result<Value> {
|
||||
println!("Running {} statements.", self.statements.len());
|
||||
|
||||
if self.is_async {
|
||||
let statements = &self.statements;
|
||||
let final_result = RwLock::new(Ok(Value::Empty));
|
||||
|
@ -32,9 +32,9 @@ pub mod r#yield;
|
||||
|
||||
pub use {
|
||||
assignment::*, block::*, built_in_function::*, expression::*, filter::*, find::*,
|
||||
function_call::*, identifier::*, if_else::*, index::*, index_assignment::*, insert::*,
|
||||
logic::*, math::*, r#for::*, r#match::*, r#while::*, r#yield::*, remove::*, select::*,
|
||||
statement::*, transform::*, value_node::*,
|
||||
function_call::*, identifier::*, if_else::*, index::*, index_assignment::IndexAssignment,
|
||||
insert::*, logic::*, math::*, r#for::*, r#match::*, r#while::*, r#yield::*, remove::*,
|
||||
select::*, statement::*, transform::*, value_node::*,
|
||||
};
|
||||
|
||||
use tree_sitter::Node;
|
||||
@ -55,6 +55,6 @@ pub trait AbstractTree: Sized {
|
||||
/// node's byte range.
|
||||
fn from_syntax_node(source: &str, node: Node) -> Result<Self>;
|
||||
|
||||
/// Execute dust code by traversing the tree
|
||||
/// Execute dust code by traversing the tree.
|
||||
fn run(&self, source: &str, context: &mut Map) -> Result<Value>;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user