Mercurial > vim
comparison runtime/syntax/lua.vim @ 30202:fee9eccee266
Update runtime files
Commit: https://github.com/vim/vim/commit/71b6d3397649fed68ef587aa863fcbdf5fdb057a
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Sep 10 13:13:14 2022 +0100
Update runtime files
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 10 Sep 2022 14:15:06 +0200 |
parents | 6dd88e45d47d |
children | 0827d3d6d8c0 |
comparison
equal
deleted
inserted
replaced
30201:e1ffe98c7c42 | 30202:fee9eccee266 |
---|---|
1 " Vim syntax file | 1 " Vim syntax file |
2 " Language: Lua 4.0, Lua 5.0, Lua 5.1 and Lua 5.2 | 2 " Language: Lua 4.0, Lua 5.0, Lua 5.1 and Lua 5.2 |
3 " Maintainer: Marcus Aurelius Farias <masserahguard-lua 'at' yahoo com> | 3 " Maintainer: Marcus Aurelius Farias <masserahguard-lua 'at' yahoo com> |
4 " First Author: Carlos Augusto Teixeira Mendes <cmendes 'at' inf puc-rio br> | 4 " First Author: Carlos Augusto Teixeira Mendes <cmendes 'at' inf puc-rio br> |
5 " Last Change: 2022 Mar 31 | 5 " Last Change: 2022 Mar 31 |
6 " Options: lua_version = 4 or 5 | 6 " Options: lua_version = 4 or 5 |
7 " lua_subversion = 0 (4.0, 5.0) or 1 (5.1) or 2 (5.2) | 7 " lua_subversion = 0 (4.0, 5.0) or 1 (5.1) or 2 (5.2) |
8 " default 5.2 | 8 " default 5.2 |
9 | 9 |
10 " quit when a syntax file was already loaded | 10 " quit when a syntax file was already loaded |
11 if exists("b:current_syntax") | 11 if exists("b:current_syntax") |
12 finish | 12 finish |
13 endif | 13 endif |
31 | 31 |
32 " Comments | 32 " Comments |
33 syn keyword luaTodo contained TODO FIXME XXX | 33 syn keyword luaTodo contained TODO FIXME XXX |
34 syn match luaComment "--.*$" contains=luaTodo,@Spell | 34 syn match luaComment "--.*$" contains=luaTodo,@Spell |
35 if lua_version == 5 && lua_subversion == 0 | 35 if lua_version == 5 && lua_subversion == 0 |
36 syn region luaComment matchgroup=luaComment start="--\[\[" end="\]\]" contains=luaTodo,luaInnerComment,@Spell | 36 syn region luaComment matchgroup=luaCommentDelimiter start="--\[\[" end="\]\]" contains=luaTodo,luaInnerComment,@Spell |
37 syn region luaInnerComment contained transparent start="\[\[" end="\]\]" | 37 syn region luaInnerComment contained transparent start="\[\[" end="\]\]" |
38 elseif lua_version > 5 || (lua_version == 5 && lua_subversion >= 1) | 38 elseif lua_version > 5 || (lua_version == 5 && lua_subversion >= 1) |
39 " Comments in Lua 5.1: --[[ ... ]], [=[ ... ]=], [===[ ... ]===], etc. | 39 " Comments in Lua 5.1: --[[ ... ]], [=[ ... ]=], [===[ ... ]===], etc. |
40 syn region luaComment matchgroup=luaComment start="--\[\z(=*\)\[" end="\]\z1\]" contains=luaTodo,@Spell | 40 syn region luaComment matchgroup=luaCommentDelimiter start="--\[\z(=*\)\[" end="\]\z1\]" contains=luaTodo,@Spell |
41 endif | 41 endif |
42 | 42 |
43 " First line may start with #! | 43 " First line may start with #! |
44 syn match luaComment "\%^#!.*" | 44 syn match luaComment "\%^#!.*" |
45 | 45 |
97 if lua_version < 5 | 97 if lua_version < 5 |
98 syn match luaSpecial contained "\\[\\abfnrtv\'\"]\|\\[[:digit:]]\{,3}" | 98 syn match luaSpecial contained "\\[\\abfnrtv\'\"]\|\\[[:digit:]]\{,3}" |
99 elseif lua_version == 5 | 99 elseif lua_version == 5 |
100 if lua_subversion == 0 | 100 if lua_subversion == 0 |
101 syn match luaSpecial contained #\\[\\abfnrtv'"[\]]\|\\[[:digit:]]\{,3}# | 101 syn match luaSpecial contained #\\[\\abfnrtv'"[\]]\|\\[[:digit:]]\{,3}# |
102 syn region luaString2 matchgroup=luaString start=+\[\[+ end=+\]\]+ contains=luaString2,@Spell | 102 syn region luaString2 matchgroup=luaStringDelimiter start=+\[\[+ end=+\]\]+ contains=luaString2,@Spell |
103 else | 103 else |
104 if lua_subversion == 1 | 104 if lua_subversion == 1 |
105 syn match luaSpecial contained #\\[\\abfnrtv'"]\|\\[[:digit:]]\{,3}# | 105 syn match luaSpecial contained #\\[\\abfnrtv'"]\|\\[[:digit:]]\{,3}# |
106 else " Lua 5.2 | 106 else " Lua 5.2 |
107 syn match luaSpecial contained #\\[\\abfnrtvz'"]\|\\x[[:xdigit:]]\{2}\|\\[[:digit:]]\{,3}# | 107 syn match luaSpecial contained #\\[\\abfnrtvz'"]\|\\x[[:xdigit:]]\{2}\|\\[[:digit:]]\{,3}# |
108 endif | 108 endif |
109 syn region luaString2 matchgroup=luaString start="\[\z(=*\)\[" end="\]\z1\]" contains=@Spell | 109 syn region luaString2 matchgroup=luaStringDelimiter start="\[\z(=*\)\[" end="\]\z1\]" contains=@Spell |
110 endif | 110 endif |
111 endif | 111 endif |
112 syn region luaString start=+'+ end=+'+ skip=+\\\\\|\\'+ contains=luaSpecial,@Spell | 112 syn region luaString matchgroup=luaStringDelimiter start=+'+ end=+'+ skip=+\\\\\|\\'+ contains=luaSpecial,@Spell |
113 syn region luaString start=+"+ end=+"+ skip=+\\\\\|\\"+ contains=luaSpecial,@Spell | 113 syn region luaString matchgroup=luaStringDelimiter start=+"+ end=+"+ skip=+\\\\\|\\"+ contains=luaSpecial,@Spell |
114 | 114 |
115 " integer number | 115 " integer number |
116 syn match luaNumber "\<\d\+\>" | 116 syn match luaNumber "\<\d\+\>" |
117 " floating point number, with dot, optional exponent | 117 " floating point number, with dot, optional exponent |
118 syn match luaNumber "\<\d\+\.\d*\%([eE][-+]\=\d\+\)\=\>" | 118 syn match luaNumber "\<\d\+\.\d*\%([eE][-+]\=\d\+\)\=\>" |
331 endif | 331 endif |
332 | 332 |
333 " Define the default highlighting. | 333 " Define the default highlighting. |
334 " Only when an item doesn't have highlighting yet | 334 " Only when an item doesn't have highlighting yet |
335 | 335 |
336 hi def link luaStatement Statement | 336 hi def link luaStatement Statement |
337 hi def link luaRepeat Repeat | 337 hi def link luaRepeat Repeat |
338 hi def link luaFor Repeat | 338 hi def link luaFor Repeat |
339 hi def link luaString String | 339 hi def link luaString String |
340 hi def link luaString2 String | 340 hi def link luaString2 String |
341 hi def link luaNumber Number | 341 hi def link luaStringDelimiter luaString |
342 hi def link luaOperator Operator | 342 hi def link luaNumber Number |
343 hi def link luaIn Operator | 343 hi def link luaOperator Operator |
344 hi def link luaConstant Constant | 344 hi def link luaIn Operator |
345 hi def link luaCond Conditional | 345 hi def link luaConstant Constant |
346 hi def link luaElse Conditional | 346 hi def link luaCond Conditional |
347 hi def link luaFunction Function | 347 hi def link luaElse Conditional |
348 hi def link luaComment Comment | 348 hi def link luaFunction Function |
349 hi def link luaTodo Todo | 349 hi def link luaComment Comment |
350 hi def link luaTable Structure | 350 hi def link luaCommentDelimiter luaComment |
351 hi def link luaError Error | 351 hi def link luaTodo Todo |
352 hi def link luaParenError Error | 352 hi def link luaTable Structure |
353 hi def link luaBraceError Error | 353 hi def link luaError Error |
354 hi def link luaSpecial SpecialChar | 354 hi def link luaParenError Error |
355 hi def link luaFunc Identifier | 355 hi def link luaBraceError Error |
356 hi def link luaLabel Label | 356 hi def link luaSpecial SpecialChar |
357 hi def link luaFunc Identifier | |
358 hi def link luaLabel Label | |
357 | 359 |
358 | 360 |
359 let b:current_syntax = "lua" | 361 let b:current_syntax = "lua" |
360 | 362 |
361 let &cpo = s:cpo_save | 363 let &cpo = s:cpo_save |