view runtime/syntax/debsources.vim @ 33791:370543108ba1 v9.0.2114

patch 9.0.2114: overflow detection not accurate when adding digits Commit: https://github.com/vim/vim/commit/22cbc8a4e17ce61aa460c451a26e1bff2c3d2af9 Author: Christian Brabandt <cb@256bit.org> Date: Sun Nov 19 10:47:21 2023 +0100 patch 9.0.2114: overflow detection not accurate when adding digits Problem: overflow detection not accurate when adding digits Solution: Use a helper function Use a helper function to better detect overflows before adding integer digits to a long or an integer variable respectively. Signal the overflow to the caller function. closes: #13539 Signed-off-by: Christian Brabandt <cb@256bit.org> Signed-off-by: Michael Henry <vim@drmikehenry.com> Signed-off-by: Ernie Rael <errael@raelity.com>
author Christian Brabandt <cb@256bit.org>
date Sun, 19 Nov 2023 11:00:07 +0100
parents c6d5af39dc7f
children f8951966ef0c
line wrap: on
line source

" Vim syntax file
" Language:     Debian sources.list
" Maintainer:   Debian Vim Maintainers
" Former Maintainer: Matthijs Mohlmann <matthijs@cacholong.nl>
" Last Change: 2023 Oct 11
" URL: https://salsa.debian.org/vim-team/vim-debian/blob/main/syntax/debsources.vim

" Standard syntax initialization
if exists('b:current_syntax')
  finish
endif

" case sensitive
syn case match

" A bunch of useful keywords
syn match debsourcesType               /\(deb-src\|deb\)/
syn match debsourcesFreeComponent      /\(main\|universe\)/
syn match debsourcesNonFreeComponent   /\(contrib\|non-free-firmware\|non-free\|restricted\|multiverse\)/

" Match comments
syn match debsourcesComment        /#.*/  contains=@Spell

" Include Debian versioning information
runtime! syntax/shared/debversions.vim

exe 'syn match debsourcesDistrKeyword   +\([[:alnum:]_./]*\)\<\('. join(g:debSharedSupportedVersions, '\|'). '\)\>\([-[:alnum:]_./]*\)+'
exe 'syn match debsourcesUnsupportedDistrKeyword +\([[:alnum:]_./]*\)\<\('. join(g:debSharedUnsupportedVersions, '\|') .'\)\>\([-[:alnum:]_./]*\)+'

unlet g:debSharedSupportedVersions
unlet g:debSharedUnsupportedVersions

" Match uri's
syn match debsourcesUri            '\(https\?://\|ftp://\|[rs]sh://\|debtorrent://\|\(cdrom\|copy\|file\):\)[^' 	<>"]\+'
syn region debsourcesLine start="^" end="$" contains=debsourcesType,debsourcesFreeComponent,debsourcesNonFreeComponent,debsourcesComment,debsourcesUri,debsourcesDistrKeyword,debsourcesUnsupportedDistrKeyword oneline


" Associate our matches and regions with pretty colours
hi def link debsourcesType                    Statement
hi def link debsourcesFreeComponent           Statement
hi def link debsourcesNonFreeComponent        Statement
hi def link debsourcesComment                 Comment
hi def link debsourcesUri                     Constant
hi def link debsourcesDistrKeyword            Type
hi def link debsourcesUnsupportedDistrKeyword WarningMsg

let b:current_syntax = 'debsources'