]> ocean-lang.org Git - ocean/commitdiff
scanner: handle unknown marks once.
authorNeilBrown <neil@brown.name>
Wed, 29 May 2019 08:19:54 +0000 (18:19 +1000)
committerNeilBrown <neil@brown.name>
Wed, 29 May 2019 08:19:54 +0000 (18:19 +1000)
There were two places in the code that tried to handle
unknown marks.  We only need one.

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

index e90690a00db57879d49840f2ea2c18f2425e7633..6eee0892deb07e78fb3f6de7497a810515a313c7 100644 (file)
@@ -402,15 +402,6 @@ before assuming that we have an unknown mark
        ## parse comment
        ## unknown mark
 
-###### unknown mark
-       if (tk.txt.len) {
-               if (ignored & (1<<TK_mark))
-                       tk.num = TK_error;
-               else
-                       tk.num = TK_mark;
-               return tk;
-       }
-
 ### Strings
 
 Strings start with one of single quote, double quote, or back quote
@@ -878,7 +869,10 @@ we have an unknown mark, otherwise this must be an error.
 ###### unknown mark
        /* one unknown character */
        close_token(state, &tk);
-       tk.num = TK_error;
+       if (ignored & (1<<TK_mark))
+               tk.num = TK_error;
+       else
+               tk.num = TK_mark;
        return tk;
 
 ## Tools For The Task