[m-rev.] for review: Update vim syntax for integer literal suffixes.

Peter Wang novalazy at gmail.com
Sat Apr 7 12:01:29 AEST 2018


vim/syntax/mercury.vim:
    Accept suffixes on binary, octal, decimal and hexadecimal integer
    literals (i, u, i8, u8, i16, u16, i32, u32, i64, u64),
    with optional leading underscores.

    Match integer and float literals only if they end at a word
    boundary.
---
 vim/syntax/mercury.vim | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/vim/syntax/mercury.vim b/vim/syntax/mercury.vim
index 38c66c950..fc1922787 100644
--- a/vim/syntax/mercury.vim
+++ b/vim/syntax/mercury.vim
@@ -2,7 +2,7 @@
 " Language:     Mercury
 " Maintainer:   Sebastian Godelet <sebastian.godelet at outlook.com>
 " Extensions:   *.m *.moo
-" Last Change:  2015-04-16
+" Last Change:  2018-04-07
 
 " for documentation, please use :help mercury-syntax
 
@@ -188,9 +188,12 @@ syn match   mercuryOperator     "*"          " multiply
 syn match   mercuryDelimiter    "\^"         " field access
 syn match   mercuryOperator     /\v`[^`']+`/ " inlined operator
 syn match   mercuryImplication  "<=>\|<=\|=>"
-syn match   mercuryNumCode /\v<(0'.|0b[01_]*[01]|0o[0-7_]*[0-7]|0x[0-9A-Fa-f_]*\x|[0-9]([0-9_]*[0-9])?)/
-syn match   mercuryFloat   /\v<([0-9]([0-9_]*[0-9])?\.[0-9]([0-9_]*[0-9])?([eE][-+]?[0-9]([0-9_]*[0-9])?)?)/
-syn match   mercuryFloat   /\v<([0-9]([0-9_]*[0-9])?[eE][-+]?[0-9]([0-9_]*[0-9])?)/
+syn match   mercuryNumCode /\v<0b[01_]*[01](_*[iu](8|16|32|64)?)?>/
+syn match   mercuryNumCode /\v<0o[0-7_]*[0-7](_*[iu](8|16|32|64)?)?>/
+syn match   mercuryNumCode /\v<0x[0-9A-Fa-f_]*\x(_*[iu](8|16|32|64)?)?>/
+syn match   mercuryNumCode /\v<0'.|<[0-9]([0-9_]*[0-9])?(_*[iu](8|16|32|64)?)?>/
+syn match   mercuryFloat   /\v<[0-9]([0-9_]*[0-9])?\.[0-9]([0-9_]*[0-9])?([eE][-+]?[0-9]([0-9_]*[0-9])?)?>/
+syn match   mercuryFloat   /\v<[0-9]([0-9_]*[0-9])?[eE][-+]?[0-9]([0-9_]*[0-9])?>/
 syn region  mercuryAtom    start=+'+ skip=+\\'+   end=+'+ contains=
       \ mercuryStringEsc, at mercuryFormatting,mercuryEscErr, at Spell
 syn region  mercuryString matchgroup=mercuryString
-- 
2.16.3



More information about the reviews mailing list