Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

utf-8 support in strings #749

Merged
merged 33 commits into from
Nov 8, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
224dff4
wip: utf-8 support in strings
liz3 Sep 18, 2024
28d47a7
fix compile error
liz3 Sep 18, 2024
9b3f32a
validity check
liz3 Sep 18, 2024
57d601a
fix: need this fix for it to compile
liz3 Oct 26, 2024
67ad5fe
implement general utf-8 check, implement the indexing, slicing
liz3 Oct 26, 2024
cb1198d
use the length version of the take/copyString functions
liz3 Oct 26, 2024
e6ee09f
need to cast this
liz3 Oct 26, 2024
8269774
oh my god it took me forever to figure this out
liz3 Oct 26, 2024
ce27a06
add isValidUtf8
liz3 Oct 27, 2024
571c73e
tests: add unicode slicing and indexing tests
liz3 Oct 27, 2024
a98d2d0
fix: only run index and slice utf8 version if there are multibyte cha…
liz3 Oct 28, 2024
e8a3d35
fix: correctly reimplement findLast
liz3 Oct 29, 2024
742c89f
tests: implement unicode tests for other string functions
liz3 Oct 29, 2024
c253114
fix errors
liz3 Oct 29, 2024
8206e4e
fix: when executing a child process, do not waitpid before reading
liz3 Oct 30, 2024
218579f
length of this is 36
liz3 Oct 31, 2024
3d68c67
Merge branch 'liz3/symbolic-links' into liz3/utf8-experiments
liz3 Oct 31, 2024
f85654b
reenable this
liz3 Oct 31, 2024
a676173
UUIDS are length 36
liz3 Oct 31, 2024
a9d86db
Merge remote-tracking branch 'origin/develop' into liz3/utf8-experiments
liz3 Nov 4, 2024
4f856d5
fix: refactor scanner to use utf8, windows is confusing me
liz3 Nov 5, 2024
2aed1ec
Revert "fix: refactor scanner to use utf8, windows is confusing me"
liz3 Nov 6, 2024
24cd958
fix: need to set the null byte here
liz3 Nov 6, 2024
e8ceb82
remove unused var
liz3 Nov 6, 2024
f8d4818
fix issue with uuid module
liz3 Nov 7, 2024
9d89a15
chore: some reformatting
liz3 Nov 7, 2024
44bc1ec
Update src/vm/datatypes/strings.c
liz3 Nov 7, 2024
aaac64e
Update src/vm/datatypes/strings.c
liz3 Nov 7, 2024
21e3d17
Update src/vm/datatypes/strings.c
liz3 Nov 7, 2024
522d432
refactor scopes
liz3 Nov 8, 2024
d0bf48b
Update src/vm/datatypes/strings.c
liz3 Nov 8, 2024
c0f3533
Update src/vm/datatypes/strings.c
liz3 Nov 8, 2024
9fa46e3
style: format file
liz3 Nov 8, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
223 changes: 128 additions & 95 deletions src/vm/datatypes/strings.c

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions src/vm/object.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "table.h"
#include "value.h"
#include "vm.h"
#include "utf8.h"

#define ALLOCATE_OBJ(vm, type, objectType) \
(type*)allocateObject(vm, sizeof(type), objectType)
Expand Down Expand Up @@ -152,6 +153,10 @@ static ObjString *allocateString(DictuVM *vm, char *chars, int length,
string->length = length;
string->chars = chars;
string->hash = hash;
if(utf8valid(chars) == 0)
string->character_len = utf8len(chars);
else
string->character_len = length;
push(vm, OBJ_VAL(string));
tableSet(vm, &vm->strings, string, NIL_VAL);
pop(vm);
Expand Down
1 change: 1 addition & 0 deletions src/vm/object.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ struct sObjString {
int length;
char *chars;
uint32_t hash;
int character_len;
};

struct sObjList {
Expand Down
Loading
Loading