aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
author_ov4 <ov4@ov4.org>2026-10-20 11:42:45 +0000
committer_ov4 <ov4@ov4.org>2026-10-20 11:42:45 +0000
commita3335110dc4f1283cf1680e273cc9775b7e8c8ac (patch)
tree15866ec0503d1edac9a1d9e11c04f7cdc7473d8d /tests
parent52e0674c54d4b53b2132e750106cc9acb266ed39 (diff)
feat(lexer): add C_STRING literal suffix
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/i/c-string-literals/case.json1
-rw-r--r--tests/i/c-string-literals/expected.txt4
-rw-r--r--tests/i/c-string-literals/notes.md5
-rw-r--r--tests/i/c-string-literals/program.cps13
4 files changed, 23 insertions, 0 deletions
diff --git a/tests/i/c-string-literals/case.json b/tests/i/c-string-literals/case.json
new file mode 100644
index 0000000..0967ef4
--- /dev/null
+++ b/tests/i/c-string-literals/case.json
@@ -0,0 +1 @@
+{}
diff --git a/tests/i/c-string-literals/expected.txt b/tests/i/c-string-literals/expected.txt
new file mode 100644
index 0000000..2255027
--- /dev/null
+++ b/tests/i/c-string-literals/expected.txt
@@ -0,0 +1,4 @@
+quote:" slash:\
+AB
+0
+1:2
diff --git a/tests/i/c-string-literals/notes.md b/tests/i/c-string-literals/notes.md
new file mode 100644
index 0000000..a469ce1
--- /dev/null
+++ b/tests/i/c-string-literals/notes.md
@@ -0,0 +1,5 @@
+# C string literals
+
+Human review: pending. Expectations follow the literal bytes and declared overloads.
+
+The adjacent uppercase C suffix produces C_STRING. Escapes use the ordinary lexer rules. Explicit STRING casts preserve the text; an empty C string has length zero after conversion. Overload selection distinguishes STRING from C_STRING.
diff --git a/tests/i/c-string-literals/program.cps b/tests/i/c-string-literals/program.cps
new file mode 100644
index 0000000..ac2f7b0
--- /dev/null
+++ b/tests/i/c-string-literals/program.cps
@@ -0,0 +1,13 @@
+DECLARE Text : C_STRING
+Text <- "quote:\" slash:\\"C
+OUTPUT (STRING)Text
+OUTPUT (STRING)"\101\x42"C
+CONSTANT Empty = ""C
+OUTPUT LENGTH((STRING)Empty)
+OVERLOAD FUNCTION Kind(Text : STRING) RETURNS INTEGER
+ RETURN 1
+ENDFUNCTION
+OVERLOAD FUNCTION Kind(Text : C_STRING) RETURNS INTEGER
+ RETURN 2
+ENDFUNCTION
+OUTPUT Kind("text"), ":", Kind("text"C)