diff options
author | kdx <kikoodx@paranoici.org> | 2023-08-26 15:05:12 +0200 |
---|---|---|
committer | kdx <kikoodx@paranoici.org> | 2023-08-26 15:05:12 +0200 |
commit | 07f9061b1287212cca8bdea2f07b7262e6d079b7 (patch) | |
tree | 2b3ae941f16349020615941d4142daba7163b382 | |
parent | 3edf6c7c39dea9155f4a34ae8f5091d2a40a2462 (diff) | |
download | golem-07f9061b1287212cca8bdea2f07b7262e6d079b7.tar.gz |
small string shortend
-rw-r--r-- | samples/helloworld.golem | 5 | ||||
-rw-r--r-- | src/main.c | 9 | ||||
-rwxr-xr-x | testing.sh | 1 |
3 files changed, 15 insertions, 0 deletions
diff --git a/samples/helloworld.golem b/samples/helloworld.golem index 24a84de..b8bb0d8 100644 --- a/samples/helloworld.golem +++ b/samples/helloworld.golem @@ -5,6 +5,11 @@ define iterations = 9; main() { local i; + print(`Hello); + wrt ' '; + print(`World); + wrt '!'; + wrt '\n'; strcpy(str, "Hello, World!\n"); i = 0; 🗿 loop variable @@ -243,6 +243,15 @@ tokenize(char *p) continue; } + if (*p == '`') { + char *q = p; + p += 1; + while (isalnum(*p) || *p == '_') + p += 1; + cur = cur->next = new_token(TOK_STRING, q, p + 1); + continue; + } + if (*p == '\'' && p[1] != '\'') { char *q = p; const int c = escaped_char(p + 1, &p); @@ -68,4 +68,5 @@ test "$1" "main() { dbg 5 % 3; }" test "$1" "main() { dbg [{1, 2, 3} + 2]; dbg [{1, 2, 3}]; }" test "$1" "main() { err 'u'; }" test "$1" "enum a, b, c; main() { dbg a; dbg b; dbg c; }" +test "$1" 'main() { dbg `howdy; }' rm -f build/tmp.* |