Merge branch 'master' of git://factorcode.org/git/factor

db4
otoburb 2011-03-26 20:19:52 +00:00
commit 906e6f73dc
5 changed files with 102 additions and 81 deletions

View File

@ -90,10 +90,10 @@ SYMBOL: error-stream
PRIVATE>
: each-stream-line ( stream quot -- )
: each-stream-line ( ... stream quot: ( ... line -- ... ) -- ... )
swap [ stream-readln ] curry each-morsel ; inline
: each-line ( quot -- )
: each-line ( ... quot: ( ... line -- ... ) -- ... )
input-stream get swap each-stream-line ; inline
: stream-lines ( stream -- seq )
@ -102,21 +102,21 @@ PRIVATE>
: lines ( -- seq )
input-stream get stream-lines ; inline
: each-stream-block ( ... stream quot: ( ... block -- ... ) -- ... )
swap 65536 swap [ stream-read-partial ] 2curry each-morsel ; inline
: each-block ( ... quot: ( ... block -- ... ) -- ... )
input-stream get swap each-stream-block ; inline
: stream-contents ( stream -- seq )
[
[ [ 65536 swap stream-read-partial dup ] curry [ ] produce nip ]
[ [ ] collector [ each-stream-block ] dip { } like ]
[ stream-element-exemplar concat-as ] bi
] with-disposal ;
: contents ( -- seq )
input-stream get stream-contents ; inline
: each-stream-block ( stream quot: ( block -- ) -- )
swap [ 8192 swap stream-read-partial ] curry each-morsel ; inline
: each-block ( quot: ( block -- ) -- )
input-stream get swap each-stream-block ; inline
: stream-copy ( in out -- )
[ [ [ write ] each-block ] with-output-stream ]
curry with-input-stream ;

View File

