diff --git a/projects/nyar_valkyrie/Cargo.toml b/projects/nyar_valkyrie/Cargo.toml deleted file mode 100644 index d50d27f0..00000000 --- a/projects/nyar_valkyrie/Cargo.toml +++ /dev/null @@ -1,29 +0,0 @@ -[package] -name = "nyar_valkyrie" -version = "0.1.0" -authors = ["Aster <192607617@qq.com>"] -description = "..." -repository = "https://github.com/nyar-vm/valkyrie.rs" -documentation = "https://docs.rs/nyar_valkyrie" -readme = "Readme.md" -license = "MPL-2.0" -edition = "2021" - -[dependencies] -tokio = { version = "1.36.0", features = ["full"] } -nyar-runtime = "0.0.2" -clap = { version = "4.5.2", features = ["derive", "unicode", "error-context"] } - -[dependencies.valkyrie-types] -path = "../valkyrie-types" -version = "0.0.8" - -[[bin]] -path = "src/main.rs" -name = "nyar-valkyrie" - - -[dev-dependencies] - -[features] -default = [] diff --git a/projects/nyar_valkyrie/Readme.md b/projects/nyar_valkyrie/Readme.md deleted file mode 100644 index e69de29b..00000000 diff --git a/projects/nyar_valkyrie/package.json b/projects/nyar_valkyrie/package.json deleted file mode 100644 index 381d4be9..00000000 --- a/projects/nyar_valkyrie/package.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "private": true, - "scripts": { - "p": "cargo publish --allow-dirty" - } -} diff --git a/projects/nyar_valkyrie/src/errors.rs b/projects/nyar_valkyrie/src/errors.rs deleted file mode 100644 index efb765ab..00000000 --- a/projects/nyar_valkyrie/src/errors.rs +++ /dev/null @@ -1,6 +0,0 @@ -#[derive(Debug, Copy, Clone)] -pub enum Error { - UnknownError, -} - -pub type Result = std::result::Result; diff --git a/projects/nyar_valkyrie/src/lib.rs b/projects/nyar_valkyrie/src/lib.rs deleted file mode 100644 index f4ca0d0b..00000000 --- a/projects/nyar_valkyrie/src/lib.rs +++ /dev/null @@ -1,19 +0,0 @@ -use clap::Parser; -use nyar_runtime::NyarVM; -use std::ffi::OsString; - -mod variant; - -#[derive(Parser)] -#[command(version, about, long_about = include_str!("readme.md"))] -pub struct Application { - /// Doc comment - #[arg(long, short = 'C')] - directory: Option, -} - -impl Application { - pub async fn run(&self) { - let p1 = NyarVM::load_wast("test").await; - } -} diff --git a/projects/nyar_valkyrie/src/main.rs b/projects/nyar_valkyrie/src/main.rs deleted file mode 100644 index 17add2a7..00000000 --- a/projects/nyar_valkyrie/src/main.rs +++ /dev/null @@ -1,7 +0,0 @@ -use clap::Parser; -use nyar_valkyrie::Application; - -#[tokio::main] -pub async fn main() { - Application::parse().run().await -} diff --git a/projects/nyar_valkyrie/src/readme.md b/projects/nyar_valkyrie/src/readme.md deleted file mode 100644 index e69de29b..00000000 diff --git a/projects/nyar_valkyrie/src/variant/mod.rs b/projects/nyar_valkyrie/src/variant/mod.rs deleted file mode 100644 index 693922a1..00000000 --- a/projects/nyar_valkyrie/src/variant/mod.rs +++ /dev/null @@ -1,3 +0,0 @@ -mod result; - -pub struct DynamicVariant {} diff --git a/projects/nyar_valkyrie/src/variant/result/mod.rs b/projects/nyar_valkyrie/src/variant/result/mod.rs deleted file mode 100644 index 9dbfacca..00000000 --- a/projects/nyar_valkyrie/src/variant/result/mod.rs +++ /dev/null @@ -1,12 +0,0 @@ -pub enum ValkyrieResult { - Success(ValkyrieSuccess), - Failure(ValkyrieFailure), -} - -pub struct ValkyrieSuccess { - pub value: T, -} - -pub struct ValkyrieFailure { - pub error: E, -} diff --git a/projects/nyar_valkyrie/tests/main.rs b/projects/nyar_valkyrie/tests/main.rs deleted file mode 100644 index cf5bed26..00000000 --- a/projects/nyar_valkyrie/tests/main.rs +++ /dev/null @@ -1,4 +0,0 @@ -#[test] -fn ready() { - println!("it works!") -} diff --git a/projects/nyar_valkyrie/tests/readme.md b/projects/nyar_valkyrie/tests/readme.md deleted file mode 100644 index 649841b0..00000000 --- a/projects/nyar_valkyrie/tests/readme.md +++ /dev/null @@ -1,5 +0,0 @@ -## Tests - -```bash -wee test -``` diff --git a/projects/valkyrie-ffi/.gitignore b/projects/valkyrie-ffi/.gitignore deleted file mode 100644 index b89e17fa..00000000 --- a/projects/valkyrie-ffi/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -tests/*.json -tests/*.yaml \ No newline at end of file diff --git a/projects/valkyrie-ffi/Cargo.toml b/projects/valkyrie-ffi/Cargo.toml deleted file mode 100644 index f3b74f2d..00000000 --- a/projects/valkyrie-ffi/Cargo.toml +++ /dev/null @@ -1,21 +0,0 @@ -[package] -name = "valkyrie-wit" -version = "0.1.0" -authors = ["192608617@qq.com"] -edition = "2018" -description = "Valkyrie Language Server" -repository = "https://github.com/nyar-vm/valkyrie.rs" -license = "MPL-2.0" - - - -[dependencies] -nyar-wasm = "0.0.5" -anyhow = "1.0.80" -wit-parser = "0.201.0" -tracing = "0.1.40" -convert_case = "0.6.0" - -[dev-dependencies] - -[build-dependencies] diff --git a/projects/valkyrie-ffi/Readme.md b/projects/valkyrie-ffi/Readme.md deleted file mode 100644 index e69de29b..00000000 diff --git a/projects/valkyrie-ffi/package.json b/projects/valkyrie-ffi/package.json deleted file mode 100644 index a0e520e4..00000000 --- a/projects/valkyrie-ffi/package.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "name": "native-nyar", - "private": true, - "scripts": { - "serve": "cargo run -- -l F:\\Python\\vk-intellij\\src\\design\\lang -s localhost:9600", - "install": "cargo build --release", - "p": "cargo publish --allow-dirty" - } -} diff --git a/projects/valkyrie-ffi/src/exports/mod.rs b/projects/valkyrie-ffi/src/exports/mod.rs deleted file mode 100644 index 02b801f9..00000000 --- a/projects/valkyrie-ffi/src/exports/mod.rs +++ /dev/null @@ -1 +0,0 @@ -pub struct ValkyrieWIT {} diff --git a/projects/valkyrie-ffi/src/helpers/color_writer.rs b/projects/valkyrie-ffi/src/helpers/color_writer.rs deleted file mode 100644 index 3e38b449..00000000 --- a/projects/valkyrie-ffi/src/helpers/color_writer.rs +++ /dev/null @@ -1,55 +0,0 @@ -use std::fmt::Write; - -#[derive(Default)] -pub struct ColoredWriter { - pub buffer: String, - pub schema: ColorSchema, -} - -pub struct ColorSchema { - pub bad: String, - pub keyword: String, - pub class: String, - pub attribute: String, -} - -impl Default for ColorSchema { - fn default() -> Self { - Self { - bad: "F44747".to_string(), - keyword: "C679DD".to_string(), - class: "E5C17C".to_string(), - attribute: "57B6C2".to_string(), - } - } -} - -impl ColoredWriter { - pub fn write_text(&mut self, text: &str) { - self.buffer.push_str(text); - } - pub fn write_newline(&mut self) { - self.buffer.push_str("
"); - } - pub fn write_bad(&mut self, text: &str) { - self.buffer.push_str(&format!("{}", self.schema.bad, text)); - } - pub fn write_keyword(&mut self, text: &str) { - self.buffer.push_str(&format!("{}", self.schema.keyword, text)); - } - pub fn write_modifiers>(&mut self, text: &[T]) { - for modifier in text.iter() { - self.buffer.push_str(&format!("{}", self.schema.keyword, modifier.as_ref())); - self.buffer.push_str(" "); - } - } - pub fn write_class(&mut self, text: &str) { - write!(self.buffer, "{text}", color = self.schema.class, text = text).ok(); - } - pub fn write_attribute(&mut self, text: &str) { - write!(self.buffer, "{text}", color = self.schema.attribute, text = text).ok(); - } - pub fn finish(self) -> String { - self.buffer - } -} diff --git a/projects/valkyrie-ffi/src/helpers/mod.rs b/projects/valkyrie-ffi/src/helpers/mod.rs deleted file mode 100644 index 8b137891..00000000 --- a/projects/valkyrie-ffi/src/helpers/mod.rs +++ /dev/null @@ -1 +0,0 @@ - diff --git a/projects/valkyrie-ffi/src/helpers/resopnse.rs b/projects/valkyrie-ffi/src/helpers/resopnse.rs deleted file mode 100644 index 25ca9a28..00000000 --- a/projects/valkyrie-ffi/src/helpers/resopnse.rs +++ /dev/null @@ -1,13 +0,0 @@ -use axum::http::StatusCode; - -pub struct JsonResponse { - code: StatusCode, - message: String, - data: T, -} - -impl From for JsonResponse { - fn from(data: T) -> Self { - Self { code: StatusCode::OK, message: String::new(), data } - } -} diff --git a/projects/valkyrie-ffi/src/imports/jetbrain.rs b/projects/valkyrie-ffi/src/imports/jetbrain.rs deleted file mode 100644 index bdab5b84..00000000 --- a/projects/valkyrie-ffi/src/imports/jetbrain.rs +++ /dev/null @@ -1,44 +0,0 @@ -use super::*; - -impl TypedDocument { - pub fn render_jetbrain(&self) -> Result, StatusCode> { - let content = match self { - TypedDocument::Keywords(s) => render_keywords(s), - TypedDocument::Operator(s) => render_operator(s), - TypedDocument::Trait { namepath } => render_trait(namepath), - }; - Ok(Json(ODocument { content })) - } -} - -fn render_keywords(keyword: &ValkyrieKeyword) -> String { - let mut w = ColoredWriter::default(); - w.write_modifiers(&["keyword"]); - w.write_attribute(keyword.name()); - w.write_newline(); - w.write_text(&keyword.document()); - w.finish() -} - -fn render_operator(operator: &ValkyrieOperator) -> String { - let mut w = ColoredWriter::default(); - w.write_modifiers(&["operator"]); - w.write_attribute(operator.name()); - w.write_text(" "); - w.write_attribute(operator.literal()); - w.write_newline(); - w.write_text("An operator is a symbol that tells the compiler to perform specific mathematical or logical manipulations."); - w.finish() -} - -fn render_trait(namepath: &[String]) -> String { - let mut w = ColoredWriter::default(); - w.write_modifiers(&["namespace"]); - w.write_text("std::categories"); - - w.write_modifiers(&["public", "static", "trait"]); - w.write_attribute(&namepath.join(".")); - w.write_newline(); - w.write_text("A trait is a collection of methods that are implemented by a type."); - w.finish() -} diff --git a/projects/valkyrie-ffi/src/imports/mod.rs b/projects/valkyrie-ffi/src/imports/mod.rs deleted file mode 100644 index 5dc1d786..00000000 --- a/projects/valkyrie-ffi/src/imports/mod.rs +++ /dev/null @@ -1,71 +0,0 @@ -use convert_case::{Case, Casing}; -use std::{fs::File, io::Write, path::Path}; -use wit_parser::{Function, FunctionKind, Interface, Package, Resolve, SourceMap, TypeDef, TypeDefKind, UnresolvedPackage}; - -mod visit_types; - -pub struct ValkyrieFFI { - cache: Resolve, -} - -impl ValkyrieFFI { - pub fn new>(directory: P) -> anyhow::Result { - let mut resolved = Resolve::new(); - resolved.push_dir(directory.as_ref())?; - Ok(Self { cache: resolved }) - } - pub fn generate>(&self, output: P) -> std::io::Result<()> { - let output = output.as_ref(); - if !output.is_dir() {} - if !output.exists() {} - for (_, item) in self.cache.packages.iter() { - self.export_packages(item, output)?; - } - Ok(()) - } - fn export_packages(&self, package: &Package, root: &Path) -> std::io::Result<()> { - let org = package.name.namespace.as_str(); - let pkg = package.name.name.as_str(); - tracing::info!("exporting interface: {}/{}", org, pkg); - let file = root.join(format!("{}/{}.vk", org, pkg)); - if let Some(dir) = file.parent() { - std::fs::create_dir_all(dir)?; - } - let mut file = std::fs::File::create(file)?; - for (name, ty) in package.interfaces.iter() { - match self.cache.interfaces.get(*ty) { - Some(s) => self.export_interface(s, package, &mut file)?, - None => tracing::error!("interface not found: {:?}", name), - } - } - Ok(()) - } - fn export_interface(&self, interface: &Interface, package: &Package, file: &mut File) -> std::io::Result<()> { - let name = match interface.name.as_ref() { - Some(s) => s, - None => Err(std::io::Error::new(std::io::ErrorKind::Other, "missing name"))?, - }; - let org = package.name.namespace.as_str(); - let pkg = package.name.name.as_str(); - let namespace = format!("{}:{}/{}", org, pkg, name); - for (name, item) in interface.types.iter() { - match self.cache.types.get(*item) { - Some(s) => { - if let Err(e) = self.export_type(s, file) { - tracing::error!("error exporting type: {:?}", e) - } - } - None => tracing::error!("type not found: {:?}", name), - } - } - for (_, item) in interface.functions.iter() { - if item.kind != FunctionKind::Freestanding { - continue; - } - if let Err(e) = self.export_functions(item, &namespace, file) { - tracing::error!("error exporting function: {:?}", e) - } - } - Ok(()) - } -} diff --git a/projects/valkyrie-ffi/src/imports/visit_types/mod.rs b/projects/valkyrie-ffi/src/imports/visit_types/mod.rs deleted file mode 100644 index 3fa15f82..00000000 --- a/projects/valkyrie-ffi/src/imports/visit_types/mod.rs +++ /dev/null @@ -1,61 +0,0 @@ -use super::*; - -mod visit_functions; - -impl ValkyrieFFI { - pub(crate) fn export_type(&self, ty: &TypeDef, file: &mut File) -> std::io::Result<()> { - match ty.kind { - TypeDefKind::Record(_) => { - file.write(b"Record\n\n")?; - } - TypeDefKind::Resource => self.export_resource(ty, file)?, - TypeDefKind::Handle(_) => { - file.write(b"Handle\n\n")?; - } - TypeDefKind::Flags(_) => { - file.write(b"Flags\n\n")?; - } - TypeDefKind::Tuple(_) => { - file.write(b"Tuple\n\n")?; - } - TypeDefKind::Variant(_) => { - file.write(b"Variant\n\n")?; - } - TypeDefKind::Enum(_) => { - file.write(b"Enum\n\n")?; - } - TypeDefKind::Option(_) => { - file.write(b"Option\n\n")?; - } - TypeDefKind::Result(_) => { - file.write(b"Result\n\n")?; - } - TypeDefKind::List(_) => { - file.write(b"List\n\n")?; - } - TypeDefKind::Future(_) => { - file.write(b"Future\n\n")?; - } - TypeDefKind::Stream(_) => { - file.write(b"Stream\n\n")?; - } - TypeDefKind::Type(v) => { - writeln!(file, "Type: {:?} {:?}\n", ty.name, v)?; - } - TypeDefKind::Unknown => { - file.write(b"Unknown\n\n")?; - } - } - Ok(()) - } - fn export_resource(&self, ty: &TypeDef, file: &mut File) -> std::io::Result<()> { - let name = match &ty.name { - Some(s) => s.to_case(Case::UpperCamel), - None => Err(std::io::Error::new(std::io::ErrorKind::Other, "missing name"))?, - }; - writeln!(file, "#resource")?; - writeln!(file, "#ffi(\"{}\")", name)?; - writeln!(file, "class {} {{}}", name)?; - writeln!(file, "") - } -} diff --git a/projects/valkyrie-ffi/src/imports/visit_types/visit_functions.rs b/projects/valkyrie-ffi/src/imports/visit_types/visit_functions.rs deleted file mode 100644 index 4d09e5fd..00000000 --- a/projects/valkyrie-ffi/src/imports/visit_types/visit_functions.rs +++ /dev/null @@ -1,10 +0,0 @@ -use super::*; - -impl ValkyrieFFI { - pub(crate) fn export_functions(&self, ty: &Function, namespace: &str, file: &mut File) -> std::io::Result<()> { - let name = ty.name.to_case(Case::Snake); - writeln!(file, "ffi(\"{}\", \"{}\")", namespace, ty.name)?; - writeln!(file, "micro {}(", name)?; - writeln!(file, "") - } -} diff --git a/projects/valkyrie-ffi/src/lib.rs b/projects/valkyrie-ffi/src/lib.rs deleted file mode 100644 index e2ad3529..00000000 --- a/projects/valkyrie-ffi/src/lib.rs +++ /dev/null @@ -1,5 +0,0 @@ -mod exports; -mod helpers; -mod imports; - -pub use crate::{exports::ValkyrieWIT, imports::ValkyrieFFI}; diff --git a/projects/valkyrie-ffi/tests/main.rs b/projects/valkyrie-ffi/tests/main.rs deleted file mode 100644 index c4cf505a..00000000 --- a/projects/valkyrie-ffi/tests/main.rs +++ /dev/null @@ -1,15 +0,0 @@ -use std::path::Path; -use valkyrie_wit::ValkyrieFFI; - -#[test] -fn ready() { - println!("it works!") -} - -#[test] -fn load_all() { - let dir = r#"C:\Users\Dell\Downloads\wasi-cloud-core-main\wit"#; - let mut resolved = ValkyrieFFI::new(dir).unwrap(); - let here = Path::new(env!("CARGO_MANIFEST_DIR")).join("tests"); - resolved.generate(here).unwrap(); -} diff --git a/projects/valkyrie-ffi/tests/wasi/blobstore.vk b/projects/valkyrie-ffi/tests/wasi/blobstore.vk deleted file mode 100644 index 353015a0..00000000 --- a/projects/valkyrie-ffi/tests/wasi/blobstore.vk +++ /dev/null @@ -1,82 +0,0 @@ -Type: Some("input-stream") Id(Id { idx: 10 }) - -Type: Some("output-stream") Id(Id { idx: 11 }) - -Type: Some("container-name") String - -Type: Some("object-name") String - -Type: Some("timestamp") U64 - -Type: Some("object-size") U64 - -Type: Some("error") String - -Record - -Record - -Record - -#resource -#ffi("OutgoingValue") -class OutgoingValue {} - -#resource -#ffi("IncomingValue") -class IncomingValue {} - -Type: Some("incoming-value-async-body") Id(Id { idx: 19 }) - -List - -Type: Some("input-stream") Id(Id { idx: 10 }) - -Type: Some("output-stream") Id(Id { idx: 11 }) - -Type: Some("container-metadata") Id(Id { idx: 26 }) - -Type: Some("error") Id(Id { idx: 25 }) - -Type: Some("incoming-value") Id(Id { idx: 30 }) - -Type: Some("object-metadata") Id(Id { idx: 27 }) - -Type: Some("object-name") Id(Id { idx: 22 }) - -Type: Some("outgoing-value") Id(Id { idx: 29 }) - -#resource -#ffi("Container") -class Container {} - -#resource -#ffi("StreamObjectNames") -class StreamObjectNames {} - -Type: Some("container") Id(Id { idx: 48 }) - -Type: Some("error") Id(Id { idx: 25 }) - -Type: Some("container-name") Id(Id { idx: 21 }) - -Type: Some("object-id") Id(Id { idx: 28 }) - -ffi("wasi:blobstore/blobstore", "create-container") -micro create_container( - -ffi("wasi:blobstore/blobstore", "get-container") -micro get_container( - -ffi("wasi:blobstore/blobstore", "delete-container") -micro delete_container( - -ffi("wasi:blobstore/blobstore", "container-exists") -micro container_exists( - -ffi("wasi:blobstore/blobstore", "copy-object") -micro copy_object( - -ffi("wasi:blobstore/blobstore", "move-object") -micro move_object( - diff --git a/projects/valkyrie-ffi/tests/wasi/cli.vk b/projects/valkyrie-ffi/tests/wasi/cli.vk deleted file mode 100644 index 10f50840..00000000 --- a/projects/valkyrie-ffi/tests/wasi/cli.vk +++ /dev/null @@ -1,53 +0,0 @@ -ffi("wasi:cli/environment", "get-environment") -micro get_environment( - -ffi("wasi:cli/environment", "get-arguments") -micro get_arguments( - -ffi("wasi:cli/environment", "initial-cwd") -micro initial_cwd( - -ffi("wasi:cli/exit", "exit") -micro exit( - -ffi("wasi:cli/run", "run") -micro run( - -Type: Some("input-stream") Id(Id { idx: 10 }) - -ffi("wasi:cli/stdin", "get-stdin") -micro get_stdin( - -Type: Some("output-stream") Id(Id { idx: 11 }) - -ffi("wasi:cli/stdout", "get-stdout") -micro get_stdout( - -Type: Some("output-stream") Id(Id { idx: 11 }) - -ffi("wasi:cli/stderr", "get-stderr") -micro get_stderr( - -#resource -#ffi("TerminalInput") -class TerminalInput {} - -#resource -#ffi("TerminalOutput") -class TerminalOutput {} - -Type: Some("terminal-input") Id(Id { idx: 228 }) - -ffi("wasi:cli/terminal-stdin", "get-terminal-stdin") -micro get_terminal_stdin( - -Type: Some("terminal-output") Id(Id { idx: 229 }) - -ffi("wasi:cli/terminal-stdout", "get-terminal-stdout") -micro get_terminal_stdout( - -Type: Some("terminal-output") Id(Id { idx: 229 }) - -ffi("wasi:cli/terminal-stderr", "get-terminal-stderr") -micro get_terminal_stderr( - diff --git a/projects/valkyrie-ffi/tests/wasi/clocks.vk b/projects/valkyrie-ffi/tests/wasi/clocks.vk deleted file mode 100644 index 2a7ff3a5..00000000 --- a/projects/valkyrie-ffi/tests/wasi/clocks.vk +++ /dev/null @@ -1,26 +0,0 @@ -Type: Some("pollable") Id(Id { idx: 2 }) - -Type: Some("instant") U64 - -Type: Some("duration") U64 - -ffi("wasi:clocks/monotonic-clock", "now") -micro now( - -ffi("wasi:clocks/monotonic-clock", "resolution") -micro resolution( - -ffi("wasi:clocks/monotonic-clock", "subscribe-instant") -micro subscribe_instant( - -ffi("wasi:clocks/monotonic-clock", "subscribe-duration") -micro subscribe_duration( - -Record - -ffi("wasi:clocks/wall-clock", "now") -micro now( - -ffi("wasi:clocks/wall-clock", "resolution") -micro resolution( - diff --git a/projects/valkyrie-ffi/tests/wasi/cloud-core.vk b/projects/valkyrie-ffi/tests/wasi/cloud-core.vk deleted file mode 100644 index e69de29b..00000000 diff --git a/projects/valkyrie-ffi/tests/wasi/config.vk b/projects/valkyrie-ffi/tests/wasi/config.vk deleted file mode 100644 index 2951ee7c..00000000 --- a/projects/valkyrie-ffi/tests/wasi/config.vk +++ /dev/null @@ -1,8 +0,0 @@ -Variant - -ffi("wasi:config/runtime", "get") -micro get( - -ffi("wasi:config/runtime", "get-all") -micro get_all( - diff --git a/projects/valkyrie-ffi/tests/wasi/filesystem.vk b/projects/valkyrie-ffi/tests/wasi/filesystem.vk deleted file mode 100644 index 79ae34b0..00000000 --- a/projects/valkyrie-ffi/tests/wasi/filesystem.vk +++ /dev/null @@ -1,48 +0,0 @@ -Type: Some("input-stream") Id(Id { idx: 10 }) - -Type: Some("output-stream") Id(Id { idx: 11 }) - -Type: Some("error") Id(Id { idx: 6 }) - -Type: Some("datetime") Id(Id { idx: 79 }) - -Type: Some("filesize") U64 - -Enum - -Flags - -Flags - -Flags - -Type: Some("link-count") U64 - -Record - -Variant - -Record - -Enum - -Enum - -Record - -#resource -#ffi("Descriptor") -class Descriptor {} - -#resource -#ffi("DirectoryEntryStream") -class DirectoryEntryStream {} - -ffi("wasi:filesystem/types", "filesystem-error-code") -micro filesystem_error_code( - -Type: Some("descriptor") Id(Id { idx: 98 }) - -ffi("wasi:filesystem/preopens", "get-directories") -micro get_directories( - diff --git a/projects/valkyrie-ffi/tests/wasi/http.vk b/projects/valkyrie-ffi/tests/wasi/http.vk deleted file mode 100644 index 044bbed4..00000000 --- a/projects/valkyrie-ffi/tests/wasi/http.vk +++ /dev/null @@ -1,99 +0,0 @@ -Type: Some("duration") Id(Id { idx: 78 }) - -Type: Some("input-stream") Id(Id { idx: 10 }) - -Type: Some("output-stream") Id(Id { idx: 11 }) - -Type: Some("io-error") Id(Id { idx: 0 }) - -Type: Some("pollable") Id(Id { idx: 2 }) - -Variant - -Variant - -Record - -Record - -Record - -Variant - -Variant - -Type: Some("field-key") String - -List - -#resource -#ffi("Fields") -class Fields {} - -Type: Some("headers") Id(Id { idx: 269 }) - -Type: Some("trailers") Id(Id { idx: 269 }) - -#resource -#ffi("IncomingRequest") -class IncomingRequest {} - -#resource -#ffi("OutgoingRequest") -class OutgoingRequest {} - -#resource -#ffi("RequestOptions") -class RequestOptions {} - -#resource -#ffi("ResponseOutparam") -class ResponseOutparam {} - -Type: Some("status-code") U16 - -#resource -#ffi("IncomingResponse") -class IncomingResponse {} - -#resource -#ffi("IncomingBody") -class IncomingBody {} - -#resource -#ffi("FutureTrailers") -class FutureTrailers {} - -#resource -#ffi("OutgoingResponse") -class OutgoingResponse {} - -#resource -#ffi("OutgoingBody") -class OutgoingBody {} - -#resource -#ffi("FutureIncomingResponse") -class FutureIncomingResponse {} - -ffi("wasi:http/types", "http-error-code") -micro http_error_code( - -Type: Some("incoming-request") Id(Id { idx: 272 }) - -Type: Some("response-outparam") Id(Id { idx: 275 }) - -ffi("wasi:http/incoming-handler", "handle") -micro handle( - -Type: Some("outgoing-request") Id(Id { idx: 273 }) - -Type: Some("request-options") Id(Id { idx: 274 }) - -Type: Some("future-incoming-response") Id(Id { idx: 282 }) - -Type: Some("error-code") Id(Id { idx: 265 }) - -ffi("wasi:http/outgoing-handler", "handle") -micro handle( - diff --git a/projects/valkyrie-ffi/tests/wasi/io.vk b/projects/valkyrie-ffi/tests/wasi/io.vk deleted file mode 100644 index 8e1d7095..00000000 --- a/projects/valkyrie-ffi/tests/wasi/io.vk +++ /dev/null @@ -1,25 +0,0 @@ -#resource -#ffi("Error") -class Error {} - -#resource -#ffi("Pollable") -class Pollable {} - -ffi("wasi:io/poll", "poll") -micro poll( - -Type: Some("error") Id(Id { idx: 0 }) - -Type: Some("pollable") Id(Id { idx: 2 }) - -Variant - -#resource -#ffi("InputStream") -class InputStream {} - -#resource -#ffi("OutputStream") -class OutputStream {} - diff --git a/projects/valkyrie-ffi/tests/wasi/keyvalue.vk b/projects/valkyrie-ffi/tests/wasi/keyvalue.vk deleted file mode 100644 index 2bc575c0..00000000 --- a/projects/valkyrie-ffi/tests/wasi/keyvalue.vk +++ /dev/null @@ -1,147 +0,0 @@ -#resource -#ffi("Error") -class Error {} - -Type: Some("input-stream") Id(Id { idx: 10 }) - -Type: Some("output-stream") Id(Id { idx: 11 }) - -Type: Some("error") Id(Id { idx: 343 }) - -#resource -#ffi("Bucket") -class Bucket {} - -Type: Some("key") String - -#resource -#ffi("OutgoingValue") -class OutgoingValue {} - -Type: Some("outgoing-value-body-async") Id(Id { idx: 346 }) - -List - -#resource -#ffi("IncomingValue") -class IncomingValue {} - -Type: Some("incoming-value-async-body") Id(Id { idx: 345 }) - -List - -Type: Some("bucket") Id(Id { idx: 348 }) - -Type: Some("error") Id(Id { idx: 347 }) - -Type: Some("key") Id(Id { idx: 349 }) - -ffi("wasi:keyvalue/atomic", "increment") -micro increment( - -ffi("wasi:keyvalue/atomic", "compare-and-swap") -micro compare_and_swap( - -Type: Some("pollable") Id(Id { idx: 2 }) - -Type: Some("key") Id(Id { idx: 349 }) - -Type: Some("incoming-value") Id(Id { idx: 353 }) - -Type: Some("outgoing-value") Id(Id { idx: 350 }) - -Type: Some("error") Id(Id { idx: 347 }) - -#resource -#ffi("FutureGetResult") -class FutureGetResult {} - -#resource -#ffi("FutureExistsResult") -class FutureExistsResult {} - -#resource -#ffi("FutureResult") -class FutureResult {} - -#resource -#ffi("FutureGetOrSetResult") -class FutureGetOrSetResult {} - -#resource -#ffi("Vacancy") -class Vacancy {} - -Variant - -ffi("wasi:keyvalue/cache", "get") -micro get( - -ffi("wasi:keyvalue/cache", "exists") -micro exists( - -ffi("wasi:keyvalue/cache", "set") -micro set( - -ffi("wasi:keyvalue/cache", "get-or-set") -micro get_or_set( - -ffi("wasi:keyvalue/cache", "delete") -micro delete( - -Type: Some("bucket") Id(Id { idx: 348 }) - -Type: Some("error") Id(Id { idx: 347 }) - -Type: Some("key") Id(Id { idx: 349 }) - -Type: Some("incoming-value") Id(Id { idx: 353 }) - -Type: Some("outgoing-value") Id(Id { idx: 350 }) - -ffi("wasi:keyvalue/eventual-batch", "get-many") -micro get_many( - -ffi("wasi:keyvalue/eventual-batch", "keys") -micro keys( - -ffi("wasi:keyvalue/eventual-batch", "set-many") -micro set_many( - -ffi("wasi:keyvalue/eventual-batch", "delete-many") -micro delete_many( - -Type: Some("bucket") Id(Id { idx: 348 }) - -Type: Some("error") Id(Id { idx: 347 }) - -Type: Some("incoming-value") Id(Id { idx: 353 }) - -Type: Some("key") Id(Id { idx: 349 }) - -Type: Some("outgoing-value") Id(Id { idx: 350 }) - -ffi("wasi:keyvalue/eventual", "get") -micro get( - -ffi("wasi:keyvalue/eventual", "set") -micro set( - -ffi("wasi:keyvalue/eventual", "delete") -micro delete( - -ffi("wasi:keyvalue/eventual", "exists") -micro exists( - -Type: Some("bucket") Id(Id { idx: 348 }) - -Type: Some("key") Id(Id { idx: 349 }) - -Type: Some("incoming-value") Id(Id { idx: 353 }) - -ffi("wasi:keyvalue/handle-watch", "on-set") -micro on_set( - -ffi("wasi:keyvalue/handle-watch", "on-delete") -micro on_delete( - diff --git a/projects/valkyrie-ffi/tests/wasi/messaging.vk b/projects/valkyrie-ffi/tests/wasi/messaging.vk deleted file mode 100644 index 61be5441..00000000 --- a/projects/valkyrie-ffi/tests/wasi/messaging.vk +++ /dev/null @@ -1,64 +0,0 @@ -#resource -#ffi("Client") -class Client {} - -#resource -#ffi("Error") -class Error {} - -Type: Some("channel") String - -Record - -Enum - -Record - -Type: Some("client") Id(Id { idx: 448 }) - -Type: Some("message") Id(Id { idx: 458 }) - -Type: Some("channel") Id(Id { idx: 450 }) - -Type: Some("error") Id(Id { idx: 449 }) - -Type: Some("guest-configuration") Id(Id { idx: 455 }) - -ffi("wasi:messaging/consumer", "subscribe-try-receive") -micro subscribe_try_receive( - -ffi("wasi:messaging/consumer", "subscribe-receive") -micro subscribe_receive( - -ffi("wasi:messaging/consumer", "update-guest-configuration") -micro update_guest_configuration( - -ffi("wasi:messaging/consumer", "complete-message") -micro complete_message( - -ffi("wasi:messaging/consumer", "abandon-message") -micro abandon_message( - -Type: Some("message") Id(Id { idx: 458 }) - -Type: Some("guest-configuration") Id(Id { idx: 455 }) - -Type: Some("error") Id(Id { idx: 449 }) - -ffi("wasi:messaging/messaging-guest", "configure") -micro configure( - -ffi("wasi:messaging/messaging-guest", "handler") -micro handler( - -Type: Some("client") Id(Id { idx: 448 }) - -Type: Some("channel") Id(Id { idx: 450 }) - -Type: Some("message") Id(Id { idx: 458 }) - -Type: Some("error") Id(Id { idx: 449 }) - -ffi("wasi:messaging/producer", "send") -micro send( - diff --git a/projects/valkyrie-ffi/tests/wasi/random.vk b/projects/valkyrie-ffi/tests/wasi/random.vk deleted file mode 100644 index 508d92bc..00000000 --- a/projects/valkyrie-ffi/tests/wasi/random.vk +++ /dev/null @@ -1,15 +0,0 @@ -ffi("wasi:random/insecure-seed", "insecure-seed") -micro insecure_seed( - -ffi("wasi:random/insecure", "get-insecure-random-bytes") -micro get_insecure_random_bytes( - -ffi("wasi:random/insecure", "get-insecure-random-u64") -micro get_insecure_random_u_64( - -ffi("wasi:random/random", "get-random-bytes") -micro get_random_bytes( - -ffi("wasi:random/random", "get-random-u64") -micro get_random_u_64( - diff --git a/projects/valkyrie-ffi/tests/wasi/sockets.vk b/projects/valkyrie-ffi/tests/wasi/sockets.vk deleted file mode 100644 index 89c24750..00000000 --- a/projects/valkyrie-ffi/tests/wasi/sockets.vk +++ /dev/null @@ -1,110 +0,0 @@ -#resource -#ffi("Network") -class Network {} - -Enum - -Enum - -Tuple - -Tuple - -Variant - -Record - -Record - -Variant - -Type: Some("network") Id(Id { idx: 128 }) - -ffi("wasi:sockets/instance-network", "instance-network") -micro instance_network( - -Type: Some("pollable") Id(Id { idx: 2 }) - -Type: Some("network") Id(Id { idx: 128 }) - -Type: Some("error-code") Id(Id { idx: 129 }) - -Type: Some("ip-address") Id(Id { idx: 133 }) - -#resource -#ffi("ResolveAddressStream") -class ResolveAddressStream {} - -ffi("wasi:sockets/ip-name-lookup", "resolve-addresses") -micro resolve_addresses( - -Type: Some("input-stream") Id(Id { idx: 10 }) - -Type: Some("output-stream") Id(Id { idx: 11 }) - -Type: Some("pollable") Id(Id { idx: 2 }) - -Type: Some("duration") Id(Id { idx: 78 }) - -Type: Some("network") Id(Id { idx: 128 }) - -Type: Some("error-code") Id(Id { idx: 129 }) - -Type: Some("ip-socket-address") Id(Id { idx: 136 }) - -Type: Some("ip-address-family") Id(Id { idx: 130 }) - -Enum - -#resource -#ffi("TcpSocket") -class TcpSocket {} - -Type: Some("network") Id(Id { idx: 128 }) - -Type: Some("error-code") Id(Id { idx: 129 }) - -Type: Some("ip-address-family") Id(Id { idx: 130 }) - -Type: Some("tcp-socket") Id(Id { idx: 158 }) - -ffi("wasi:sockets/tcp-create-socket", "create-tcp-socket") -micro create_tcp_socket( - -Type: Some("pollable") Id(Id { idx: 2 }) - -Type: Some("network") Id(Id { idx: 128 }) - -Type: Some("error-code") Id(Id { idx: 129 }) - -Type: Some("ip-socket-address") Id(Id { idx: 136 }) - -Type: Some("ip-address-family") Id(Id { idx: 130 }) - -Record - -Record - -#resource -#ffi("UdpSocket") -class UdpSocket {} - -#resource -#ffi("IncomingDatagramStream") -class IncomingDatagramStream {} - -#resource -#ffi("OutgoingDatagramStream") -class OutgoingDatagramStream {} - -Type: Some("network") Id(Id { idx: 128 }) - -Type: Some("error-code") Id(Id { idx: 129 }) - -Type: Some("ip-address-family") Id(Id { idx: 130 }) - -Type: Some("udp-socket") Id(Id { idx: 190 }) - -ffi("wasi:sockets/udp-create-socket", "create-udp-socket") -micro create_udp_socket( - diff --git a/projects/valkyrie-ffi/tests/wasi/sql.vk b/projects/valkyrie-ffi/tests/wasi/sql.vk deleted file mode 100644 index 9885e23f..00000000 --- a/projects/valkyrie-ffi/tests/wasi/sql.vk +++ /dev/null @@ -1,30 +0,0 @@ -Variant - -Record - -#resource -#ffi("Statement") -class Statement {} - -#resource -#ffi("Error") -class Error {} - -#resource -#ffi("Connection") -class Connection {} - -Type: Some("statement") Id(Id { idx: 492 }) - -Type: Some("row") Id(Id { idx: 491 }) - -Type: Some("error") Id(Id { idx: 493 }) - -Type: Some("connection") Id(Id { idx: 494 }) - -ffi("wasi:sql/readwrite", "query") -micro query( - -ffi("wasi:sql/readwrite", "exec") -micro exec( - diff --git a/projects/valkyrie-parser/grammars/valkyrie.ygg b/projects/valkyrie-parser/grammars/valkyrie.ygg index dc69973b..88cea9f8 100644 --- a/projects/valkyrie-parser/grammars/valkyrie.ygg +++ b/projects/valkyrie-parser/grammars/valkyrie.ygg @@ -873,8 +873,8 @@ hide class SkipSpace { } @style(comment) hide class Comment { - | [~⍝🗨] ROL - | '/*' '*/' + | /[⍝🗨]|\\{2}/ ROL + | '🗨🗨🗨' '🗩🗩🗩' } // ============================----------------------------------------------------------------------------------------- // === string interpolation === ---------------------------------------------------------------------------------------- diff --git a/projects/valkyrie-types/Cargo.toml b/projects/valkyrie-types/Cargo.toml index 5966dca0..fed27450 100644 --- a/projects/valkyrie-types/Cargo.toml +++ b/projects/valkyrie-types/Cargo.toml @@ -22,7 +22,7 @@ jupyter-types = "0.0.*" convert_case = "0.6.0" [dependencies.nyar-wasm] -version = "0.0.5" +version = "0.0.6" path = 'C:\Users\Dell\CLionProjects\nyar-vm\projects\nyar-wasm' [dependencies.nyar-error] diff --git a/projects/valkyrie-types/src/structures/display.rs b/projects/valkyrie-types/src/structures/display.rs index 15cbe7a8..268babbe 100644 --- a/projects/valkyrie-types/src/structures/display.rs +++ b/projects/valkyrie-types/src/structures/display.rs @@ -16,6 +16,7 @@ impl Debug for ValkyrieClass { } } } + impl Debug for ValkyrieField { fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { f.debug_struct("Field").field("name", &self.field_name).field("wasi", &self.wasi_alias).finish() diff --git a/projects/valkyrie-types/tests/random.vk b/projects/valkyrie-types/tests/random.vk deleted file mode 100644 index d633e6a9..00000000 --- a/projects/valkyrie-types/tests/random.vk +++ /dev/null @@ -1,13 +0,0 @@ -namespace package.random;; - -#ffi("wasi:random/random", "get-random-u64") -function random_seed_safe() -> u64 { - -} - -#ffi("wasi:random/insecure", "get-insecure-random-u64") -function random_seed_fast() -> u64 { - -} - - diff --git a/projects/valkyrie-types/tests/source/fs/_.vk b/projects/valkyrie-types/tests/source/fs/_.vk new file mode 100644 index 00000000..404d241f --- /dev/null +++ b/projects/valkyrie-types/tests/source/fs/_.vk @@ -0,0 +1,26 @@ +namespace package.fs + +enumerate DescriptorType { + \\\ The type of the descriptor or file is unknown or is different from + \\\ any of the other types specified. + Unknown, + \\\ The descriptor refers to a block device inode. + BlockDevice, + \\\ The descriptor refers to a character device inode. + CharacterDevice, + \\\ The descriptor refers to a directory inode. + Directory, + \\\ The descriptor refers to a named pipe. + FIFO, + \\\ The file refers to a symbolic link inode. + SymbolicLink, + \\\ The descriptor refers to a regular file inode. + RegularFile, + \\\ The descriptor refers to a socket. + Socket, +} + +#import("wasi:filesystem/types", "descriptor") +class Descriptor { + +} \ No newline at end of file diff --git a/projects/valkyrie-types/tests/source/io/_.vk b/projects/valkyrie-types/tests/source/io/_.vk index 9e496199..be899011 100644 --- a/projects/valkyrie-types/tests/source/io/_.vk +++ b/projects/valkyrie-types/tests/source/io/_.vk @@ -11,3 +11,4 @@ union StreamError { } +