Timothy Sample
38c832a8e2
Add missing copyright headers.
...
* gash/pattern.scm,
gash/shell.scm,
tests/bootstrap/bash-without-bash.scm,
tests/spec/oil.scm,
tests/unit/config.scm.in: Add missing copyright header.
2019-05-20 18:07:47 -04:00
Timothy Sample
3d80f05940
Fix readline-related compiler warnings.
...
* gash/gash.scm: Use the readline module at expansion time too, so
that the compiler can see it.
2019-05-20 18:07:47 -04:00
Timothy Sample
e86623b642
Clean up version text.
...
* gash/gash.scm (display-version): Clean up output.
2019-05-20 18:07:47 -04:00
Timothy Sample
669c414116
Prefer 'if-guile-version-below' to 'cond-expand'.
...
* gash/compat.scm: Use 'if-guile-version-below' over 'cond-expand'.
* gash/compat/textual-ports.scm: Ditto.
2019-05-20 18:07:47 -04:00
Timothy Sample
2d46b8b43e
Move 'setvbuf' shim to '(gash compat)'.
...
* tests/unit/shell.scm: Mode 'setvbuf' shim...
* gash/compat.scm: ...here.
2019-05-20 18:07:47 -04:00
Timothy Sample
0c57fc9ef9
Move 'textual-ports' under 'compat'.
...
* gash/textual-ports.scm: Move this...
* gash/compat/textual-ports.scm: ...here.
* Makefile.am, gash/lexer.scm, gash/parser.scm, gash/shell.scm,
tests/unit/shell.scm: Update references.
2019-05-20 18:07:47 -04:00
Timothy Sample
878b9c3dca
Add support for Guile 2.0.9.
...
* gash/compat.scm: New file.
* gash/compat/hash-table.scm: New file.
* Makefile.am: Add them.
* .dir-locals.scm: Add indentation for 'if-guile-version-below'.
* guix.scm (guile-2.0.9): New variable.
* gash/built-ins/echo.scm (escape->control): Use '#\esc'.
* gash/environment.scm: Use '(gash compat hash-table)'.
* gash/built-ins/break.scm,
gash/built-ins/cd.scm,
gash/built-ins/command.scm,
gash/built-ins/continue.scm,
gash/built-ins/dot.scm,
gash/built-ins/exec.scm,
gash/built-ins/exit.scm,
gash/built-ins/pwd.scm,
gash/built-ins/return.scm,
gash/built-ins/set.scm,
gash/built-ins/shift.scm,
gash/built-ins/trap.scm,
gash/built-ins/type.scm,
gash/built-ins/umask.scm,
gash/eval.scm,
tests/unit/automake.scm: Use '(gash compat)'.
squash! Add support for Guile 2.0.9.
2019-05-20 18:07:47 -04:00
Timothy Sample
b024fcaab7
Remove compression utility configuration.
...
* configure.ac: Do not look for bzip2, compress, gzip, or xz.
* gash/config.scm.in (exec-internal-compress): Delete function.
(%bzip2, %compress, %gzip, %xz): Delete variables.
2019-05-20 01:18:54 -04:00
Timothy Sample
c677ed85cc
Clean up module imports in 'gash.scm'.
...
* gash/gash.scm: Sort the '#:use-module' lines and remove a duplicate
'(gash environment)'.
2019-05-20 01:18:54 -04:00
Timothy Sample
315322e6ca
Remove 'debug' and 'prefer-builtins' options.
...
These were not working anyway.
* gash/gash.scm (%debug-level, %prefer-builtins): Remove variables.
(display-help, main): Remove 'debug' and 'prefer-builtins'.
2019-05-20 01:18:54 -04:00
Timothy Sample
ff34039b62
Remove unused modules.
...
* gash/builtins.scm,
gash/io.scm,
gash/job.scm,
gash/pipe.scm,
gash/script.scm,
gash/shell-utils.scm,
gash/util.scm: Delete files.
* Makefile.am: Remove them.
* gash/gash.scm (main, prompt): Remove calls to deleted job control
procedures.
2019-05-20 01:18:54 -04:00
Timothy Sample
df43ca7215
Add support for Guile 2.0.
...
* configure.ac (GUILE_PKG): Add 2.0.
* gash/textual-ports.scm: New file.
* Makefile.am: Add it.
* gash/lexer.scm, gash/parser.scm, gash/shell.scm: Use it in place of
'(ice-9 textual-ports)'.
* tests/unit/shell.scm: Use it in place of '(ice-9 textual-ports)';
replace '(ice-9 textual-ports)' with '(rnrs io ports)' in sub-scripts;
and add a shim for 'setvbuf'.
2019-05-20 01:18:54 -04:00
Timothy Sample
5b236ceef3
Structure 'echo' like all the other built-ins.
...
* gash/built-ins/echo.scm (echo): Rename this...
(main): ...to this, and do not export it.
* gash/built-ins.scm: Reference the 'main' function of the 'echo'
module using '@@'.
2019-05-20 01:18:54 -04:00
Timothy Sample
10400ed2ad
Remove PEG modules and the PEG-based parser.
...
* gash/grammar.scm,
gash/peg.scm,
gash/peg/cache.scm,
gash/peg/codegen.scm,
gash/peg/simplify-tree.scm,
gash/peg/string-peg.scm,
gash/peg/using-parsers.scm: Delete files.
Makefile.am: Remove them.
2019-05-20 01:18:54 -04:00
Timothy Sample
874d165b11
Remove the unused 'geesh' module.
...
* gash/geesh.scm: Delete file.
* Makefile.am: Do not compile it.
* gash/gash.scm (%geesh-parser?): Remove unused variable.
(parse, parse-string, file-to-ast): Remove unused procedures.
2019-05-20 01:18:54 -04:00
Jan Nieuwenhuizen
5b74c6426a
echo: Implement escapes.
...
* gash/built-ins/echo.scm (escape->control): New function.
(echo): Support '-e' and '-E' options even when clumped.
* Makefile.am (XFAIL_TESTS): Remove tests/20-pipe-sed.sh.
Co-authored-by: Timothy Sample <samplet@ngyro.com>
2019-05-20 01:18:48 -04:00
Jan Nieuwenhuizen
1cd6f963ea
Allow setting the status with a Boolean.
...
* gash/environment.scm (set-status!): Allow numerical or boolean input.
2019-05-20 01:18:48 -04:00
Jan Nieuwenhuizen
7640a09382
Support redirects with empty commands.
...
* gash/eval.scm (exp->thunk): Return 'noop' if 'exp' is '#f'.
* tests/50-redirect-clobber.sh: New file.
* tests/50-redirect-clobber.stdout: New file.
* Makefile.am (FULL_TESTS): Add tests/50-redirect-clobber.sh.
Co-authored-by: Timothy Sample <samplet@ngyro.com>
2019-05-20 01:18:36 -04:00
Jan Nieuwenhuizen
6808c941f1
Respect '--parse' flag for files and non-TTY inputs.
...
* gash/gash.scm (main): Include 'parse?' in all calls to 'run-repl'.
2019-05-20 01:18:36 -04:00
Jan Nieuwenhuizen
13f43973f5
Do not export unset variables.
...
* gash/environment.scm (get-environ): Filter out unset variables.
* tests/42-sh-export-new.sh: New file.
* tests/42-sh-export-new.stdout: New file.
* Makefile.am (FULL_TESTS): Add tests/42-sh-export-new.sh.
(XFAIL_TESTS): Remove tests/42-export-new.sh and tests/42-sh-export.sh.
Co-authored-by: Timothy Sample <samplet@ngyro.com>
2019-05-20 01:18:22 -04:00
Jan Nieuwenhuizen
25597a4bec
set: Support clumped flags, e.g. set -eux.
...
* gash/built-ins/set.scm (main): Support clumped flags.
2019-05-20 01:18:22 -04:00
Timothy Sample
50473ac9d4
Add copyright sign to headers.
...
* gash/built-ins/*, gash/environment.scm, gash/eval.scm,
gash/lexer.scm, gash/parser.scm, gash/repl.scm, gash/word.scm,
tests/unit/*, tools/coverage.in: Add copyright sign to headers.
2019-05-20 01:18:22 -04:00
Jan Nieuwenhuizen
9f57723fb6
Make 'set -x' print commands.
...
* gash/shell.scm (sh:exec-let): Respect the 'xtrace' option.
2019-05-20 01:18:22 -04:00
Jan Nieuwenhuizen
2e4e078975
Fix some environment-dependent tests.
...
* gash/environment.scm (initial-variables): Add 'SHELL' and 'SHELLOPTS'.
* tests/100-cd.sh, tests/100-cd.stdout: Use '/tmp' instead of '/bin'.
* tests/50-redirect-in-out.sh, tests/50-redirect-space.sh,
tests/50-redirect.sh: Use '/tmp' and PID for temporary files.
* tests/50-redirect-sed.sh: Make sure 'DESTDIR' is unset and use
'/bin/GASH' in place of '/bin/gash'.
* tests/50-redirect-sed.stdout, tests/data/diff.scm: Use '/bin/GASH' in
place of '/bin/gash'.
* Makefile.am (FULL_TESTS): Add tests/50-redirect-sed.sh,
tests/50-redirect-space.sh, and tests/100-cd.sh; remove
tests/50-redirect-merge.sh.
(BROKEN_TESTS): Remove tests/10-if-redirect.sh,
tests/50-redirect-sed.sh, tests/50-redirect-space.sh, and
tests/100-cd.sh; add tests/50-redirect-merge.sh.
Co-authored-by: Timothy Sample <samplet@ngyro.com>
2019-05-20 01:18:07 -04:00
Timothy Sample
e87f351f3e
Add missing copyright headers.
...
* gash/gash.scm, gash/grammar.scm, gash/io.scm, gash/job.scm,
gash/pipe.scm, gash/script.scm: Add missing copyright header.
Co-authored-by: Jan Nieuwenhuizen <janneke@gnu.org>
2019-05-20 01:17:48 -04:00
Timothy Sample
1bd92e2893
Remove (almost) all references to Geesh.
...
gash/environment.scm: Remove file.
geesh/*: Move these files into the 'gash' folder and replace all
instances of the word 'geesh'.
scripts/geesh.in: Remove file.
HACKING, INSTALL, Makefile.am, configure.ac, guix.scm,
tests/bootstrap/bash-without-bash.scm, tests/spec/Makefile.am,
tests/spec/check-spec, tests/spec/oil.scm, tests/unit/*,
tools/coverage.in: Replace all instances of the word 'geesh'.
Co-authored-by: Jan Nieuwenhuizen <janneke@gnu.org>
2019-05-20 01:17:40 -04:00
Timothy Sample
f387269c0b
Only use readline for TTYs.
...
* gash/gash.scm: Hide the readline interface behind a check for
'isatty?', and default to just running the plain REPL.
2019-05-20 01:17:40 -04:00
Jan Nieuwenhuizen
7fcfe66407
Add the 'command' built-in.
...
* geesh/built-ins/command.scm: New file.
* Makefile.am: Add it.
* geesh/built-ins.scm (*built-ins*): Add 'command'.
Co-authored-by: Timothy Sample <samplet@ngyro.com>
2019-05-20 01:17:30 -04:00
Jan Nieuwenhuizen
cf5611f6d4
Replace geesh script with gash.
...
* geesh/repl.scm (run-repl): Add optional parse? parameter.
* gash/gash.scm (main): Rewrite to use Geesh parser and evaluator.
* scripts/geesh.in: Remove.
* Makefile.am: Remove scripts/geesh; adjust XFAIL_TESTS.
* .gitignore: Update.
Co-authored-by: Timothy Sample <samplet@ngyro.com>
2019-05-20 01:17:14 -04:00
Timothy Sample
171796317f
Remove external commands.
...
* gash/bournish-commands.scm, gash/commands/*, gash/compress.scm,
gash/guix-utils.scm, gash/lzw.scm, gash/ustar.scm: Delete files.
* gash/builtins.scm, gash/gash.scm, gash/script.scm: Remove references
to deleted modules.
* tests/100-basename-*, tests/100-dirname-*, tests/100-sed-*,
tests/100-tar-*, tests/100-tr-*: Delete files.
* Makefile.am: Remove deleted modules and tests.
2019-05-16 10:49:38 -04:00
Timothy Sample
bbcb78de14
Use built-in compress without an external file.
...
When the system does not provide a compress executable, we use our
own. Before, this was done by installing an executable named
'compress' along with Gash. This commit allows the compressed-port
functions to use our built-in compress without needing an external
executable.
* gash/config.scm.in (exec-internal-compress): New function.
(%compress): Fall back to it on systems without compress.
* gash/guix-utils.scm (filtered-port, filtered-output-port): When the
given command list begins with a procedure, apply it to its arguments
instead of using execl.
2019-01-12 11:42:26 -05:00
Timothy Sample
35444457f8
Remove unused variable from Gash config.
...
* gash/config.scm.in (%commands): Remove variable.
2019-01-12 11:42:17 -05:00
Timothy Sample
1cda08dd4a
sed: Replace blank regexes with the last regex.
2018-12-11 13:13:46 -05:00
Timothy Sample
7aa7a883e0
sed: Add basic support for script files.
2018-12-11 13:13:46 -05:00
Timothy Sample
489f092131
sed: Add quit function.
2018-12-11 13:13:46 -05:00
Timothy Sample
5be7ed331d
sed: Support command lists.
2018-12-11 13:13:46 -05:00
Timothy Sample
1302c8bf28
sed: Support single pattern addresses.
2018-12-11 13:13:46 -05:00
Timothy Sample
194c098ab7
sed: Fully parse commands before processing them.
2018-12-11 13:12:45 -05:00
Jan Nieuwenhuizen
8757ab67fb
basename: fix /, add autoconf basename, dirname tests.
2018-12-09 04:13:27 +01:00
Jan Nieuwenhuizen
5b7f85aa3d
Fix [, use \[ in tests.
2018-12-04 21:00:47 +01:00
Jan Nieuwenhuizen
179ae8cddd
grammar: Support \[ builtin.
2018-12-04 19:17:39 +01:00
Jan Nieuwenhuizen
1ce8250029
set: Ignore set -o, set +o.
2018-12-04 19:17:39 +01:00
Jan Nieuwenhuizen
42d52d1a70
tar: Support extracting of read-only archives.
2018-12-04 10:13:45 +01:00
Jan Nieuwenhuizen
53fe775de9
chmod: Recurse also chmod's directories.
2018-12-04 10:10:05 +01:00
Jan Nieuwenhuizen
f7617fce47
builtins: test: Fix a = b.
2018-12-03 21:01:37 +01:00
Jan Nieuwenhuizen
d4f58ffa19
test: 04-word-at-word.
2018-12-02 09:51:57 +01:00
Jan Nieuwenhuizen
39761c0087
test: 04-word-at.
2018-12-02 09:51:57 +01:00
Jan Nieuwenhuizen
632295fa18
fix: 100-sed-fooRbar.
2018-12-02 09:03:02 +01:00
Jan Nieuwenhuizen
f5bc1d45c4
fix: 50-redirect-in-out.
2018-12-02 09:03:02 +01:00
Jan Nieuwenhuizen
a043f9ef09
tr: New builtin.
...
* gash/commands/tr.scm: New file.
* gash/bournish-commands.scm: Use it.
* build-aux/build-guile.sh: Compile it.
* configure: Wrap it.
* .gitignore: Ignore it.
2018-12-02 09:03:02 +01:00
Jan Nieuwenhuizen
353af765eb
cp: Support -f, --force.
2018-12-02 09:03:02 +01:00
Jan Nieuwenhuizen
0679cf9903
mv: Support -f, --force (by ignoring it).
2018-12-02 09:03:02 +01:00
Jan Nieuwenhuizen
73ecccef1e
fix 01-script-$@.
2018-12-02 09:03:02 +01:00
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
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
Jan Nieuwenhuizen
1162f37d19
test: 07-variable-or-empty.
2018-11-25 11:53:29 +01:00
Jan Nieuwenhuizen
7f6b88c43b
implement shift.
2018-11-25 08:46:10 +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
43f79811aa
fix 07-variable-or-variable.sh.
2018-11-24 10:55:24 +01:00
Jan Nieuwenhuizen
bdbc29e448
transform: reduce simple commands...WIP
2018-11-17 20:08:17 +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
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
Rutger van Beusekom
983b9b355a
pass make check-parse
2018-11-13 08:42:55 +01:00
Jan Nieuwenhuizen
b68f8c3223
connect backend: WIP
2018-11-12 10:23:01 +01:00
Jan Nieuwenhuizen
f6a9bb4109
grammar: strip all keywords.
2018-11-12 10:22:52 +01:00
Jan Nieuwenhuizen
0ee86aa981
grammar: move variable-and, or, regex to variable toplevel.
2018-11-12 10:22:52 +01:00
Jan Nieuwenhuizen
b28798b034
grammar: space: allow newline twice.
2018-11-12 10:22:52 +01:00
Jan Nieuwenhuizen
b9b6da52b6
grammar: literal: add \<unalias>. mag dat?
2018-11-12 10:22:52 +01:00
Jan Nieuwenhuizen
7483b27f55
Move peg into gash/, compile.
2018-11-12 10:22:40 +01:00
Rutger van Beusekom
2334e6ebde
revamp PEG grammar
2018-11-11 20:13:07 +01:00
Jan Nieuwenhuizen
5f2bcb9528
test: add failing 07-variable-or-slash.sh.
2018-11-10 11:55:50 +01:00
Jan Nieuwenhuizen
2ea6d6ce34
WIP: parse mes configure.sh
2018-11-10 11:45:01 +01:00
Jan Nieuwenhuizen
9a96816b5d
Support elif.
2018-11-10 11:30:55 +01:00
Jan Nieuwenhuizen
90325b22a2
Support . script, source script.
2018-11-10 11:30:55 +01:00
Jan Nieuwenhuizen
726ca052a9
Support ${ / / }, ${ / }.
2018-11-10 11:30:55 +01:00
Jan Nieuwenhuizen
8ca428c7f2
Support ${ # ## % %% }.
2018-11-05 22:47:34 +01:00
Jan Nieuwenhuizen
1e51c5cbd1
basename: New builtin.
...
* gash/commands/basename.scm: New file.
* build-aux/build-guile.sh: Compile it.
* configure: Create script.
* gash/bournish-commands.scm (basename-command): New variable.
(%bournish-commands): Add it.
2018-11-05 20:46:25 +01:00