1 ! Copyright (C) 2004, 2006 Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
4 ! We define these words in !syntax with ! prefixes to avoid
5 ! clashing with the host parsing words when we are building the
6 ! target image. The end of boot-stage1.factor renames the
7 ! !syntax vocab to syntax, and removes the ! prefix from each
10 USING: alien arrays definitions errors generic
11 hashtables kernel math modules namespaces parser sequences
12 strings vectors words ;
14 : !! line-text get length column-number set ; parsing
15 : !#! POSTPONE: ! ; parsing
16 : !IN: scan set-in ; parsing
17 : !USE: scan use+ ; parsing
18 : !USING: string-mode on [ string-mode off add-use ] f ; parsing
19 : !HEX: 16 parse-base ; parsing
20 : !OCT: 8 parse-base ; parsing
21 : !BIN: 2 parse-base ; parsing
23 : !f f parsed ; parsing
24 : !CHAR: 0 scan next-char nip parsed ; parsing
25 : !" parse-string parsed ; parsing
26 : !SBUF" skip-blank parse-string >sbuf parsed ; parsing
28 : !] >quotation parsed ; parsing
29 : !; >quotation swap call ; parsing
30 : !} swap call parsed ; parsing
31 : !{ [ >array ] f ; parsing
32 : !V{ [ >vector ] f ; parsing
33 : !H{ [ alist>hash ] f ; parsing
34 : !C{ [ first2 rect> ] f ; parsing
35 : !T{ [ >tuple ] f ; parsing
36 : !W{ [ first <wrapper> ] f ; parsing
37 : !POSTPONE: scan-word parsed ; parsing
38 : !\ scan-word literalize parsed ; parsing
39 : !parsing word t "parsing" set-word-prop ; parsing
40 : !inline word t "inline" set-word-prop ; parsing
41 : !foldable word t "foldable" set-word-prop ; parsing
42 : !SYMBOL: CREATE dup reset-generic define-symbol ; parsing
44 DEFER: !PRIMITIVE: parsing
45 : !DEFER: CREATE drop ; parsing
46 : !: CREATE dup reset-generic [ define-compound ] f ; parsing
47 : !GENERIC: CREATE dup reset-word define-generic ; parsing
48 : !G: CREATE dup reset-word [ define-generic* ] f ; parsing
51 scan-word scan-word location
52 [ <method> -rot define-method ] f ; parsing
55 CREATE dup intern-symbol dup predicate-word
56 [ dupd unit "predicate" set-word-prop ] keep
57 [ define-union ] f ; parsing
60 scan-word CREATE dup intern-symbol
61 dup rot "superclass" set-word-prop dup predicate-word
62 [ define-predicate-class ] f ; parsing
65 scan string-mode on [ string-mode off define-tuple ] f ;
70 [ create-constructor dup reset-generic dup set-word ] keep
71 [ define-constructor ] f ; parsing
73 : !FORGET: scan use get hash-stack [ forget ] when* ; parsing
75 : !PROVIDE: scan location [ provide ] f ; parsing
80 [ [ require ] each ] no-parse-hook
84 scan [ swap module set-module-main ] f ; parsing
88 swap "declared-effect" set-word-prop