From e0bf13622b0922252439e3fa8b43df9877678d75 Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Sun, 25 Oct 2026 02:39:11 +0100 Subject: numbers are separate parser states and there are syntactic octal and hexadecimal constants now * Instead of every digit being a stack-modifying standalone command, there is a single continuous parser state (teco_state_number) now - even though it has certain unique characteristics. They are consequently documented in the ARITHMETICS AND EXPRESSIONS chapter of sciteco(7). * A number will therefore be rubbed out entirely by CTRL+W, including a possible @-modifier. * (!) Spaces within constants are no longer ignored, but will push separate numbers to the stack instead (`1 2 3` pushes 3 numbers). The significance of the `,` operator is thus further reduced. * (!) You can no longer "append" to numbers on the stack as in `Qa001` - this was never actually used and caused more confusion. * (!) Digits outside the current radix are no longer accepted. E.g. digit 2 after `2^R`. This feature was also never used. * (!) Octal constants are supported with leading zeros as in C. This works regardless of the current radix set via `8^R` or `^O`. It remains to see whether this is actually useful or is rather annoying (since every constant beginning with 0 is automatically octal, you cannot left-pad arbitrary numbers with 0). * Hexadecimal constants are supported by at-modifying them as in `@0ff`. They must still begin with a digit 0-9 and since A-F are valid SciTECO commands, you may need additional spaces to separate hexadecimal constants from regular commands as in `@0ff D`. During syntax highlighting the number style is extended back to the at-sign. Note: Hexadecimal constants couldn't have been realized via `16^R` (or some shortcut) since that depends on runtime state, but we must know during parsing whether symbols A-F are part of the number of regular SciTECO commands. * The new hexadecimal constants are used in the color schemes now. Thanks to them, we no longer need workarounds like the "color.rgb" macro. * Since numbers don't have a dedicated terminator character, but any letter may terminate it, the number state must behave similar to a start state. Consequently, hexadecimal constants will currently be auto-case-folded if you enabled this feature. I recommend not to write hex constants in upper-case, though. Perhaps this should be worked around with a custom process_edit_cmd() callback. * Test suite updated --- lib/color.tes | 74 +++++++++++++++++++++++++++-------------------------------- 1 file changed, 34 insertions(+), 40 deletions(-) (limited to 'lib/color.tes') diff --git a/lib/color.tes b/lib/color.tes index a45c646..c2a8691 100644 --- a/lib/color.tes +++ b/lib/color.tes @@ -1,57 +1,51 @@ -!* M[color.rgb] -> Scintilla color *! -@[color.rgb]{ - U.bU.gU.r - (Q.r # Q.g*256 # Q.b*256*256) -} - 0EJ-1"= !* - * The Curses RGB values are hardcoded by Scinterm + * The Curses BGR values are hardcoded by Scinterm * and do not necessarily correspond to the renditions by * terminal emulators. *! !* These 8 colors should be available on every system *! - 000,000,000:M[color.rgb]U[color.black] - 128,000,000:M[color.rgb]U[color.red] - 000,128,000:M[color.rgb]U[color.green] - 128,128,000:M[color.rgb]U[color.yellow] - 000,000,128:M[color.rgb]U[color.blue] - 128,000,128:M[color.rgb]U[color.magenta] - 000,128,128:M[color.rgb]U[color.cyan] - 192,192,192:M[color.rgb]U[color.white] + @0000000U[color.black] + @0000080U[color.red] + @0008000U[color.green] + @0008080U[color.yellow] + @0800000U[color.blue] + @0800080U[color.magenta] + @0808000U[color.cyan] + @0c0c0c0U[color.white] !* Light color variants, might not be available on every terminal *! - 064,064,064:M[color.rgb]U[color.lblack] - 255,000,000:M[color.rgb]U[color.lred] - 000,255,000:M[color.rgb]U[color.lgreen] - 255,255,000:M[color.rgb]U[color.lyellow] - 000,000,255:M[color.rgb]U[color.lblue] - 255,000,255:M[color.rgb]U[color.lmagenta] - 000,255,255:M[color.rgb]U[color.lcyan] - 255,255,255:M[color.rgb]U[color.lwhite] + @0404040U[color.lblack] + @00000ffU[color.lred] + @000ff00U[color.lgreen] + @000ffffU[color.lyellow] + @0ff0000U[color.lblue] + @0ff00ffU[color.lmagenta] + @0ffff00U[color.lcyan] + @0ffffffU[color.lwhite] | !* - * The GTK RGB values are the ones used by common terminal + * The GTK BGR values are the ones used by common terminal * emulators. This should ensure that color schemes based * on the 16 default colors look similar on Curses and GTK. *! - 000,000,000:M[color.rgb]U[color.black] - 205,000,000:M[color.rgb]U[color.red] - 000,205,000:M[color.rgb]U[color.green] - 205,205,000:M[color.rgb]U[color.yellow] - 000,000,238:M[color.rgb]U[color.blue] - 205,000,205:M[color.rgb]U[color.magenta] - 000,205,205:M[color.rgb]U[color.cyan] - 229,229,229:M[color.rgb]U[color.white] + @0000000U[color.black] + @00000cdU[color.red] + @000cd00U[color.green] + @000cdcdU[color.yellow] + @0ee0000U[color.blue] + @0cd00cdU[color.magenta] + @0cdcd00U[color.cyan] + @0e5e5e5U[color.white] - 127,127,127:M[color.rgb]U[color.lblack] - 255,000,000:M[color.rgb]U[color.lred] - 000,255,000:M[color.rgb]U[color.lgreen] - 255,255,000:M[color.rgb]U[color.lyellow] - 092,092,255:M[color.rgb]U[color.lblue] - 255,000,255:M[color.rgb]U[color.lmagenta] - 000,255,255:M[color.rgb]U[color.lcyan] - 255,255,255:M[color.rgb]U[color.lwhite] + @07f7f7fU[color.lblack] + @00000ffU[color.lred] + @000ff00U[color.lgreen] + @000ffffU[color.lyellow] + @0ff5c5cU[color.lblue] + @0ff00ffU[color.lmagenta] + @0ffff00U[color.lcyan] + @0ffffffU[color.lwhite] ' !* <[[flags,]bg,]fg,style>M[color.set] *! -- cgit v1.2.3