mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Match freestanding macros in vim syntax
Any valid name beginning with `#` that isn't already a preprocessor macro is now considered a freestanding macro. Previously, only preprocessor macros were handled in the vim syntax file, e.g. `#if`. For example, this properly handles the syntax for the `#expect` and the `#require` macros used in Swift Testing.
This commit is contained in:
@@ -207,6 +207,9 @@ syn match swiftTupleIndexNumber contains=swiftDecimal
|
||||
syn match swiftDecimal contained
|
||||
\ /[0-9]\+/
|
||||
|
||||
" This is a superset of the Preproc macros below, so it must come FIRST
|
||||
syn match swiftFreestandingMacro
|
||||
\ /#\<[A-Za-z_][A-Za-z_0-9]*\>/
|
||||
syn match swiftPreproc
|
||||
\ /#\(\<column\>\|\<dsohandle\>\|\<file\>\|\<line\>\|\<function\>\)/
|
||||
syn match swiftPreproc
|
||||
@@ -271,6 +274,7 @@ hi def link swiftLabel Operator
|
||||
hi def link swiftMutating Statement
|
||||
hi def link swiftPreproc PreCondit
|
||||
hi def link swiftPreprocFalse Comment
|
||||
hi def link swiftFreestandingMacro Macro
|
||||
hi def link swiftAttribute Type
|
||||
hi def link swiftTodo Todo
|
||||
hi def link swiftNil Constant
|
||||
|
||||
Reference in New Issue
Block a user