polserver/docs/docs.polserver.com/pol100/objref.dot
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

120 lines
4.5 KiB
Text

// To generate:
//
// dot -Kneato -Tsvg -o objref.svg objref.dot
//
// ... and remove DOCTYPE line at the beginning!
//
// -- or --
//
// cat objref.dot | docker run --rm -i backplane/graphviz dot -Kneato -Tsvg | sed '2,3d' > objref.svg
//
graph {
bgcolor="transparent"
node [shape=plain fontname="monospace" fontsize=12 fontcolor="blue" target="_top"]
splines=line
uobject [label="UObject" href="#UObject" pos="2.05,10!"]
char [label="Character" href="#Character" pos="1.35,9.4!"]
item [label="Item" href="#Item" pos="2.75,9.4!"]
npc [label="NPC" href="#NPC" pos="1.35,8.8!"]
equipment [label="Equipment" href="#Equipment" pos="0.65,8.2!"]
lockable [label="Lockable" href="#Lockable" pos="2.05,8.2!"]
map [label="Map" href="#Map" pos="3.45,8.2!"]
multi [label="Multi" href="#Multi" pos="4.85,8.2!"]
armor [label="Armor" href="#Armor" pos="0.3,7.6!"]
weapon [label="Weapon" href="#Weapon" pos="1.0,7.6!"]
door [label="Door" href="#Door" pos="1.7,7.6!"]
container [label="Container" href="#Container" pos="2.4,7.6!"]
boat [label="Boat" href="#Boat" pos="4.5,7.6!"]
house [label="House" href="#House" pos="5.2,7.6!"]
spellbook [label="Spellbook" href="#Spellbook" pos="2.00,7!"]
corpse [label="Corpse" href="#Corpse" pos="2.8,7!"]
// standalone
account [label="Account" href="#Account" pos="4.85,10!"]
array [label="Array" href="#Array" pos="4.85,9.7!"]
auxconnection [label="AuxConnection" href="#AuxConnection" pos="4.85,9.4!"]
binaryfile [label="BinaryFile" href="#BinaryFile" pos="4.85,9.1!"]
boolean [label="Boolean" href="#Boolean" pos="4.85,8.8!"]
classinstref [label="ClassInstanceRef" href="#ClassInstanceRef" pos="6.35,10.0!"]
client [label="Client" href="#Client" pos="6.35,9.7!"]
configelem [label="ConfigElem" href="#ConfigElem" pos="6.35,9.4!"]
configfile [label="ConfigFile" href="#ConfigFile" pos="6.35,9.1!"]
datafile [label="Datafile" href="#Datafile" pos="6.35,8.8!"]
datafileelement [label="DataFileElement" href="#DataFileElement" pos="6.35,8.5!"]
dictionary [label="Dictionary" href="#Dictionary" pos="6.35,8.2!"]
error [label="Error" href="#Error" pos="6.35,7.9!"]
exportedscript [label="ExportedScript" href="#ExportedScript" pos="6.35,7.6!"]
functionobject [label="FunctionObject" href="#FunctionObject" pos="6.35,7.3!"]
guild [label="Guild" href="#Guild" pos="6.35,7.0!"]
package [label="Package" href="#Package" pos="6.35,6.7!"]
packet [label="Packet" href="#Packet" pos="7.85,10.0!"]
party [label="Party" href="#Party" pos="7.85,9.7!"]
polcore [label="PolCore" href="#Polcore" pos="7.85,9.4!"]
regexp [label="RegExp" href="#RegExp" pos="7.85,9.1!"]
script [label="Script" href="#Script" pos="7.85,8.8!"]
struct [label="Struct" href="#Struct" pos="7.85,8.5!"]
string [label="String" href="#String" pos="7.85,8.2!"]
storageareas [label="StorageAreas" href="#StorageAreas" pos="7.85,7.9!"]
storagearea [label="StorageArea" href="#StorageArea" pos="7.85,7.6!"]
xmlfile [label="XMLFile" href="#XMLFile" pos="7.85,7.3!"]
xmlnode [label="XMLNode" href="#XMLNode" pos="7.85,7.0!"]
xmlattributes [label="XMLAttributes" href="#XMLAttributes" pos="7.85,6.7!"]
{
node [width=0, shape=point, style=invis];
0 [pos="2.05,9.7!"] // uobject
1 [pos="1.35,9.7!"]
2 [pos="2.75,9.7!"]
3 [pos="2.75,8.5!"] // item
4 [pos="0.65,8.5!"]
5 [pos="2.05,8.5!"]
6 [pos="3.45,8.5!"]
7 [pos="4.85,8.5!"]
8 [pos="0.65,7.9!"] // equipment
9 [pos="0.3,7.9!"]
10 [pos="1,7.9!"]
11 [pos="2.05,7.9!"] //lockable
12 [pos="1.7,7.9!"]
13 [pos="2.4,7.9!"]
14 [pos="4.85,7.9!"] //multi
15 [pos="4.5,7.9!"]
16 [pos="5.2,7.9!"]
17 [pos="2.4,7.3!"] //container
18 [pos="2,7.3!"]
19 [pos="2.8,7.3!"]
}
uobject:s -- 0 -- {1,2}
1 -- char:n
2 -- item:n
char -- npc
item -- 3
3 -- {5,6}
5 -- 4
6 -- 7
4 -- equipment
5 -- lockable
6 -- map
7 -- multi
equipment -- 8 -- {9,10}
9 -- armor
10 -- weapon
lockable -- 11 -- {12,13}
12 -- door
13 -- container
multi -- 14 -- {15,16}
15 -- boat
16 -- house
container -- 17 -- {18,19}
18 -- spellbook
19 -- corpse
}