annotate runtime/syntax/elm.vim @ 27784:bfce04a99561 v8.2.4418

patch 8.2.4418: crash when using special multi-byte character Commit: https://github.com/vim/vim/commit/5921aeb5741fc6e84c870d68c7c35b93ad0c9f87 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Feb 19 11:20:12 2022 +0000 patch 8.2.4418: crash when using special multi-byte character Problem: Crash when using special multi-byte character. Solution: Don't use isalpha() for an arbitrary character.
author Bram Moolenaar <Bram@vim.org>
date Sat, 19 Feb 2022 12:30:04 +0100
parents 661eb972cb22
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
20753
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1 " Vim syntax file
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2 " Language: Elm
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3 " Maintainer: Andreas Scharf <as@99n.de>
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
4 " Original Author: Joseph Hager <ajhager@gmail.com>
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
5 " Copyright: Joseph Hager <ajhager@gmail.com>
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
6 " License: BSD3
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
7 " Latest Revision: 2020-05-29
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
8
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
9 if exists('b:current_syntax')
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
10 finish
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
11 endif
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
12
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
13 " Keywords
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
14 syn keyword elmConditional else if of then case
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
15 syn keyword elmAlias alias
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
16 syn keyword elmTypedef contained type port
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
17 syn keyword elmImport exposing as import module where
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
18
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
19 " Operators
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
20 " elm/core
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
21 syn match elmOperator contained "\(<|\||>\|||\|&&\|==\|/=\|<=\|>=\|++\|::\|+\|-\|*\|/\|//\|^\|<>\|>>\|<<\|<\|>\|%\)"
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
22 " elm/parser
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
23 syn match elmOperator contained "\(|.\||=\)"
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
24 " elm/url
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
25 syn match elmOperator contained "\(</>\|<?>\)"
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
26
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
27 " Types
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
28 syn match elmType "\<[A-Z][0-9A-Za-z_-]*"
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
29 syn keyword elmNumberType number
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
30
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
31 " Modules
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
32 syn match elmModule "\<\([A-Z][0-9A-Za-z_'-\.]*\)\+\.[A-Za-z]"me=e-2
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
33 syn match elmModule "^\(module\|import\)\s\+[A-Z][0-9A-Za-z_'-\.]*\(\s\+as\s\+[A-Z][0-9A-Za-z_'-\.]*\)\?\(\s\+exposing\)\?" contains=elmImport
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
34
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
35 " Delimiters
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
36 syn match elmDelimiter "[,;]"
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
37 syn match elmBraces "[()[\]{}]"
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
38
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
39 " Functions
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
40 syn match elmTupleFunction "\((,\+)\)"
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
41
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
42 " Comments
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
43 syn keyword elmTodo TODO FIXME XXX contained
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
44 syn match elmLineComment "--.*" contains=elmTodo,@spell
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
45 syn region elmComment matchgroup=elmComment start="{-|\=" end="-}" contains=elmTodo,elmComment,@spell fold
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
46
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
47 " Strings
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
48 syn match elmStringEscape "\\u[0-9a-fA-F]\{4}" contained
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
49 syn match elmStringEscape "\\[nrfvbt\\\"]" contained
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
50 syn region elmString start="\"" skip="\\\"" end="\"" contains=elmStringEscape,@spell
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
51 syn region elmTripleString start="\"\"\"" skip="\\\"" end="\"\"\"" contains=elmStringEscape,@spell
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
52 syn match elmChar "'[^'\\]'\|'\\.'\|'\\u[0-9a-fA-F]\{4}'"
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
53
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
54 " Lambda
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
55 syn region elmLambdaFunc start="\\"hs=s+1 end="->"he=e-2
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
56
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
57 " Debug
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
58 syn match elmDebug "Debug.\(log\|todo\|toString\)"
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
59
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
60 " Numbers
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
61 syn match elmInt "-\?\<\d\+\>"
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
62 syn match elmFloat "-\?\(\<\d\+\.\d\+\>\)"
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
63
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
64 " Identifiers
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
65 syn match elmTopLevelDecl "^\s*[a-zA-Z][a-zA-z0-9_]*\('\)*\s\+:\(\r\n\|\r\|\n\|\s\)\+" contains=elmOperator
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
66 syn match elmFuncName /^\l\w*/
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
67
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
68 " Folding
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
69 syn region elmTopLevelTypedef start="type" end="\n\(\n\n\)\@=" contains=ALL fold
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
70 syn region elmTopLevelFunction start="^[a-zA-Z].\+\n[a-zA-Z].\+=" end="^\(\n\+\)\@=" contains=ALL fold
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
71 syn region elmCaseBlock matchgroup=elmCaseBlockDefinition start="^\z\(\s\+\)\<case\>" end="^\z1\@!\W\@=" end="\(\n\n\z1\@!\)\@=" end="\n\z1\@!\(\n\n\)\@=" contains=ALL fold
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
72 syn region elmCaseItemBlock start="^\z\(\s\+\).\+->$" end="^\z1\@!\W\@=" end="\(\n\n\z1\@!\)\@=" end="\(\n\z1\S\)\@=" contains=ALL fold
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
73 syn region elmLetBlock matchgroup=elmLetBlockDefinition start="\<let\>" end="\<in\>" contains=ALL fold
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
74
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
75 hi def link elmFuncName Function
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
76 hi def link elmCaseBlockDefinition Conditional
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
77 hi def link elmCaseBlockItemDefinition Conditional
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
78 hi def link elmLetBlockDefinition TypeDef
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
79 hi def link elmTopLevelDecl Function
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
80 hi def link elmTupleFunction Normal
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
81 hi def link elmTodo Todo
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
82 hi def link elmComment Comment
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
83 hi def link elmLineComment Comment
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
84 hi def link elmString String
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
85 hi def link elmTripleString String
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
86 hi def link elmChar String
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
87 hi def link elmStringEscape Special
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
88 hi def link elmInt Number
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
89 hi def link elmFloat Float
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
90 hi def link elmDelimiter Delimiter
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
91 hi def link elmBraces Delimiter
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
92 hi def link elmTypedef TypeDef
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
93 hi def link elmImport Include
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
94 hi def link elmConditional Conditional
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
95 hi def link elmAlias Delimiter
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
96 hi def link elmOperator Operator
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
97 hi def link elmType Type
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
98 hi def link elmNumberType Identifier
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
99 hi def link elmLambdaFunc Function
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
100 hi def link elmDebug Debug
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
101 hi def link elmModule Type
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
102
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
103 syn sync minlines=500
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
104
661eb972cb22 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
105 let b:current_syntax = 'elm'