patch 9.1.0550: filetype: antlr4 files are not recognized

Commit: 
https://github.com/vim/vim/commit/4a7a4a3675b6ad90a525524ba4684925df212325
Author: Yinzuo Jiang <jiangyin...@foxmail.com>
Date:   Tue Jul 9 19:11:18 2024 +0200

    patch 9.1.0550: filetype: antlr4 files are not recognized
    
    Problem:  filetype: antlr4 files are not recognized
    Solution: Detect '*.g4' as antlr4 filetype, include a simple antlr4
              syntax and filetype plugin (Yinzuo Jiang)
    
    closes: #15191
    
    Signed-off-by: Yinzuo Jiang <jiangyin...@foxmail.com>
    Signed-off-by: Christian Brabandt <c...@256bit.org>

diff --git a/.github/MAINTAINERS b/.github/MAINTAINERS
index f546a6782..e8c864783 100644
--- a/.github/MAINTAINERS
+++ b/.github/MAINTAINERS
@@ -107,6 +107,7 @@ runtime/compiler/zsh.vim            @dkearns
 runtime/doc/ft_hare.txt                        @selenebun
 runtime/doc/ps1.txt                    @heaths
 runtime/ftplugin/abaqus.vim            @costerwi
+runtime/ftplugin/antlr4.vim            @jiangyinzuo
 runtime/ftplugin/apache.vim            @dubgeiser
 runtime/ftplugin/arduino.vim           @k-takata
 runtime/ftplugin/astro.vim             @romainl
@@ -368,6 +369,7 @@ runtime/syntax/shared/hgcommitDiff.vim      @vegerot
 runtime/syntax/abaqus.vim              @costerwi
 runtime/syntax/aidl.vim                        @dpelle
 runtime/syntax/ant.vim                 @dkearns
+runtime/syntax/antlr4.vim              @jiangyinzuo
 runtime/syntax/arduino.vim             @johshoff
 runtime/syntax/asciidoc.vim            @aerostitch
 runtime/syntax/asm.vim                 @dkearns
diff --git a/runtime/filetype.vim b/runtime/filetype.vim
index eb4e9043f..d22dd57cb 100644
--- a/runtime/filetype.vim
+++ b/runtime/filetype.vim
@@ -98,6 +98,13 @@ au BufNewFile,BufRead *.run                  setf ampl
 " Ant
 au BufNewFile,BufRead build.xml                        setf ant
 
+" ANTLR / PCCTS
+"au BufNewFile,BufRead *.g                     setf antlr
+au BufNewFile,BufRead *.g                      setf pccts
+
+" ANTLR 4
+au BufNewFile,BufRead *.g4                     setf antlr4
+
 " Arduino
 au BufNewFile,BufRead *.ino,*.pde              setf arduino
 
@@ -1814,10 +1821,6 @@ au BufNewFile,BufRead *termcap
 " Prisma
 au BufRead,BufNewFile *.prisma                 setf prisma
 
-" PCCTS / ANTLR
-"au BufNewFile,BufRead *.g                     setf antlr
-au BufNewFile,BufRead *.g                      setf pccts
-
 " PPWizard
 au BufNewFile,BufRead *.it,*.ih                        setf ppwiz
 
diff --git a/runtime/ftplugin/antlr4.vim b/runtime/ftplugin/antlr4.vim
new file mode 100644
index 000000000..610d5284f
--- /dev/null
+++ b/runtime/ftplugin/antlr4.vim
@@ -0,0 +1,14 @@
+" Vim filetype plugin
+" Language:    ANTLR4, ANother Tool for Language Recognition v4 <www.antlr.org>
+" Maintainer:  Yinzuo Jiang <jiangyin...@foxmail.com>
+" Last Change: 2024 July 09
+
+if exists('b:did_ftplugin')
+  finish
+endif
+let b:did_ftplugin = 1
+
+setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,://
+setlocal commentstring=//\ %s
+
+let b:undo_ftplugin = 'setl com< cms<'
diff --git a/runtime/syntax/antlr4.vim b/runtime/syntax/antlr4.vim
new file mode 100644
index 000000000..33cc865cc
--- /dev/null
+++ b/runtime/syntax/antlr4.vim
@@ -0,0 +1,30 @@
+" Vim syntax file
+" Language:    ANTLR4, ANother Tool for Language Recognition v4 <www.antlr.org>
+" Maintainer:  Yinzuo Jiang <jiangyin...@foxmail.com>
+" Last Change: 2024 July 09
+
+" quit when a syntax file was already loaded
+if exists("b:current_syntax")
+  finish
+endif
+
+" Keywords. See https://github.com/antlr/antlr4/blob/4.13.1/doc/lexicon.md
+syn keyword antlr4Include import
+" https://github.com/antlr/antlr4/blob/4.13.1/doc/options.md
+" https://github.com/antlr/antlr4/blob/4.13.1/doc/grammars.md
+syn keyword antlr4Structure fragment lexer parser grammar options channels 
tokens mode
+syn keyword antlr4Statement returns locals
+syn keyword antlr4Exceptions throws catch finally
+
+" Comments.
+syn keyword antlr4Todo contained TODO FIXME XXX NOTE
+syn region antlr4Comment start="//"  end="$"   contains=antlr4Todo,@Spell
+syn region antlr4Comment start="/\*" end="\*/" contains=antlr4Todo,@Spell
+
+hi def link antlr4Include Include
+hi def link antlr4Structure Structure
+hi def link antlr4Statement Statement
+hi def link antlr4Exceptions Structure
+hi def link antlr4Comment Comment
+
+let b:current_syntax = "antlr4"
diff --git a/src/version.c b/src/version.c
index dd5b254a0..caa779ce5 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 */
+/**/
+    550,
 /**/
     549,
 /**/

-- 
-- 
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 vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/E1sRERH-00DJcP-I0%40256bit.org.

Raspunde prin e-mail lui