Commit graph

14 commits

Author SHA1 Message Date
turleypol
62fe97f492 more grind.. 2026-08-11 20:39:36 +02:00
turleypol
1c4fd3f526 more escript tests 2026-08-10 21:17:03 +02:00
Kevin Eady
5cf6949ea7
Add support for regular expressions (#818)
* implementation

* tests

* maybe fix windows compilation?

* undo change of match_flag_type

* switch to boost regex

* move flags to BRegExp object

* fix tests due to cmake 4 update

* update grammar

* update prettifier

* move flag parsing to BRegExp ctor

* add AST nodes, update instr generation and execution

* copy tests but use regular expression literals

* fix grammar for handling division correctly

* modify return values a bit, update tests
- string.match: make groups hold structs of matched, offset
- string.match: add offset
- string.replace: use a groups array like string.match vs individual arguments

* bundle of changes

- standardize error messages
- add more tests for coverage
- move BRegExp creation to static method:  previous implementation had
  ctor throwing, which was no good inside executor since it didn't have
  a try/catch

* more tests; add OT_REGEXP to basic.em

* move string regex stuff to bregexp and support regex/wregex via std::visit

* maybe fix compilation errors?

* add unicode escape sequence handling

* really maybe fix compilation error?

* fix compiler warnings

* refactor a bit to remove duplicate code

* address discord comments
- just return wstring, no need for vector<wchar_t> method

* Add string.split by string and regexp

* Use Max_Split instead of Limit
This makes it match basic::SplitWords

* add support for empty string delim in SplitWords

* remove duplicate code across string.split and mf_SplitWords

* Squashed commit of the following:

commit b3148e069f
Author: turleypol <turley@polserver.com>
Date:   Sat Sep 27 17:02:22 2025 +0200

    memorylocation of input string is not allowed to changed, switched back
    to uniqueptr

commit 5a4d1c8fcb
Author: turleypol <turley@polserver.com>
Date:   Sat Sep 27 10:18:01 2025 +0200

    no need to use ptr for input

commit 90fa0edc66
Author: turleypol <turley@polserver.com>
Date:   Sat Sep 27 09:56:29 2025 +0200

    fixed typo

commit bed4ff3ac9
Author: turleypol <turley@polserver.com>
Date:   Sat Sep 27 09:47:36 2025 +0200

    make Callback for BContinuation move only

* use uninit when group isn't matched

* fix multiline flag handling; add test

* add docs and doc example tests

* some cleanup

* address review comments
- allow move assignment

* add core-changes
2025-11-17 18:02:45 +01:00
Kevin Eady
3ccf701ce9
Format testsuite scripts, pol-core support modules (#713)
* Format escript testsuite

* Manual formatting for escript testsuite
- Add format-off to places where formatter does what it should, but we don't like the results
- Manually change places where formatter outputs weird things _without_ format-off, so next format-all would show changes if not fixed

* Update .err files; add update_err.py helper script

Use the format `:line:col: message` for all .err file checks. This
allows us to change the file names without needing to edit the .err
contents.

Note that `in/inc0{1,2}.err` need have error messages between POSIX and
Windows, so their messages are a bit more "generic" than the other errs.

* Format pol testsuite

* Manual formatting for pol testsuite

* Format pol-core modules

* Manual formatting for pol-core modules

* Additional format pol-core modules

Use FormatterLineWidth=10000 since module functions must be on one line
because of the parse_modules target

* Address Discord comments

- Support multi-line module function declarations in parse_modules

* Format on df07831
2024-10-04 10:29:55 +02:00
Kevin Eady
593cfffb83
Add uninit, true, false keywords to grammar (#596)
* Update grammar

* Update expression handling for uninit

* update existing tests

* Add new tests

* Remove fullpath from escriptgrammar generation comment

* fix tests

* Update eScript guide

* Declare escript version 0x11

* Add core-changes

* Add `true` and `false` to grammar

* true/false implementation

* Fix existing tests

* Add new tests

* Update core changes

* add docs

* Fix BooleanValue::describe_to

* bool optimizations

* optimize uninit

* remove unused var assignments

* Update grammar for case labels for uninit, booleans

* Fix case label handling for uninit, true, false

* Tests

* Fix compiler version display v1.1700000017881393 -> v1.17

* optimize boolean binary operations

* fix unary boolean optimizer

* add boolean, uninit optimizer test

* Use new fmt lib apis

* Fix compiler warning

* really fix warning lol

* Add Executor[Module]::getParam for bools, FindSubstance test
2024-01-20 05:38:25 +01:00
Kevin Eady
c29c4ebfab
Undo breakage caused by multiline strings (#375)
* Undo breakage caused by multiline strings

* Use different newline string test
2021-02-26 22:59:55 +01:00
Kevin Eady
b1e8d2b36a
Fix escape sequences, double-slash in strings (#368) 2021-02-22 21:20:55 +01:00
turleypol
1bdbd5150b
fixed crash in str.format when invalid param index is given (#307) 2020-09-13 11:38:17 +02:00
turleypol
e6f59a69a9 removed instructions testscript files they are not used
removed appveyor xml testresult (I'm to dumb)
2018-10-31 12:09:31 +01:00
Gabriele Tozzi
96fb55fee2 Tests: re-added string20, support multiple runs 2016-01-25 02:26:54 +01:00
Gabriele Tozzi
95b41a1e9b Temporarily disabling the string20 test case until weird comparison is addressed
The comparison (< and > operators) between objects of different types is
now based on object's addresses in memory. This leads to unpredictable results
and causes troubles with test scripts.

Proposed solution is:
- This is undefined behavior and could change in future, leave it undocumented
- Error and Undefined should always be < than any other object
- Objects of different type should compare < or > based on their Type ID
- Objects of the same type should always have comparison method implemented.
  The code should not compile if those methods have not been implemented.
2016-01-20 21:56:13 +01:00
Gabriele Tozzi
c4747601cb Test suite: added extensive string tests
Will be helpful for later comparisons while implementing unicode
2015-12-26 13:58:51 +01:00
Gabriele Tozzi
c468f49881 Unit tests: adding escript tests for new \xFF escape sequence 2015-12-19 03:09:09 +01:00
Gabriele Tozzi
0efeb4d379 Unit Tests: putting some orde rin escript unit tests 2015-12-19 02:31:08 +01:00