annotate runtime/syntax/lhaskell.vim @ 11510:deb9295dccda v8.0.0638

patch 8.0.0638: cannot build with new MSVC version commit https://github.com/vim/vim/commit/d7383881c8e9f474a909b54b21abb0aa2b412ba2 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Jun 13 15:22:12 2017 +0200 patch 8.0.0638: cannot build with new MSVC version Problem: Cannot build with new MSVC version VS2017. Solution: Change the compiler arguments. (Leonardo Manera, closes https://github.com/vim/vim/issues/1731, closes #1747)
author Christian Brabandt <cb@256bit.org>
date Tue, 13 Jun 2017 15:30:03 +0200
parents 46763b01cd9a
children ef454a7f485d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1 " Vim syntax file
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2 " Language: Haskell with literate comments, Bird style,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3 " TeX style and plain text surrounding
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4 " \begin{code} \end{code} blocks
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5 " Maintainer: Haskell Cafe mailinglist <haskell-cafe@haskell.org>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6 " Original Author: Arthur van Leeuwen <arthurvl@cs.uu.nl>
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2034
diff changeset
7 " Last Change: 2010 Apr 11
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
8 " Version: 1.04
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10 " Thanks to Ian Lynagh for thoughtful comments on initial versions and
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
11 " for the inspiration for writing this in the first place.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
12 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
13 " This style guesses as to the type of markup used in a literate haskell
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
14 " file and will highlight (La)TeX markup if it finds any
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
15 " This behaviour can be overridden, both glabally and locally using
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
16 " the lhs_markup variable or b:lhs_markup variable respectively.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
17 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
18 " lhs_markup must be set to either tex or none to indicate that
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
19 " you always want (La)TeX highlighting or no highlighting
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
20 " must not be set to let the highlighting be guessed
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
21 " b:lhs_markup must be set to eiterh tex or none to indicate that
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
22 " you want (La)TeX highlighting or no highlighting for
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
23 " this particular buffer
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
24 " must not be set to let the highlighting be guessed
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
25 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
26 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
27 " 2004 February 18: New version, based on Ian Lynagh's TeX guessing
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
28 " lhaskell.vim, cweb.vim, tex.vim, sh.vim and fortran.vim
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
29 " 2004 February 20: Cleaned up the guessing and overriding a bit
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
30 " 2004 February 23: Cleaned up syntax highlighting for \begin{code} and
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
31 " \end{code}, added some clarification to the attributions
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
32 " 2008 July 1: Removed % from guess list, as it totally breaks plain
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
33 " text markup guessing
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
34 " 2009 April 29: Fixed highlighting breakage in TeX mode,
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
35 " thanks to Kalman Noel
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
36 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
37
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
38
10048
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 2152
diff changeset
39 " quit when a syntax file was already loaded
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 2152
diff changeset
40 if exists("b:current_syntax")
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
41 finish
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
42 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
43
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
44 " First off, see if we can inherit a user preference for lhs_markup
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
45 if !exists("b:lhs_markup")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
46 if exists("lhs_markup")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
47 if lhs_markup =~ '\<\%(tex\|none\)\>'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
48 let b:lhs_markup = matchstr(lhs_markup,'\<\%(tex\|none\)\>')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
49 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
50 echohl WarningMsg | echo "Unknown value of lhs_markup" | echohl None
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
51 let b:lhs_markup = "unknown"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
52 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
53 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
54 let b:lhs_markup = "unknown"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
55 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
56 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
57 if b:lhs_markup !~ '\<\%(tex\|none\)\>'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
58 let b:lhs_markup = "unknown"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
59 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
60 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
61
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
62 " Remember where the cursor is, and go to upperleft
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
63 let s:oldline=line(".")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
64 let s:oldcolumn=col(".")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
65 call cursor(1,1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
66
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
67 " If no user preference, scan buffer for our guess of the markup to
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
68 " highlight. We only differentiate between TeX and plain markup, where
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
69 " plain is not highlighted. The heuristic for finding TeX markup is if
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
70 " one of the following occurs anywhere in the file:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
71 " - \documentclass
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
72 " - \begin{env} (for env != code)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
73 " - \part, \chapter, \section, \subsection, \subsubsection, etc
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
74 if b:lhs_markup == "unknown"
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
75 if search('\\documentclass\|\\begin{\(code}\)\@!\|\\\(sub\)*section\|\\chapter|\\part','W') != 0
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
76 let b:lhs_markup = "tex"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
77 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
78 let b:lhs_markup = "plain"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
79 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
80 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
81
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
82 " If user wants us to highlight TeX syntax or guess thinks it's TeX, read it.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
83 if b:lhs_markup == "tex"
10048
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 2152
diff changeset
84 runtime! syntax/tex.vim
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 2152
diff changeset
85 unlet b:current_syntax
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 2152
diff changeset
86 " Tex.vim removes "_" from 'iskeyword', but we need it for Haskell.
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 2152
diff changeset
87 setlocal isk+=_
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
88 syntax cluster lhsTeXContainer contains=tex.*Zone,texAbstract
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
89 else
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
90 syntax cluster lhsTeXContainer contains=.*
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
91 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
92
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
93 " Literate Haskell is Haskell in between text, so at least read Haskell
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
94 " highlighting
10048
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 2152
diff changeset
95 syntax include @haskellTop syntax/haskell.vim
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
96
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
97 syntax region lhsHaskellBirdTrack start="^>" end="\%(^[^>]\)\@=" contains=@haskellTop,lhsBirdTrack containedin=@lhsTeXContainer
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2034
diff changeset
98 syntax region lhsHaskellBeginEndBlock start="^\\begin{code}\s*$" matchgroup=NONE end="\%(^\\end{code}.*$\)\@=" contains=@haskellTop,beginCodeBegin containedin=@lhsTeXContainer
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
99
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
100 syntax match lhsBirdTrack "^>" contained
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
101
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
102 syntax match beginCodeBegin "^\\begin" nextgroup=beginCodeCode contained
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
103 syntax region beginCodeCode matchgroup=texDelimiter start="{" end="}"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
104
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
105 " Define the default highlighting.
10048
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 2152
diff changeset
106 " Only when an item doesn't have highlighting yet
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 2152
diff changeset
107
10051
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
108 hi def link lhsBirdTrack Comment
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
109
10051
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
110 hi def link beginCodeBegin texCmdName
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
111 hi def link beginCodeCode texSection
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
112
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
113
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
114 " Restore cursor to original position, as it may have been disturbed
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
115 " by the searches in our guessing code
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
116 call cursor (s:oldline, s:oldcolumn)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
117
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
118 unlet s:oldline
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
119 unlet s:oldcolumn
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
120
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
121 let b:current_syntax = "lhaskell"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
122
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
123 " vim: ts=8