nitg: handle triple-quoted strings
authorJean Privat <jean@pryen.org>
Thu, 25 Jul 2013 14:55:06 +0000 (10:55 -0400)
committerJean Privat <jean@pryen.org>
Thu, 25 Jul 2013 14:55:06 +0000 (10:55 -0400)
Signed-off-by: Jean Privat <jean@pryen.org>

src/literal.nit

index 67f1120..e044bee 100644 (file)
@@ -104,7 +104,9 @@ redef class AStringFormExpr
        redef fun accept_literal(v)
        do
                var txt = self.n_string.text
-               self.value = txt.substring(1, txt.length-2).unescape_nit
+               var skip = 1
+               if txt[0] == txt[1] and txt.length >= 6 then skip = 3
+               self.value = txt.substring(skip, txt.length-(2*skip)).unescape_nit
        end
 end