! See http://factorcode.org/license.txt for BSD license.
USING: accessors kernel sets namespaces make sequences parser
lexer combinators words classes.parser classes.tuple arrays
-slots math assocs ;
+slots math assocs parser.notes ;
IN: classes.tuple.parser
: slot-names ( slots -- seq )
--- /dev/null
+Slava Pestov
\ No newline at end of file
--- /dev/null
+! Copyright (C) 2009 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: namespaces kernel source-files lexer accessors io math.parser ;
+IN: parser.notes
+
+SYMBOL: parser-notes
+
+t parser-notes set-global
+
+: parser-notes? ( -- ? )
+ parser-notes get "quiet" get not and ;
+
+: note. ( str -- )
+ parser-notes? [
+ file get [ path>> write ":" write ] when*
+ lexer get [ line>> number>string write ": " write ] when*
+ "Note:" print dup print
+ ] when drop ;
\ No newline at end of file
combinators sorting splitting math.parser effects continuations
io.files vocabs io.encodings.utf8 source-files classes
hashtables compiler.units accessors sets lexer vocabs.parser
-effects.parser slots ;
+effects.parser slots parser.notes ;
IN: parser
: location ( -- loc )
: save-location ( definition -- )
location remember-definition ;
-SYMBOL: parser-notes
-
-t parser-notes set-global
-
-: parser-notes? ( -- ? )
- parser-notes get "quiet" get not and ;
-
-: note. ( str -- )
- parser-notes? [
- file get [ path>> write ":" write ] when*
- lexer get [ line>> number>string write ": " write ] when*
- "Note:" print dup print
- ] when drop ;
-
M: parsing-word stack-effect drop (( parsed -- parsed )) ;
: create-in ( str -- word )
! See http://factorcode.org/license.txt for BSD license.
USING: assocs hashtables kernel namespaces sequences
sets strings vocabs sorting accessors arrays compiler.units
-combinators vectors splitting continuations math ;
+combinators vectors splitting continuations math
+parser.notes ;
IN: vocabs.parser
ERROR: no-word-error name ;
: use-vocab ( vocab -- )
dup using-vocab?
- [ drop ] [
+ [ vocab-name "Already using ``" "'' vocabulary" surround note. ] [
manifest get
[ [ vocab-name ] dip search-vocab-names>> conjoin ]
[ [ load-vocab ] dip search-vocabs>> push ]