Comments for Brian Schott
Thanks for improving the qdoj page. I think I'll make the page's text a description of the tool and just leave the nice script you added as the formal source for the code. Maybe I can make an AddOn .
Appreciate your help.
-- DanBron 2007-10-27 22:01:16
This is the syntax/j.vim file I am using. I received it from Mike Manti who said he might update it, but has not. It does not seem to work as can be seen in the snippet below. Can others recommend improvements, please?
You can see in this example that especially the & and &. colors are unpredictable, for example.
cat /usr/share/vim/vim62/syntax/j.vim
" Vim syntax file
" Language: J
" Author: Michael Manti (mmanti@mac.com)
" Version: 0.1
" Date: Fri Jul 11 21:18:41 EDT 2003
" Last Changed: Fri Jul 11 21:18:41 EDT 2003
" Derived From: ijs.vim by Unknown
syntax clear
syntax case match
syntax sync fromstart
setlocal iskeyword=a-z,.,_
syntax keyword jStatement do. end.
syntax keyword jConditional if. elseif. else. select. case. fcase.
syntax keyword jException assert. try. throw. catch. catcht. catchd.
syntax keyword jRepeat for. while. whilst. break. continue. return.
syntax match jIdentifier /\a\+\d*\%(_\%(\a\+\d*\)\=_\)\=/
syntax match jVerb /[][{=!#$%^*+[|;,<>?-]/
syntax match jAdverb /[/\~}]/
syntax match jConjunction /[.:"@&`]/
syntax match jConjunction /[!@^&_`DLS]:/
syntax match jConjunction /[;!@&dDHT]\./
syntax match jAdverb /[/\~bft]\./
syntax match jVerb /["-~#$%^*+|,{}<>?]\./
syntax match jVerb /[AcCeEijLopr]\./
syntax match jVerb /[ipq]:/
syntax match jVerb /[-~#$%^*+[|;,{}<>?\/]:/
syntax match jVerb /_\=[0-9_]\+:/
syntax match jPlaceholder /[mnuvxy]\./
syntax match jCopula /=[.:]/
syntax match jRepeat /for_\a\+\./
syntax match jComment /NB\..*$/
syntax region jString start=/'/ end=/'/
" enable syntax folding with
" :set foldmethod=syntax
syntax region jDef
\ start=/^\s*\a\+\d*\%(_\a\+\d*_\)\=\s*=[.:]\s*\%([0-4]\|13\)\s*:\s*0\s*$/
\ end=/^\s*)\s*$/
\ contains=ALLBUT,jDef
\ transparent keepend fold
syntax region jDef
\ start=/^\s*\a\+\d*\%(_\a\+\d*_\)\=\s*=[.:]\s*noun\s\+define\s*$/
\ end=/^\s*)\s*$/
\ contains=ALLBUT,jDef
\ transparent keepend fold
syntax region jDef
\ start=/^\s*\a\+\d*\%(_\a\+\d*_\)\=\s*=[.:]\s*adverb\s\+define\s*$/
\ end=/^\s*)\s*$/
\ contains=ALLBUT,jDef
\ transparent keepend fold
syntax region jDef
\ start=/^\s*\a\+\d*\%(_\a\+\d*_\)\=\s*=[.:]\s*conjunction\s\+define\s*$/
\ end=/^\s*)\s*$/
\ contains=ALLBUT,jDef
\ transparent keepend fold
syntax region jDef
\ start=/^\s*\a\+\d*\%(_\a\+\d*_\)\=\s*=[.:]\s*verb\s\+define\s*$/
\ end=/^\s*)\s*$/
\ contains=ALLBUT,jDef
\ transparent keepend fold
syntax region jDef
\ start=/^\s*\a\+\d*\%(_\a\+\d*_\)\=\s*=[.:]\s*monad\s\+define\s*$/
\ end=/^\s*)\s*$/
\ contains=ALLBUT,jDef
\ transparent keepend fold
syntax region jDef
\ start=/^\s*\a\+\d*\%(_\a\+\d*_\)\=\s*=[.:]\s*dyad\s\+define\s*$/
\ end=/^\s*)\s*$/
\ contains=ALLBUT,jDef
\ transparent keepend fold
syntax region jBlock
\ start=/^\s*\%(if\|select\|try\|for\|while\|whilst\)\./
\ end=/^\s*end\.\s*$/
\ contains=ALLBUT,jDef
\ transparent keepend extend fold
syntax region jBlock
\ start=/^\s*for_\a\+\./
\ end=/^\s*end\.\s*$/
\ contains=ALLBUT,jDef
\ transparent keepend extend fold
hi link jStatement Statement
hi link jConditional Conditional
hi link jException Exception
hi link jRepeat Repeat
hi link jIdentifier Identifier
hi link jString String
hi link jComment Comment
hi jCopula guifg=black
hi jConjunction guifg=red
hi jAdverb guifg=orange
hi jVerb guifg=green
hi jPlaceholder guifg=yellow-- BrianSchott <<DateTime: Bad timestamp u'2009-1-22T014:48:16Z': invalid literal for float(): 2009-1-22T014:48:16Z>>
The j.vim file has several problems.
syntax match jVerb /["-~#$%^*+|,{}<>?]\./This matches every character in the character range "-~ followed by a dot, and identifies that as a verb (later rules override earlier rules). I recommend that "-~ be changed to -"~
syntax match jConjunction /[.:"@&`]/
This mis-handles . and :
I recommend this be replaced by two rules:
syntax match jConjunction /["@&`]/ syntax match jConjunction /\(^\| \)[.:][.:]*/
Also, &.: needs to be handled
syntax match jConjunction /[&]\.\:/
There may be other issues?
Also, this would have been simpler to isolate if I had found the example file in text format.
-- Raul Miller 2009-01-23 22:36:55
