Mercurial > vim
annotate runtime/syntax/asm.vim @ 32816:939396a5711c v9.0.1722
patch 9.0.1722: wrong error messages when passing wrong types to count()
Commit: https://github.com/vim/vim/commit/4f389e7c0fe7dfeccfa512a72fa36f9028d57159
Author: zeertzjq <zeertzjq@outlook.com>
Date: Thu Aug 17 22:10:40 2023 +0200
patch 9.0.1722: wrong error messages when passing wrong types to count()
Problem: wrong error messages when passing wrong types to count()
Solution: fix it
This fixes two problems:
1. When passing wrong type to {ic} argument of count(), two error
messages are given, the second of which is misleading.
2. When passing wrong type to {comp} argument of count(), the error
message doesn't mention that {comp} may be a String.
closes: #12825
Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Thu, 17 Aug 2023 22:15:03 +0200 |
parents | 8dad79c661d1 |
children |
rev | line source |
---|---|
7 | 1 " Vim syntax file |
22824 | 2 " Language: GNU Assembler |
3 " Maintainer: Doug Kearns dougkearns@gmail.com | |
4 " Previous Maintainers: Erik Wognsen <erik.wognsen@gmail.com> | |
5 " Kevin Dahlhausen <kdahlhaus@yahoo.com> | |
6 " Contributors: Ori Avtalion, Lakshay Garg | |
7 " Last Change: 2020 Oct 31 | |
7 | 8 |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
5663
diff
changeset
|
9 " quit when a syntax file was already loaded |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
5663
diff
changeset
|
10 if exists("b:current_syntax") |
7 | 11 finish |
12 endif | |
13 | |
3256 | 14 let s:cpo_save = &cpo |
15 set cpo&vim | |
16 | |
7 | 17 syn case ignore |
18 | |
19 " storage types | |
20 syn match asmType "\.long" | |
21 syn match asmType "\.ascii" | |
22 syn match asmType "\.asciz" | |
23 syn match asmType "\.byte" | |
24 syn match asmType "\.double" | |
25 syn match asmType "\.float" | |
26 syn match asmType "\.hword" | |
27 syn match asmType "\.int" | |
28 syn match asmType "\.octa" | |
29 syn match asmType "\.quad" | |
30 syn match asmType "\.short" | |
31 syn match asmType "\.single" | |
32 syn match asmType "\.space" | |
33 syn match asmType "\.string" | |
34 syn match asmType "\.word" | |
35 | |
22824 | 36 syn match asmIdentifier "[a-z_][a-z0-9_]*" |
7 | 37 syn match asmLabel "[a-z_][a-z0-9_]*:"he=e-1 |
38 | |
39 " Various #'s as defined by GAS ref manual sec 3.6.2.1 | |
22824 | 40 " Technically, the first asmDecimal def is actually octal, |
7 | 41 " since the value of 0-7 octal is the same as 0-7 decimal, |
3256 | 42 " I (Kevin) prefer to map it as decimal: |
22824 | 43 syn match asmDecimal "\<0\+[1-7]\=\>" display |
44 syn match asmDecimal "\<[1-9]\d*\>" display | |
45 syn match asmOctal "\<0[0-7][0-7]\+\>" display | |
46 syn match asmHexadecimal "\<0[xX][0-9a-fA-F]\+\>" display | |
47 syn match asmBinary "\<0[bB][0-1]\+\>" display | |
48 | |
49 syn match asmFloat "\<\d\+\.\d*\%(e[+-]\=\d\+\)\=\>" display | |
50 syn match asmFloat "\.\d\+\%(e[+-]\=\d\+\)\=\>" display | |
51 syn match asmFloat "\<\d\%(e[+-]\=\d\+\)\>" display | |
52 syn match asmFloat "[+-]\=Inf\>\|\<NaN\>" display | |
7 | 53 |
22824 | 54 syn match asmFloat "\%(0[edfghprs]\)[+-]\=\d*\%(\.\d\+\)\%(e[+-]\=\d\+\)\=" display |
55 syn match asmFloat "\%(0[edfghprs]\)[+-]\=\d\+\%(\.\d\+\)\=\%(e[+-]\=\d\+\)\=" display | |
56 " Avoid fighting the hexadecimal match for unicorn-like '0x' prefixed floats | |
57 syn match asmFloat "\%(0x\)[+-]\=\d*\%(\.\d\+\)\%(e[+-]\=\d\+\)\=" display | |
2152 | 58 |
22824 | 59 " Allow all characters to be escaped (and in strings) as these vary across |
60 " architectures [See sec 3.6.1.1 Strings] | |
61 syn match asmCharacterEscape "\\." contained | |
62 syn match asmCharacter "'\\\=." contains=asmCharacterEscape | |
63 | |
64 syn match asmStringEscape "\\\_." contained | |
65 syn match asmStringEscape "\\\%(\o\{3}\|00[89]\)" contained display | |
66 syn match asmStringEscape "\\x\x\+" contained display | |
67 | |
68 syn region asmString start="\"" end="\"" skip="\\\\\|\\\"" contains=asmStringEscape | |
69 | |
70 syn keyword asmTodo contained TODO FIXME XXX NOTE | |
3256 | 71 |
72 " GAS supports one type of multi line comments: | |
22824 | 73 syn region asmComment start="/\*" end="\*/" contains=asmTodo,@Spell |
3256 | 74 |
3465 | 75 " GAS (undocumentedly?) supports C++ style comments. Unlike in C/C++ however, |
76 " a backslash ending a C++ style comment does not extend the comment to the | |
77 " next line (hence the syntax region does not define 'skip="\\$"') | |
22824 | 78 syn region asmComment start="//" end="$" keepend contains=asmTodo,@Spell |
3465 | 79 |
3256 | 80 " Line comment characters depend on the target architecture and command line |
81 " options and some comments may double as logical line number directives or | |
82 " preprocessor commands. This situation is described at | |
83 " http://sourceware.org/binutils/docs-2.22/as/Comments.html | |
84 " Some line comment characters have other meanings for other targets. For | |
85 " example, .type directives may use the `@' character which is also an ARM | |
86 " comment marker. | |
87 " As a compromise to accommodate what I arbitrarily assume to be the most | |
88 " frequently used features of the most popular architectures (and also the | |
89 " non-GNU assembly languages that use this syntax file because their asm files | |
90 " are also named *.asm), the following are used as line comment characters: | |
22824 | 91 syn match asmComment "[#;!|].*" contains=asmTodo,@Spell |
3256 | 92 |
93 " Side effects of this include: | |
94 " - When `;' is used to separate statements on the same line (many targets | |
95 " support this), all statements except the first get highlighted as | |
96 " comments. As a remedy, remove `;' from the above. | |
97 " - ARM comments are not highlighted correctly. For ARM, uncomment the | |
98 " following two lines and comment the one above. | |
99 "syn match asmComment "@.*" contains=asmTodo | |
100 "syn match asmComment "^#.*" contains=asmTodo | |
101 | |
102 " Advanced users of specific architectures will probably want to change the | |
103 " comment highlighting or use a specific, more comprehensive syntax file. | |
7 | 104 |
105 syn match asmInclude "\.include" | |
106 syn match asmCond "\.if" | |
107 syn match asmCond "\.else" | |
108 syn match asmCond "\.endif" | |
109 syn match asmMacro "\.macro" | |
110 syn match asmMacro "\.endm" | |
111 | |
5663
1dea14d4c738
Update runtime files. Add support for systemverilog.
Bram Moolenaar <bram@vim.org>
parents:
3465
diff
changeset
|
112 " Assembler directives start with a '.' and may contain upper case (e.g., |
1dea14d4c738
Update runtime files. Add support for systemverilog.
Bram Moolenaar <bram@vim.org>
parents:
3465
diff
changeset
|
113 " .ABORT), numbers (e.g., .p2align), dash (e.g., .app-file) and underscore in |
1dea14d4c738
Update runtime files. Add support for systemverilog.
Bram Moolenaar <bram@vim.org>
parents:
3465
diff
changeset
|
114 " CFI directives (e.g., .cfi_startproc). This will also match labels starting |
1dea14d4c738
Update runtime files. Add support for systemverilog.
Bram Moolenaar <bram@vim.org>
parents:
3465
diff
changeset
|
115 " with '.', including the GCC auto-generated '.L' labels. |
1dea14d4c738
Update runtime files. Add support for systemverilog.
Bram Moolenaar <bram@vim.org>
parents:
3465
diff
changeset
|
116 syn match asmDirective "\.[A-Za-z][0-9A-Za-z-_]*" |
7 | 117 |
118 syn case match | |
119 | |
120 " Define the default highlighting. | |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
5663
diff
changeset
|
121 " Only when an item doesn't have highlighting yet |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
5663
diff
changeset
|
122 |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
5663
diff
changeset
|
123 " The default methods for highlighting. Can be overridden later |
22824 | 124 hi def link asmSection Special |
125 hi def link asmLabel Label | |
126 hi def link asmComment Comment | |
127 hi def link asmTodo Todo | |
10051
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
128 hi def link asmDirective Statement |
7 | 129 |
22824 | 130 hi def link asmInclude Include |
131 hi def link asmCond PreCondit | |
132 hi def link asmMacro Macro | |
7 | 133 |
22824 | 134 if exists('g:asm_legacy_syntax_groups') |
135 hi def link hexNumber Number | |
136 hi def link decNumber Number | |
137 hi def link octNumber Number | |
138 hi def link binNumber Number | |
139 hi def link asmHexadecimal hexNumber | |
140 hi def link asmDecimal decNumber | |
141 hi def link asmOctal octNumber | |
142 hi def link asmBinary binNumber | |
143 else | |
144 hi def link asmHexadecimal Number | |
145 hi def link asmDecimal Number | |
146 hi def link asmOctal Number | |
147 hi def link asmBinary Number | |
148 endif | |
149 hi def link asmFloat Float | |
150 | |
151 hi def link asmString String | |
152 hi def link asmStringEscape Special | |
153 hi def link asmCharacter Character | |
154 hi def link asmCharacterEscape Special | |
7 | 155 |
10051
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
156 hi def link asmIdentifier Identifier |
22824 | 157 hi def link asmType Type |
7 | 158 |
159 let b:current_syntax = "asm" | |
160 | |
3256 | 161 let &cpo = s:cpo_save |
162 unlet s:cpo_save | |
163 | |
22824 | 164 " vim: nowrap sw=2 sts=2 ts=8 noet |