! Copyright (C) 2008, 2009 Jose Antonio Ortega Ruiz.
! See http://factorcode.org/license.txt for BSD license.
-USING: accessors assocs compiler.units continuations fuel.eval
+USING: accessors assocs compiler.units continuations fry fuel.eval
fuel.help fuel.xref help.topics io.pathnames kernel namespaces parser
-parser.notes sequences tools.scaffold vocabs vocabs.files
+parser.notes sequences source-files tools.scaffold vocabs vocabs.files
vocabs.hierarchy vocabs.loader vocabs.metadata vocabs.parser words ;
IN: fuel
: fuel-eval-set-result ( obj -- )
clone eval-result set-global ; inline
-: fuel-retort ( -- ) send-retort ; inline
+: fuel-retort ( -- ) f f "" send-retort ; inline
! Loading files
SYMBOL: :uses
SYMBOL: :uses-suggestions
-: is-use-restart ( restart -- ? )
+: is-use-restart? ( restart -- ? )
name>> [ "Use the " head? ] [ " vocabulary" tail? ] bi and ;
: get-restart-vocab ( restart -- vocab/f )
obj>> dup word? [ vocabulary>> ] [ drop f ] if ;
-: is-suggested-restart ( restart -- ? )
- dup is-use-restart [
+: is-suggested-restart? ( restart -- ? )
+ dup is-use-restart? [
get-restart-vocab :uses-suggestions get member?
] [ drop f ] if ;
: try-suggested-restarts ( -- )
- restarts get [ is-suggested-restart ] filter
+ restarts get [ is-suggested-restart? ] filter
dup length 1 = [ first continue-restart ] [ drop ] if ;
: set-use-hook ( -- )
[ manifest get auto-used>> clone :uses prefix fuel-eval-set-result ]
print-use-hook set ;
-: get-uses ( lines -- )
- [
- parser-quiet? on
- parse-fresh drop
- ] curry with-compilation-unit ; inline
-
PRIVATE>
: fuel-use-suggested-vocabs ( ..a suggestions quot: ( ..a -- ..b ) -- ..b )
[ try-suggested-restarts rethrow ] recover ; inline
: fuel-run-file ( path -- )
- [ set-use-hook run-file ] curry with-scope ; inline
+ '[ _ set-use-hook run-file ] with-scope ; inline
: fuel-with-autouse ( ..a quot: ( ..a -- ..b ) -- ..b )
- [ set-use-hook call ] curry with-scope ; inline
-
-: fuel-get-uses ( lines -- )
- [ get-uses ] curry fuel-with-autouse ;
+ '[ _ set-use-hook call ] with-scope ; inline
+
+: fuel-get-uses ( name lines -- )
+ '[
+ [
+ _ [
+ parser-quiet? on
+ _ parse-fresh drop
+ ] with-source-file
+ ] with-compilation-unit
+ ] fuel-with-autouse ;
! Edit locations
! Help support
-: fuel-get-article ( name -- ) lookup-article fuel-eval-set-result ;
+: fuel-get-article ( name -- ) fuel.help:get-article fuel-eval-set-result ;
: fuel-get-article-title ( name -- )
articles get at [ article-title ] [ f ] if* fuel-eval-set-result ;