This change makes Splash stop highlighting generic types that are attached
to an initializer declaration, and instead now only highlights their
constraints, just like within other kinds of generic type lists.
This patch fixes two regressions caused by the recently introduced change
to not highlight keywords used as symbol names when binding optionals:
1. When a weak reference to `self` is unwrapped using a `guard` statement.
2. When a property declaration is placed after a comment ending with “var”.
- Don’t highlight what *could* be a static method call using
the `dotAccess` style, only highlight tokens that are either
value-less enum cases or static properties.
- The exception to the above rule is within `switch` statements,
in which even call-like tokens are assumed to be enum cases.
- Highlight calls to `.init()` as keywords, for consistency
with other `init` usages.
Splash was already capable of highlighting property wrappers, since
anything following an `@` symbol is treated as a keyword, but this
change adds a test that makes sure that it’ll keep working.
This change adds SwiftLint to the project. For now, the rules are tweaked
to match the current state of the code base — but will over time be changed
back to their defaults in several cases.
Some smaller changes (mostly related to code style) were applied to the
project to remove all warnings.
This change adds support for three pre-processors that can appear in
function delcarations: `#file`, `#line` and `#function`. They’re not
highlighted as pre-processors, but rather as keywords, to match the
way Xcode treats them.
This patch makes Splash correctly highlight associated types within
protocol declarations. Like other declarations, typed declared using
the `associatedtype` keyword should not be highlighted.
Previously, the last protocol would be treated as a function call (Splash
thought it was a call with trailing closure syntax, rather than the opening
of a type definition). This patch fixes that by verifying that the code
checking for constraints inside a generic type definition is in fact looking
at a generic, rather than something else.
Swift enables the use of keywords as function names, and we want those
to be treated as plain text (like other function names) rather than as
keywords. Some keywords require escaping using back-ticks, and this
patch accounts for both of those variations.