aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/string.tes
diff options
context:
space:
mode:
authorRobin Haberkorn <robin.haberkorn@googlemail.com>2024-12-24 13:29:32 +0300
committerRobin Haberkorn <robin.haberkorn@googlemail.com>2024-12-24 13:29:32 +0300
commitef897b418a4487196e1dbc18a97046f8f0aea2e8 (patch)
tree264b026de6ce805f1bf371d1b01371c4ba1aed0c /lib/string.tes
parente5d1253d363a209ecd1288278808e38ac87b34d9 (diff)
downloadsciteco-ef897b418a4487196e1dbc18a97046f8f0aea2e8.tar.gz
introduced true block and EOL comments
* The previous convention of !* ... *! are now true block comments, i.e. they are parsed faster, don't spam the goto table and allow embedding of exclamation marks - only "*!" terminates the comment. * It is therefore now forbidden to have goto labels beginning with "*". * Also support "!!" to introduce EOL comments (like C++'s //). This disallows empty labels, but they weren't useful anyway. This is the shortest way to begin a comment. * All comment labels have been converted to true comments, to ensure that syntax highlighting works correctly. EOL comments are used for single line commented-out code, since it's easiest to uncomment - you don't have to jump to the line end. This is a pure convention / coding style. Other people might do it differently. * It's of course still possible to abuse goto labels as comments as TECO did for ages. * In lexing / syntax highlighting, labels and comments are highlighted differently. * When syntax highlighting, a single "!" will first be highlighted as a label since it's not yet unambiguous. Once you type the second character (* or !), the first character is retroactively styled as a comment as well.
Diffstat (limited to 'lib/string.tes')
-rw-r--r--lib/string.tes12
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/string.tes b/lib/string.tes
index e6ec4a1..fe049a9 100644
--- a/lib/string.tes
+++ b/lib/string.tes
@@ -1,7 +1,9 @@
-! String utility macros !
+!* String utility macros *!
-! <pos1,pos2>M[symcasecmp] - Compare symbol at pos1 with symbol at pos2 (caseless)
- this case-folds to lower case so "_"<"A" which is compatible with g_ascii_strcasecmp() !
+!*
+ * <pos1,pos2>M[symcasecmp] - Compare symbol at pos1 with symbol at pos2 (caseless)
+ * this case-folds to lower case so "_"<"A" which is compatible with g_ascii_strcasecmp()
+ *!
@[symcasecmp]{
U.2U.1 -.%.1 -.%.2
@.#lo{
@@ -13,7 +15,7 @@
Q.c
}
-! <i,j>M[exchange] - Exchange line at I with line at J (I < J), returning new J !
+!* <i,j>M[exchange] - Exchange line at I with line at J (I < J), returning new J *!
@[exchange]{
U.jU.i
Q.jJ @X.x
@@ -22,7 +24,7 @@
Q.j
}
-! <i,j>M[qsort] - Sort lines beginning at I until J using Quicksort algorithm !
+!* <i,j>M[qsort] - Sort lines beginning at I until J using Quicksort algorithm *!
@[qsort]{
U.rU.l