tcl, yorick: fix read-string of raw newline.
authorJoel Martin <github@martintribe.org>
Tue, 27 Aug 2019 05:28:43 +0000 (00:28 -0500)
committerJoel Martin <github@martintribe.org>
Tue, 27 Aug 2019 05:28:43 +0000 (00:28 -0500)
tcl/reader.tcl
yorick/reader.i

index c1c7072..6812335 100644 (file)
@@ -18,9 +18,9 @@ oo::class create Reader {
 }
 
 proc tokenize str {
-    set re {[\s,]*(~@|[\[\]\{\}()'`~^@]|\"(?:\\.|[^\\\"])*\"?|;.*|[^\s\[\]\{\}('\"`~^@,;)]*)}
+    set re {[\s,]*(~@|[\[\]\{\}()'`~^@]|\"(?:\\.|[^\\\"])*\"?|;[^\n]*|[^\s\[\]\{\}('\"`~^@,;)]*)}
     set tokens {}
-    foreach {_ capture} [regexp -line -all -inline $re $str] {
+    foreach {_ capture} [regexp -all -inline $re $str] {
         if {[string length $capture] > 0 && [string range $capture 0 0] != ";"} {
             lappend tokens $capture
         }
index f102a41..92adfd0 100644 (file)
@@ -1,7 +1,7 @@
 #include "yeti_regex.i"
 require, "types.i"
 
-TOKENIZER_REGEXP = regcomp("[[:space:],]*(~@|[][{}()'`~@]|\"([\\].|[^\\\"])*\"?|;.*|[^][[:space:]{}()'\"`~@,;]*)", newline=1)
+TOKENIZER_REGEXP = regcomp("[[:space:],]*(~@|[][{}()'`~@]|\"([\\].|[^\\\"])*\"?|;[^\n]*|[^][[:space:]{}()'\"`~@,;]*)")
 
 func tokenize(str)
 {