[PATCH] Update Erlang syntax for recent language changes

23 views
Skip to first unread message

Johannes Christ

unread,
Feb 25, 2025, 3:09:25 PMFeb 25
to vim...@vim.org, Johannes Christ
Erlang recently added the `-moduledoc` attribute as well as triple
quoted strings, see [1].

[1]: https://www.erlang.org/doc/system/documentation.html
---
runtime/syntax/erlang.vim | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/runtime/syntax/erlang.vim b/runtime/syntax/erlang.vim
index 0b256193a..081c7940f 100644
--- a/runtime/syntax/erlang.vim
+++ b/runtime/syntax/erlang.vim
@@ -54,8 +54,9 @@ syn match erlangNumberInteger '\<\%([2-9]\|[12]\d\|3[0-6]\)\+#[[:alnum:]]\+\>'
syn match erlangNumberFloat '\<\d\+\.\d\+\%([eE][+-]\=\d\+\)\=\>'

" Strings, atoms, characters
-syn region erlangString start=/"/ end=/"/ contains=erlangStringModifier
-syn region erlangQuotedAtom start=/'/ end=/'/ contains=erlangQuotedAtomModifier
+syn region erlangString start=/"/ end=/"/ contains=erlangStringModifier
+syn region erlangString start=/"""/ end=/"""/ contains=erlangStringModifier
+syn region erlangQuotedAtom start=/'/ end=/'/ contains=erlangQuotedAtomModifier
syn match erlangStringModifier '\\\%(\o\{1,3}\|x\x\x\|x{\x\+}\|\^.\|.\)\|\~\%([ni~]\|\%(-\=\d\+\|\*\)\=\.\=\%(\*\|\d\+\)\=\%(\..\)\=[tl]*[cfegswpWPBX#bx+]\)' contained
syn match erlangQuotedAtomModifier '\\\%(\o\{1,3}\|x\x\x\|x{\x\+}\|\^.\|.\)' contained
syn match erlangModifier '\$\%([^\\]\|\\\%(\o\{1,3}\|x\x\x\|x{\x\+}\|\^.\|.\)\)'
@@ -94,7 +95,7 @@ syn match erlangBitType '\%(\/\%(\s\|\n\|%.*\n\)*\)\@<=\%(integer\|float\|binary

" Constants and Directives
syn match erlangUnknownAttribute '^\s*-\%(\s\|\n\|%.*\n\)*\l[[:alnum:]_@]*' contains=erlangComment
-syn match erlangAttribute '^\s*-\%(\s\|\n\|%.*\n\)*\%(behaviou\=r\|compile\|export\(_type\)\=\|file\|import\|module\|author\|copyright\|doc\|vsn\|on_load\|optional_callbacks\|feature\)\>' contains=erlangComment
+syn match erlangAttribute '^\s*-\%(\s\|\n\|%.*\n\)*\%(behaviou\=r\|compile\|export\(_type\)\=\|file\|import\|module\(doc\)\=\|author\|copyright\|doc\|vsn\|on_load\|optional_callbacks\|feature\)\>' contains=erlangComment
syn match erlangInclude '^\s*-\%(\s\|\n\|%.*\n\)*\%(include\|include_lib\)\>' contains=erlangComment
syn match erlangRecordDef '^\s*-\%(\s\|\n\|%.*\n\)*record\>' contains=erlangComment
syn match erlangDefine '^\s*-\%(\s\|\n\|%.*\n\)*\%(define\|undef\)\>' contains=erlangComment
--
2.39.5

Christian Brabandt

unread,
Feb 25, 2025, 3:12:36 PMFeb 25
to 'Johannes Christ' via vim_dev, vim...@vim.org, Johannes Christ
Hi,
sorry, I did not see this earlier. Can you please go via the upstream
repository first? In this case this would be
https://github.com/vim-erlang/vim-erlang-runtime and you may want to
remind them to send updates back to Vim.

If you don't see any reaction there, I can go to include it here, but
I'd like to give the maintainers a chance to have a look at it.

Thanks,
Chris
Mit freundlichen Grüßen
Christian
--
When some people discover the truth, they just can't understand why
everybody isn't eager to hear it.

Csaba Hoch

unread,
Feb 26, 2025, 11:18:43 AMFeb 26
to vim_dev
Hi,

Indeed, sending a PR to https://github.com/vim-erlang/vim-erlang-runtime would be the best. It would be nice if you could also extend test/test_syntax.erl with the new language features.

Otherwise (if you don't have a GitHub account for example) I can create a commit based on your patch.

Regards,
Csaba

Johannes Christ

unread,
Mar 1, 2025, 11:30:40 AMMar 1
to vim...@googlegroups.com
Good morning,

thank you for the info! I thought it's developed in here.
I have a GitHub account, but thank you for the kind offer :-) I will PR
it there.


Have a nice day!
Johannes
>--
>--
>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+u...@googlegroups.com.
>To view this discussion visit https://groups.google.com/d/msgid/vim_dev/fffea6df-80d1-405c-bfc0-7e2cc647202en%40googlegroups.com.

Christian Brabandt

unread,
Mar 1, 2025, 11:31:13 AMMar 1
to vim...@googlegroups.com

On Thu, 27 Feb 2025, 'Johannes Christ' via vim_dev wrote:

> Good morning,
>
> thank you for the info! I thought it's developed in here.
> I have a GitHub account, but thank you for the kind offer :-) I will PR it
> there.

Perfect. Thank you!

Thanks,
Christian
--
court, n.:
A place where they dispense with justice.
-- Arthur Train
Reply all
Reply to author
Forward
0 new messages