]> gitweb.factorcode.org Git - factor.git/commitdiff
syntax: Add a "syntax" word property for tracking which words are defined with SYNTAX...
authorDoug Coleman <doug.coleman@gmail.com>
Tue, 30 Jun 2015 01:45:16 +0000 (18:45 -0700)
committerDoug Coleman <doug.coleman@gmail.com>
Tue, 30 Jun 2015 01:45:16 +0000 (18:45 -0700)
core/syntax/syntax.factor

index 132e09988d54753b8dd95b71624666dab366b30c..a3e6859447bf21e71bcb5c721c9485a8176a8e74 100644 (file)
@@ -23,8 +23,16 @@ IN: bootstrap.syntax
 : define-delimiter ( name -- )
     "syntax" lookup-word t "delimiter" set-word-prop ;
 
+! Keep track of words defined by SYNTAX: as opposed to words
+! merely generated by define-syntax.
+: mark-top-level-syntax ( word -- word )
+    dup t "syntax" set-word-prop ;
+
 : define-core-syntax ( name quot -- )
-    [ dup "syntax" lookup-word [ ] [ no-word-error ] ?if ] dip
+    [
+        dup "syntax" lookup-word [ ] [ no-word-error ] ?if
+        mark-top-level-syntax
+    ] dip
     define-syntax ;
 
 [
@@ -114,7 +122,9 @@ IN: bootstrap.syntax
     "deprecated" [ last-word make-deprecated ] define-core-syntax
 
     "SYNTAX:" [
-        scan-new-word parse-definition define-syntax
+        scan-new-word
+        mark-top-level-syntax
+        parse-definition define-syntax
     ] define-core-syntax
 
     "BUILTIN:" [