]> gitweb.factorcode.org Git - factor.git/commitdiff
lexer: change new-lexer to take a string
authorJohn Benediktsson <mrjbq7@gmail.com>
Fri, 13 Oct 2023 18:54:32 +0000 (11:54 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Fri, 13 Oct 2023 18:54:32 +0000 (11:54 -0700)
core/lexer/lexer.factor

index 57f88b525b3f6380e6fa692176f539fc92e4dfb1..c8ec22db6b654d62435ddfe27c598a639b632a61 100644 (file)
@@ -2,7 +2,7 @@
 ! See https://factorcode.org/license.txt for BSD license.
 USING: accessors arrays classes combinators continuations io
 kernel math math.parser namespaces sequences source-files.errors
-strings vectors ;
+splitting strings vectors ;
 IN: lexer
 
 TUPLE: lexer
@@ -33,7 +33,7 @@ TUPLE: lexer-parsing-word word line line-text column ;
     lexer get lexer check-instance parsing-words>> pop* ;
 
 : new-lexer ( text class -- lexer )
-    new
+    [ dup string? [ split-lines ] when ] dip new
         0 >>line
         swap >>text
         V{ } clone >>parsing-words