Mercurial > vim
annotate runtime/syntax/j.vim @ 7538:c9fc24b76293 v7.4.1070
commit https://github.com/vim/vim/commit/8a5115cf18751022387af2085f374d38c60dde83
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Jan 9 19:41:11 2016 +0100
patch 7.4.1070
Problem: The Tcl interface can't be loaded dynamically on Unix.
Solution: Make it possible to load it dynamically. (Ken Takata)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sat, 09 Jan 2016 19:45:05 +0100 |
parents | 198e1e498edf |
children | cb3163d590a1 |
rev | line source |
---|---|
5362
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
1 " Vim syntax file |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
2 " Language: J |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
3 " Maintainer: David Bürgin <676c7473@gmail.com> |
5734 | 4 " URL: https://github.com/glts/vim-j |
6505 | 5 " Last Change: 2015-01-11 |
5362
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
6 |
5734 | 7 if exists('b:current_syntax') |
5362
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
8 finish |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
9 endif |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
10 |
5815 | 11 let s:save_cpo = &cpo |
12 set cpo&vim | |
13 | |
5362
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
14 syntax case match |
6292
31f7581068a9
Update runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
5968
diff
changeset
|
15 syntax sync minlines=100 |
5362
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
16 |
5815 | 17 syntax cluster jStdlibItems contains=jStdlibNoun,jStdlibAdverb,jStdlibConjunction,jStdlibVerb |
18 syntax cluster jPrimitiveItems contains=jNoun,jAdverb,jConjunction,jVerb,jCopula | |
19 | |
5734 | 20 syntax match jControl /\<\%(assert\|break\|case\|catch[dt]\=\|continue\|do\|else\%(if\)\=\|end\|fcase\|for\|if\|return\|select\|throw\|try\|whil\%(e\|st\)\)\./ |
21 syntax match jControl /\<\%(for\|goto\|label\)_\a\k*\./ | |
5362
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
22 |
5815 | 23 " Standard library names. A few names need to be defined with ":syntax match" |
24 " because they would otherwise take precedence over the corresponding jControl | |
25 " and jDefineExpression items. | |
6505 | 26 syntax keyword jStdlibNoun ARGV BINPATH CR CRLF DEL Debug EAV EMPTY FF FHS IF64 IFIOS IFJCDROID IFJHS IFQT IFRASPI IFUNIX IFWIN IFWINCE IFWINE IFWOW64 JB01 JBOXED JCHAR JCMPX JFL JINT JPTR JSIZES JSTR JTYPES JVERSION LF LF2 TAB UNAME UNXLIB dbhelp libjqt |
27 syntax keyword jStdlibAdverb define each every fapplylines inv inverse items leaf rows rxapply rxmerge table | |
5815 | 28 syntax keyword jStdlibConjunction bind cuts def on |
6505 | 29 syntax keyword jStdlibVerb AND Endian IFDEF OR XOR anddf android_exec_am android_exec_host andunzip apply boxopen boxxopen bx calendar cd cdcb cder cderx cdf charsub chopstring cleartags clear coclass cocreate cocurrent codestroy coerase cofind cofindv cofullname coinfo coinsert compare coname conames conew conl conouns conounsx copath copathnl copathnlx coreset costate cut cutLF cutopen cutpara datatype dbctx dberm dberr dbg dbjmp dblocals dblxq dblxs dbnxt dbq dbr dbret dbrr dbrrx dbrun dbs dbsig dbsq dbss dbst dbstack dbstk dbstop dbstopme dbstopnext dbstops dbtrace dbview deb debc delstring detab dfh dir dircompare dircompares dirfind dirpath dirss dirssrplc dirtree dirused dlb dltb dltbs dquote drop dropafter dropto dtb dtbs echo empty endian erase evtloop exit expand f2utf8 fappend fappends fboxname fc fcompare fcompares fcopynew fdir ferase fetch fexist fexists fgets file2url fixdotdot fliprgb fmakex foldpara foldtext fpathcreate fpathname fputs fread freadblock freadr freads frename freplace fsize fss fssrplc fstamp fstringreplace ftype fview fwrite fwritenew fwrites getalpha getargs getdate getenv getqtbin hfd hostpathsep ic install iospath isatty isotimestamp isutf8 jcwdpath joinstring jpath jpathsep jsystemdefs launch list ljust load loadd loadtags mema memf memr memw nameclass namelist names nc nl pick quote require rjust rplc rxE rxall rxcomp rxcut rxeq rxerror rxfirst rxfree rxfrom rxhandles rxin rxindex rxinfo rxmatch rxmatches rxrplc rxutf8 script scriptd scripts setalpha setbreak shell show sign sminfo smoutput sort split splitnostring splitstring ss startupandroid startupconsole startupide stderr stdin stdout stringreplace symdat symget symset ta tagcp tagopen tagselect take takeafter taketo timespacex timestamp timex tmoutput toCRLF toHOST toJ todate todayno tolower topara toupper tsdiff tsrep tstamp type ucp ucpcount unxlib usleep utf8 uucp valdate wcsize weekday weeknumber weeksinyear winpathsep xedit |
5815 | 30 syntax match jStdlibNoun /\<\%(adverb\|conjunction\|dyad\|monad\|noun\|verb\)\>/ |
6505 | 31 syntax match jStdlibVerb /\<\%(Note\|\%(assert\|break\|do\)\.\@!\)\>/ |
5362
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
32 |
6292
31f7581068a9
Update runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
5968
diff
changeset
|
33 " Numbers. Matching J numbers is difficult. In fact, the job cannot be done |
31f7581068a9
Update runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
5968
diff
changeset
|
34 " with regular expressions alone. Below is a sketch of the pattern used. It |
31f7581068a9
Update runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
5968
diff
changeset
|
35 " accepts most well-formed numbers and rejects most of the ill-formed ones. |
31f7581068a9
Update runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
5968
diff
changeset
|
36 " See http://www.jsoftware.com/help/dictionary/dcons.htm for reference. |
5362
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
37 " |
6292
31f7581068a9
Update runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
5968
diff
changeset
|
38 " "double1" and "double2" patterns: |
31f7581068a9
Update runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
5968
diff
changeset
|
39 " (_?\d+(\.\d*)?|_\.\d+)([eE]_?\d+)? |
31f7581068a9
Update runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
5968
diff
changeset
|
40 " (_?\d+(\.\d*)?|_\.\d+|\.\d+)([eE]_?\d+)? |
5362
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
41 " |
6292
31f7581068a9
Update runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
5968
diff
changeset
|
42 " "rational1" and "rational2" patterns: |
31f7581068a9
Update runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
5968
diff
changeset
|
43 " \k<double1>(r\k<double2>)?|__? |
31f7581068a9
Update runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
5968
diff
changeset
|
44 " \k<double2>(r\k<double2>)?|__? |
5362
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
45 " |
6292
31f7581068a9
Update runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
5968
diff
changeset
|
46 " "complex1" and "complex2" patterns: |
31f7581068a9
Update runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
5968
diff
changeset
|
47 " \k<rational1>((j|a[dr])\k<rational2>)? |
31f7581068a9
Update runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
5968
diff
changeset
|
48 " \k<rational2>((j|a[dr])\k<rational2>)? |
31f7581068a9
Update runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
5968
diff
changeset
|
49 " |
31f7581068a9
Update runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
5968
diff
changeset
|
50 " "basevalue" pattern: |
31f7581068a9
Update runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
5968
diff
changeset
|
51 " _?[0-9a-z]+(\.[0-9a-z]*)?|_?\.[0-9a-z]+ |
5734 | 52 " |
6292
31f7581068a9
Update runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
5968
diff
changeset
|
53 " all numbers: |
31f7581068a9
Update runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
5968
diff
changeset
|
54 " \b\k<complex1>([px]\k<complex2>)?(b\k<basevalue>)?(?![0-9A-Za-z_.]) |
31f7581068a9
Update runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
5968
diff
changeset
|
55 syntax match jNumber /\<_\.[0-9A-Za-z_.]\@!/ |
31f7581068a9
Update runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
5968
diff
changeset
|
56 syntax match jNumber /\<_\=\d\+x[0-9A-Za-z_.]\@!/ |
31f7581068a9
Update runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
5968
diff
changeset
|
57 syntax match jNumber /\<\%(__\=r_\=\d\+\|_\=\d\+r__\=\)[0-9A-Za-z_.]\@!/ |
31f7581068a9
Update runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
5968
diff
changeset
|
58 syntax match jNumber /\<\%(\%(_\=\d\+\%(\.\d*\)\=\|_\.\d\+\)\%([eE]_\=\d\+\)\=\%(r\%(_\=\d\+\%(\.\d*\)\=\|_\.\d\+\|\.\d\+\)\%([eE]_\=\d\+\)\=\)\=\|__\=\)\%(\%(j\|a[dr]\)\%(\%(_\=\d\+\%(\.\d*\)\=\|_\.\d\+\|\.\d\+\)\%([eE]_\=\d\+\)\=\%(r\%(_\=\d\+\%(\.\d*\)\=\|_\.\d\+\|\.\d\+\)\%([eE]_\=\d\+\)\=\)\=\|__\=\)\)\=\%([px]\%(\%(_\=\d\+\%(\.\d*\)\=\|_\.\d\+\|\.\d\+\)\%([eE]_\=\d\+\)\=\%(r\%(_\=\d\+\%(\.\d*\)\=\|_\.\d\+\|\.\d\+\)\%([eE]_\=\d\+\)\=\)\=\|__\=\)\%(\%(j\|a[dr]\)\%(\%(_\=\d\+\%(\.\d*\)\=\|_\.\d\+\|\.\d\+\)\%([eE]_\=\d\+\)\=\%(r\%(_\=\d\+\%(\.\d*\)\=\|_\.\d\+\|\.\d\+\)\%([eE]_\=\d\+\)\=\)\=\|__\=\)\)\=\)\=\%(b\%(_\=[0-9a-z]\+\%(\.[0-9a-z]*\)\=\|_\=\.[0-9a-z]\+\)\)\=[0-9A-Za-z_.]\@!/ |
5362
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
59 |
5815 | 60 syntax region jString oneline start=/'/ skip=/''/ end=/'/ |
61 | |
62 syntax keyword jArgument contained x y u v m n | |
63 | |
64 " Primitives. Order is significant both within the patterns and among | |
65 " ":syntax match" statements. Refer to "Parts of speech" in the J dictionary. | |
66 syntax match jNoun /\<a[.:]/ | |
67 syntax match jAdverb /[}~]\|[/\\]\.\=\|\<\%([Mbft]\.\|t:\)/ | |
68 syntax match jConjunction /"\|`:\=\|[.:@&][.:]\=\|&\.:\|\<\%([dDHT]\.\|[DLS]:\)/ | |
69 syntax match jVerb /[=!\]]\|[\^?]\.\=\|[;[]:\=\|{\.\|[_/\\]:\|[<>+*\-%$|,#][.:]\=\|[~}"][.:]\|{\%[::]\|\<\%([ACeEiIjLor]\.\|p\.\.\=\|[ipqsux]:\|0:\|_\=[1-9]:\)/ | |
70 syntax match jCopula /=[.:]/ | |
71 syntax match jConjunction /;\.\|\^:\|![.:]/ | |
72 | |
5968 | 73 " Explicit noun definition. The difficulty is that the define expression can |
74 " occur in the middle of a line but the jNounDefine region must only start on | |
75 " the next line. The trick is to split the problem into two regions and link | |
76 " them with "nextgroup=". The fold wrapper provides syntax folding. | |
77 syntax region jNounDefineFold | |
6505 | 78 \ matchgroup=NONE start=/\%(\%(\%(^\s*Note\)\|\<\%(0\|noun\)\s\+\%(\:\s*0\|def\s\+0\|define\)\)\>\)\@=/ |
5968 | 79 \ keepend matchgroup=NONE end=/^\s*)\s*$/ |
80 \ contains=jNounDefineStart | |
81 \ fold | |
5815 | 82 syntax region jNounDefineStart |
6505 | 83 \ matchgroup=jDefineExpression start=/\%(\%(^\s*Note\)\|\<\%(0\|noun\)\s\+\%(\:\s*0\|def\s\+0\|define\)\)\>/ |
5815 | 84 \ keepend matchgroup=NONE end=/$/ |
85 \ contains=@jStdlibItems,@jPrimitiveItems,jNumber,jString,jParenGroup,jParen,jComment | |
5968 | 86 \ contained oneline skipempty nextgroup=jDefineEnd,jNounDefine |
5815 | 87 " These two items must have "contained", which allows them to match only after |
88 " jNounDefineStart thanks to the "nextgroup=" above. | |
89 syntax region jNounDefine | |
90 \ matchgroup=NONE start=/^/ | |
91 \ matchgroup=jDefineEnd end=/^\s*)\s*$/ | |
92 \ contained | |
93 " This match is necessary in case of an empty noun definition | |
94 syntax match jDefineEnd contained /^\s*)\s*$/ | |
95 | |
96 " Explicit verb, adverb, and conjunction definition | |
97 syntax region jDefine | |
98 \ matchgroup=jDefineExpression start=/\<\%([1-4]\|13\|adverb\|conjunction\|verb\|monad\|dyad\)\s\+\%(:\s*0\|def\s\+0\|define\)\>/ | |
99 \ matchgroup=jDefineEnd end=/^\s*)\s*$/ | |
100 \ contains=jControl,@jStdlibItems,@jPrimitiveItems,jNumber,jString,jArgument,jParenGroup,jParen,jComment,jDefineMonadDyad | |
5968 | 101 \ fold |
5815 | 102 syntax match jDefineMonadDyad contained /^\s*:\s*$/ |
103 | |
104 " Paired parentheses. When a jDefineExpression such as "3 : 0" is | |
105 " parenthesised it will erroneously extend jParenGroup to span over the whole | |
106 " definition body. This situation receives a special treatment here. | |
107 syntax match jParen /(\%(\s*\%([0-4]\|13\|noun\|adverb\|conjunction\|verb\|monad\|dyad\)\s\+\%(:\s*0\|def\s\+0\|define\)\s*)\)\@=/ | |
108 syntax match jParen contained /\%((\s*\%([0-4]\|13\|noun\|adverb\|conjunction\|verb\|monad\|dyad\)\s\+\%(:\s*0\|def\s\+0\|define\)\s*\)\@<=)/ | |
109 syntax region jParenGroup | |
110 \ matchgroup=jParen start=/(\%(\s*\%([0-4]\|13\|noun\|adverb\|conjunction\|verb\|monad\|dyad\)\s\+\%(:\s*0\|def\s\+0\|define\)\>\)\@!/ | |
111 \ matchgroup=jParen end=/)/ | |
112 \ oneline transparent | |
113 | |
114 syntax keyword jTodo contained TODO FIXME XXX | |
6505 | 115 syntax match jComment /\<NB\..*$/ contains=jTodo,@Spell |
5815 | 116 |
5734 | 117 syntax match jSharpBang /\%^#!.*$/ |
5362
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
118 |
5815 | 119 highlight default link jControl Statement |
120 highlight default link jStdlibNoun Identifier | |
121 highlight default link jStdlibAdverb Function | |
122 highlight default link jStdlibConjunction Function | |
123 highlight default link jStdlibVerb Function | |
124 highlight default link jString String | |
125 highlight default link jNumber Number | |
126 highlight default link jNoun Constant | |
127 highlight default link jAdverb Normal | |
128 highlight default link jConjunction Normal | |
129 highlight default link jVerb Normal | |
130 highlight default link jCopula Normal | |
131 highlight default link jArgument Identifier | |
132 highlight default link jParen Delimiter | |
133 | |
134 highlight default link jDefineExpression Define | |
135 highlight default link jDefineMonadDyad Delimiter | |
136 highlight default link jDefineEnd Delimiter | |
137 highlight default link jNounDefine Normal | |
138 | |
139 highlight default link jTodo Todo | |
140 highlight default link jComment Comment | |
141 highlight default link jSharpBang PreProc | |
5362
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
142 |
5734 | 143 let b:current_syntax = 'j' |
5815 | 144 |
145 let &cpo = s:save_cpo | |
146 unlet s:save_cpo |