view runtime/syntax/j.vim @ 5403:b9c1c1f4cda9 v7.4.052

updated for version 7.4.052 Problem: With 'fo' set to "a2" inserting a space in the first column may cause the cursor to jump to the previous line. Solution: Handle the case when there is no comment leader properly. (Tor Perkins) Also fix that cursor is in the wrong place when spaces get replaced with a Tab.
author Bram Moolenaar <bram@vim.org>
date Sun, 06 Oct 2013 17:46:56 +0200
parents ab1508486b12
children 9521463d4fc1
line wrap: on
line source

" Vim syntax file
" Language:	J
" Maintainer:	David Bürgin <676c7473@gmail.com>
" Last Change:	2013-09-21

if exists("b:current_syntax")
  finish
endif

syntax case match
syntax sync minlines=50

syn match jControl /\<\%(assert\|break\|case\|catch[dt]\=\|continue\|do\|else\%(if\)\=\|end\|fcase\|for\|if\|return\|select\|throw\|try\|whil\%(e\|st\)\)\./
syn match jControl /\<\%(for\|goto\|label\)_\a\k*\./

syn region jString oneline start=/'/ skip=/''/ end=/'/

" Patterns for numbers in general, rational numbers, numbers with explicit
" base, infinities, and numbers with extended precision.
"
" Matching J numbers is difficult. The regular expression used for the general
" case roughly embodies this grammar sketch:
"
"         EXP     := /_?\d+(\.\d*)?([eE]_?\d+)?/
"         COMP    := EXP  |  EXP (j|a[dr]) EXP
"         PIEU    := COMP  |  COMP [px] COMP
"
" For the rest, a compromise between correctness and practicality was made.
" See http://www.jsoftware.com/help/dictionary/dcons.htm for reference.
syn match jNumber /\<_\=\d\+\%(\.\d*\)\=\%([eE]_\=\d\+\)\=\%(\%(j\|a[dr]\)_\=\d\+\%(\.\d*\)\=\%([eE]_\=\d\+\)\=\)\=\%([px]_\=\d\+\%(\.\d*\)\=\%([eE]_\=\d\+\)\=\%(\%(j\|a[dr]\)_\=\d\+\%(\.\d*\)\=\%([eE]_\=\d\+\)\=\)\=\)\=/
syn match jNumber /\<_\=\d\+\%(\.\d*\)\=\%([eE]_\=\d\+\)\=r_\=\d\+\%(\.\d*\)\=\%([eE]_\=\d\+\)\=/
syn match jNumber /\<_\=\d\+\%([eE]\d\+\)\=b_\=[0-9a-z]\+/
syn match jNumber /\<__\=\>/
syn match jNumber /\<_\=\d\+x\>/

syn match jComment /NB\..*$/

hi def link jControl Statement
hi def link jString String
hi def link jNumber Number
hi def link jComment Comment

let b:current_syntax = "j"