@ -12,7 +12,7 @@ IN: factor.vim.fgen
" Vim syntax file
" Language: Factor
" Maintainer: Alex Chapman <chapman.alex@gmail.com>
" Last Change: 2011 Mar 18
" Last Change: 2011 Mar 21
" To run: USING: html.templates html.templates.fhtml ; "resource:misc/factor.vim.fgen" <fhtml> call-template
" For version 5.x: Clear all syntax items
@ -150,8 +150,9 @@ syn cluster factorWordOps contains=factorConstant,factorAlias,factorSingle
" LIBRARY:
"#\ "
syn region factorString start=/\<"/ skip=/\\"/ end=/"/
syn region factorTriString start=/\<"""/ skip=/\\"/ end=/"""/
syn match factorEscape /\\\([\\stnr0e\"]\|u\x\{6}\|u{\S\+}\)/ contained display
syn region factorString start=/\<"/ skip=/\\"/ end=/"/ contains=factorEscape
syn region factorTriString start=/\<"""/ skip=/\\"/ end=/"""/ contains=factorEscape
syn region factorSbuf start=/\<[-a-zA-Z0-9]\+"\>/ skip=/\\"/ end=/"/
syn region factorMultiString matchgroup=factorMultiStringDelims start=/\<STRING:\s\+\S\+\>/ end=/^;$/ contains=factorMultiStringContents
@ -235,6 +236,7 @@ if version >= 508 || !exists("did_factor_syn_inits")
HiLink factorPrivateMethodDelims Special
HiLink factorPGenericDelims Special
HiLink factorPGenericNDelims Special
HiLink factorEscape SpecialChar
HiLink factorString String
HiLink factorTriString String
HiLink factorSbuf String
@ -317,4 +319,4 @@ endif
let b:current_syntax = "factor"
" vim: syntax=vim
" vim:set ft=vim sw=4:

View File

@ -1,64 +0,0 @@
Vim support for Factor
----------------------
This directory contains various support files that make editing Factor code
more pleasant in Vim. The file-layout exactly matches the Vim runtime
structure, so you can install them by copying the contents of this directory
into ~/.vim/ or the equivalent path on other platforms (Open Vim and type
":help 'runtimepath'" for details).
The current set of files is as follows:
ftdetect/factor.vim
Teach Vim when to load Factor support files.
ftplugin/factor_settings.vim
Teach Vim to follow the Factor Coding Style guidelines.
plugin/factor.vim
Teach Vim some commands for navigating Factor source code. See below.
syntax/factor.vim
Syntax highlighting for Factor code.
The "plugin/factor.vim" file implements the following commands for
navigating Factor source:
:FactorVocab factor.vocab.name
Opens the source file implementing the "factor.vocab.name"
vocabulary.
:NewFactorVocab factor.vocab.name
Creates a new factor vocabulary under the working vocabulary root.
:FactorVocabImpl
Opens the main implementation file for the current vocabulary
(name.factor). The keyboard shortcut "\fi" is bound to this
command.
:FactorVocabDocs
Opens the documentation file for the current vocabulary
(name-docs.factor). The keyboard shortcut "\fd" is bound to this
command.
:FactorVocabTests
Opens the unit test file for the current vocabulary
(name-tests.factor). The keyboard shortcut "\ft" is bound to this
command.
In order for the ":FactorVocab" command to work, you'll need to set some
variables in your vimrc file:
g:FactorRoot
This variable should be set to the root of your Factor
installation. The default value is "~/factor".
g:FactorVocabRoots
This variable should be set to a list of Factor vocabulary roots.
The paths may be either relative to g:FactorRoot or absolute paths.
The default value is ["core", "basis", "extra", "work"].
g:FactorNewVocabRoot
This variable should be set to the vocabulary root in which
vocabularies created with NewFactorVocab should be created. The
default value is "work".
Note: The syntax-highlighting file is automatically generated to include the
names of all the vocabularies Factor knows about. To regenerate it manually,
run the following code in the listener:
"editors.vim.generate-syntax" run
...or run it from the command line:
factor -run=editors.vim.generate-syntax

81
misc/vim/README.md Normal file
View File

@ -0,0 +1,81 @@
Vim support for Factor
======================
This directory contains various support files that make editing Factor code
more pleasant in Vim.
## Installation
The file-layout exactly matches the Vim runtime
structure, so you can install them by copying the contents of this directory
into `~/.vim/` or the equivalent path on other platforms (Open Vim and type
`:help 'runtimepath'` for details).
## File organization
The current set of files is as follows:
* ftdetect/factor.vim - Teach Vim when to load Factor support files.
* ftplugin/factor_settings.vim - Teach Vim to follow the Factor Coding Style guidelines.
* plugin/factor.vim - Teach Vim some commands for navigating Factor source code. See below.
* syntax/factor.vim - Syntax highlighting for Factor code.
## Commands
The `plugin/factor.vim` file implements the following commands for navigating Factor source.
### :FactorVocab factor.vocab.name
Opens the source file implementing the `factor.vocab.name` vocabulary.
### :NewFactorVocab factor.vocab.name
Creates a new factor vocabulary under the working vocabulary root.
### :FactorVocabImpl
Opens the main implementation file for the current vocabulary
(name.factor). The keyboard shortcut `<Leader>fi` is bound to this command.
### :FactorVocabDocs
Opens the documentation file for the current vocabulary
(name-docs.factor). The keyboard shortcut `<Leader>fd` is bound to this command.
### :FactorVocabTests
Opens the unit test file for the current vocabulary
(name-tests.factor). The keyboard shortcut `<Leader>ft` is bound to this command.
## Configuration
In order for the `:FactorVocab` command to work, you'll need to set some variables in your vimrc file.
### g:FactorRoot
This variable should be set to the root of your Factor
installation. The default value is `~/factor`.
### g:FactorVocabRoots
This variable should be set to a list of Factor vocabulary roots.
The paths may be either relative to g:FactorRoot or absolute paths.
The default value is `["core", "basis", "extra", "work"]`.
### g:FactorNewVocabRoot
This variable should be set to the vocabulary root in which
vocabularies created with NewFactorVocab should be created.
The default value is `work`.
## Note
The syntax-highlighting file is automatically generated to include the
names of all the vocabularies Factor knows about. To regenerate it manually,
run the following code in the listener:
"editors.vim.generate-syntax" run
or run it from the command line:
factor -run=editors.vim.generate-syntax

View File

@ -1,7 +1,7 @@
" Vim syntax file
" Language: Factor
" Maintainer: Alex Chapman <chapman.alex@gmail.com>
" Last Change: 2011 Mar 18
" Last Change: 2011 Mar 21
" To run: USING: html.templates html.templates.fhtml ; "resource:misc/factor.vim.fgen" <fhtml> call-template
" For version 5.x: Clear all syntax items
@ -137,8 +137,9 @@ syn cluster factorWordOps contains=factorConstant,factorAlias,factorSingle
" LIBRARY:
"#\ "
syn region factorString start=/\<"/ skip=/\\"/ end=/"/
syn region factorTriString start=/\<"""/ skip=/\\"/ end=/"""/
syn match factorEscape /\\\([\\stnr0e\"]\|u\x\{6}\|u{\S\+}\)/ contained display
syn region factorString start=/\<"/ skip=/\\"/ end=/"/ contains=factorEscape
syn region factorTriString start=/\<"""/ skip=/\\"/ end=/"""/ contains=factorEscape
syn region factorSbuf start=/\<[-a-zA-Z0-9]\+"\>/ skip=/\\"/ end=/"/
syn region factorMultiString matchgroup=factorMultiStringDelims start=/\<STRING:\s\+\S\+\>/ end=/^;$/ contains=factorMultiStringContents
@ -222,6 +223,7 @@ if version >= 508 || !exists("did_factor_syn_inits")
HiLink factorPrivateMethodDelims Special
HiLink factorPGenericDelims Special
HiLink factorPGenericNDelims Special
HiLink factorEscape SpecialChar
HiLink factorString String
HiLink factorTriString String
HiLink factorSbuf String
@ -304,4 +306,4 @@ endif
let b:current_syntax = "factor"
" vim: syntax=vim
" vim:set ft=vim sw=4: