From bc82a6b90e0e9902f55410b4865606c4dcb0a595 Mon Sep 17 00:00:00 2001 From: Steven Love Date: Thu, 11 Jul 2024 00:48:02 -0700 Subject: [PATCH] corrected spelling across the entire project --- .config/cspell.jsonc | 6 ++++-- .config/custom-dictionary.txt | 8 ++++++++ README.md | 6 +++--- bridge_adapters/src/lisp_adapters.rs | 2 +- bridge_adapters/src/lisp_adapters/text.rs | 4 ++-- bridge_macros/README.md | 2 +- bridge_macros/src/lib.rs | 10 +++++----- builtins/src/conversions.rs | 4 ++-- builtins/src/string.rs | 4 ++-- builtins/tests/MACRO_HELP.md | 2 +- builtins/tests/convert_string_pass.rs | 2 +- compile_state/src/state.rs | 14 +++++++------- compiler/src/compile/compile_call.rs | 2 +- doc/README.md | 4 ++-- doc/src/errors.md | 10 +++++----- lisp/core.slosh | 8 ++++---- lisp/iterator.slosh | 4 ++-- lisp/sh-color.slosh | 2 +- shell/src/platform.rs | 4 ++-- shell/src/platform/unix.rs | 2 +- shell/src/platform/unix/umask.rs | 2 +- slosh.vim | 2 +- vim/slosh.vim | 2 +- vm/src/value.rs | 2 +- vm/src/vm/exec_loop.rs | 4 ++-- 25 files changed, 61 insertions(+), 51 deletions(-) diff --git a/.config/cspell.jsonc b/.config/cspell.jsonc index c01cd26a85..a97bebf337 100644 --- a/.config/cspell.jsonc +++ b/.config/cspell.jsonc @@ -5,7 +5,9 @@ // you can check which dictionary has a word with `npx cspell trace yourWord` { "version": "0.2", - "ignorePaths": ["target", "legacy", "*.lock"], + "ignorePaths": ["target", "legacy", "**/*.lock"], + "useGitignore": false, + "enableFiletypes": ["*", "Vimscript"], "dictionaryDefinitions": [ { "name": "custom-dictionary", @@ -16,6 +18,6 @@ "dictionaries": ["custom-dictionary", "rust", "makefile", "softwareTerms"], "words": [], "flagWords": [], - "ignoreWords": ["atwo", "btwo", "ctwo", "dtwo"], + "ignoreWords": ["Emmmmm", "atwo", "btwo", "ctwo", "dtwo", "hexy"], "import": [] } diff --git a/.config/custom-dictionary.txt b/.config/custom-dictionary.txt index 24ecd4b064..96cfb75aca 100644 --- a/.config/custom-dictionary.txt +++ b/.config/custom-dictionary.txt @@ -126,6 +126,7 @@ evaled evals execvp Expandvec +Falh falsey fclose fcntl @@ -136,6 +137,7 @@ footgun fopen fprn fract +frood FSIZE ftype fxhasher @@ -151,8 +153,11 @@ GOTPCREL gpwclark greenyellow guifg +Habcdefiklmnpqrstuvx +hasher hashkey haskey +hoopy iargs idents instring @@ -222,6 +227,7 @@ movsbl movzbl MSGQUEUE mult +munge myfn myfun namespacemath @@ -416,6 +422,7 @@ Syscall syscall sysconf tadd +takek targ TCALL # opcode for a tail call tcall @@ -475,6 +482,7 @@ VECPSH vecs vecvalues vhandle +vimscript vlen VMEM waitpid diff --git a/README.md b/README.md index 06160f9ab8..fbba9e9ade 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ ![Rust](https://github.com/sl-sh-dev/sl-sh/workflows/Rust/badge.svg?branch=master) -## Note this is a new expermental version, see ./legacy/ for the original version (slush). +## Note this is a new experimental version, see ./legacy/ for the original version (slush). Simple Lisp SHell (slosh) is a lisp based shell written in Rust. It is not POSIX compliant and makes no effort to be. Sl-sh should run on any *nix platform as @@ -160,7 +160,7 @@ Note: These are all compiled to bytecode and once compiled are not dynamic anymo ### Features - Lisp reader (no reader macros yet) -- Lisp lists (pair/concell based) +- Lisp lists (pair/conscell based) - Vectors - Tail call optimization - Continuations (call/cc) @@ -213,5 +213,5 @@ generated from the source code. All of this is covered in `doc/README.md` -Must be compiled in lisp-test mode for appropriate documenation functions to be present (`cargo build --features lisp-test`). +Must be compiled in lisp-test mode for appropriate documentation functions to be present (`cargo build --features lisp-test`). diff --git a/bridge_adapters/src/lisp_adapters.rs b/bridge_adapters/src/lisp_adapters.rs index 651dc4bbcf..ad0b6e08ae 100644 --- a/bridge_adapters/src/lisp_adapters.rs +++ b/bridge_adapters/src/lisp_adapters.rs @@ -9,7 +9,7 @@ //! TODO PC ISSUE #7 - returning values via annotated or lifetime? //! To avoid allocations when converting a slosh &Value back to a rust type that was mutated //! don't return anything. If it is necessary for the API to return some value. -//! ...either use an annotation on an input argument `fn myfun(#[likethis] returnme: &mut String, someotherval: String) -> VMResult<()>` +//! ...either use an annotation on an input argument `fn myfun(#[likeThis] returnme: &mut String, someotherval: String) -> VMResult<()>` //! or a lifetime... might be easier to do the annotation. //! //! diff --git a/bridge_adapters/src/lisp_adapters/text.rs b/bridge_adapters/src/lisp_adapters/text.rs index d81d508055..34c86559d1 100644 --- a/bridge_adapters/src/lisp_adapters/text.rs +++ b/bridge_adapters/src/lisp_adapters/text.rs @@ -522,7 +522,7 @@ mod tests { for val in loose_strings_as_vals { let _loose_string: LooseString = val .sl_into_ref(vm) - .expect("This value should be convertable to a LooseString"); + .expect("This value should be convertible to a LooseString"); } } @@ -533,7 +533,7 @@ mod tests { let sample = LooseString::Owned("hello world".to_string()); let val: Value = - Value::sl_from(sample, vm).expect("This LooseString should be convertable to a Value"); + Value::sl_from(sample, vm).expect("This LooseString should be convertible to a Value"); assert!(matches!(val, Value::String(_))); } } diff --git a/bridge_macros/README.md b/bridge_macros/README.md index d577e9fa65..ac0915b83a 100644 --- a/bridge_macros/README.md +++ b/bridge_macros/README.md @@ -223,7 +223,7 @@ implemented and then coerce the rust types into sl-sh Expressions with the appropriate errors and call the original function, `int_to_float` with rust types. - once `builtin_int_to_float` exists, `intern_int_to_float` must be manually -called in the add_buitlins function like: +called in the add_builtins function like: ```rust pub fn add_type_builtins( diff --git a/bridge_macros/src/lib.rs b/bridge_macros/src/lib.rs index 8a58ba46ac..738ed7282d 100644 --- a/bridge_macros/src/lib.rs +++ b/bridge_macros/src/lib.rs @@ -1044,16 +1044,16 @@ fn generate_parse_fn( } fn num_required_args(params: &[Param]) -> usize { - params.iter().fold(0, |accum, nxt| { + params.iter().fold(0, |accumulator, nxt| { if nxt.handle == TypeHandle::Direct { - accum + 1 + accumulator + 1 } else { - accum + accumulator } }) } -/// write the builtin_ version of the provided function. This function is the function taht makes +/// write the builtin_ version of the provided function. This function is the function that makes /// a direct call to the original rust native function to which the macro was applied. To accomplish /// this the builtin_ function generates takes some number of ArgType structs (the wrapper enum that /// enables passing optional and varargs). the body of the function handles unwrapping the ArgType @@ -1643,7 +1643,7 @@ pub fn sl_sh_fn( //TODO // - functions that return Values, tuple return types? -// - fcns that accept iters? +// - functions that accept iters? // - then... compare against inline the function being called... randomize variable names... // and fn names too? could pick some random string and prefix all generated idents. // - ISSUE #119 trybuild! diff --git a/builtins/src/conversions.rs b/builtins/src/conversions.rs index aa366b3b89..14a506e31b 100644 --- a/builtins/src/conversions.rs +++ b/builtins/src/conversions.rs @@ -108,7 +108,7 @@ Section: conversion env, "ref", global_ref, - r#"Usage: (ref symol) -> Value + r#"Usage: (ref symbol) -> Value If symbol is defined then return the thing it references. @@ -119,7 +119,7 @@ Section: conversion env, "def?", is_def, - r#"Usage: (def? symol) -> #t/#f + r#"Usage: (def? symbol) -> #t/#f If symbol is defined then return true else false. diff --git a/builtins/src/string.rs b/builtins/src/string.rs index 6a16a211aa..adaa4ccbe4 100644 --- a/builtins/src/string.rs +++ b/builtins/src/string.rs @@ -159,7 +159,7 @@ fn str_map_inner(vm: &mut SloshVm, func: Value, string: Value) -> VMResult { @@ -520,7 +520,7 @@ pub fn add_str_builtins(env: &mut SloshVm) { str_replace, r#"Usage: (str-replace string old-pattern new-pattern) -> string -Replace occurances of second string with third in the first string. +Replace occurrences of second string with third in the first string. Section: string diff --git a/builtins/tests/MACRO_HELP.md b/builtins/tests/MACRO_HELP.md index 359957a923..76000c75ad 100644 --- a/builtins/tests/MACRO_HELP.md +++ b/builtins/tests/MACRO_HELP.md @@ -7,7 +7,7 @@ To get macro expansion output for a given test If macro expansion for the test/trybuild/ is needed it is a little more complicated. -Why? well, if you put failling tests in `/tests/` then cargo tests fails so you +Why? well, if you put failing tests in `/tests/` then cargo tests fails so you can't do that. But `cargo expand --test` relies on finding modules in a test directory so, you can move a test from trybuild up one directory but move it back b/c otherwise `cargo test` will fail and CI won't pass. diff --git a/builtins/tests/convert_string_pass.rs b/builtins/tests/convert_string_pass.rs index 1c9bc948a0..56fb1ee020 100644 --- a/builtins/tests/convert_string_pass.rs +++ b/builtins/tests/convert_string_pass.rs @@ -53,7 +53,7 @@ pub fn return_string() -> VMResult { Ok("return_string".to_string()) } -//TODO PC document use of generics in return parameters and limitatons, +//TODO PC document use of generics in return parameters and limitations, /// obligatory doc #[sl_sh_fn(fn_name = "return_loose_string")] pub fn return_loose_string<'a>() -> VMResult> { diff --git a/compile_state/src/state.rs b/compile_state/src/state.rs index 9ac1aa5bf2..faebb8652f 100644 --- a/compile_state/src/state.rs +++ b/compile_state/src/state.rs @@ -213,7 +213,7 @@ impl Specials { def: add_special(vm, "def", r#"Usage: (def symbol doc_string? expression) -> expression Adds an expression to the current namespace. Return the expression that was defined. -Symbol is not evaluted. Can take an option doc string (docstrings can only be +Symbol is not evaluated. Can take an option doc string (docstrings can only be set on namespaced (global) symbols). Section: core @@ -226,7 +226,7 @@ Example: (test::assert-equal "Two" test-do-two) (test::assert-equal "Three" test-do-three) (let (test-do-one nil) - ; Add this to tthe let's scope (shadow the outer test-do-two). + ; Add this to the let's scope (shadow the outer test-do-two). (test::assert-equal "Default" (def test-do-four "Default")) ; set the currently scoped value. (set! test-do-one "1111") @@ -240,7 +240,7 @@ Example: set: add_special(vm, "set!", r#"Usage: (set! symbol expression) -> expression Sets an existing expression in the current scope(s). Return the expression that was set. -Symbol is not evalauted. +Symbol is not evaluated. Set will set the first binding it finds starting in the current scope and then trying enclosing scopes until exhausted. @@ -262,7 +262,7 @@ Example: (test::assert-equal "One" test-do-one)"#), do_: add_special(vm, "do", r#"Usage: (do exp0 ... expN) -> expN -Evaluatate each form and return the last. +Evaluate each form and return the last. Section: core @@ -532,7 +532,7 @@ Example: Destructive form that replaces the cdr (second item) in a pair with a new expression. -If used on a proper list will replace everthing after the first item. +If used on a proper list will replace everything after the first item. Can be used on nil to create a pair (nil . expression). Section: pair @@ -680,7 +680,7 @@ recursive call would work in a non-tail position but could blow the stack if it is to deep- unlike a recur or tail position recursive call). NOTE: potential footgun, the let macro expands to a lambda (fn) and a recur used inside the let would bind with the let not the enclosing lambda (this would -apply to any macro that also expands to a lamda- this is by design with the +apply to any macro that also expands to a lambda- this is by design with the loop macro but would be unexpected with let). Section: core @@ -1039,7 +1039,7 @@ Example: "#), mk_err: add_special(vm, "mk-err", r#"Usage: (mk-err :keyword value) -Create an error object. This does not raise the error but merly cretes it. +Create an error object. This does not raise the error but merely creates it. Can use car/cdr to extract the keyword and value. Section: core diff --git a/compiler/src/compile/compile_call.rs b/compiler/src/compile/compile_call.rs index b8b7cbd5ef..83dfcdc30f 100644 --- a/compiler/src/compile/compile_call.rs +++ b/compiler/src/compile/compile_call.rs @@ -88,7 +88,7 @@ pub(crate) fn compile_call_reg( .chunk .encode2(MOV, result as u16 + 1, reg, env.own_line())?; } - // Lie abpout this being a tail call because we can not emit the BMOV yet. + // Lie about this being a tail call because we can not emit the BMOV yet. compile_params(env, state, cdr, result + 2, false)?; let b_reg = result + cdr.len() + 3; if b_reg > state.max_regs { diff --git a/doc/README.md b/doc/README.md index 7862ac84c2..dad9a52fe3 100644 --- a/doc/README.md +++ b/doc/README.md @@ -13,11 +13,11 @@ rm -rf ./book/* # generated site entrypoint at `./book/index.html` ``` -TODO PC need md files in a specific folder named after a section to be inlined within the section documetnation +TODO PC need md files in a specific folder named after a section to be inlined within the section documentation ## Important information -0. Must be compiled in lisp-test mode for appropriate documenation functions to be present (`cargo build --features lisp-test`). +0. Must be compiled in lisp-test mode for appropriate documentation functions to be present (`cargo build --features lisp-test`). 1. To create new documentation files add them in markdown format to the `doc/src/` directory and then reference them in `doc/src/SUMMARY.md` when slosh builds the documentation it will create an html file in the format specified in the SUMMARY.md table of contents at the provided relative URL. diff --git a/doc/src/errors.md b/doc/src/errors.md index e77f9e98e1..8ce3a70714 100644 --- a/doc/src/errors.md +++ b/doc/src/errors.md @@ -1,22 +1,22 @@ # ERRORS ## Error Type -The error type consists of an identifing keywork and a data/payload value. This +The error type consists of an identifying keywork and a data/payload value. This value is typically a string but can be any valid value. (type [error]) returns :Error -The form (car [error]) returns the keyword identifing this error. +The form (car [error]) returns the keyword identifying this error. The form (cdr [error]) returns the data value for the error. Note the use of car/cdr to pull apart an error even though it is not of the pair type. Use (mk-err :[ID] value) to create an error type or (err :[ID] value) to "raise" an error (see below). ## Raising an error -Runtime errors will be "raised". This means the program execution will halt and the debugger will be entered. Currently this only allows examing the running state but will eventually include the ability to modify state and restart as other Lisps allow. Code can raise an error with the err form, for instance (err :some-error-type "This is my error") will raise an error and interrupt the program. +Runtime errors will be "raised". This means the program execution will halt and the debugger will be entered. Currently this only allows examining the running state but will eventually include the ability to modify state and restart as other Lisps allow. Code can raise an error with the err form, for instance (err :some-error-type "This is my error") will raise an error and interrupt the program. -Note, the (get-error FORM+) form can be used to programmaticly return a raised error instead of breaking to the debugger. +Note, the (get-error FORM+) form can be used to programmatically return a raised error instead of breaking to the debugger. ## Returning an error -Code can return an error instead of breaking into the debugger. Use the (mk-err :[ERROR ID] vallue) to create an error and then use it as any other value (return it from a function for instance). This may be appropraite for a common error that does not warrent breaking to the debugger. +Code can return an error instead of breaking into the debugger. Use the (mk-err :[ERROR ID] vallue) to create an error and then use it as any other value (return it from a function for instance). This may be appropriate for a common error that does not warrent breaking to the debugger. ## References See the docs string for: diff --git a/lisp/core.slosh b/lisp/core.slosh index 7fa3b8eeb7..d4a5db93f5 100644 --- a/lisp/core.slosh +++ b/lisp/core.slosh @@ -300,8 +300,8 @@ Example: (inc! ~i-name))))) #% -Evaluate body a number of times equal to times' numnrical value. Includes an -incrementing reference binding, idx-bind, accesible in body. +Evaluate body a number of times equal to times' numerical value. Includes an +incrementing reference binding, idx-bind, accessible in body. Section: core @@ -342,7 +342,7 @@ Example: Usage: (dyn key value expression) -> result_of_expression Creates a dynamic binding for key, assigns value to it and evals expression under it. -Note that if key must be a symbol and is not evaluted. +Note that if key must be a symbol and is not evaluated. The binding is gone once the dyn form ends. This is basically a set! on the binding in an unwind protect to reset it when done. When used on a global will @@ -543,7 +543,7 @@ Example: Usage: (cond ((test form*)*) -> result Evaluate each test in order. If it is true then evaluate the form(s) in an -implicit do and return the result. Stop evaluting at the first true test. +implicit do and return the result. Stop evaluating at the first true test. Return nil if no conditions are true. Section: conditional diff --git a/lisp/iterator.slosh b/lisp/iterator.slosh index b419f36172..53b5e561c7 100644 --- a/lisp/iterator.slosh +++ b/lisp/iterator.slosh @@ -274,7 +274,7 @@ Example: #% Loops over each element in an iterator. -The bind parameter is bound to the current element of items and is accesible +The bind parameter is bound to the current element of items and is accessible in body. Body is evaluated a number of times equal to the items in the iterator. Section: iterator @@ -326,7 +326,7 @@ Example: #% -reduce is used to amalgamate an iterator and an intitial value, +reduce is used to amalgamate an iterator and an initial value, according to the reducing function provided. The reducing-fcn should be a function of two arguments. In the first iteration of reduce, the init-val will be used as the first argument to the reducing-fcn and (iter) will be used as the diff --git a/lisp/sh-color.slosh b/lisp/sh-color.slosh index ce7e386eb6..2f3c611ea7 100644 --- a/lisp/sh-color.slosh +++ b/lisp/sh-color.slosh @@ -79,7 +79,7 @@ Section: shell Example: (assert-true (sys-command? "ls")) -(assert-false (sys-command? "rst-not-a-comand-strsnt")) +(assert-false (sys-command? "rst-not-a-command-strsnt")) %# (defn sys-command? (com) (if (or (str-empty? com)(identical? com.0 \/)(identical? com.0 \.)) diff --git a/shell/src/platform.rs b/shell/src/platform.rs index a1a019a06c..cc9ba077ad 100644 --- a/shell/src/platform.rs +++ b/shell/src/platform.rs @@ -63,7 +63,7 @@ pub trait Platform { /// If mask_string is a mode string then merge it with umask and set the current umask. /// If mask_string is an int then treat it as a umask and set the current umask (no merge)). fn merge_and_set_umask(current_umask: mode_t, mask_string: &str) -> Result; - /// Cears the current umask and returns the previous umask. + /// Clears the current umask and returns the previous umask. fn get_and_clear_umask() -> mode_t; /// Set current umask to umask. fn set_umask(umask: mode_t) -> Result<(), io::Error>; @@ -103,7 +103,7 @@ pub struct RLimitVals { /// Abstraction over the various rlimits. pub enum RLimit { - ///-b: The maximum socket buffer size. RLIMIT_SBSIZE (freebsd, drogonfly) + ///-b: The maximum socket buffer size. RLIMIT_SBSIZE (freebsd, dragonfly) SocketBufferSize, /// -c; The maximum size of core files created. RLIMIT_CORE /// The maximum size core file that this process can create. If the process terminates and would diff --git a/shell/src/platform/unix.rs b/shell/src/platform/unix.rs index 020105e769..5679df623e 100644 --- a/shell/src/platform/unix.rs +++ b/shell/src/platform/unix.rs @@ -637,7 +637,7 @@ fn rlimit_to_c(rlimit: RLimit) -> Result { #[cfg(not(any(target_os = "android", target_os = "linux")))] RLimit::SigPending => Err(Error::new(ErrorKind::Unsupported, "not on platform")), #[cfg(target_os = "freebsd")] - RLimit::KQueues => Ok(libc::RLIMIT_KQUEUESA), + RLimit::KQueues => Ok(libc::RLIMIT_KQUEUES), #[cfg(not(target_os = "freebsd"))] RLimit::KQueues => Err(Error::new(ErrorKind::Unsupported, "not on platform")), #[cfg(any( diff --git a/shell/src/platform/unix/umask.rs b/shell/src/platform/unix/umask.rs index 5506d1b443..84876c86e9 100644 --- a/shell/src/platform/unix/umask.rs +++ b/shell/src/platform/unix/umask.rs @@ -302,7 +302,7 @@ pub fn merge_and_set_umask(current_umask: mode_t, mask_string: &str) -> Result mode_t { nix::sys::stat::umask(Mode::empty()).bits() as mode_t diff --git a/slosh.vim b/slosh.vim index a358869c68..b7ad53b4ce 100644 --- a/slosh.vim +++ b/slosh.vim @@ -73,7 +73,7 @@ syn keyword sloshFunc + - * \ syn keyword sloshFunc inc! dec! list list-append syn keyword sloshFunc cons car cdr xar! xdr! syn keyword sloshFunc = /= -" TODO- these dont work... set! eq? equal? +" TODO- these don't work... set! eq? equal? syn keyword sloshFunc < > <= >= syn keyword sloshFunc pr prn load eval diff --git a/vim/slosh.vim b/vim/slosh.vim index 3ef12e2a68..6ba226235d 100644 --- a/vim/slosh.vim +++ b/vim/slosh.vim @@ -72,7 +72,7 @@ syn keyword sloshFunc + - * \ syn keyword sloshFunc inc! dec! list list-append syn keyword sloshFunc cons car cdr xar! xdr! syn keyword sloshFunc = /= -" TODO- these dont work... set! eq? equal? +" TODO- these don't work... set! eq? equal? syn keyword sloshFunc < > <= >= syn keyword sloshFunc pr prn load eval diff --git a/vm/src/value.rs b/vm/src/value.rs index 142436b69e..0d64d938af 100644 --- a/vm/src/value.rs +++ b/vm/src/value.rs @@ -225,7 +225,7 @@ impl Value { matches!(self, Value::True) } - pub fn is_truethy(&self) -> bool { + pub fn is_truthy(&self) -> bool { !matches!(self, Value::False | Value::Nil) } diff --git a/vm/src/vm/exec_loop.rs b/vm/src/vm/exec_loop.rs index 6d1329ee5c..972e08348c 100644 --- a/vm/src/vm/exec_loop.rs +++ b/vm/src/vm/exec_loop.rs @@ -538,7 +538,7 @@ impl GVm { WIDE => wide = true, MOV => { let (dest, src) = decode2!(self.ip_ptr, wide); - // XXX TODO- figure out proper mov symantics... + // XXX TODO- figure out proper mov semantics... let val = self.register_unref(src as usize); //let val = self.register(src as usize); mov_register!(self, dest as usize, val); @@ -808,7 +808,7 @@ impl GVm { } JMPT => { let (test, jmp) = decode2!(self.ip_ptr, wide); - if self.register(test as usize).is_truethy() { + if self.register(test as usize).is_truthy() { self.ip_ptr = get_code_at!(chunk, chunk.jump_table[jmp as usize] as isize); } }