Commit Graph

639 Commits

Author SHA1 Message Date
Jan Nieuwenhuizen 1f0a7674d9 fix 01-script-$#. 2018-12-02 09:03:02 +01:00
Jan Nieuwenhuizen d5c94e75dd parse [ .. ] into plain command. fixes 10-if-bracket-false, 100-bracket-file. 2018-12-02 06:56:17 +01:00
Jan Nieuwenhuizen 6cf9cf7d0f test: 10-if-test, 10-if-test-false, 10-if-bracket, 10-if-bracket-false. 2018-12-02 06:56:17 +01:00
Jan Nieuwenhuizen ddc0f58896 test: 01-script-$#, 60-function-at. 2018-12-02 06:56:17 +01:00
Jan Nieuwenhuizen 6852e24dc4 test: 00-exit-error, 00-exit-var. 2018-12-02 06:56:17 +01:00
Jan Nieuwenhuizen 932339a5eb test: 30-substitution-word. 2018-12-02 06:56:17 +01:00
Jan Nieuwenhuizen d2d799a2f9 test: 20-exec. 2018-12-02 06:56:17 +01:00
Jan Nieuwenhuizen 8b925dd5e8 test: 03-echo-brace. 2018-12-02 06:56:17 +01:00
Jan Nieuwenhuizen 157bd5162d test: 10-if-line.sh.
Adding a newline to this file will no longer reproduce this bug.
2018-12-02 06:56:17 +01:00
Jan Nieuwenhuizen 380562c0b3 test: 100-test-file, 100-bracket-file. 2018-12-02 06:56:17 +01:00
Jan Nieuwenhuizen 8f12c6a562 test: 50-redirect-sed.sh 2018-12-02 06:56:17 +01:00
Jan Nieuwenhuizen 298238e8e6 guix: Update build. 2018-11-30 12:40:49 +01:00
Jan Nieuwenhuizen 0a09ab114a mv: New builtin.
* gash/commands/mv.scm: New file.
* gash/bournish-commands.scm: Use it.
* build-aux/build-guile.sh: Compile it.
* configure: Wrap it.
* .gitignore: Ignore it.
2018-11-30 12:38:24 +01:00
Timothy Sample 8739cafad9 Add subshell semantics
* geesh/shell.scm (subshell): New public function.
* tests/shell.scm: Test it.
* .dir-locals.el: Indent it nicely.
2018-11-28 23:07:03 -05:00
Timothy Sample b5e77fc27b Add support for '<sh-begin>'
* geesh/eval.scm (eval-sh): Handle '<sh-begin>'.
2018-11-28 23:07:03 -05:00
Timothy Sample d171a8cd15 Add support for setting variables
* geesh/eval.scm (eval-sh): Handle '<sh-set!>' forms.
2018-11-28 23:07:03 -05:00
Timothy Sample 5384009f75 Add redirect support
* geesh/eval.scm (eval-redir): New function.
(exp->thunk): New function.
(eval-sh): Handle '<sh-with-redirects>' forms.
2018-11-28 23:07:03 -05:00
Timothy Sample e6f732ada9 Add redirect semantics
* geesh/shell.scm (save-and-install-redirect!): New function.
(restore-saved-fdes!): New function.
(with-redirects): New public function.
* tests/shell.scm: Test it.
* .dir-locals.el: Indent it nicely.
2018-11-28 23:07:03 -05:00
Timothy Sample 9b879623de Import existing variables into the REPL
* geesh/repl.scm (run-repl): Use existing environment variables for
the initial environment.
2018-11-28 23:07:03 -05:00
Timothy Sample 737ed6a1b7 Add function for reading an 'environ'
* geesh/environment.scm (environ->alist): New function.
* tests/environment.scm: Test it.
2018-11-28 23:07:03 -05:00
Timothy Sample d7d26534b2 Remove prompt-printing from the REPL
This will have to be added again later, but for now it is getting in
the way of automated testing.

* geesh/repl.scm (run-repl): Do not print prompts.
2018-11-28 23:07:03 -05:00
Timothy Sample 93b238d9fd Use parser and interpreter in the REPL
* geesh/repl.scm (run-repl): Actually read and evaluate input.
2018-11-28 23:07:03 -05:00
Timothy Sample 549d1e7867 Remove REPL unit tests
In order to test the REPL in isolation, we would have to mock out the
parser and interpreter.  This is possible, but too much work for the
benefit (at least for now).

* tests/repl.scm: Deleted.
* Makefile.am: Remove it.
2018-11-28 23:07:03 -05:00
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