]> gitweb.factorcode.org Git - factor.git/commitdiff
io.encodings.iso2022: use $ instead of making ESC a parsing word.
authorDoug Coleman <doug.coleman@gmail.com>
Tue, 21 Jul 2015 23:14:53 +0000 (16:14 -0700)
committerDoug Coleman <doug.coleman@gmail.com>
Wed, 22 Jul 2015 00:33:14 +0000 (17:33 -0700)
basis/io/encodings/iso2022/iso2022.factor

index 9e70e91860452c3590c6062443511c1aeca6e870..9b2f3f44c5772941e15ef16a6ebb5940aaaf7f5b 100644 (file)
@@ -2,7 +2,7 @@
 ! See http://factorcode.org/license.txt for BSD license.
 USING: io.encodings kernel sequences io simple-flat-file sets math
 combinators.short-circuit io.binary arrays assocs namespaces
-locals accessors combinators biassocs byte-arrays parser ;
+locals accessors combinators biassocs byte-arrays parser literals ;
 IN: io.encodings.iso2022
 
 SINGLETON: iso2022
@@ -31,12 +31,12 @@ M: iso2022 <encoder>
 M: iso2022 <decoder>
     make-iso-coder <decoder> ;
 
-<< SYNTAX: ESC 0x16 suffix! ; >>
+CONSTANT: ESC 0x16
 
-CONSTANT: switch-ascii B{ ESC CHAR: ( CHAR: B }
-CONSTANT: switch-jis201 B{ ESC CHAR: ( CHAR: J }
-CONSTANT: switch-jis208 B{ ESC CHAR: $ CHAR: B }
-CONSTANT: switch-jis212 B{ ESC CHAR: $ CHAR: ( CHAR: D }
+CONSTANT: switch-ascii B{ ESC CHAR: ( CHAR: B }
+CONSTANT: switch-jis201 B{ ESC CHAR: ( CHAR: J }
+CONSTANT: switch-jis208 B{ ESC CHAR: $ CHAR: B }
+CONSTANT: switch-jis212 B{ ESC CHAR: $ CHAR: ( CHAR: D }
 
 : find-type ( char -- code type )
     {
@@ -90,7 +90,7 @@ M:: iso2022-state encode-char ( char stream encoding -- )
 
 M:: iso2022-state decode-char ( stream encoding -- char )
     stream stream-read1 {
-        { ESC [
+        { ESC [
             stream read-escape [
                 encoding type<<
                 stream encoding decode-char