aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/lexer.tes
AgeCommit message (Collapse)AuthorFilesLines
2024-12-24introduced true block and EOL commentsRobin Haberkorn1-3/+3
* 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.
2024-12-13fixed lexer.checkheader: restore dot in case of successRobin Haberkorn1-1/+1
2024-12-06support the ::S anchored search (string comparison) command (and ::FD, ::FR, ↵Robin Haberkorn1-0/+0
::FS as well) * The colon modifier can now occur 2 times. Specifying `@` more than once or `:` more than twice is an error now. * Commands do not check for excess colon modifiers - almost every command would have to check it. Instead, a double colon will simply behave like a single colon on most commands. * All search commands inherit the anchored semantics, but it's not very useful in some combinations like -::S, ::N or ::FK. That's why the `::` variants are not documented everywhere. * The lexer.checkheader macro could be simplified and should also be faster now, speeding up startup. Eventually this macro can be made superfluous, e.g. by using 1:FB or 0,1^Q::S.
2024-11-24lexer.auto: use case-sensitive searchesRobin Haberkorn1-0/+0
* lexer.checkheader is therefore case-sensitive now as well
2024-09-09Xq and ]q inherit the document encoding from the source document (refs #5)Robin Haberkorn1-0/+0
* ^Uq however always sets an UTF8 register as the source is supposed to be a SciTECO macro which is always UTF-8. * :^Uq preserves the register's encoding * teco_doc_set_string() now also sets the encoding * instead of trying to restore the encoding in teco_doc_undo_set_string(), we now swap out the document in a teco_doc_t and pass it to an undo token. * The get_codepage() Q-Reg method has been removed as the same can now be done with teco_doc_get_string() and the get_string() method.
2024-09-09lexer.checkheader is Unicode-aware now (refs #5)Robin Haberkorn1-1/+1
2016-02-15implemented <$$> command for returning from a macroRobin Haberkorn1-4/+3
* <$$> is faster than jumping to the end of the macro and enables shorter code for returning values from macros. * this also replaces $$ as an immediate editing command. In other words, command line termination is an ordinary command now. The old behaviour was similar to what classic TECO did. Classic TECO however had no choice than to track key presses directly for command line termination as it did not keep track about the parser state as input was typed. This led to some glitches in the language. For instance "FS$$" would terminate the command line, unless the second escape was typed after backspace, etc. This behaviour is not worth copying and SciTECO did a better job than that by making sure that at least the second escape is only effective if it is not part of language syntax. This still lead to some undesirable cases like "ES...$$$" that would terminate the command line unexpectedly. To terminate the command line after something like "FS$$", you will now have to type "FS$$$$". * As it is a regular command now - just executed immediately - and its properties stay close to the macro return behaviour, command line termination may now not always be performed when $$ is typed even as a standalone command. E.g. "Ofoo$ !bar!$$ !foo!Obar$" will curiously terminate the command line now. * This also means that macros can finally terminate command lines by using the command line editing commands ({ and }) to insert $$ into the command line macro. This is also of interest for function key macros. * This implementation showed some serious shortcoming in SciTECO's current parser that yet have to be fixed. E.g. the macro "@^Ua{<$$>}" is currently unsafe since loops abuse the expression stack for storing their state and $$ does not touch the expression stack. Calling "Ma>" would actually continue the loop jumping to the beginning of the command line since program counters referring to the macro A will be reused! This cannot be easily solved by checking for loop termination since being able to return that way from loops is a useful feature. This is a problem even without loops and $$, e.g. as in "@^Ua{1,2,3(4,5} Ma)". Instead, a kind of expression stack frame pointer must be added to macro invocation stack frames, pointing to the beginning of the expression stack for the current frame. At the end of macros or on return, the stack contents of corresponding to the frame can be discarded while preserving the immediate arguments at the time of the return or end-of-macro. This would stabilize SciTECO's macro semantics. * When a top-level macro returns in batch mode, it would be a good idea to use the last argument to calculate the process return code, so it can be set by SciTECO scripts (TODO).
2016-02-03Gtk UI: automatically configure font of the command lineRobin Haberkorn1-0/+4
* This uses the font and size of STYLE_DEFAULT. * We cannot just pass the font down to the user CSS. There are no font variables in Gtk CSS. Therefore we configure the command line widget directly. This can still be overwritten by an user CSS. * Instead of using the deprecated gtk_widget_modify_font(), we generate CSS. Ugly, but still better than writing our own style provider. * Font setting is exposed to the user using a new optional Q-Reg "lexer.font". The numeric part is the point size multiplied with 100 (fractional point size). * Font setting in lexer.auto is skipped in Curses where it is irrelevant anyway to speed up startup. * Perhaps the "Monospace" font name is also a good default value instead of Courier? fixup
2015-07-14fixed default colors in color.tes and style Q-Register viewRobin Haberkorn1-3/+1
* the RGB values of the 8 standard colors defined by color.tes were wrong (i.e. did not correspond to the normal 8 color codes defined by Scinterm but only the bright versions). Except for `color.black` which referred to terminal color 0. * now we define the 16 colors defined by Scinterm, allowing color schemes to explicitly use bright color versions without using the bold attribute. On 8 color terminals, the bold attribute might still be the only way to get a bright color. * terminal.tes: Use bright default color instead of relying on bold to get bright color versions. This is especially important for comments which where relied on bold black to be rendered grey. This did not work by default on terminals supporting bold fonts (e.g. OS X Terminal) or GTK+. The scheme now works on more terminals out of the box and on GTK+ and is thus a good default color scheme. * Color schemes will now also define the default style, the line number style and caret foreground/background. `color.calltip` is now also defined for STYLE_CALLTIP and can later be used to style SciTECO's custom popup widget.
2015-06-11fixed lexer configuration for the unnamed bufferRobin Haberkorn1-0/+1
* The unnamed buffer must be handled separately since the "lexer.test..." macros assume that register "*" is non-empty. Else it will be configured for some arbitrary lexer. * this was a regression compared to v0.6.4
2015-05-25extended <EN> command and used it to optimize "lexer.test..." macrosRobin Haberkorn1-7/+6
* EN may now be used for matching file names (similar to fnmatch(3)). This is used to check the current buffers file extension in the lexer configuration macros instead of using expensive Q-Register manipulations. This halves the overall startup time - it is now acceptable even with the current amount of lexer configurations. * EN may now be used for checking file types. session.tes has been simplified. * BREAKS macro portability (EN now has 2 string arguments). * The Globber class has been extended to allow filtering of glob results by file type.
2014-11-22updated lexer and session libraries using new EU, [* and ]* commandsRobin Haberkorn1-17/+14
2014-11-22added globbing command ENRobin Haberkorn1-8/+13
* implements the same globbing as the EB command already did * uses Globber helper class that behaves more like UNIX glob(). glib only has a glob-style pattern matcher. * The Globber class may be extended later to provide more UNIX-like globbing. * lexer.tes has been updated to make use of globbing. Now, lexers can be automatically loaded and registered at startup. To install a new lexer, it's sufficient to copy a file to the lexers/ directory.
2014-11-20lexer library: added M[lexer.checkheader] and M[lexer.checkname] for ↵Robin Haberkorn1-5/+14
matching a pattern against the first line of a buffer or its filename. This simplifies the "lexer.test..." macros and allows us to select lexers based on the #! line.
2014-11-19added first draft of new modular lexer systemRobin Haberkorn1-232/+18
2013-07-04updated lexer config: CMake and XML lexingRobin Haberkorn1-0/+87
2013-02-15install standard macros into special standard library path (pkgdatadir/lib)Robin Haberkorn1-0/+150
* SCITECOPATH environment variable defaults to this directory * manpage updated * default teco.ini updated: no need to generate it anymore