Permalink
Please sign in to comment.
Browse files
Word eval and the read builtin now use the new IFS splitting algorithm.
It took a couple tries to get the concepts right, but this fixes even
more bugs in word splitting.
The read builtin now fully supports backslash escaping (without -r).
Dozens of more spec tests pass, e.g. in
spec/{word-split,var-sub-quote,word-eval,builtin-io}.test.sh.
All unit tests pass.
Details:
- Change the representation of evaluated word parts. Add
part_value.CompoundPartValue because it is logically a tree.
TODO: We can flatten this on the fly by using the recursive
accumulator style.
- Stop using WhitespaceSplitter. A Single IfsSplitter works better,
because both have to handle backslash escaping.
- 'read' uses a new _AppendParts() function which handles backslash
escapes and line continuation.
- Fix a bug where REPLY was not respected, and add test.
- Fix a bug with echo -e "\\", and add tests. The Python regex wasn't
properly escaped!
- Use runtime.asdl for Span so we debug with pretty-printing.
- asdl/format.py: Change pretty-printing of ASDL bools.
- Remove old regex-based IFS splitting code.
- Add a text file on word evaluation.
NOTE: we have to escape inside out!
1. maybe GlobEscape
2. maybe IFS escape
3. split with IFS
4. glob- Loading branch information...
Showing
with
844 additions
and 456 deletions.
- +4 −1 asdl/format.py
- +83 −31 core/builtin.py
- +9 −29 core/builtin_test.py
- +1 −1 core/glob_.py
- +89 −155 core/legacy.py
- +72 −44 core/legacy_test.py
- +8 −12 core/runtime.asdl
- +201 −171 core/word_eval.py
- +270 −0 doc/word-eval.txt
- +63 −4 spec/builtin-io.test.sh
- +28 −0 spec/var-sub-quote.test.sh
- +12 −4 spec/word-split.test.sh
- +4 −4 test/spec.sh
Oops, something went wrong.
0 comments on commit
a034751