Commit Graph

516 Commits

Author SHA1 Message Date
Timothy Sample 83c5d603ee Add eval module
* geesh/eval.scm: New file.
* Makefile.am: Add it.
2018-11-28 23:07:03 -05:00
Timothy Sample e1f139b841 Add support for built-ins, starting with 'echo'
* geesh/built-ins/echo.scm: New file.
* geesh/built-ins.scm: New file.
* Makefile.scm: Add them.
* geesh/shell.scm (exec-let): Include built-ins in command search.
* tests/shell.scm: Add a test for this.
2018-11-28 23:07:03 -05:00
Timothy Sample 7cc94e88e1 Add PATH searching
* geesh/shell.scm (slashless?) New function.
(split-search-path): New function.
(find-utility): New function.
(exec-let): Use them to search PATH for a utility when appropriate.
(exec): Update doc string.
* tests/shell.scm: Test it.
2018-11-28 23:07:03 -05:00
Timothy Sample 020adfc58b Add convenience function 'var-ref*'
* geesh/environment.scm (var-ref*): New public function.
* geesh/word.scm (word->qword): Use it to simplify things.
2018-11-28 23:07:03 -05:00
Timothy Sample da1746f2d6 Add missing doc strings in environment
* geesh/environment.scm (var-ref): Add doc string.
(set-var!): Add doc string.
2018-11-28 23:07:03 -05:00
Timothy Sample b9ec924bbe Add shell module
* geesh/shell.scm: New file.
* tests/shell.scm: New file.
* Makefile.am: Add them.
* tests/config.scm.in: New file.
* configure.ac: Add it.
* .gitignore: Add its generated form.
* .dir-locals.el: Add indentation rule for 'make-script'.
2018-11-28 23:07:03 -05:00
Timothy Sample cfb2b5b99b Add function for creating an 'environ'
* geesh/environment.scm (environment->environ): New function.
* tests/environment.scm: Test it.
2018-11-28 23:07:03 -05:00
Timothy Sample 99378697e2 Add missing '(test-end)' to environment tests
* tests/environment.scm: Add '(test-end)'.
2018-11-28 23:07:03 -05:00
Timothy Sample 9d834d0767 Fix parsing of for loops
* geesh/parser.scm (make-parser): When parsing for loops, make all
word-lists actual lists, and make an empty word-list with the 'in'
keyword yield an empty list rather than a reference to '$@'.
* tests/parser.scm: Update tests.
2018-11-28 23:04:30 -05:00
Timothy Sample 91cfdac307 Throw an error when missing a single quote
We used to loop forever here because of the lack of 'eof-object?'
test!

* geesh/lexer.scm (get-single-quotation): Throw an error on unexpected
end-of-file.
2018-11-28 23:00:10 -05:00
Timothy Sample 48e122c42f Fix AST for redirects and assignments
This should have been in 2b05199562, but
it was overlooked.

