]> gitweb.factorcode.org Git - factor.git/blobdiff - extra/fjsc/fjsc.factor
factor: trim using lists
[factor.git] / extra / fjsc / fjsc.factor
index 720236ba0b0743ee6d0738929c54d3b7d6b8bc7b..48ee7711d6dce55fbf50bf157e62ba390a0d5a94 100644 (file)
@@ -1,7 +1,7 @@
 ! Copyright (C) 2006 Chris Double. All Rights Reserved.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors kernel peg strings sequences math math.parser
-namespaces make words quotations arrays hashtables io
+make words quotations arrays hashtables io
 io.streams.string assocs ascii peg.parsers words.symbol
 combinators.short-circuit ;
 IN: fjsc
@@ -32,7 +32,7 @@ TUPLE: ast-hashtable elements ;
     [
         {
             [ blank? not ]
-            [ CHAR: " = not ]
+            [ CHAR: \" = not ]
             [ CHAR: ; = not ]
             [ LETTER? not ]
             [ letter? not ]
@@ -113,10 +113,7 @@ DEFER: expression-parser
 
 : comment-parser ( -- parser )
     [
-        [
-            "#!" token sp ,
-            "!" token sp ,
-        ] choice* hide ,
+        "!" token hide ,
         [
             dup CHAR: \n = swap CHAR: \r = or not
         ] satisfy repeat0 ,
@@ -307,36 +304,36 @@ M: ast-using (compile)
 
 GENERIC: (parse-factor-quotation) ( object -- ast )
 
-M: number (parse-factor-quotation) ( object -- ast )
+M: number (parse-factor-quotation)
     ast-number boa ;
 
-M: symbol (parse-factor-quotation) ( object -- ast )
+M: symbol (parse-factor-quotation)
     [ >string ] [ vocabulary>> ] bi ast-identifier boa ;
 
-M: word (parse-factor-quotation) ( object -- ast )
+M: word (parse-factor-quotation)
     [ name>> ] [ vocabulary>> ] bi ast-identifier boa ;
 
-M: string (parse-factor-quotation) ( object -- ast )
+M: string (parse-factor-quotation)
     ast-string boa ;
 
-M: quotation (parse-factor-quotation) ( object -- ast )
+M: quotation (parse-factor-quotation)
     [ (parse-factor-quotation) ] { } map-as ast-quotation boa ;
 
-M: array (parse-factor-quotation) ( object -- ast )
+M: array (parse-factor-quotation)
     [ (parse-factor-quotation) ] { } map-as ast-array boa ;
 
-M: hashtable (parse-factor-quotation) ( object -- ast )
+M: hashtable (parse-factor-quotation)
     >alist [ (parse-factor-quotation) ] { } map-as ast-hashtable boa ;
 
-M: wrapper (parse-factor-quotation) ( object -- ast )
+M: wrapper (parse-factor-quotation)
     wrapped>> [ name>> ] [ vocabulary>> ] bi ast-word boa ;
 
 GENERIC: fjsc-parse ( object -- ast )
 
-M: string fjsc-parse ( object -- ast )
+M: string fjsc-parse
     expression-parser parse ;
 
-M: quotation fjsc-parse ( object -- ast )
+M: quotation fjsc-parse
     [ (parse-factor-quotation) ] { } map-as ast-expression boa ;
 
 : fjsc-compile ( ast -- string )