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 change is motivated by highlighting for
test/Interpreter/SDK/lib.swift. It contains the line
// CHECK: the magic word is ///* magic *///
which without this change leaves the rest of the file highlighted as
commented out. swiftComment cannot contain swiftLineComment, or else
this:
/* // */ hello
gets incorrectly highlighted as if "hello" was commented out.
Similarly, swiftLineComment cannot contain swiftComment, or else this:
// /*
*/
gets incorrectly highlighted as if */ was closing a comment, when
actually it should be a syntax error.
This improves the detection of syntax so that the identifier for a
typealias is identified as an identifier, the `=` is identified as a
delimiter, and the type that is aliased is identified as a type.
* Implement #warning and #error
* Fix #warning/#error in switch statements
* Fix AST printing for #warning/#error
* Add to test case
* Add extra handling to ParseDeclPoundDiagnostic
* fix dumping
* Consume the right paren even in the failure case
* Diagnose extra tokens on the same line after a diagnostic directive
* vim-syntax: fix highlighting for indirect case/enum
without skipwhite, `indirect enum` never gets highlighted. this
commit also adds the `indirect case` multiword keyword.
* vim-syntax: allow whitespace before type parameters
Added skipwhite to multiple match groups so that whitespace can be used
before type parameters (`Type <Param>`). This matches Xcode's behavior.
* vim-syntax: update last change line
* vim-syntax: remove indirect case from multiword type def group
* vim-syntax: highlight #function preproc macro
* vim-syntax: highlight preproc macros in string interpolation
* vim syntax: make string interpolation a matchgroup
Now, only the opening \( and ) are highlighted, and everything inside retains its coloring
This was duplicating the swiftTypeName. However, the swiftTypeName is more
generically named and applies to both types and functions both in structure and
usage. Retain the single definition.