! 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
"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
"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
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