aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--tests/077.sh12
-rw-r--r--tokenize.c2
2 files changed, 14 insertions, 0 deletions
diff --git a/tests/077.sh b/tests/077.sh
new file mode 100644
index 0000000..4a58cb8
--- /dev/null
+++ b/tests/077.sh
@@ -0,0 +1,12 @@
+set -e
+
+cat <<'EOF' > expected
+0
+EOF
+bash ../../test_diff.sh <<'EOF'
+int printf();
+
+int main() {
+ printf("%d\n", '\0');
+}
+EOF
diff --git a/tokenize.c b/tokenize.c
index 0b3c9ba..2642b5a 100644
--- a/tokenize.c
+++ b/tokenize.c
@@ -283,6 +283,8 @@ void tokenize_all(Lexer* l) {
ch = '\t';
} else if (ch == 'v') {
ch = '\v';
+ } else if (ch == '0') {
+ ch = '\0';
}
}
char* buf = calloc(4, sizeof(char));