From accc1088170788afccc9e8c85b2be78a46fd41b5 Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Mon, 8 Apr 2024 16:13:19 -0700 Subject: [PATCH] Added linebreak escape character --- examples/hello.modal | 7 +++---- src/modal.c | 6 +++++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/examples/hello.modal b/examples/hello.modal index fef5e5c..f6adc9f 100644 --- a/examples/hello.modal +++ b/examples/hello.modal @@ -1,5 +1,4 @@ -<> (greeting) (Melcome to) -<> (name) (Modal --) -<> (?: ?: -- print) () +<> (lang_name) (Modal) +<> (?: print) () -greeting name print \ No newline at end of file +(Welcome to lang_name \nHave fun! \n) print diff --git a/src/modal.c b/src/modal.c index 88ead4e..500863e 100644 --- a/src/modal.c +++ b/src/modal.c @@ -65,7 +65,11 @@ set_reg(int r, char *b) } else if(r == ':') { char *bb = walk(b); if(*b == '(') b++, --bb; - while(b < bb) putc(*(b++), stdout); + while(b < bb) { + char c = *(b++); + if(c == '\\' && *(b++) == 'n') c = 0xa; + putc(c, stdout); + } } else regs[r] = b; return 1;