summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkdx <kikoodx@paranoici.org>2023-08-26 15:05:12 +0200
committerkdx <kikoodx@paranoici.org>2023-08-26 15:05:12 +0200
commit07f9061b1287212cca8bdea2f07b7262e6d079b7 (patch)
tree2b3ae941f16349020615941d4142daba7163b382
parent3edf6c7c39dea9155f4a34ae8f5091d2a40a2462 (diff)
downloadgolem-07f9061b1287212cca8bdea2f07b7262e6d079b7.tar.gz
small string shortend
-rw-r--r--samples/helloworld.golem5
-rw-r--r--src/main.c9
-rwxr-xr-xtesting.sh1
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
diff --git a/src/main.c b/src/main.c
index a022d75..94dae81 100644
--- a/src/main.c
+++ b/src/main.c
@@ -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);
diff --git a/testing.sh b/testing.sh
index dce1fea..bc3d741 100755
--- a/testing.sh
+++ b/testing.sh
@@ -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.*