mirror of
https://github.com/fluencelabs/aquavm
synced 2025-06-25 12:41:33 +00:00
Rename Aqua to AIR, move AVM from FCE (#99)
This commit is contained in:
@ -8,7 +8,7 @@ edition = "2018"
|
||||
include = [
|
||||
"**/*.rs",
|
||||
"Cargo.toml",
|
||||
"aquamarine.wasm"
|
||||
"air_interpreter_server.wasm"
|
||||
]
|
||||
|
||||
[build-dependencies]
|
||||
|
@ -1,4 +1,4 @@
|
||||
pub const INTERPRETER_WASM: &'static [u8] = include_bytes!("../aquamarine.wasm");
|
||||
pub const INTERPRETER_WASM: &'static [u8] = include_bytes!("../air_interpreter_server.wasm");
|
||||
|
||||
pub mod build_info {
|
||||
include!(concat!(env!("OUT_DIR"), "/built.rs"));
|
||||
|
@ -152,8 +152,7 @@ fn parse_deep(c: &mut Criterion) {
|
||||
|
||||
fn parse_dashboard_script(c: &mut Criterion) {
|
||||
let parser = Rc::new(AIRParser::new());
|
||||
const DASHBOARD_SCRIPT: &str =
|
||||
include_str!("../../../interpreter-lib/tests/scripts/dashboard.clj");
|
||||
const DASHBOARD_SCRIPT: &str = include_str!("../../../air/tests/scripts/dashboard.clj");
|
||||
|
||||
c.bench_function(
|
||||
format!("parse {} bytes", DASHBOARD_SCRIPT.len()).as_str(),
|
||||
|
@ -1,5 +1,5 @@
|
||||
// auto-generated: "lalrpop 0.19.5"
|
||||
// sha3: 77dae23ab83d8f477c2499daf2bf613faf395480197fcef0e8db3bfaf80735c
|
||||
// sha3: 1cadaaf56b5b5fbe817c11b265260f6264013d92baffb3953cc5e20876491fe
|
||||
use crate::parser::ast::*;
|
||||
use crate::parser::air_parser::make_flattened_error;
|
||||
use crate::parser::ParserError;
|
||||
|
@ -37,7 +37,7 @@ thread_local!(static PARSER: AIRParser = AIRParser::new());
|
||||
/// Parse AIR `source_code` to `Box<Instruction>`
|
||||
pub fn parse(air_script: &str) -> Result<Box<Instruction<'_>>, String> {
|
||||
let mut files = SimpleFiles::new();
|
||||
let file_id = files.add("script.aqua", air_script);
|
||||
let file_id = files.add("script.air", air_script);
|
||||
|
||||
PARSER.with(|parser| {
|
||||
let mut errors = Vec::new();
|
||||
|
@ -197,7 +197,7 @@ impl<'input> CallVariableParser<'input> {
|
||||
}
|
||||
|
||||
fn try_parse_as_alphanumeric(&self) -> LexerResult<()> {
|
||||
if !self.aqua_alphanumeric() {
|
||||
if !self.air_alphanumeric() {
|
||||
let error_pos = self.pos_in_string_to_parse();
|
||||
return Err(LexerError::IsNotAlphanumeric(error_pos, error_pos));
|
||||
}
|
||||
@ -246,8 +246,8 @@ impl<'input> CallVariableParser<'input> {
|
||||
self.state.first_dot_met_pos.is_some()
|
||||
}
|
||||
|
||||
fn aqua_alphanumeric(&self) -> bool {
|
||||
super::is_aqua_alphanumeric(self.current_char())
|
||||
fn air_alphanumeric(&self) -> bool {
|
||||
super::is_air_alphanumeric(self.current_char())
|
||||
}
|
||||
|
||||
fn json_path_allowed_char(&self) -> bool {
|
||||
|
@ -62,6 +62,7 @@ use crate::parser::ParserError;
|
||||
impl<'err, 'input, 'i> __ToTriple<'err, 'input, 'i>
|
||||
for Result<(usize, Token<'input>, usize), LexerError>
|
||||
{
|
||||
#[allow(clippy::wrong_self_convention)]
|
||||
fn to_triple(
|
||||
value: Self,
|
||||
) -> Result<
|
||||
|
@ -31,5 +31,5 @@ pub use token::Variable;
|
||||
|
||||
pub(super) type LexerResult<T> = std::result::Result<T, LexerError>;
|
||||
|
||||
pub(self) use utils::is_aqua_alphanumeric;
|
||||
pub(self) use utils::is_air_alphanumeric;
|
||||
pub(self) use utils::is_json_path_allowed_char;
|
||||
|
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
pub(super) fn is_aqua_alphanumeric(ch: char) -> bool {
|
||||
pub(super) fn is_air_alphanumeric(ch: char) -> bool {
|
||||
ch.is_alphanumeric() || ch == '_' || ch == '-'
|
||||
}
|
||||
|
||||
@ -37,6 +37,6 @@ pub(super) fn is_json_path_allowed_char(ch: char) -> bool {
|
||||
',' => true,
|
||||
'"' => true,
|
||||
'\'' => true,
|
||||
ch => is_aqua_alphanumeric(ch),
|
||||
ch => is_air_alphanumeric(ch),
|
||||
}
|
||||
}
|
||||
|
@ -84,7 +84,7 @@ impl<'i> VariableValidator<'i> {
|
||||
self.unresolved_iterables.insert(iterable_name, span);
|
||||
}
|
||||
|
||||
pub(super) fn finalize<'err>(&self) -> Vec<ErrorRecovery<usize, Token<'i>, ParserError>> {
|
||||
pub(super) fn finalize(&self) -> Vec<ErrorRecovery<usize, Token<'i>, ParserError>> {
|
||||
let mut errors = Vec::new();
|
||||
for (name, span) in self.unresolved_variables.iter() {
|
||||
if !self.contains_variable(name, *span) {
|
||||
|
@ -1,13 +1,13 @@
|
||||
[package]
|
||||
name = "aqua-interpreter-interface"
|
||||
description = "Interface of the Aquamarine interpreter"
|
||||
name = "air-interpreter-interface"
|
||||
description = "Interface of the AIR interpreter"
|
||||
version = "0.5.0"
|
||||
authors = ["Fluence Labs"]
|
||||
edition = "2018"
|
||||
license = "Apache-2.0"
|
||||
|
||||
[lib]
|
||||
name = "aqua_interpreter_interface"
|
||||
name = "air_interpreter_interface"
|
||||
path = "src/lib.rs"
|
||||
|
||||
[dependencies]
|
||||
|
@ -1,12 +1,12 @@
|
||||
[package]
|
||||
name = "aqua-test-module"
|
||||
name = "air-test-module"
|
||||
version = "0.1.0"
|
||||
authors = ["Fluence Labs"]
|
||||
edition = "2018"
|
||||
license = "Apache-2.0"
|
||||
|
||||
[[bin]]
|
||||
name = "aqua_test_module"
|
||||
name = "air_test_module"
|
||||
path = "src/main.rs"
|
||||
|
||||
[dependencies]
|
||||
|
@ -1,15 +1,15 @@
|
||||
[package]
|
||||
name = "aqua-test-utils"
|
||||
name = "air-test-utils"
|
||||
version = "0.1.0"
|
||||
authors = ["Fluence Labs"]
|
||||
edition = "2018"
|
||||
license = "Apache-2.0"
|
||||
|
||||
[lib]
|
||||
name = "aqua_test_utils"
|
||||
name = "air_test_utils"
|
||||
path = "src/lib.rs"
|
||||
|
||||
[dependencies]
|
||||
fluence = "0.6.1"
|
||||
aquamarine-vm = { version = "0.7.0", features = ["raw-aquamarine-vm-api"] }
|
||||
avm-server = { path = "../../avm/server", features = ["raw-avm-api"] }
|
||||
serde_json = "1.0.56"
|
||||
|
@ -25,36 +25,33 @@
|
||||
unreachable_patterns
|
||||
)]
|
||||
|
||||
pub use aquamarine_vm::ne_vec::NEVec;
|
||||
pub use aquamarine_vm::AquamarineVM;
|
||||
pub use aquamarine_vm::AquamarineVMConfig;
|
||||
pub use aquamarine_vm::AquamarineVMError;
|
||||
pub use aquamarine_vm::CallServiceClosure;
|
||||
pub use aquamarine_vm::IType;
|
||||
pub use aquamarine_vm::IValue;
|
||||
pub use aquamarine_vm::InterpreterOutcome;
|
||||
pub use aquamarine_vm::ParticleParameters;
|
||||
pub use avm_server::ne_vec::NEVec;
|
||||
pub use avm_server::AVMConfig;
|
||||
pub use avm_server::AVMError;
|
||||
pub use avm_server::CallServiceClosure;
|
||||
pub use avm_server::IType;
|
||||
pub use avm_server::IValue;
|
||||
pub use avm_server::InterpreterOutcome;
|
||||
pub use avm_server::ParticleParameters;
|
||||
pub use avm_server::AVM;
|
||||
|
||||
use std::collections::HashMap;
|
||||
use std::path::PathBuf;
|
||||
|
||||
type JValue = serde_json::Value;
|
||||
|
||||
pub fn create_aqua_vm(
|
||||
call_service: CallServiceClosure,
|
||||
current_peer_id: impl Into<String>,
|
||||
) -> AquamarineVM {
|
||||
pub fn create_avm(call_service: CallServiceClosure, current_peer_id: impl Into<String>) -> AVM {
|
||||
let tmp_dir = std::env::temp_dir();
|
||||
|
||||
let config = AquamarineVMConfig {
|
||||
aquamarine_wasm_path: PathBuf::from("../target/wasm32-wasi/debug/aquamarine.wasm"),
|
||||
let config = AVMConfig {
|
||||
air_wasm_path: PathBuf::from("../target/wasm32-wasi/debug/air_interpreter_server.wasm"),
|
||||
call_service,
|
||||
current_peer_id: current_peer_id.into(),
|
||||
particle_data_store: tmp_dir,
|
||||
logging_mask: i32::max_value(),
|
||||
};
|
||||
|
||||
AquamarineVM::new(config).expect("vm should be created")
|
||||
AVM::new(config).expect("vm should be created")
|
||||
}
|
||||
|
||||
pub fn unit_call_service() -> CallServiceClosure {
|
||||
|
Reference in New Issue
Block a user