@tishlang/tish 1.0.13 → 1.0.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. package/crates/js_to_tish/Cargo.toml +4 -2
  2. package/crates/js_to_tish/src/span_util.rs +1 -1
  3. package/crates/js_to_tish/src/transform/expr.rs +15 -15
  4. package/crates/js_to_tish/src/transform/stmt.rs +7 -7
  5. package/crates/js_to_tish/src/transform.rs +1 -1
  6. package/crates/tish/Cargo.toml +22 -22
  7. package/crates/tish/src/main.rs +46 -46
  8. package/crates/tish/src/repl_completion.rs +4 -4
  9. package/crates/tish/tests/integration_test.rs +28 -28
  10. package/crates/tish_ast/Cargo.toml +3 -1
  11. package/crates/tish_ast/src/ast.rs +1 -1
  12. package/crates/tish_build_utils/Cargo.toml +3 -1
  13. package/crates/tish_build_utils/src/lib.rs +18 -6
  14. package/crates/tish_builtins/Cargo.toml +5 -3
  15. package/crates/tish_builtins/src/array.rs +2 -2
  16. package/crates/tish_builtins/src/globals.rs +3 -3
  17. package/crates/tish_builtins/src/helpers.rs +1 -1
  18. package/crates/tish_builtins/src/lib.rs +3 -3
  19. package/crates/tish_builtins/src/math.rs +1 -1
  20. package/crates/tish_builtins/src/object.rs +2 -2
  21. package/crates/tish_builtins/src/string.rs +1 -1
  22. package/crates/tish_bytecode/Cargo.toml +9 -7
  23. package/crates/tish_bytecode/src/chunk.rs +1 -1
  24. package/crates/tish_bytecode/src/compiler.rs +1 -1
  25. package/crates/tish_bytecode/src/encoding.rs +6 -6
  26. package/crates/tish_bytecode/tests/constant_folding.rs +7 -7
  27. package/crates/tish_bytecode/tests/shortcircuit.rs +11 -11
  28. package/crates/tish_bytecode/tests/sort_optimization.rs +3 -3
  29. package/crates/tish_compile/Cargo.toml +6 -4
  30. package/crates/tish_compile/src/codegen.rs +96 -96
  31. package/crates/tish_compile/src/lib.rs +2 -2
  32. package/crates/tish_compile/src/resolve.rs +7 -7
  33. package/crates/tish_compile/src/types.rs +1 -1
  34. package/crates/tish_compile_js/Cargo.toml +8 -6
  35. package/crates/tish_compile_js/src/codegen.rs +12 -12
  36. package/crates/tish_compile_js/src/js_intrinsics.rs +1 -1
  37. package/crates/tish_compile_js/src/lib.rs +2 -2
  38. package/crates/tish_compile_js/src/tests_jsx.rs +2 -2
  39. package/crates/tish_compiler_wasm/Cargo.toml +8 -6
  40. package/crates/tish_compiler_wasm/src/lib.rs +12 -12
  41. package/crates/tish_compiler_wasm/src/resolve_virtual.rs +3 -3
  42. package/crates/tish_core/Cargo.toml +3 -1
  43. package/crates/tish_core/src/lib.rs +1 -1
  44. package/crates/tish_core/src/macros.rs +1 -1
  45. package/crates/tish_core/src/value.rs +1 -1
  46. package/crates/tish_cranelift/Cargo.toml +6 -4
  47. package/crates/tish_cranelift/src/lib.rs +2 -2
  48. package/crates/tish_cranelift/src/link.rs +11 -11
  49. package/crates/tish_cranelift/src/lower.rs +3 -3
  50. package/crates/tish_cranelift_runtime/Cargo.toml +9 -7
  51. package/crates/tish_cranelift_runtime/src/lib.rs +2 -2
  52. package/crates/tish_eval/Cargo.toml +10 -8
  53. package/crates/tish_eval/src/eval.rs +35 -35
  54. package/crates/tish_eval/src/http.rs +1 -1
  55. package/crates/tish_eval/src/lib.rs +3 -3
  56. package/crates/tish_eval/src/natives.rs +2 -2
  57. package/crates/tish_eval/src/regex.rs +2 -2
  58. package/crates/tish_eval/src/value.rs +7 -7
  59. package/crates/tish_eval/src/value_convert.rs +3 -3
  60. package/crates/tish_fmt/Cargo.toml +3 -3
  61. package/crates/tish_fmt/src/bin/tish-fmt.rs +1 -1
  62. package/crates/tish_fmt/src/lib.rs +3 -3
  63. package/crates/tish_jsx_web/Cargo.toml +3 -1
  64. package/crates/tish_lexer/Cargo.toml +3 -1
  65. package/crates/tish_lint/Cargo.toml +3 -3
  66. package/crates/tish_lint/src/bin/tish-lint.rs +3 -3
  67. package/crates/tish_lint/src/lib.rs +15 -15
  68. package/crates/tish_llvm/Cargo.toml +7 -5
  69. package/crates/tish_llvm/src/lib.rs +10 -10
  70. package/crates/tish_lsp/Cargo.toml +5 -5
  71. package/crates/tish_lsp/src/main.rs +35 -35
  72. package/crates/tish_native/Cargo.toml +10 -8
  73. package/crates/tish_native/src/build.rs +8 -8
  74. package/crates/tish_native/src/lib.rs +39 -39
  75. package/crates/tish_opt/Cargo.toml +5 -3
  76. package/crates/tish_opt/src/lib.rs +27 -27
  77. package/crates/tish_parser/Cargo.toml +5 -3
  78. package/crates/tish_parser/src/lib.rs +4 -4
  79. package/crates/tish_parser/src/parser.rs +2 -2
  80. package/crates/tish_runtime/Cargo.toml +7 -5
  81. package/crates/tish_runtime/src/http.rs +1 -1
  82. package/crates/tish_runtime/src/http_fetch.rs +2 -2
  83. package/crates/tish_runtime/src/lib.rs +21 -21
  84. package/crates/tish_runtime/src/native_promise.rs +1 -1
  85. package/crates/tish_runtime/src/promise.rs +2 -2
  86. package/crates/tish_runtime/src/promise_io.rs +1 -1
  87. package/crates/tish_runtime/src/timers.rs +1 -1
  88. package/crates/tish_runtime/src/ws.rs +1 -1
  89. package/crates/tish_runtime/tests/fetch_readable_stream.rs +2 -2
  90. package/crates/tish_vm/Cargo.toml +14 -12
  91. package/crates/tish_vm/src/lib.rs +2 -2
  92. package/crates/tish_vm/src/vm.rs +42 -42
  93. package/crates/tish_wasm/Cargo.toml +8 -6
  94. package/crates/tish_wasm/src/lib.rs +17 -17
  95. package/crates/tish_wasm_runtime/Cargo.toml +9 -7
  96. package/crates/tish_wasm_runtime/src/lib.rs +4 -4
  97. package/justfile +4 -4
  98. package/package.json +1 -1
  99. package/platform/darwin-arm64/tish +0 -0
  100. package/platform/darwin-x64/tish +0 -0
  101. package/platform/linux-arm64/tish +0 -0
  102. package/platform/linux-x64/tish +0 -0
  103. package/platform/win32-x64/tish.exe +0 -0
