- directory listings\r
- index.html\r
- if a directory is requested and URL does not end with /, redirect\r
-- doc strings with native factor\r
\r
+ bignums:\r
\r
\r
+ listener/plugin:\r
\r
+- inferior hangs\r
- plugin should not exit jEdit on fatal errors\r
- auto insert USE:\r
- balance needs USE:\r
USE: unparser
USE: words
+: prettyprint-:; ( indent word list -- indent )
+ over >r >r dup
+ >r dupd prettyprint-IN: prettyprint-: r>
+ prettyprint-word prettyprint-space
+ r>
+ prettyprint-list prettyprint-; r> prettyprint-plist ;
+
: prettyprint-~<< ( indent -- indent )
"~<<" write prettyprint-space
tab-size + ;
! OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
! ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-! Parsing words. 'builtins' is a stupid vocabulary name now
-! that it does not contain Java words anymore!
IN: syntax
USE: combinators
USE: vectors
USE: unparser
+! The variable "in-definition" is set inside a : ... ;.
+! ( and #! then add "stack-effect" and "documentation"
+! properties to the current word if it is set.
+
! Constants
: t t parsed ; parsing
: f f parsed ; parsing
: POSTPONE: ( -- ) scan parse-word parsed ; parsing
! Colon defs
-: CREATE scan "in" get create ;
+: CREATE
+ scan "in" get create dup set-word
+ f "documentation" pick set-word-property ;
: remember-where ( word -- )
"line-number" get "line" pick set-word-property
: :
#! Begin a word definition. Word name follows.
- CREATE dup remember-where [ ] ; parsing
+ CREATE dup remember-where [ ]
+ "in-definition" on ; parsing
: ;-hook ( -- quot )
";-hook" get [ [ define-compound ] ] unless* ;
: ;
#! End a word definition.
+ "in-definition" off
nreverse
;-hook call ; parsing
scan str>number scan str>number rect> parsed "}" expect ;
! Comments
-: ( ")" until drop ; parsing
+: doc-comment-here? ( parsed -- ? )
+ not "in-definition" get and ;
+
+: parsed-stack-effect ( parsed str -- parsed )
+ over doc-comment-here? [
+ "stack-effect" word set-word-property
+ ] [
+ drop
+ ] ifte ;
+
+: ( ")" until parsed-stack-effect ; parsing
+
: ! until-eol drop ; parsing
-: #! until-eol drop ; parsing
+
+: parsed-documentation ( parsed str -- parsed )
+ over doc-comment-here? [
+ "documentation" word word-property [
+ swap "\n" swap cat3
+ ] when* "documentation" word set-word-property
+ ] [
+ drop
+ ] ifte ;
+
+: #! until-eol parsed-documentation ; parsing
! Reading numbers in other bases
IN: prettyprint
USE: combinators
+USE: lists
USE: parser
USE: prettyprint
USE: stack
USE: stdio
+USE: strings
USE: unparser
USE: words
+: prettyprint-docs ( indent word -- indent )
+ [
+ stack-effect [
+ <% CHAR: ( % % CHAR: ) % %> prettyprint-comment
+ dup prettyprint-newline
+ ] when*
+ ] keep
+
+ documentation [
+ "\n" split [
+ "#!" swap cat2 prettyprint-comment
+ dup prettyprint-newline
+ ] each
+ ] when* ;
+
: see-compound ( word -- )
- 0 swap dup word-parameter prettyprint-:;
- prettyprint-newline ;
+ 0 swap
+ [ dupd prettyprint-IN: prettyprint-: ] keep
+ [ prettyprint-word prettyprint-space ] keep
+ [ prettyprint-docs ] keep
+ [ word-parameter prettyprint-list prettyprint-; ] keep
+ prettyprint-plist prettyprint-newline ;
: see-primitive ( word -- )
"PRIMITIVE: " write unparse print ;
drop "Not defined" print ;
: see ( name -- )
+ #! Show a word definition.
intern
[
[ compound? ] [ see-compound ]
: define-compound ( word def -- )
#! Define a compound word at runtime.
- over set-word
over set-word-parameter
1 swap set-word-primitive ;
+
+: stack-effect ( word -- str )
+ "stack-effect" swap word-property ;
+
+: documentation ( word -- str )
+ "documentation" swap word-property ;
: prettyprint-vocab ( vocab -- )
dup vocab-attrs write-attr ;
-: prettyprint-IN: ( indent word -- indent )
+: prettyprint-IN: ( indent word -- )
"IN:" write prettyprint-space
- word-vocabulary prettyprint-vocab
- dup prettyprint-newline ;
+ word-vocabulary prettyprint-vocab prettyprint-newline ;
: prettyprint-: ( indent -- indent )
":" write prettyprint-space
"inline" over word-property [ " inline" write ] when
drop ;
-: prettyprint-:; ( indent word list -- indent )
- over >r >r dup
- >r prettyprint-IN: prettyprint-: r>
- prettyprint-word
- native? [ dup prettyprint-newline ] [ prettyprint-space ] ifte
- r>
- prettyprint-list prettyprint-; r> prettyprint-plist ;
-
: . ( obj -- )
[
"prettyprint-single-line" on