Factor out parser note code into parser.notes vocabulary, and print a note if a using list contains duplicates
parent
90560d3959
commit
35ccf0231e
|
@ -2,7 +2,7 @@
|
|||
! 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 )
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Slava Pestov
|
|
@ -0,0 +1,18 @@
|
|||
! 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 ;
|
|
@ -5,7 +5,7 @@ sequences strings vectors words words.symbol quotations io
|
|||
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 )
|
||||
|
@ -15,20 +15,6 @@ IN: parser
|
|||
: 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 )
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
! 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 ;
|
||||
|
@ -105,7 +106,7 @@ TUPLE: no-current-vocab ;
|
|||
|
||||
: 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 ]
|
||||
|
|
Loading…
Reference in New Issue