]> gitweb.factorcode.org Git - factor.git/commitdiff
strings.parser: remove parse-short-string, everyone should parse-string.
authorJohn Benediktsson <mrjbq7@gmail.com>
Mon, 4 Apr 2016 21:54:06 +0000 (14:54 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Mon, 4 Apr 2016 22:00:04 +0000 (15:00 -0700)
basis/alien/syntax/syntax.factor
basis/urls/urls.factor
core/strings/parser/parser.factor
core/syntax/syntax.factor
extra/gml/runtime/runtime.factor

index 6676906941e3f9613726819f61ed188cab605a57..cbf93f735a66ed585b19bfab13623b7d56219fa0 100755 (executable)
@@ -6,7 +6,7 @@ strings.parser vocabs words ;
 << "alien.arrays" require >> ! needed for bootstrap
 IN: alien.syntax
 
-SYNTAX: DLL" lexer get skip-blank parse-short-string dlopen suffix! ;
+SYNTAX: DLL" lexer get skip-blank parse-string dlopen suffix! ;
 
 SYNTAX: ALIEN: 16 scan-base <alien> suffix! ;
 
index ac4257c1bbfa19bbe51f997d090511ab5b375aa1..3e3822452262b759afe20eedb21cfca7423d72fa 100644 (file)
@@ -197,6 +197,6 @@ UNION: abstract-inet inet inet4 inet6 ;
 M: abstract-inet >secure-addr <secure> ;
 
 ! Literal syntax
-SYNTAX: URL" lexer get skip-blank parse-short-string >url suffix! ;
+SYNTAX: URL" lexer get skip-blank parse-string >url suffix! ;
 
 { "urls" "prettyprint" } "urls.prettyprint" require-when
index 17259bd6deee0a8922dfabd11bfe9d6f46ff7b3f..e70f9498ff999bd916baec64addc2e1554b1fd2b 100644 (file)
@@ -70,28 +70,6 @@ PRIVATE>
 
 <PRIVATE
 
-: (parse-short-string) ( accum str -- accum m )
-    { sbuf slice } declare
-    dup [ "\"\\" member? ] find [
-        [ cut-slice [ append! ] dip rest-slice ] dip
-        CHAR: " = [
-            from>>
-        ] [
-            next-escape [ suffix! ] dip (parse-short-string)
-        ] if
-    ] [
-        "Unterminated string" throw
-    ] if* ;
-
-PRIVATE>
-
-: parse-short-string ( -- str )
-    SBUF" " clone lexer get [
-        swap tail-slice (parse-short-string) [ "" like ] dip
-    ] change-lexer-column ;
-
-<PRIVATE
-
 : lexer-subseq ( i lexer -- before )
     { fixnum lexer } declare
     [ [ column>> ] [ line-text>> ] bi swapd subseq ]
@@ -126,7 +104,7 @@ PRIVATE>
     [ column>> ] [ line-text>> ] bi
     [ "\"\\" member? ] find-from ;
 
-DEFER: (parse-full-string)
+DEFER: (parse-string)
 
 : parse-found-token ( accum lexer i elt -- )
     { sbuf lexer fixnum fixnum } declare
@@ -135,12 +113,12 @@ DEFER: (parse-full-string)
         dup dup [ next-char ] bi@
         [ [ pick push ] bi@ ]
         [ drop 2dup next-line% ] if*
-        (parse-full-string)
+        (parse-string)
     ] [
         advance-char drop
     ] if ;
 
-: (parse-full-string) ( accum lexer -- )
+: (parse-string) ( accum lexer -- )
     { sbuf lexer } declare
     dup still-parsing? [
         dup find-next-token [
@@ -148,13 +126,13 @@ DEFER: (parse-full-string)
         ] [
             drop 2dup next-line%
             CHAR: \n pick push
-            (parse-full-string)
+            (parse-string)
         ] if*
     ] [
         "Unterminated string" throw
     ] if ;
 
-: rewind-on-error ( quot -- )
+: rewind-lexer-on-error ( quot -- )
     lexer get [ line>> ] [ line-text>> ] [ column>> ] tri
     [
         lexer get [ column<< ] [ line-text<< ] [ line<< ] tri
@@ -163,9 +141,9 @@ DEFER: (parse-full-string)
 
 PRIVATE>
 
-: parse-full-string ( -- str )
+: parse-string ( -- str )
     [
         SBUF" " clone [
-            lexer get (parse-full-string)
+            lexer get (parse-string)
         ] keep unescape-string
-    ] rewind-on-error ;
+    ] rewind-lexer-on-error ;
index 13f07fcddce1db554e47cffbf006b60bb3bd8baf..ab760813fce1edd0c0909ec2888982845211ae2e 100644 (file)
@@ -88,14 +88,14 @@ IN: bootstrap.syntax
         } cond suffix!
     ] define-core-syntax
 
-    "\"" [ parse-full-string suffix! ] define-core-syntax
+    "\"" [ parse-string suffix! ] define-core-syntax
 
     "SBUF\"" [
-        lexer get skip-blank parse-full-string >sbuf suffix!
+        lexer get skip-blank parse-string >sbuf suffix!
     ] define-core-syntax
 
     "P\"" [
-        lexer get skip-blank parse-short-string <pathname> suffix!
+        lexer get skip-blank parse-string <pathname> suffix!
     ] define-core-syntax
 
     "[" [ parse-quotation suffix! ] define-core-syntax
index 64603619667a51853d17032cae6811c2e3cff8c3..798de511e401feb523c35358bb4e2778b1d136c6 100644 (file)
@@ -53,7 +53,7 @@ TUPLE: exec-name < identity-tuple name ;
 
 MEMO: exec-name ( string -- name ) name \ exec-name boa ;
 
-SYNTAX: exec" lexer get skip-blank parse-short-string exec-name suffix! ;
+SYNTAX: exec" lexer get skip-blank parse-string exec-name suffix! ;
 
 ERROR: unbound-name { name name } ;