]> ocean-lang.org Git - ocean/commitdiff
scanner: fix multi-line strings
authorNeilBrown <neil@brown.name>
Tue, 28 May 2019 05:04:35 +0000 (15:04 +1000)
committerNeilBrown <neil@brown.name>
Tue, 28 May 2019 05:04:35 +0000 (15:04 +1000)
I broke multi-line strings.  A quote cannot be part of an
unknown mark, but it can be part of '"""' or "'''".

Signed-off-by: NeilBrown <neil@brown.name>
csrc/scanner.mdc

index 0abc08c6f8dd09a548b239b40cf253ab676bfc67..9a1ea7144b612a6624e39d799921c37682d46c99 100644 (file)
@@ -368,7 +368,11 @@ Known marks are included in the same list as the list of known words.
                prev = ch;
                save_unget_state(state);
                ch = get_char(state);
-               if (!(ignored && (1<<TK_string)) && is_quote(ch))
+               if (!(ignored && (1<<TK_string)) && n < 0 &&is_quote(ch) && !is_quote(prev))
+                       /* If strings are allowed, a quote (Which isn't a known mark)
+                        * mustn't be treated as part of an unknown mark.  It can be
+                        * part of a multi-line srtings though.
+                        */
                        break;
                if (prev == '#' && n < 0)
                        /* '#' is not a known mark, so assume it is a comment */