]> gitweb.factorcode.org Git - factor.git/blobdiff - core/syntax/syntax.factor
Merge qualified, alias, symbols, constants into core
[factor.git] / core / syntax / syntax.factor
index 9640aa9275f524604910cce58a2321568e14f5d0..c81fc9201e64794e573a2309c099de384cb52845 100644 (file)
@@ -2,12 +2,13 @@
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors alien arrays byte-arrays definitions generic
 hashtables kernel math namespaces parser lexer sequences strings
-strings.parser sbufs vectors words quotations io assocs
-splitting classes.tuple generic.standard generic.math
-generic.parser classes io.pathnames vocabs classes.parser
-classes.union classes.intersection classes.mixin
-classes.predicate classes.singleton classes.tuple.parser
-compiler.units combinators effects.parser slots ;
+strings.parser sbufs vectors words words.symbol words.constant
+words.alias quotations io assocs splitting classes.tuple
+generic.standard generic.math generic.parser classes
+io.pathnames vocabs vocabs.parser classes.parser classes.union
+classes.intersection classes.mixin classes.predicate
+classes.singleton classes.tuple.parser compiler.units
+combinators effects.parser slots ;
 IN: bootstrap.syntax
 
 ! These words are defined as a top-level form, instead of with
@@ -22,7 +23,8 @@ IN: bootstrap.syntax
     "syntax" lookup t "delimiter" set-word-prop ;
 
 : define-syntax ( name quot -- )
-    [ "syntax" lookup dup ] dip define make-parsing ;
+    [ dup "syntax" lookup [ dup ] [ no-word-error ] ?if ] dip
+    define make-parsing ;
 
 [
     { "]" "}" ";" ">>" } [ define-delimiter ] each
@@ -51,6 +53,22 @@ IN: bootstrap.syntax
 
     "USING:" [ ";" parse-tokens add-use ] define-syntax
 
+    "QUALIFIED:" [ scan dup add-qualified ] define-syntax
+
+    "QUALIFIED-WITH:" [ scan scan add-qualified ] define-syntax
+
+    "FROM:" [
+        scan "=>" expect ";" parse-tokens swap add-words-from
+    ] define-syntax
+
+    "EXCLUDE:" [
+        scan "=>" expect ";" parse-tokens swap add-words-excluding
+    ] define-syntax
+
+    "RENAME:" [
+        scan scan "=>" expect scan add-renamed-word
+    ] define-syntax
+
     "HEX:" [ 16 parse-base ] define-syntax
     "OCT:" [ 8 parse-base ] define-syntax
     "BIN:" [ 2 parse-base ] define-syntax
@@ -97,6 +115,24 @@ IN: bootstrap.syntax
         CREATE-WORD define-symbol
     ] define-syntax
 
+    "SYMBOLS:" [
+        ";" parse-tokens
+        [ create-in dup reset-generic define-symbol ] each
+    ] define-syntax
+
+    "SINGLETONS:" [
+        ";" parse-tokens
+        [ create-class-in define-singleton-class ] each
+    ] define-syntax
+    
+    "ALIAS:" [
+        CREATE-WORD scan-word define-alias
+    ] define-syntax
+
+    "CONSTANT:" [
+        CREATE scan-object define-constant
+    ] define-syntax
+
     "DEFER:" [
         scan current-vocab create
         dup old-definitions get [ delete-at ] with each