From 583eddc3bf4c84f1ff7a88d4e3575835264208fa Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Sun, 2 Feb 2025 17:58:20 +0300 Subject: redefining labels is a warning now * Allowing label redefinitions might have been useful when used as comments, since you will want to be able to define arbitrary comments. However as flow control constructs, this introduced a certain ambiguity since gotos might jump to different locations, depending on the progression of the parser. * On the other hand, making label redefinition an error might disqualify labels as comments when writing or porting classic TECO code. Therefore, it has been made a warning as a compromise. * Added test case --- tests/testsuite.at | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'tests') diff --git a/tests/testsuite.at b/tests/testsuite.at index f17a711..3f0b7e5 100644 --- a/tests/testsuite.at +++ b/tests/testsuite.at @@ -270,6 +270,14 @@ AT_SETUP([Jump to beginning of macro]) AT_CHECK([$SCITECO -e "%a-2\"< F< ' Qa-2\"N(0/0)'"], 0, ignore, ignore) AT_CLEANUP +AT_SETUP([Gotos and labels]) +# Not a label redefinition, there must not even be a warning. +AT_CHECK([$SCITECO -e '2'], 0, ignore, stderr) +AT_FAIL_IF([$GREP "^Warning:" stderr]) +# Will print a warning about label redefinition, though... +AT_CHECK([$SCITECO -e "!foo! Qa\"S^C' !foo! Qa\"S(0/0)' -Ua @O/foo/"], 0, ignore, ignore) +AT_CLEANUP + # # Command-line editing bugs. # -- cgit v1.2.3