diff options
author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2025-02-02 17:58:20 +0300 |
---|---|---|
committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2025-02-15 01:43:17 +0300 |
commit | 583eddc3bf4c84f1ff7a88d4e3575835264208fa (patch) | |
tree | a9565db5b8a67d5f7bc4ec1a55a5b9e2ed4e717b /doc | |
parent | 2843ca269cb59bdf9c544fc5dec343bc7430cf3d (diff) | |
download | sciteco-583eddc3bf4c84f1ff7a88d4e3575835264208fa.tar.gz |
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
Diffstat (limited to 'doc')
-rw-r--r-- | doc/sciteco.7.template | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/doc/sciteco.7.template b/doc/sciteco.7.template index f9cad80..6ca81ab 100644 --- a/doc/sciteco.7.template +++ b/doc/sciteco.7.template @@ -2078,7 +2078,7 @@ The most basic flow control command in \*(ST is the Go-to command. Since it is really an ordinary command, exceptional only in setting the program counter and influencing parsing, it is described in this document's command reference. -\*(ST may do simple unconditional and computed gotos. +\*(ST can perform simple unconditional and computed gotos. .LP .SCITECO_TOPIC label Labels are symbolic and are defined with the following syntax: @@ -2093,9 +2093,14 @@ When a label is encountered, it is cached in a macro-invocation level specific goto table if it is not in there already. Therefore every macro invocation has its own label namespace and gotos to a label have constant complexity once a label has been parsed. +\# The table lookup is not constant of course. Terminating a macro execution (or command line) fails if a label that is jumped to has not been defined. Labels are also historically used as comments in TECO code. +That's why \*(ST allows several identical labels in the same scope \(em +goto commands will always jump to the first occurrance of the label. +In case of label redefinition, a warning will be printed, so you are +encouraged to use \(lqtrue\(rq comments as described below. . .SS Comments .SCITECO_TOPIC comment |