additional comment form

This commit is contained in:
Ava Hahn 2023-03-10 13:16:25 -08:00
parent ce3dba470a
commit 61a1b47b85
Signed by untrusted user who does not match committer: affine
GPG key ID: 3A4645B8CF806069
3 changed files with 48 additions and 20 deletions

View file

@ -301,11 +301,16 @@ This contains any executable target of this project. Notably the main shell file
Note: this section will not show the status of each item unless you are viewing it with a proper orgmode viewer. Note: this section will not show the status of each item unless you are viewing it with a proper orgmode viewer.
Note: this section only tracks the state of incomplete TODO items. Having everything on here would be cluttered. Note: this section only tracks the state of incomplete TODO items. Having everything on here would be cluttered.
*** TODO Syntax improvements
**** WONTDO implicit single quote
**** TODO :symbol syntax
**** TODO Update Tests
**** TODO Update Makefile documentation
*** TODO Quote function *** TODO Quote function
*** TODO Eval function *** TODO Eval function
*** TODO lambda
*** TODO Lex function
*** TODO Input function *** TODO Input function
*** TODO Lex function
*** TODO Read function (Input + Lex)
*** TODO Load (load a script) function *** TODO Load (load a script) function
Pull/Refactor the logic out of the configure functions. Pull/Refactor the logic out of the configure functions.
Optionally return a list of new variables and/or functions? Optionally return a list of new variables and/or functions?
@ -313,13 +318,14 @@ Will need a concatenate function for tables
*** TODO Main shell calls Load function on arg and exits *** TODO Main shell calls Load function on arg and exits
*** TODO FINISH DOCUMENTATION *** TODO FINISH DOCUMENTATION
*** TODO Shell module *** TODO Shell module
**** TODO Support for single quoting string literals **** TODO only loadable via POSIX config var
**** TODO Args parsing helper Overload Load function to call a binary too
**** TODO arg processor because these are control flow
**** TODO Process launching with environment variables **** TODO Process launching with environment variables
**** TODO Optional form of process which allows fd redirecting **** TODO Optional form of process which allows fd redirecting
**** TODO Foreground process TTY **** TODO Background processes (bg function)
**** TODO Background processes **** TODO Foreground process TTY (fg function)
**** TODO Update config env var docstring with functions loaded or unloaded **** TODO list jobs (j function)
**** TODO ESSENTIAL: DOCUMENT POSIX MODULE **** TODO ESSENTIAL: DOCUMENT POSIX MODULE
*** TODO Can enter multiple lines of text, with formatting in repl *** TODO Can enter multiple lines of text, with formatting in repl
*** TODO Rename to Flesh *** TODO Rename to Flesh

View file

@ -131,7 +131,7 @@ fn process(document: &String) -> Result<Box<Seg>, String> {
delim_stack.push(c); delim_stack.push(c);
} }
// eat the whole line // eat the whole line
'#' => { '#' | ';' => {
ign = true; ign = true;
delim_stack.push('\n'); delim_stack.push('\n');
} }

View file

@ -14,16 +14,16 @@ mod lex_tests {
} }
#[test] #[test]
fn test_lex_complex_list() { fn test_bad_symbol() {
let document = String::from("(hello 'world' (1 2 (1 2 3)) 1 2 3)"); let document = String::from("(as/dd)");
assert_eq!(lex(&document).unwrap().to_string(), document); let output: &str = "Problem lexing document: \"Unparsable token: as/dd\"";
assert_eq!(lex(&document).err().unwrap(), output.to_string(),);
} }
#[test] #[test]
fn test_bad_symbol() { fn test_lex_complex_list() {
let document = String::from("(as;dd)"); let document = String::from("(hello 'world' (1 2 (1 2 3)) 1 2 3)");
let output: &str = "Problem lexing document: \"Unparsable token: as;dd\""; assert_eq!(lex(&document).unwrap().to_string(), document);
assert_eq!(lex(&document).err().unwrap(), output.to_string(),);
} }
#[test] #[test]
@ -53,23 +53,45 @@ mod lex_tests {
} }
#[test] #[test]
fn test_comment() { fn test_comment_1() {
let document = String::from("#!/bin/relish\n(one two)"); let document = String::from("#!/bin/relish\n(one two)");
let output: &str = "(one two)"; let output: &str = "(one two)";
assert_eq!(lex(&document).unwrap().to_string(), output.to_string(),); assert_eq!(lex(&document).unwrap().to_string(), output.to_string(),);
} }
#[test] #[test]
fn test_postline_comment() { fn test_comment_2() {
let document = String::from(";; big doc string\n(one two)");
let output: &str = "(one two)";
assert_eq!(lex(&document).unwrap().to_string(), output.to_string(),);
}
#[test]
fn test_postline_comment_1() {
let document = let document =
String::from("#!/bin/relish\n((one two)# another doc comment\n(three four))"); String::from("#!/bin/relish\n((one two)# another doc comment\n('three' four))");
let output: &str = "((one two) ('three' four))";
assert_eq!(lex(&document).unwrap().to_string(), output.to_string(),);
}
#[test]
fn test_postline_comment_2() {
let document =
String::from("#!/bin/relish\n((one two);;another doc comment\n(three four))");
let output: &str = "((one two) (three four))"; let output: &str = "((one two) (three four))";
assert_eq!(lex(&document).unwrap().to_string(), output.to_string(),); assert_eq!(lex(&document).unwrap().to_string(), output.to_string(),);
} }
#[test] #[test]
fn test_inline_comment() { fn test_inline_comment_1() {
let document = String::from("#!/bin/relish\n((one two)\n# another doc comment\nthree)"); let document = String::from("#!/bin/relish\n((one two)\n# another comment\nthree)");
let output: &str = "((one two) three)";
assert_eq!(lex(&document).unwrap().to_string(), output.to_string(),);
}
#[test]
fn test_inline_comment_2() {
let document = String::from("# head\n((one two)\n;; another comment\nthree)");
let output: &str = "((one two) three)"; let output: &str = "((one two) three)";
assert_eq!(lex(&document).unwrap().to_string(), output.to_string(),); assert_eq!(lex(&document).unwrap().to_string(), output.to_string(),);
} }