summaryrefslogtreecommitdiffstats
path: root/tests/015
Commit message (Collapse)AuthorAgeFilesLines
* awk: tests for fconv.Kaz Kylheku2020-12-312-0/+21
| | | | | * tests/015/awk-fconv.tl, * tests/015/awk-fconv.expected: New files.
* New functions trim-left and trim-right.Kaz Kylheku2020-10-052-0/+41
| | | | | | | | | * regex.c (trim_left, trim_right): New static functions. (regex_init): New intrinsics registered. * tests/015/trim.tl, tests/015/trim.expected: New files. * txr.1: Documented.
* awk: implement ranges right using functions.Kaz Kylheku2017-10-291-13/+13
| | | | | | | | | | | | | | | | | | | | * share/txr/stdlib/awk.tl (sys:awk%--rng, sys:awk%--rng-, sys:awk%rng+, sys:awk%-rng+, sys:awk%--rng+): New functions. (sys:awk-mac-let): Rewritten range expander. The four basic ranges rng, rng-, -rng and -rng- are handled with in-line expansion, because by doing that we avoid unnecessarily evaluating the from-expression. The remaining cases expand to function calls to the new functions, which receive the flag vector, the index position in that vector and the values of the from and to expressions. The behavior change is that that the -- forms now do the right thing: they hide all leading records that satisfy the from-expression, right to the last record of the range if necessary. * tests/015/awk-rng.expected: Updated. * txr.1: Revise semantic description the -- range types, plus minor fixes.
* awk: more range test cases.Kaz Kylheku2017-10-272-1/+7
| | | | | | * tests/015/awk-rng.tl: More rows of data. * tests/015/awk-rng.expected: Updated.
* awk: five new range operators.Kaz Kylheku2017-10-252-0/+43
| | | | | | | | | | | | * share/txr/stdlib/awk.tl (sys;awk-mac-let): Provide the implementation for the local macros --rng, --rng-, rng+, -rng+ and --rng+. * tests/015/awk-rng.tl: New file. * tests/015/awk-rng.expected: New file. * txr.1: Documented.
* Fix tok-str semantics once again.Kaz Kylheku2016-10-261-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The problem is that when the regular expression is capable of matching empty strings, tok-str will extract an empty token immediately following a non-empty token. For instance (tok-str "a,b" /[^,]*/) extracts ("a" "" "b") instead of just ("a" "b"). This is a poor behavior and the way to fix it is to impose a rule that an empty token must not be extracted immediately at the ending position of a previous token. Only a non-empty token can be consecutive to a token. * lib.c (tok_str): Rewrite the logic of the loop, using the prev_empty flag to suppress empty tokens which immediately follow non-empty tokens. The addition of 1 to the position when the token is empty to skip a character is done at the bottom of the loop and a new last_end variable keeps track of the end position of the last extracted token for the purposes of extracting the keep-between area if keep_sep is true. The old loop is preserved intact and enabled by compatibility. * tests/015/split.tl: Multiple empty-regex test cases for tok-str updated. * txr.1: Updated tok-str documentation and also added a note between the conditions under which split-str and tok-str, invoked with keep-sep true, produce equivalent output. Added compatibility notes.
* Tests for tok-str.Kaz Kylheku2016-09-172-0/+73
| | | | * tests/015/split.tl: New cases added.
* Adding tests for split-str.Kaz Kylheku2016-09-171-0/+123
* Makefile (TXR_DBG_OPTS): Disable for tst/tests/015. * tests/common.tl (mtest): New macro. * tests/015/split.tl: New file.