From ef897b418a4487196e1dbc18a97046f8f0aea2e8 Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Tue, 24 Dec 2024 13:29:32 +0300 Subject: 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. --- lib/lexers/bash.tes | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'lib/lexers/bash.tes') diff --git a/lib/lexers/bash.tes b/lib/lexers/bash.tes index 33d6664..862a0c1 100644 --- a/lib/lexers/bash.tes +++ b/lib/lexers/bash.tes @@ -1,6 +1,8 @@ -! Unix Shell - It's called bash.tes only because SciTE calls it this way - internally ! +!* + * Unix Shell + * It's called bash.tes only because SciTE calls it this way + * internally + *! @[lexer.test.bash]{ _#!M[sh,bash,ksh]:M[lexer.checkheader]"S -1 ' @@ -35,8 +37,8 @@ :M[color.string],5M[color.set] :M[color.string],6M[color.set] :M[color.operator],7M[color.set] - :M[color.target],8M[color.set] ! Identifiers, e.g. FOO=... ! + :M[color.target],8M[color.set] !* Identifiers, e.g. FOO=... *! :M[color.variable],9M[color.set] :M[color.variable],10M[color.set] - :M[color.string2],11M[color.set] ! Backticks ! + :M[color.string2],11M[color.set] !* Backticks *! } -- cgit v1.2.3