about summary refs log tree commit diff stats
path: root/src/js/regex.nim
Commit message (Collapse)AuthorAgeFilesLines
* man: rewrite in Nimbptato2024-03-131-21/+22
| | | | | | | | | | | | Depending on Perl just for this is silly. Now we use libregexp for filtering basically the same things as w3mman2html did. This required another patch to QuickJS to avoid pulling in the entire JS engine, but in return, we can now run regexes without a dummy JS context global variable. Also, man.nim now tries to find a man command on the system even if it's not in /usr/bin/man.
* regex: compileSearchRegex improvementsbptato2024-02-181-9/+7
| | | | | * do not eat \\c, \\C * emulate vi-style word boundary matching (\<, \>) with \b
* regex: re-work compileSearchRegexbptato2024-02-171-47/+37
| | | | | | | I've gotten tired of not being able to search for forward slashes. Now it works like in vim, and you can also set default ignore case in the config.
* regex: fix 8-bit narrow strings in JSbptato2024-02-051-1/+1
| | | | | The previous approach to add UTF-8 support to libregexp was broken. This time, we use a separate flag (cbuf_len == 3) to indicate UTF-8 input.
* Use std/* imports everywherebptato2024-01-071-1/+1
|
* regex: copy after compilingbptato2023-09-241-38/+17
| | | | | | | | | | | | Instead of the broken attempt at making regexes zero-copy (it copied anyway), copy once and forget about it. (There have been way too many problems with the destructor approach, including the latest one where the GC would happily zero out our regexes if they were in a sequence. Maybe we can make this work once we switched to ORC. For now, it's not worth the trouble.)
* move around more modulesbptato2023-09-141-1/+1
| | | | | | | | | | * ips -> io/ * loader related stuff -> loader/ * tempfile -> extern/ * buffer, forkserver -> server/ * lineedit, window -> display/ * cell -> types/ * opt -> types/
* ouchbptato2023-09-081-1/+1
|
* regex: avoid infinite loopbptato2023-09-081-1/+7
| | | | | A capture size of 0 (e.g. |) no longer sends the regex matcher into an infinite loop.
* javascript: misc. refactoringsbptato2023-08-241-3/+2
| | | | | | | | | | | | * Remove some unused properties from objects * Un-extern JSFunctionList * Remove js/javascript dependency from regex (the wrapper functions were rather pointless) * Remove setProperty (only toJS(Table) used it, but there we have to use defineProperty instead.) * Accordingly, use definePropertyCWE in toJS(Table) * Simplify fromJSTable (replace pointer arithmetic with UncheckedArray) * Reduce implicit `result' usage
* javascript: update Events, misc fixes & additionsbptato2023-08-201-7/+15
| | | | | | | | | | | | | | Events: just implement the interfaces, no events are triggered yet. JS changes: * add LegacyUnforgeable * make consts enumerable * fix crash in isInstanceOf * fix destructor warnings * refactor registerType As a result, peakmem is now 1G+ on 1.6.14. It stays ~750M on 2.0.0. Hmm. Well, better upgrade to 2.0.0 I guess.
* Add compileMatchRegexbptato2023-07-251-0/+35
| | | | | | | This makes it so that host = 'example\.org' mandates an exact match, but host = '^example' matches example.org, example.com, etc. (Previously, 'example\.org' would have matched exampleexample.org as well, which was quite counter-intuitive.)
* Add utf-8 support to libregexpbptato2023-07-041-96/+10
| | | | | | | This allows us to greatly simplify exec(Regex). In particular, we no longer have to convert any line containing non-ascii characters into UTF-16 (which was a significant inefficiency in regex search until now).
* Option -> Opt in config, return error in compileSearchRegexbptato2023-06-241-11/+11
|
* regex: fix setting start in unicode stringsbptato2023-01-031-1/+1
| | | | | We have to set it to (capture - cstr) >> 1, because libregexp later shifts it left.
* buffer: fix some search bugs & refactor regex stuffbptato2023-01-011-27/+27
| | | | | | | | cursorBytes uses twidth now. cursorNextMatch matches the byte *after* the cursor (somewhat more consistently than before). match() no longer counts capture groups. LRE_FLAG_GLOBAL now goes through the entire string.
* Add referer support, re-render on windowChangebptato2022-12-131-2/+2
|
* Fix stream error handling confusion, title displaybptato2022-12-131-0/+3
| | | | Also probably other fixes.
* Add more cookie optionsbptato2022-12-131-0/+3
|
* regex.nim: remove unused functionsbptato2022-12-101-42/+1
| | | | Including replace.
* Add support for the encoding standard, fix parseLegacyColorbptato2022-12-101-1/+68
| | | | Also, fix a bug in the
* Add siteconf, fix lineedit bugsbptato2022-11-291-0/+45
| | | | | | This enables rule-based dynamic url rewriting. Also, lineedit is a bit less broken now (though it's still less than ideal.)
* Rewrite buffer/pager for multi-processingbptato2022-11-191-9/+16
|
* Incremental search fixesbptato2022-07-251-2/+2
|
* Improved incremental search: support unicodebptato2022-07-231-8/+42
|
* Add search functionbptato2022-07-221-0/+105
Uses libregexp from QuickJS. Incremental search is quite hacky for now, but overall it seems to work OK.