@@ -5,7 +5,7 @@
5
5
 
6
6
  use std::sync::Arc;
7
7
 
8
- use tish_ast::{ArrowBody, BinOp, Expr, Literal, Program, Statement, UnaryOp};
8
+ use tishlang_ast::{ArrowBody, BinOp, Expr, Literal, Program, Statement, UnaryOp};
9
9
 
10
10
  /// Optimize a Tish program. Returns a new program with transformations applied.
11
11
  pub fn optimize(program: &Program) -> Program {
@@ -333,8 +333,8 @@ fn optimize_expr(expr: &Expr) -> Expr {
333
333
  args: args
334
334
  .iter()
335
335
  .map(|a| match a {
336
- tish_ast::CallArg::Expr(e) => tish_ast::CallArg::Expr(optimize_expr(e)),
337
- tish_ast::CallArg::Spread(e) => tish_ast::CallArg::Spread(optimize_expr(e)),
336
+ tishlang_ast::CallArg::Expr(e) => tishlang_ast::CallArg::Expr(optimize_expr(e)),
337
+ tishlang_ast::CallArg::Spread(e) => tishlang_ast::CallArg::Spread(optimize_expr(e)),
338
338
  })
339
339
  .collect(),
340
340
  span: *span,
@@ -347,9 +347,9 @@ fn optimize_expr(expr: &Expr) -> Expr {
347
347
  } => {
348
348
  let opt_obj = optimize_expr(object);
349
349
  let opt_prop = match prop {
350
- tish_ast::MemberProp::Name(n) => tish_ast::MemberProp::Name(Arc::clone(n)),
351
- tish_ast::MemberProp::Expr(e) => {
352
- tish_ast::MemberProp::Expr(Box::new(optimize_expr(e)))
350
+ tishlang_ast::MemberProp::Name(n) => tishlang_ast::MemberProp::Name(Arc::clone(n)),
351
+ tishlang_ast::MemberProp::Expr(e) => {
352
+ tishlang_ast::MemberProp::Expr(Box::new(optimize_expr(e)))
353
353
  }
354
354
  };
355
355
  Expr::Member {
@@ -392,11 +392,11 @@ fn optimize_expr(expr: &Expr) -> Expr {
392
392
  elements: elements
393
393
  .iter()
394
394
  .map(|e| match e {
395
- tish_ast::ArrayElement::Expr(ex) => {
396
- tish_ast::ArrayElement::Expr(optimize_expr(ex))
395
+ tishlang_ast::ArrayElement::Expr(ex) => {
396
+ tishlang_ast::ArrayElement::Expr(optimize_expr(ex))
397
397
  }
398
- tish_ast::ArrayElement::Spread(ex) => {
399
- tish_ast::ArrayElement::Spread(optimize_expr(ex))
398
+ tishlang_ast::ArrayElement::Spread(ex) => {
399
+ tishlang_ast::ArrayElement::Spread(optimize_expr(ex))
400
400
  }
401
401
  })
402
402
  .collect(),
@@ -406,11 +406,11 @@ fn optimize_expr(expr: &Expr) -> Expr {
406
406
  props: props
407
407
  .iter()
408
408
  .map(|p| match p {
409
- tish_ast::ObjectProp::KeyValue(k, v) => {
410
- tish_ast::ObjectProp::KeyValue(Arc::clone(k), optimize_expr(v))
409
+ tishlang_ast::ObjectProp::KeyValue(k, v) => {
410
+ tishlang_ast::ObjectProp::KeyValue(Arc::clone(k), optimize_expr(v))
411
411
  }
412
- tish_ast::ObjectProp::Spread(e) => {
413
- tish_ast::ObjectProp::Spread(optimize_expr(e))
412
+ tishlang_ast::ObjectProp::Spread(e) => {
413
+ tishlang_ast::ObjectProp::Spread(optimize_expr(e))
414
414
  }
415
415
  })
416
416
  .collect(),
@@ -556,7 +556,7 @@ fn try_algebraic_simplify(
556
556
  op: BinOp,
557
557
  left: &Expr,
558
558
  right: &Expr,
559
- span: tish_ast::Span,
559
+ span: tishlang_ast::Span,
560
560
  ) -> Option<Expr> {
561
561
  use BinOp::*;
562
562
  fn num_is_zero(n: f64) -> bool {
@@ -720,7 +720,7 @@ mod tests {
720
720
  use super::*;
721
721
 
722
722
  fn program_from_source(src: &str) -> Program {
723
- tish_parser::parse(src).expect("parse")
723
+ tishlang_parser::parse(src).expect("parse")
724
724
  }
725
725
 
726
726
  fn has_literal_number(expr: &Expr, n: f64) -> bool {
@@ -740,7 +740,7 @@ mod tests {
740
740
  let program = program_from_source("1 + 2");
741
741
  let opt = optimize(&program);
742
742
  let expr = match &opt.statements[..] {
743
- [tish_ast::Statement::ExprStmt { expr, .. }] => expr,
743
+ [tishlang_ast::Statement::ExprStmt { expr, .. }] => expr,
744
744
  _ => panic!("expected single expr stmt"),
745
745
  };
746
746
  assert!(has_literal_number(expr, 3.0), "expected 3, got {:?}", expr);
@@ -751,7 +751,7 @@ mod tests {
751
751
  let program = program_from_source("-42");
752
752
  let opt = optimize(&program);
753
753
  let expr = match &opt.statements[..] {
754
- [tish_ast::Statement::ExprStmt { expr, .. }] => expr,
754
+ [tishlang_ast::Statement::ExprStmt { expr, .. }] => expr,
755
755
  _ => panic!("expected single expr stmt"),
756
756
  };
757
757
  assert!(has_literal_number(expr, -42.0), "expected -42, got {:?}", expr);
@@ -762,7 +762,7 @@ mod tests {
762
762
  let program = program_from_source("false && foo");
763
763
  let opt = optimize(&program);
764
764
  let expr = match &opt.statements[..] {
765
- [tish_ast::Statement::ExprStmt { expr, .. }] => expr,
765
+ [tishlang_ast::Statement::ExprStmt { expr, .. }] => expr,
766
766
  _ => panic!("expected single expr stmt"),
767
767
  };
768
768
  assert!(
@@ -777,7 +777,7 @@ mod tests {
777
777
  let program = program_from_source("true ? 1 : 2");
778
778
  let opt = optimize(&program);
779
779
  let expr = match &opt.statements[..] {
780
- [tish_ast::Statement::ExprStmt { expr, .. }] => expr,
780
+ [tishlang_ast::Statement::ExprStmt { expr, .. }] => expr,
781
781
  _ => panic!("expected single expr stmt"),
782
782
  };
783
783
  assert!(has_literal_number(expr, 1.0), "expected 1, got {:?}", expr);
@@ -789,7 +789,7 @@ mod tests {
789
789
  let program = program_from_source("x + 0");
790
790
  let opt = optimize(&program);
791
791
  let expr = match &opt.statements[..] {
792
- [tish_ast::Statement::ExprStmt { expr, .. }] => expr,
792
+ [tishlang_ast::Statement::ExprStmt { expr, .. }] => expr,
793
793
  _ => panic!("expected single expr stmt"),
794
794
  };
795
795
  assert!(
@@ -804,7 +804,7 @@ mod tests {
804
804
  let program = program_from_source("x * 1");
805
805
  let opt = optimize(&program);
806
806
  let expr = match &opt.statements[..] {
807
- [tish_ast::Statement::ExprStmt { expr, .. }] => expr,
807
+ [tishlang_ast::Statement::ExprStmt { expr, .. }] => expr,
808
808
  _ => panic!("expected single expr stmt"),
809
809
  };
810
810
  assert!(
@@ -820,7 +820,7 @@ mod tests {
820
820
  let program = program_from_source("x * (1 + 0)");
821
821
  let opt = optimize(&program);
822
822
  let expr = match &opt.statements[..] {
823
- [tish_ast::Statement::ExprStmt { expr, .. }] => expr,
823
+ [tishlang_ast::Statement::ExprStmt { expr, .. }] => expr,
824
824
  _ => panic!("expected single expr stmt"),
825
825
  };
826
826
  assert!(
@@ -835,7 +835,7 @@ mod tests {
835
835
  let program = program_from_source("x ** 1");
836
836
  let opt = optimize(&program);
837
837
  let expr = match &opt.statements[..] {
838
- [tish_ast::Statement::ExprStmt { expr, .. }] => expr,
838
+ [tishlang_ast::Statement::ExprStmt { expr, .. }] => expr,
839
839
  _ => panic!("expected single expr stmt"),
840
840
  };
841
841
  assert!(
@@ -850,7 +850,7 @@ mod tests {
850
850
  let program = program_from_source("x ** 0");
851
851
  let opt = optimize(&program);
852
852
  let expr = match &opt.statements[..] {
853
- [tish_ast::Statement::ExprStmt { expr, .. }] => expr,
853
+ [tishlang_ast::Statement::ExprStmt { expr, .. }] => expr,
854
854
  _ => panic!("expected single expr stmt"),
855
855
  };
856
856
  assert!(has_literal_number(expr, 1.0), "expected 1, got {:?}", expr);
@@ -861,7 +861,7 @@ mod tests {
861
861
  let program = program_from_source("1 ** x");
862
862
  let opt = optimize(&program);
863
863
  let expr = match &opt.statements[..] {
864
- [tish_ast::Statement::ExprStmt { expr, .. }] => expr,
864
+ [tishlang_ast::Statement::ExprStmt { expr, .. }] => expr,
865
865
  _ => panic!("expected single expr stmt"),
866
866
  };
867
867
  assert!(has_literal_number(expr, 1.0), "expected 1, got {:?}", expr);
@@ -872,7 +872,7 @@ mod tests {
872
872
  let program = program_from_source("null ?? x");
873
873
  let opt = optimize(&program);
874
874
  let expr = match &opt.statements[..] {
875
- [tish_ast::Statement::ExprStmt { expr, .. }] => expr,
875
+ [tishlang_ast::Statement::ExprStmt { expr, .. }] => expr,
876
876
  _ => panic!("expected single expr stmt"),
877
877
  };
878
878
  assert!(
@@ -1,9 +1,11 @@
1
1
  [package]
2
- name = "tish_parser"
2
+ name = "tishlang_parser"
3
3
  version = "0.1.0"
4
4
  edition = "2021"
5
5
  description = "Tish recursive descent parser"
6
6
 
7
+ license-file = { workspace = true }
8
+ repository = { workspace = true }
7
9
  [dependencies]
8
- tish_lexer = { path = "../tish_lexer" }
9
- tish_ast = { path = "../tish_ast" }
10
+ tishlang_lexer = { path = "../tish_lexer" }
11
+ tishlang_ast = { path = "../tish_ast" }
@@ -4,8 +4,8 @@ mod parser;
4
4
 
5
5
  use parser::Parser;
6
6
 
7
- use tish_ast::Program;
8
- use tish_lexer::Lexer;
7
+ use tishlang_ast::Program;
8
+ use tishlang_lexer::Lexer;
9
9
 
10
10
  pub fn parse(source: &str) -> Result<Program, String> {
11
11
  let lexer = Lexer::new(source);
@@ -18,13 +18,13 @@ pub fn parse(source: &str) -> Result<Program, String> {
18
18
  #[cfg(test)]
19
19
  mod tests {
20
20
  use super::*;
21
- use tish_ast::{Expr, ObjectProp, Statement};
21
+ use tishlang_ast::{Expr, ObjectProp, Statement};
22
22
 
23
23
  #[test]
24
24
  fn test_async_fn_parse() {
25
25
  let program = parse("async fn foo() { }").expect("parse async fn");
26
26
  assert_eq!(program.statements.len(), 1);
27
- if let tish_ast::Statement::FunDecl { async_, name, .. } = &program.statements[0] {
27
+ if let tishlang_ast::Statement::FunDecl { async_, name, .. } = &program.statements[0] {
28
28
  assert!(async_, "expected async function");
29
29
  assert_eq!(name.as_ref(), "foo");
30
30
  } else {
@@ -51,13 +51,13 @@ macro_rules! binary_multi_op {
51
51
  };
52
52
  }
53
53
 
54
- use tish_ast::{
54
+ use tishlang_ast::{
55
55
  ArrowBody, ArrayElement, BinOp, CallArg, CompoundOp, DestructElement, DestructPattern,
56
56
  DestructProp, ExportDeclaration, Expr, ImportSpecifier, JsxAttrValue, JsxChild, JsxProp,
57
57
  Literal, LogicalAssignOp, MemberProp, ObjectProp, Program, Span, Statement, TypeAnnotation,
58
58
  TypedParam, UnaryOp,
59
59
  };
60
- use tish_lexer::{Token, TokenKind};
60
+ use tishlang_lexer::{Token, TokenKind};
61
61
 
62
62
  pub struct Parser<'a> {
63
63
  tokens: &'a [Token],
@@ -1,21 +1,23 @@
1
1
  [package]
2
- name = "tish_runtime"
2
+ name = "tishlang_runtime"
3
3
  version = "0.1.0"
4
4
  edition = "2021"
5
5
  description = "Minimal runtime for Tish compiled output"
6
6
 
7
+ license-file = { workspace = true }
8
+ repository = { workspace = true }
7
9
  [features]
8
10
  default = []
9
- http = ["tokio", "reqwest", "futures", "bytes", "tiny_http", "tish_core/regex"]
11
+ http = ["tokio", "reqwest", "futures", "bytes", "tiny_http", "tishlang_core/regex"]
10
12
  fs = []
11
13
  process = []
12
- regex = ["tish_core/regex"]
14
+ regex = ["tishlang_core/regex"]
13
15
  # WebSocket (JS-like API). Modular: import { WebSocket, Server } from 'tish:ws'
14
16
  ws = ["tokio", "tokio/net", "tokio/io-util", "tokio-tungstenite", "futures-util", "lazy_static"]
15
17
 
16
18
  [dependencies]
17
- tish_core = { path = "../tish_core" }
18
- tish_builtins = { path = "../tish_builtins" }
19
+ tishlang_core = { path = "../tish_core" }
20
+ tishlang_builtins = { path = "../tish_builtins" }
19
21
  tokio = { version = "1.50.0", features = ["rt-multi-thread", "macros", "time", "sync"], optional = true }
20
22
  reqwest = { version = "0.13.2", default-features = false, features = ["rustls", "json", "stream"], optional = true }
21
23
  futures = { version = "0.3.32", optional = true }
@@ -6,7 +6,7 @@ use std::fs::File;
6
6
  use std::io::Write;
7
7
  use std::rc::Rc;
8
8
  use std::sync::Arc;
9
- use tish_core::Value;
9
+ use tishlang_core::Value;
10
10
  use tokio::runtime::Runtime;
11
11
 
12
12
  thread_local! {
@@ -9,7 +9,7 @@ use std::sync::{Arc, Mutex};
9
9
  use bytes::Bytes;
10
10
  use futures::Stream;
11
11
  use futures::StreamExt;
12
- use tish_core::{NativeFn, TishOpaque, TishPromise, Value};
12
+ use tishlang_core::{NativeFn, TishOpaque, TishPromise, Value};
13
13
 
14
14
  use crate::http::{build_error_response, extract_body, extract_headers, extract_method};
15
15
 
@@ -115,7 +115,7 @@ impl TishPromise for JsonTextPromise {
115
115
  if let Some(rx) = rx {
116
116
  let r = crate::http::block_on_http(rx);
117
117
  match r {
118
- Ok(Ok(s)) => match tish_core::json_parse(&s) {
118
+ Ok(Ok(s)) => match tishlang_core::json_parse(&s) {
119
119
  Ok(v) => Ok(v),
120
120
  Err(e) => Err({
121
121
  let mut obj = HashMap::new();
@@ -1,6 +1,6 @@
1
1
  //! Minimal runtime for Tish compiled output.
2
2
  //!
3
- //! Re-exports core types from tish_core and provides console, Math,
3
+ //! Re-exports core types from tishlang_core and provides console, Math,
4
4
  //! and other builtin functions for compiled Tish programs.
5
5
 
6
6
  #[cfg(feature = "regex")]
@@ -9,14 +9,14 @@ use std::cell::RefCell;
9
9
  use std::rc::Rc;
10
10
  use std::fmt;
11
11
  use std::sync::OnceLock;
12
- use tish_builtins::helpers::extract_num;
12
+ use tishlang_builtins::helpers::extract_num;
13
13
  #[cfg(feature = "fs")]
14
- use tish_builtins::helpers::make_error_value;
14
+ use tishlang_builtins::helpers::make_error_value;
15
15
 
16
- pub use tish_core::Value;
16
+ pub use tishlang_core::Value;
17
17
 
18
- // Re-export array methods from tish_builtins
19
- pub use tish_builtins::array::{
18
+ // Re-export array methods from tishlang_builtins
19
+ pub use tishlang_builtins::array::{
20
20
  push as array_push_impl,
21
21
  pop as array_pop,
22
22
  shift as array_shift,
@@ -45,8 +45,8 @@ pub use tish_builtins::array::{
45
45
  sort_numeric_desc as array_sort_numeric_desc,
46
46
  };
47
47
 
48
- // Re-export string methods from tish_builtins
49
- pub use tish_builtins::string::{
48
+ // Re-export string methods from tishlang_builtins
49
+ pub use tishlang_builtins::string::{
50
50
  index_of as string_index_of_impl,
51
51
  includes as string_includes_impl,
52
52
  slice as string_slice_impl,
@@ -128,7 +128,7 @@ pub fn number_to_fixed(n: &Value, digits: &Value) -> Value {
128
128
 
129
129
  /// Operators module for compound assignment operations
130
130
  pub mod ops {
131
- use tish_core::Value;
131
+ use tishlang_core::Value;
132
132
 
133
133
  #[inline]
134
134
  pub fn add(left: &Value, right: &Value) -> Result<Value, Box<dyn std::error::Error>> {
@@ -232,7 +232,7 @@ pub mod ops {
232
232
  }
233
233
  }
234
234
 
235
- use tish_builtins::globals::{
235
+ use tishlang_builtins::globals::{
236
236
  array_is_array as builtins_array_is_array,
237
237
  boolean as builtins_boolean,
238
238
  decode_uri as builtins_decode_uri,
@@ -246,7 +246,7 @@ use tish_builtins::globals::{
246
246
  object_values as builtins_object_values,
247
247
  string_from_char_code as builtins_string_from_char_code,
248
248
  };
249
- use tish_core::{
249
+ use tishlang_core::{
250
250
  json_parse as core_json_parse,
251
251
  json_stringify as core_json_stringify,
252
252
  };
@@ -291,7 +291,7 @@ fn get_log_level() -> LogLevel {
291
291
  }
292
292
 
293
293
  fn format_args(args: &[Value]) -> String {
294
- tish_core::format_values_for_console(args, tish_core::use_console_colors())
294
+ tishlang_core::format_values_for_console(args, tishlang_core::use_console_colors())
295
295
  }
296
296
 
297
297
  pub fn console_debug(args: &[Value]) {
@@ -323,11 +323,11 @@ pub fn console_error(args: &[Value]) {
323
323
  }
324
324
 
325
325
  pub fn parse_int(args: &[Value]) -> Value {
326
- tish_builtins::globals::parse_int(args)
326
+ tishlang_builtins::globals::parse_int(args)
327
327
  }
328
328
 
329
329
  pub fn parse_float(args: &[Value]) -> Value {
330
- tish_builtins::globals::parse_float(args)
330
+ tishlang_builtins::globals::parse_float(args)
331
331
  }
332
332
 
333
333
  pub fn is_finite(args: &[Value]) -> Value {
@@ -350,8 +350,8 @@ pub fn encode_uri(args: &[Value]) -> Value {
350
350
  builtins_encode_uri(args)
351
351
  }
352
352
 
353
- // Math functions - use tish_builtins::math
354
- pub use tish_builtins::math::{
353
+ // Math functions - use tishlang_builtins::math
354
+ pub use tishlang_builtins::math::{
355
355
  abs as tish_math_abs_impl,
356
356
  sqrt as tish_math_sqrt_impl,
357
357
  floor as tish_math_floor_impl,
@@ -640,7 +640,7 @@ pub fn in_operator(key: &Value, obj: &Value) -> Value {
640
640
  Value::Bool(result)
641
641
  }
642
642
 
643
- // Object functions - delegate to tish_builtins::globals
643
+ // Object functions - delegate to tishlang_builtins::globals
644
644
  pub fn object_assign(args: &[Value]) -> Value {
645
645
  builtins_object_assign(args)
646
646
  }
@@ -707,7 +707,7 @@ pub use native_promise::{await_promise, fetch_all_promise, fetch_async_promise,
707
707
 
708
708
  // RegExp Support
709
709
  #[cfg(feature = "regex")]
710
- pub use tish_core::{TishRegExp, RegExpFlags};
710
+ pub use tishlang_core::{TishRegExp, RegExpFlags};
711
711
 
712
712
  #[cfg(feature = "regex")]
713
713
  pub fn regexp_new(args: &[Value]) -> Value {
@@ -753,7 +753,7 @@ pub fn regexp_exec(re: &Value, input: &Value) -> Value {
753
753
  }
754
754
 
755
755
  #[cfg(feature = "regex")]
756
- fn regexp_exec_impl(re: &mut tish_core::TishRegExp, input: &str) -> Value {
756
+ fn regexp_exec_impl(re: &mut tishlang_core::TishRegExp, input: &str) -> Value {
757
757
  use std::collections::HashMap;
758
758
 
759
759
  let start = if re.flags.global || re.flags.sticky {
@@ -895,7 +895,7 @@ pub fn string_match_regex(s: &Value, regexp: &Value) -> Value {
895
895
  }
896
896
  }
897
897
  Value::String(pattern) => {
898
- match tish_core::TishRegExp::new(pattern, "") {
898
+ match tishlang_core::TishRegExp::new(pattern, "") {
899
899
  Ok(mut re) => regexp_exec_impl(&mut re, input),
900
900
  Err(_) => Value::Null,
901
901
  }
@@ -987,7 +987,7 @@ pub fn string_search_regex(s: &Value, regexp: &Value) -> Value {
987
987
  }
988
988
  }
989
989
  Value::String(pattern) => {
990
- match tish_core::TishRegExp::new(pattern, "") {
990
+ match tishlang_core::TishRegExp::new(pattern, "") {
991
991
  Ok(re) => match re.regex.find(input) {
992
992
  Ok(Some(m)) => {
993
993
  let char_index = input[..m.start()].chars().count();
@@ -1,6 +1,6 @@
1
1
  //! Native Promise entrypoints for fetch / fetchAll.
2
2
 
3
- use tish_core::Value;
3
+ use tishlang_core::Value;
4
4
 
5
5
  pub fn fetch_promise(args: Vec<Value>) -> Value {
6
6
  crate::http_fetch::fetch_promise_from_args(args)
@@ -4,7 +4,7 @@ use std::cell::RefCell;
4
4
  use std::collections::HashMap;
5
5
  use std::rc::Rc;
6
6
  use std::sync::Arc;
7
- use tish_core::Value;
7
+ use tishlang_core::Value;
8
8
 
9
9
  /// Promise.resolve(value) - returns the value (immediate resolve).
10
10
  pub fn promise_resolve(args: &[Value]) -> Value {
@@ -26,7 +26,7 @@ pub fn promise_all(args: &[Value]) -> Value {
26
26
  .iter()
27
27
  .map(|v| {
28
28
  if let Value::Promise(p) = v {
29
- match tish_core::TishPromise::block_until_settled(p.as_ref()) {
29
+ match tishlang_core::TishPromise::block_until_settled(p.as_ref()) {
30
30
  Ok(val) => val,
31
31
  Err(rejection) => rejection,
32
32
  }
@@ -4,7 +4,7 @@ use std::cell::RefCell;
4
4
  use std::collections::HashMap;
5
5
  use std::rc::Rc;
6
6
  use std::sync::{Arc, Mutex};
7
- use tish_core::{Value, TishPromise};
7
+ use tishlang_core::{Value, TishPromise};
8
8
  use tokio::sync::oneshot;
9
9
 
10
10
  fn error_value(msg: String) -> Value {
@@ -6,7 +6,7 @@ use std::collections::HashMap;
6
6
  use std::sync::atomic::{AtomicU64, Ordering};
7
7
  use std::time::{Duration, Instant};
8
8
 
9
- use tish_core::Value;
9
+ use tishlang_core::Value;
10
10
 
11
11
  static NEXT_ID: AtomicU64 = AtomicU64::new(1);
12
12
 
@@ -15,7 +15,7 @@ use std::time::{Duration, Instant};
15
15
 
16
16
  use futures_util::{SinkExt, StreamExt};
17
17
  use lazy_static::lazy_static;
18
- use tish_core::Value;
18
+ use tishlang_core::Value;
19
19
  use tokio::sync::mpsc as tokio_mpsc;
20
20
  use tokio::runtime::Runtime;
21
21
 
@@ -6,8 +6,8 @@ use std::net::TcpListener;
6
6
  use std::thread;
7
7
  use std::time::Duration;
8
8
 
9
- use tish_core::Value;
10
- use tish_runtime::{await_promise, fetch_promise};
9
+ use tishlang_core::Value;
10
+ use tishlang_runtime::{await_promise, fetch_promise};
11
11
 
12
12
  fn chunked_body_server(listener: TcpListener) {
13
13
  let (mut stream, _) = listener.accept().expect("accept");
@@ -1,31 +1,33 @@
1
1
  [package]
2
- name = "tish_vm"
2
+ name = "tishlang_vm"
3
3
  version = "0.1.0"
4
4
  edition = "2021"
5
5
  description = "Bytecode VM for Tish"
6
6
 
7
+ license-file = { workspace = true }
8
+ repository = { workspace = true }
7
9
  [features]
8
10
  default = []
9
- regex = ["tish_core/regex"]
11
+ regex = ["tishlang_core/regex"]
10
12
  # For wasm32 target: use web_sys console for output
11
13
  wasm = ["dep:wasm-bindgen"]
12
14
  # Built-in modules: fs, http, process (for bytecode LoadNativeExport)
13
- fs = ["tish_runtime/fs"]
14
- process = ["tish_runtime/process"]
15
- http = ["tish_runtime/http"]
16
- ws = ["tish_runtime/ws"]
15
+ fs = ["tishlang_runtime/fs"]
16
+ process = ["tishlang_runtime/process"]
17
+ http = ["tishlang_runtime/http"]
18
+ ws = ["tishlang_runtime/ws"]
17
19
 
18
20
  [dependencies]
19
- tish_ast = { path = "../tish_ast" }
20
- tish_builtins = { path = "../tish_builtins" }
21
- tish_bytecode = { path = "../tish_bytecode" }
22
- tish_core = { path = "../tish_core" }
23
- tish_runtime = { path = "../tish_runtime", optional = true }
21
+ tishlang_ast = { path = "../tish_ast" }
22
+ tishlang_builtins = { path = "../tish_builtins" }
23
+ tishlang_bytecode = { path = "../tish_bytecode" }
24
+ tishlang_core = { path = "../tish_core" }
25
+ tishlang_runtime = { path = "../tish_runtime", optional = true }
24
26
  rand = "0.10"
25
27
  wasm-bindgen = { version = "0.2", optional = true }
26
28
 
27
29
  [dev-dependencies]
28
- tish_parser = { path = "../tish_parser" }
30
+ tishlang_parser = { path = "../tish_parser" }
29
31
 
30
32
  [target.'cfg(target_arch = "wasm32")'.dependencies]
31
33
  getrandom = { version = "0.4", features = ["wasm_js"] }
@@ -32,8 +32,8 @@ switch (k) {
32
32
  fn f(a, b, ...rest) { return rest.length; }
33
33
  console.log(f(1,2,3,4));
34
34
  "#;
35
- let program = tish_parser::parse(src).expect("parse");
36
- let chunk = tish_bytecode::compile(&program).expect("compile");
35
+ let program = tishlang_parser::parse(src).expect("parse");
36
+ let chunk = tishlang_bytecode::compile(&program).expect("compile");
37
37
  let _ = run(&chunk).expect("run");
38
38
  }
39
39
  }