* geesh/parser.scm (make-parser): Splice in arguments in the redirect
case (to be consistent with the non-redirect case).
* tests/parser.scm: Add a test for this.
2018-11-28 22:09:34 -05:00
Timothy Sample 870c10b37a Add a CI script for GitLab
* build-aux/gitlab-ci.yml: New file.
* .gitignore: Do not ignore it.
2018-11-28 21:55:22 -05:00
Jan Nieuwenhuizen 1162f37d19 test: 07-variable-or-empty. 2018-11-25 11:53:29 +01:00
Jan Nieuwenhuizen 7f2b1b1ff1 build: Oops, configure SHELLS as shell. 2018-11-25 11:48:12 +01:00
Jan Nieuwenhuizen 7f6b88c43b implement shift. 2018-11-25 08:46:10 +01:00
Jan Nieuwenhuizen 2f5de56cfd test: add 50-redirect-merge.sh 2018-11-24 21:57:34 +01:00
Jan Nieuwenhuizen f3fc92c266 test: add failing redirect/pipe test. 2018-11-24 21:05:59 +01:00
Jan Nieuwenhuizen 29ae8bc570 test: add substitution tests. 2018-11-24 20:48:21 +01:00
Jan Nieuwenhuizen 3c7b22febf test: add 42-sh.sh 2018-11-24 13:17:21 +01:00
Jan Nieuwenhuizen cb05054006 fix parsing of 07-variable-or-doublequete.sh. 2018-11-24 13:10:38 +01:00
Jan Nieuwenhuizen 9ac8140cf4 test: 07-variable-or-doublequete.sh: New failing parse test. 2018-11-24 12:57:07 +01:00
Jan Nieuwenhuizen b2f5004eb6 01-script-$0.sh, 01-script-$@.sh: add test and fix. 2018-11-24 12:25:24 +01:00
Jan Nieuwenhuizen f81b526bd0 fix and test cd builtin. 2018-11-24 11:32:33 +01:00
Jan Nieuwenhuizen 58d1627b08 fix 60-function.sh. 2018-11-24 11:12:44 +01:00
Jan Nieuwenhuizen 2df901d337 50-redirect-append.sh: New failing parse test. 2018-11-24 11:05:46 +01:00
Jan Nieuwenhuizen 43f79811aa fix 07-variable-or-variable.sh. 2018-11-24 10:55:24 +01:00
Jan Nieuwenhuizen b9013153f2 test: 07-variable-or-variable.sh: New failing parse test. 2018-11-18 15:36:35 +01:00
Jan Nieuwenhuizen bdbc29e448 transform: reduce simple commands...WIP 2018-11-17 20:08:17 +01:00
Jan Nieuwenhuizen 992479b0a3 11-for-subshell: new failing parse test. 2018-11-17 20:08:01 +01:00
Jan Nieuwenhuizen 74454c2156 transform: handle ./source. 2018-11-17 19:27:51 +01:00
Jan Nieuwenhuizen 9d1ed9ef57 transform: if-clause->if. 2018-11-17 19:27:51 +01:00
Jan Nieuwenhuizen df73d5421f transform: translate script to begin or command. 2018-11-17 08:46:39 +01:00
Jan Nieuwenhuizen b89ca17134 transform: rewrite io-redirection. 2018-11-17 08:42:54 +01:00
Jan Nieuwenhuizen 96d55d0985 guix: install bournish in libexec/gash. 2018-11-16 18:58:28 +01:00
Jan Nieuwenhuizen 2dc0a56ff9 guix: replace recipe with guile-only (bootstrappable) build. 2018-11-16 08:03:58 +01:00
Rutger van Beusekom d36ee815df variable-regex: fix 70-*.sh 2018-11-16 00:24:17 +01:00
Jan Nieuwenhuizen df605a161a sed: Support substitution of \t, \n. 2018-11-14 22:58:32 +01:00
Jan Nieuwenhuizen 303746a4bc io-here. 2018-11-14 22:49:06 +01:00
Jan Nieuwenhuizen b6340bd612 io-redirect: some progress, some new tests. 2018-11-14 22:41:24 +01:00
Jan Nieuwenhuizen 049c4a20dc cat: Oops, two fixes. 2018-11-14 22:40:52 +01:00
Jan Nieuwenhuizen efd22ab959 fix 11-for.sh. 2018-11-14 21:09:21 +01:00
Rutger van Beusekom bb79378e66 fix 10-if-else.sh and 10-if-elif.sh 2018-11-14 19:59:18 +01:00
Rutger van Beusekom 1fe85e2b8f fix 10-if-word-variable.sh (HACK) 2018-11-14 19:50:43 +01:00
Rutger van Beusekom c20ac38ace fix 08-variable-not-and.sh 2018-11-14 19:46:02 +01:00
Rutger van Beusekom 03dcfb9a9f fix 08-variable-and.sh 2018-11-14 19:40:46 +01:00
Rutger van Beusekom aa8aa10151 fix 05-assignment-doublequoted-doubleqoutes.sh 2018-11-14 19:31:29 +01:00
Rutger van Beusekom da105e0e81 fix 05-assignment-empty.sh 2018-11-14 19:31:00 +01:00
Rutger van Beusekom 6e88ad23d0 place assignment at the proper grammar level 2018-11-14 08:22:12 +01:00
Rutger van Beusekom 98868392c8 cleanup commented out code 2018-11-14 08:22:00 +01:00
Rutger van Beusekom d667922bbd narrow escape 2018-11-13 09:04:56 +01:00