patch 9.1.1173: filetype: ABNF files are not detected
Commit:
https://github.com/vim/vim/commit/9f827ec58728c4ea55a8d71d40a283ca2ce5b058
Author: A4-Tacks <[email protected]>
Date: Wed Mar 5 20:10:29 2025 +0100
patch 9.1.1173: filetype: ABNF files are not detected
Problem: filetype: ABNF files are not detected
Solution: detect '.abnf' file as abnf filetype and
include an abnf syntax plugin (A4-Tacks).
References:
- RFC5234
- RFC7405
closes: #16802
Signed-off-by: A4-Tacks <[email protected]>
Signed-off-by: Christian Brabandt <[email protected]>
diff --git a/.github/MAINTAINERS b/.github/MAINTAINERS
index c316849cf..071553b9f 100644
--- a/.github/MAINTAINERS
+++ b/.github/MAINTAINERS
@@ -422,6 +422,7 @@ runtime/pack/dist/opt/nohlsearch/ @habamax
runtime/plugin/manpager.vim @Konfekt
runtime/syntax/shared/hgcommitDiff.vim @vegerot
runtime/syntax/abaqus.vim @costerwi
+runtime/syntax/abnf.vim @A4-Tacks
runtime/syntax/aidl.vim @dpelle
runtime/syntax/ant.vim @dkearns
runtime/syntax/antlr4.vim @jiangyinzuo
diff --git a/runtime/filetype.vim b/runtime/filetype.vim
index ff6905f91..50c9f08f7 100644
--- a/runtime/filetype.vim
+++ b/runtime/filetype.vim
@@ -1,7 +1,7 @@
" Vim support file to detect file types
"
" Maintainer: The Vim Project <https://github.com/vim/vim>
-" Last Change: 2025 Feb 23
+" Last Change: 2025 Mar 05
" Former Maintainer: Bram Moolenaar <[email protected]>
" Listen very carefully, I will say this only once
@@ -75,6 +75,9 @@ au BufNewFile,BufRead *.abc setf abc
" ABEL
au BufNewFile,BufRead *.abl setf abel
+" ABNF
+au BufNewFile,BufRead *.abnf setf abnf
+
" AceDB
au BufNewFile,BufRead *.wrm setf acedb
diff --git a/runtime/syntax/abnf.vim b/runtime/syntax/abnf.vim
new file mode 100644
index 000000000..13459eb9f
--- /dev/null
+++ b/runtime/syntax/abnf.vim
@@ -0,0 +1,33 @@
+" Vim compiler file
+" Language: abnf
+" Maintainer: A4-Tacks <[email protected]>
+" Last Change: 2025 Mar 05
+" Upstream: https://github.com/A4-Tacks/abnf.vim
+
+" Implementing RFC-5234, RFC-7405
+
+if exists('b:current_syntax')
+ finish
+endif
+
+syn case ignore
+
+syn match abnfError /[<>"]/
+syn match abnfComment /;.*/
+syn match abnfOption /[[/\]]/
+syn region abnfString start=/\(%[si]\)\="/ end=/"/ oneline
+syn region abnfProse start=/</ end=/>/ oneline
+syn match abnfNumVal / \%b[01]+%(%(\.[01]+)+|-[01]+)=>/
+syn match abnfNumVal / \%d\d+%(%(\.\d+)+|-\d+)=>/
+syn match abnfNumVal / \%x[0-9a-f]+%(%(\.[0-9a-f]+)+|-[0-9a-f]+)=>/
+syn match abnfRepeat / %(%(<\d+)=\*\d*|<\d+ =)\ze[^
0-9*/)\]]/
+
+hi def link abnfError Error
+hi def link abnfComment Comment
+hi def link abnfOption PreProc
+hi def link abnfString String
+hi def link abnfProse String
+hi def link abnfNumVal Number
+hi def link abnfRepeat Repeat
+
+" vim:noet:ts=8:sts=8:nowrap
diff --git a/src/testdir/test_filetype.vim b/src/testdir/test_filetype.vim
index bbc2d1f00..d8fc0a1e0 100644
--- a/src/testdir/test_filetype.vim
+++ b/src/testdir/test_filetype.vim
@@ -87,6 +87,7 @@ def s:GetFilenameChecks(): dict<list<string>>
abap: ['file.abap'],
abc: ['file.abc'],
abel: ['file.abl'],
+ abnf: ['file.abnf'],
acedb: ['file.wrm'],
ada: ['file.adb', 'file.ads', 'file.ada', 'file.gpr'],
ahdl: ['file.tdf'],
diff --git a/src/version.c b/src/version.c
index cfb661e70..8b42a7909 100644
--- a/src/version.c
+++ b/src/version.c
@@ -704,6 +704,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 1173,
/**/
1172,
/**/
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/vim_dev/E1tpuRP-00AYeV-Lg%40256bit.org.