From ef9e1f07315e09c3f40b4e9ab2e793b2141f06eb Mon Sep 17 00:00:00 2001 From: Eatswap Date: Wed, 14 Dec 2022 01:21:18 +0800 Subject: [PATCH] fix: string parse and update sample --- DragonLisp.l | 2 +- sample.lisp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/DragonLisp.l b/DragonLisp.l index f49c39a..c5327a3 100644 --- a/DragonLisp.l +++ b/DragonLisp.l @@ -35,7 +35,7 @@ int [+-]?(0[xX][0-9A-Fa-f]*|0[0-7]*|[1-9][0-9]*) id [a-zA-Z_][a-zA-Z_0-9]* blank [ \t\v\r] comment ;[^\n\r]* -string \"[^\r\n]*\" +string \"(?:[^\"\\]|\\.)*\" and [aA][nN][dD] or [oO][rR] diff --git a/sample.lisp b/sample.lisp index 2dd354a..2d3a434 100644 --- a/sample.lisp +++ b/sample.lisp @@ -44,7 +44,8 @@ (print (+ 1 2 3 4 5)) ; prints 15 -(print "Hello, world!") ; prints Hello, world! +(print "Hello, + wo\n\"r\"ld!") ; prints Hello,(newline here) wo\n\"r\"ld! (defvar lower_bound 1) (loop