aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/parser.h
AgeCommit message (Collapse)AuthorFilesLines
2023-04-05updated copyright to 2023Robin Haberkorn1-1/+1
2022-06-21updated copyright to 2022 and updated TODORobin Haberkorn1-1/+1
2021-10-11upgraded to Scintilla 5.1.3 and Scinterm 3.1Robin Haberkorn1-1/+0
* Previous Scintilla version was 3.6.4 and Scinterm was 1.7 (with lots of custom patches). All of the patches are now either irrelevant or have been merged upstream. * Since Scintilla 5 requires C++17, this increases the minimum GCC version at least to 5.0. We may actually require even newer versions. * I could not upgrade the scintilla-mirror (which was imported from Mercurial), so the old sciteco-dev branch was renamed to sciteco-dev-pre-v2.0.0, master was deleted and I reimported the entire Scintilla repo using git-remote-hg. This means that scintilla-mirror now contains two entirely separate trees. But it is still possible to clone old SciTECO repos. * The strategy/workflow of maintaining hotfix branches on scintilla-mirror has been changed. Instead of having one sciteco-dev branch that is rebased onto new Scintilla upstream releases and tagging SciTECO releases in scintilla-mirror (to keep the commits referenced), we now create a branch for every Scintilla version we are based on (eg. sciteco-rel-5-1-3). This branch is never rebased or deleted. Therefore, we are guaranteed to be able to clone arbitrary SciTECO repo commits - not only releases. Releases no longer have to be tagged in scintilla-mirror. On the downside, fixup commits may accumulate in these new branches. They can only be squashed once a new branch for a new Scintilla release is created (e.g. by cherry-picking followed by rebase). * Scinterm does no longer have to reside in the Scintilla subdirectory, so we added it as a regular submodule. There are no more recursive submodules. The Scinterm build system has not been improved at all, but we use a trick based on VPATH to build Scinterm in scintilla/bin/. * Scinterm is now in Git and we reference the upstream repo for the time being. We might mirror it and apply the same branching workflow as with Scintilla if necessary. The scinterm-mirror repository still exists but has not been touched. We will also have to rewrite its master branch as it was a non-reproducible Mercurial import. * Scinterm now also comes with patches for Scintilla which we simply applied on our sciteco-rel-5-1-3 branch. * Scintilla 5 outsourced its lexers into the Lexilla project. We added it as yet another submodule. * All submodules have been moved into contrib/. * The Scintilla API for setting lexers has consequently changed. We now have to call SCI_SETILEXER(0, CreateLexer(name)). As I did not want to introduce a separate command for setting lexers, <ES> has been extended to allow setting lexers by name with the SCI_SETILEXER message which effectively replaces SCI_SETLEXERLANGUAGE. * The lexer macros (SCLEX_...) no longer serve any purpose - they weren't used in the SciTECO standard library anyway - and have consequently been removed from symbols-scilexer.c. The style macros from SciLexer.h (SCE_...) are theoretically still useful - even though they are not used by our current color schemes - and have therefore been retained. They can be specified as wParam in <ES>. * <ES> no longer allows symbolic constants for lParam. This never made any sense since all supported symbols were always wParam. * Scinterm supports new native cursor modes. They are not used for the time being and the previous CARETSTYLE_BLOCK_AFTER caret style is configured by default. It makes no sense to enable native cursor modes now since the command line should have a native cursor but is not yet a Scintilla view. * The Scintilla upgrade performed much worse than before, so some optimizations will be necessary.
2021-05-30THE GREAT CEEIFICATION EVENTRobin Haberkorn1-373/+472
This is a total conversion of SciTECO to plain C (GNU C11). The chance was taken to improve a lot of internal datastructures, fix fundamental bugs and lay the foundations of future features. The GTK user interface is now in an useable state! All changes have been squashed together. The language itself has almost not changed at all, except for: * Detection of string terminators (usually Escape) now takes the string building characters into account. A string is only terminated outside of string building characters. In other words, you can now for instance write I^EQ[Hello$world]$ This removes one of the last bits of shellisms which is out of place in SciTECO where no tokenization/lexing is performed. Consequently, the current termination character can also be escaped using ^Q/^R. This is used by auto completions to make sure that strings are inserted verbatim and without unwanted sideeffects. * All strings can now safely contain null-characters (see also: 8-bit cleanliness). The null-character itself (^@) is not (yet) a valid SciTECO command, though. An incomplete list of changes: * We got rid of the BSD headers for RB trees and lists/queues. The problem with them was that they used a form of metaprogramming only to gain a bit of type safety. It also resulted in less readble code. This was a C++ desease. The new code avoids metaprogramming only to gain type safety. The BSD tree.h has been replaced by rb3ptr by Jens Stimpfle (https://github.com/jstimpfle/rb3ptr). This implementation is also more memory efficient than BSD's. The BSD list.h and queue.h has been replaced with a custom src/list.h. * Fixed crashes, performance issues and compatibility issues with the Gtk 3 User Interface. It is now more or less ready for general use. The GDK lock is no longer used to avoid using deprecated functions. On the downside, the new implementation (driving the Gtk event loop stepwise) is even slower than the old one. A few glitches remain (see TODO), but it is hoped that they will be resolved by the Scintilla update which will be performed soon. * A lot of program units have been split up, so they are shorter and easier to maintain: core-commands.c, qreg-commands.c, goto-commands.c, file-utils.h. * Parser states are simply structs of callbacks now. They still use a kind of polymorphy using a preprocessor trick. TECO_DEFINE_STATE() takes an initializer list that will be merged with the default list of field initializers. To "subclass" states, you can simply define new macros that add initializers to existing macros. * Parsers no longer have a "transitions" table but the input_cb() may use switch-case statements. There are also teco_machine_main_transition_t now which can be used to implement simple transitions. Additionally, you can specify functions to execute during transitions. This largely avoids long switch-case-statements. * Parsers are embeddable/reusable now, at least in parse-only mode. This does not currently bring any advantages but may later be used to write a Scintilla lexer for TECO syntax highlighting. Once parsers are fully embeddable, it will also be possible to run TECO macros in a kind of coroutine which would allow them to process string arguments in real time. * undo.[ch] still uses metaprogramming extensively but via the C preprocessor of course. On the downside, most undo token generators must be initiated explicitly (theoretically we could have used embedded functions / trampolines to instantiate automatically but this has turned out to be dangereous). There is a TECO_DEFINE_UNDO_CALL() to generate closures for arbitrary functions now (ie. to call an arbitrary function at undo-time). This simplified a lot of code and is much shorter than manually pushing undo tokens in many cases. * Instead of the ridiculous C++ Curiously Recurring Template Pattern to achieve static polymorphy for user interface implementations, we now simply declare all functions to implement in interface.h and link in the implementations. This is possible since we no longer hace to define interface subclasses (all state is static variables in the interface's *.c files). * Headers are now significantly shorter than in C++ since we can often hide more of our "class" implementations. * Memory counting is based on dlmalloc for most platforms now. Unfortunately, there is no malloc implementation that provides an efficient constant-time memory counter that is guaranteed to decrease when freeing memory. But since we use a defined malloc implementation now, malloc_usable_size() can be used safely for tracking memory use. malloc() replacement is very tricky on Windows, so we use a poll thread on Windows. This can also be enabled on other supported platforms using --disable-malloc-replacement. All in all, I'm still not pleased with the state of memory limiting. It is a mess. * Error handling uses GError now. This has the advantage that the GError codes can be reused once we support error catching in the SciTECO language. * Added a few more test suite cases. * Haiku is no longer supported as builds are instable and I did not manage to debug them - quite possibly Haiku bugs were responsible. * Glib v2.44 or later are now required. The GTK UI requires Gtk+ v3.12 or later now. The GtkFlowBox fallback and sciteco-wrapper workaround are no longer required. * We now extensively use the GCC/Clang-specific g_auto feature (automatic deallocations when leaving the current code block). * Updated copyright to 2021. SciTECO has been in continuous development, even though there have been no commits since 2018. * Since these changes are so significant, the target release has been set to v2.0. It is planned that beginning with v3.0, the language will be kept stable.
2018-06-11improved Emscripten support: fixed configure-checks, generate *.js and ↵Robin Haberkorn1-7/+1
detect EMCurses * Emscripten can be used (theoretically) to build a host-only platform-independant version of SciTECO (running under node.js instead of the browser). * I ported netbsd-curses with Emscripten for that purpose. Therefore, adaptions for running in the browser are restricted to EMcurses now.
2017-03-250,8ED: Automatic case-folding of commandsRobin Haberkorn1-6/+18
* when enabled, it will automatically upper-case all one or two letter commands (which are case insensitive). * also affects the up-carret control commands, so they when inserted they look more like real control commands. * specifically does not affect case-insensitive Q-Register specifications * the result are command lines that are better readable and conform to the coding style used in SciTECO's standard library. This eases reusing command lines as well. * Consequently, string-building and pattern match characters should be case-folded as well, but they aren't currently since State::process_edit_cmd() does not have sufficient insight into the MicroStateMachines. Also, it could not be delegated to the MicroStateMachines. Perhaps they should be abandoned in favour of embeddedable regular state machines; or regular state machines with a stack of return states?
2017-03-08fixup to 89224899: fixed function key macros after $ and the rubout-command ↵Robin Haberkorn1-0/+19
editing key * StateEscape should return the same fnmacro mask as StateStart * When rubbing out a command, we should stop at StateEscape as well. Therefore we reintroduced States::is_start(). RTTI is still not used.
2017-03-07refactored commandline key processing: rewritten Cmdline::process_edit_cmd() ↵Robin Haberkorn1-41/+65
as State::process_edit_cmd() virtual methods * Cmdline::process_edit_cmd() was much too long and deeply nested. It used RTTI excessively to implement the state-specific behaviour. It became apparent that the behaviour is largely state-specific and could be modelled much more elegantly as virtual methods of State. * Basically, a state can now implement a method to customize its commandline behaviour. In the case that the state does not define custom behaviour for the key pressed, it can "chain" to the parent class' process_edit_cmd(). This can be optimized to tail calls by the compiler. * The State::process_edit_cmd() implementations are still isolated in cmdline.cpp. This is not strictly necessary but allows us keep the already large compilations units like parser.cpp small. Also, the edit command processing has little to do with the rest of a state's functionality and is only used in interactive mode. * As a result, we have many small functions now which are much easier to maintain. This makes adding new and more complex context sensitive editing behaviour easier. * State-specific function key masking has been refactored by introducing State::get_fnmacro_mask(). * This allowed us to remove the States::is_*() functions which have always been a crutch to support context-sensitive key handling. * RTTI is almost completely eradicated, except for exception handling and StdError(). Both remaining cases can probably be avoided in the future, allowing us to compile smaller binaries.
2017-03-03updated copyright to 2017Robin Haberkorn1-1/+1
2016-11-30allow dollar sign as another variant of ^[ (discard all arguments or return)Robin Haberkorn1-0/+15
* some classic TECOs have this * just like ^[, dollar works as a command only, not as a string terminator * it improves the readability of macros using printable characters only * it closes a gap in the language by allowing $$ (double-dollar) and ^[$ as printable ways to write the return from macro command. ^[^[ was not and is not possible. * since command line termination is a regular interactive return-command in SciTECO, double-dollar will also terminate the command line now. This will be allowed unless it turns out to be a cause of trouble. * The handling of unterminated commands has been cleaned up by introducing State::end_of_macro(). Most commands (and thus states) except the start state cannot be valid at the end of a macro since this indicates an unterminated/incomplete command. All lookahead-commands (currently only ^[) will end implicitly at the end of a macro and so will need a way to perform their action. The virtual method allows these actions to be defined with the rest of the state's implementation.
2016-11-20fixed glib warnings about using g_mem_set_vtable() and revised memory limitingRobin Haberkorn1-9/+3
* we were basing the glib allocators on throwing std::bad_alloc just like the C++ operators. However, this always was unsafe since we were throwing exceptions across plain-C frames (Glib). Also, the memory vtable has been deprecated in Glib, resulting in ugly warnings. * Instead, we now let the C++ new/delete operators work like Glib by basing them on g_malloc/g_slice. This means they will assert and the application will terminate abnormally in case of OOM. OOMs cannot be handled properly anyway, so it is more important to have a good memory limiting mechanism. * Memory limiting has been completely revised. Instead of approximating undo stack sizes using virtual methods (which is unprecise and comes with a performance penalty), we now use a common base class SciTECO::Object to count the memory required by all objects allocated within SciTECO. This is less precise than using global replacement new/deletes which would allow us to control allocations in all C++ code including Scintilla, but they are only supported as of C++14 (GCC 5) and adding compile-time checks would be cumbersome. In any case, we're missing Glib allocations (esp. strings). * As a platform-specific extension, on Linux/glibc we use mallinfo() to count the exact memory usage of the process. On Windows, we use GetProcessMemoryInfo() -- the latter implementation is currently UNTESTED. * We use g_malloc() for new/delete operators when there is malloc_trim() since g_slice does not free heap chunks properly (probably does its own mmap()ing), rendering malloc_trim() ineffective. We've also benchmarked g_slice on Linux/glib (malloc_trim() shouldn't be available elsewhere) and found that it brings no significant performance benefit. On all other platforms, we use g_slice since it is assumed that it at least does not hurt. The new g_slice based allocators should be tested on MSVCRT since I assume that they bring a significant performance benefit on Windows. * Memory limiting does now work in batch mode as well and is still enabled by default. * The old UndoTokenWithSize CRTP hack could be removed. UndoStack operations should be a bit faster now. But on the other hand, there will be an overhead due to repeated memory limit checking on every processed character.
2016-11-20auto-completion of Q-Register names, goto labels and help topicsRobin Haberkorn1-5/+11
* Using a common implementation in RBTreeString::auto_complete(). This is very efficient even for very huge tables since only an O(log(n)) lookup is required and then all entries with a matching prefix are iterated. Worst-case complexity is still O(n), since all entries may be legitimate completions. If necessary, the number of matching entries could be restricted, though. * Auto completes short and long Q-Reg names. Short names are "case-insensitive" (since they are upper-cased). Long specs are terminated with a closing bracket. * Long spec completions may have problems with names containing funny characters since they may be misinterpreted as string building characters or contain braces. All the auto-completions suffered from this problem already (see TODO). * This greatly simplifies investigating the Q-Register name spaces interactively and e.g. calling macros with long names, inserting environment registers etc. * Goto labels are terminated with commas since they may be part of a computed goto. * Help topics are matched case insensitive (just like the topic lookup itself) and are terminated with the escape character. This greatly simplifies navigating womanpages and looking up topics with long names.
2016-02-16fixed function key macros and command reinsertion after ^[Robin Haberkorn1-0/+11
* one would expect function key macros masked for the start state to work after ^[ ($), but since it has its own state now, this was broken since f08187e454f56954b41d95615ca2e370ba19667e. * Similarily command reinsertion would reinsert too much after $, since the parser wouldn't be in the "real" start state. * The "escape" state should be handled like the start state (where new commands can begin) from the perspective of the user -- the difference is not even documented, it's an implementation detail.
2016-02-15revised looping implementation, aggregating loops, sane $$ semantics, some ↵Robin Haberkorn1-0/+20
optimizationa and additional checks * undo tokens emitted by the expression stack no longer waste memory by pointing to the stack implementation. This uses some ugly C++ constant template arguments but saves 4 or 8 byte per undo token depending on the architecture. * Round braces are counted now and the return command $$ will use this information to discard all non-relevant brace levels. * It is an error to close a brace when none have been opened. * The bracing rules are still very liberal, allowing you to close braces in macros belonging to a higher call frame or leave them open at the end of a macro. While this is technically possible, it is perhaps a good idea to stricten these rules in some future release. * Loops no longer (ab)use the expression stack to store program counters and loop counters. This removes flow control from the responsibility of the expression stack which is much safer now since we can control where we jump to. This also eased implemented proper semantics for $$. * It is an error to leave loops open at the end of a macro or trying to close a loop opened in the caller of the macro. Similarily it is only possible to close a loop from the current invocation frame. This means it is now impossible to accidentally jump to invalid PCs. * Even though loop context stacks could be attached directly to the macro invocation frame, this would be inefficient. Instead there's a loop frame pointer now that is part of the invocation frame. All frames will reuse the same stack structure. * Loops are automatically discarded when returning using $$. * Special aggregating forms of the loop start (":<") and loop end (":>") commands are possible now and have been implemented. This improves SciTECO's capability as a stack-oriented language. It is no longer necessary to write recursive macros to generate stack values of arbitrary length dynamically or to process them. * All expression and loop stacks are still fixed-size. It may be a good idea to implement dynamic resizing (TODO). * Added some G_UNLIKELYs to Execute::macro(). Should improve the branch prediction of modern CPUs. * Local Q-Register tables are allocated on the stack now instead of on the heap (the bulk of a table is stored on the heap anyway). Should improve performance of macro invocations. * Document that "F<" will jump to the beginning of the macro if there is no loop. This is not in standard TECO, but I consider it a useful feature.
2016-02-15implemented <$$> command for returning from a macroRobin Haberkorn1-0/+9
* <$$> 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-11optimized command execution in batch mode, during macro calls, loops etc.Robin Haberkorn1-1/+14
* SciTECO commands are implemented with immediate execution in mind. Those commands that do need to execute immediately while a string command is entered, can do so using StateExpectString::process(). For simplicity, the parser just assumed that every input character should result in immediate execution (if the command supports it of course). * This lead to unnecessarily slow execution of commands like <I> or <S> in batch mode. E.g. a search was always repeated for every character of the pattern - a N character pattern could result in N searches instead of one. Also in interactive mode when executing a macro or repeating commands in a loop, immediate processing of string arguments is unnecessary and results in superfluous undo tokens. * These cases are all optimized now by being informed about the necessity of providing immediate feedback via State::refresh(). This is used by StateExpectString to defer calling process() as long as possible. * For states extending StateExpectString, there is no change since they can already process arbitrarily long strings. The optimization is hidden in StateExpectString. * some allocations are now also avoided in StateExpectString::custom().
2016-01-28updated copyright to 2016Robin Haberkorn1-1/+1
2015-06-29MicroStateMachine::input() returns whether a result was set nowRobin Haberkorn1-2/+2
* this means that QRegSpecMachine::input() no longer has to return a dummy QRegister in parse-only mode. This saves an unnecessary QRegister table lookup and speeds up parsing. * QRegSpecMachine can now be easily extended to behave differently when returning a Q-Register, e.g. simply returning NULL if a register does not exist, or returning a register by prefix. This is important for some planned commands. * StateExpectQReg::got_register() now gets a QRegister *. It can theoretically be NULL - still we don't have to check for NULL in most cases since NULL is only passed in parse-only mode.
2015-06-12support UNIX-shell-like tilde-expansions in file names and directoriesRobin Haberkorn1-1/+7
* expands to the value of $HOME (the env variable instead of the register which currently makes a slight difference). * supported for tab-completions * supported for all file-name accepting commands. The expansion is done centrally in StateExpectFile::done(). A new virtual method StateExpectFile::got_file() has been introduced to pass the expanded/processed file name to command implementations. * sciteco(7) has been updated: There is now a separate section on file name arguments and file name handling in SciTECO. This information is important but has been scattered across the document previously. * optimized is_glob_pattern() in glob.h
2015-06-02added <FG> command and special Q-Register "$" to set and get the current ↵Robin Haberkorn1-0/+46
working directory * FG stands for "Folder Go" * FG behaves similar to a Unix shell `cd`. Without arguments, it changes to the $HOME directory. * The $HOME directory was previously only used by $SCITECOCONFIG on Unix. Now it is documented on its own, since the HOME directory should also be configurable on Windows - e.g. to adapt SciTECO to a MinGW or Cygwin installation. HOME is initialized just like the other environment variables. This also means that now, the $HOME Q-Register is always defined and can be used by platform-agnostic macros. * FG uses a new kind of tab-completion: for directories only. It would be annoying to complete the FG command after every directory, so this tab-completion does not close the command automatically. Theoretically, it would be possible to close the command after completing a directory with no subdirectories, but this is not supported currently. * Filename arguments are no longer completed with " " if {} escaping is in place as this brings no benefit. Instead no completion character is inserted for this escape mode. * "$" was mapped to the current directory to support an elegant way to insert/get the current directory. Also this allows the idiom "[$ FG...new_dir...$ ]$" for changing the current directory temporarily. * The Q-Register stack was extended to support restoring the string part of special Q-Registers (that overwrite the default functionality) when using the "[$" and "]$" commands. * fixed minor typos (american spelling)
2015-03-01keep rubbed out command line for later re-insertion and massive Cmdline ↵Robin Haberkorn1-3/+2
cleanup/refactoring * characters rubbed out are not totally removed from the command line, but only from the *effective* command line. * The rubbed out command line is displayed after the command line cursor. On Curses it is grey and underlined. * When characters are inserted that are on the rubbed out part of the command line, the cursor simply moves forward. NOTE: There's currently no immediate editing command for reinserting the next character/word from the rubbed out command line. * Characters resulting in errors are no longer simply discarded but rubbed out, so they will stay in the rubbed out part of the command line, reminding you which character caused the error. * Improved Cmdline formatting on Curses UI: * Asterisk is printed bold * Control characters are printed in REVERSE style, similar to what Scinterm does. The controll character formatting has thus been moved from macro_echo() in cmdline.cpp to the UI implementations. * Updated the GTK+ UI (UNTESTED): I did only, the most important API adaptions. The command line still does not use any colors. * Refactored entire command line handling: * The command line is now a class (Cmdline), and most functions in cmdline.cpp have been converted to methods. * Esp. process_edit_cmd() (now Cmdline::process_edit_cmd()) has been simplified. There is no longer the possibility of a buffer overflow because of static insertion buffer sizes * Cleaned up usage of the cmdline_pos variable (now Cmdline::pc) which is really a program counter that used a different origin as macro_pc which was really confusing. * The new Cmdline class is theoretically 8-bit clean. However all of this will change again when we introduce Scintilla views for the command line. * Added 8-bit clean (null-byte aware) versions of QRegisterData::set_string() and QRegisterData::append_string()
2015-02-14updated Scintilla submodule: fixed tab stop calculation on CursesRobin Haberkorn1-1/+1
* also did some whitespace cleanup in SciTECO now that tabs are displayed properly
2015-02-11updated copyright to 2015Robin Haberkorn1-1/+1
2015-02-11implemented support for different indention stylesRobin Haberkorn1-0/+12
* the ^I command was altered to insert indention characters rather than plain tabs always. * The <TAB> immediate editing command was added for all insertion arguments (I, ^I but also FR and FS) * documentation was extended for a discussion of indention
2014-11-22added EI as non-string-building variant of IRobin Haberkorn1-1/+6
this is analoguous to EU as the string-build equivalent of ^U.
2014-11-11refactored SciTECO runtime errors: moved from parser.cpp to error.cppRobin Haberkorn1-189/+2
* the GError expection has been renamed to GlibError, to avoid nameclashes when working from the SciTECO namespace
2014-11-11added all of SciTECO's declarations to the "SciTECO" namespaceRobin Haberkorn1-0/+4
normally, since SciTECO is not a library, this is not strictly necessary since every library should use proper name prefixes or namespaces for all global declarations to avoid name clashes. However * you cannot always rely on that * Scintilla does violate the practice of using prefixes or namespaces. The public APIs are OK, but it does define global functions/methods, e.g. for "Document" that clashed with SciTECO's "TECODocument" class at link-time. Scintilla can put its definitions in a namespace, but this feature cannot be easily enabled without patching Scintilla. * a "SciTECO" namespace will be necessary if "SciTECO" is ever to be turned into a library. Even if this library will have only a C-linkage API, it must ensure it doesn't clutter the global namespace. So the old "TECODocument" class was renamed back to "Document" (SciTECO::Document).
2014-11-09revised U command: fail if no argument is providedRobin Haberkorn1-0/+8
* there is no reasonable default value for U * omitting the parameter for U might be a frequent programming error * U can be colon-modified now, in which case it may be used * to check for the presence of arguments in macros
2014-02-15updated Copyright to year 2014Robin Haberkorn1-1/+1
2014-02-15added State::StdError class for constructing errors from std::exception objectsRobin Haberkorn1-0/+11
2014-02-15use GLib's GError information to yield errorsRobin Haberkorn1-0/+6
* results in better error messages, e.g. when opening files * the case that a file to be opened (EB) exists but is not readably is handled for the first time
2014-02-15fixed Execute::macro() and Execute::file() exceptionsRobin Haberkorn1-4/+40
* might throw other exceptions that must be associated with the parent macro level's (stack frame) * add position information to "label not found" errors * Error copy constructors
2014-02-15removed most exception specifications: allow bad_allocs to propagateRobin Haberkorn1-20/+20
* specifications resulted in runtime errors (unexpected exception) when bad_alloc ocurred * specs should be used scarcely: only when the errors that may be thrown are all known and for documentary purposes
2014-02-15String::get_coord() calculates line and column of a string positionRobin Haberkorn1-11/+10
* use to get line and column into a stack frame
2014-02-15added support for TECO stack tracingRobin Haberkorn1-3/+80
* when an error is thrown, stack frames are collected on clean up, up to the toplevel macro * the toplevel macro decides how to display the error * now errors in interactive and batch mode are displayed differently * in batch mode, a backtrace is displayed as a sequence of messages * Execute::file() forwards errors correctly * the correct error in the file is displayed in interactive mode * necessary to build the stack trace
2014-02-15added EMCurses/Emscripten supportRobin Haberkorn1-1/+7
by building with Emscripten support, SciTECO may be embedded into web pages. * sciteco.html is not a piece of documentation but a sample SciTECO embedding
2013-03-19avoid delete-non-virtual-dtor warning on g++ 4.7Robin Haberkorn1-0/+1
* the warning itself makes sense but in the cases reportet they were irrelevant
2013-03-18explicitly instantiate MicroStateMachine: fixes compilation with gcc-4.4Robin Haberkorn1-4/+4
2013-03-18declare State::Error::Error() as printf-likeRobin Haberkorn1-1/+1
2013-03-16common parent state for all file-name-expecting commands: fixes EM ↵Robin Haberkorn1-0/+12
tab-completions * StateExpectFile adds no functionality (currently), but is useful for checking state types
2013-02-22use typedef for SciTECO integers and make it configurable at configure timeRobin Haberkorn1-5/+5
* storage size should always be 64 (gint64) to aid macro portability * however, for performance reasons users compiling from source might explicitly compile with 32 bit integers
2013-02-16implemented command to query ASCII code of character (^^x)Robin Haberkorn1-0/+9
2013-02-14hide some implementation details in MicroStateMachinesRobin Haberkorn1-5/+12
2013-02-14use Q-Register micro state machine when parsing Q-Reg spec in ↵Robin Haberkorn1-7/+8
string-building commands * allows referring to long Q-Register names in string arguments * currently, long names specified this way use their own string building char parsing (I'm unsure whether this makes any sense)
2013-02-14rewritten string building state machine using a common MicroStateMachine ↵Robin Haberkorn1-25/+51
base class * uses label pointers instead of state-enum and switch case (both faster and shorter to write) * common interface for all micro state machines: makes them reusable
2013-02-11States::is_string() to check whether current state is a string-stateRobin Haberkorn1-0/+6
2013-02-08reverse Execute::step() change: no need to pass parameters by referenceRobin Haberkorn1-1/+1
cmdline and cmdline_pos is no longer modified by code executed by step() instead it is modified at the outermost macro level (commandline macro level)
2013-02-08use special Q-Register $ (<ESC>) to hold the replacement commandlineRobin Haberkorn1-1/+1
* allows us to switch between buffers/registers when editing the commandline
2013-02-08delegate commandline replacements ("}") to the cmdline macro levelRobin Haberkorn1-6/+17
allows commandline editing scripted by macros
2013-02-03first draft of commandline-editing commands ({ and } as in VideoTECO)Robin Haberkorn1-1/+1
* simplified traditional commandline editing. no need to extend cmdline string one character at a time when inserting multiple. instead there's a marker (cmdline_pos) specifying the macro length to execute in a "step" and also the anchor for generating undo tokens * implementation does not yet work in macro calls * while editing the commandline, other buffers/registers may not be edited (need push-down-list and auxiliary q-register)