From 54c3c4929abf062717f36712cd20dc4873c8d04c Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Sun, 21 Feb 2021 22:32:18 -0800 Subject: txr: pattern function calls are non-matching. This patch causes TXR to treat calls to verticatl functions, as well as the @(call) directive to be considered non-matching directives, so that opening the data source is deferred. This allows included .txr files to call the funtions that they define, without the side effect of standard input being read. * match.c (open_data_source): Function refactored to reduce duplication. c->data is checked first, and if it is not t, nothing is done, making the function cheaper in the frequent case. The non_matching_dir condition changes. We now check that the first element of the first spec is a non-nil symbol. If it has a function binding as a vertical function, then that is considered non_matching. (dir_tables_init): Treat @(call) as a non-matching directive. * Makefile (tst/tests/008/no-stdin-hang.ok): Add -n argument for non-interactive, which will cause stdin to be read in that test case if there is a regression in this change. If make tests is run in a terminal, this will hang make tests. * tests/no-stdin-hang.txr: New file. * tests/no-stdin-hang.expected: New file. --- tests/008/no-stdin-hang.txr | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 tests/008/no-stdin-hang.txr (limited to 'tests/008/no-stdin-hang.txr') diff --git a/tests/008/no-stdin-hang.txr b/tests/008/no-stdin-hang.txr new file mode 100644 index 00000000..4b29f021 --- /dev/null +++ b/tests/008/no-stdin-hang.txr @@ -0,0 +1,5 @@ +@(define foo (var)) +@(next :list '("a")) +@var +@(end) +@(foo x) -- cgit v1.2.3