157 Commits

Author SHA1 Message Date
John Sundell
6a75ec4491
Add support for Swift 5 single-line raw strings (#52)
This change makes Splash capable of highlighting Swift 5 raw strings,
although it’s currently limited to single line string literals. Support
for multi-line literals will be added in a future commit.
2019-03-12 00:21:25 +01:00
Marco Capano
9a7fdefab4 Adding nonmutating support (#50) 2019-03-11 21:31:32 +01:00
John Sundell
1a77051c67
README: Remove social networks I no longer use 2019-03-11 14:55:04 +01:00
John Sundell
8bc46cbeb0
Add SwiftLint (#49)
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.
2019-03-11 14:52:46 +01:00
Marco Capano
892d6ae39c adding support for "dynamic" keyword (#48)
* adding support for "dynamic" keyword

* adding test for linux

* Fixing alignment issue
2019-03-11 13:57:33 +01:00
John Sundell
f50a610849
Merge pull request #47 from JohnSundell/multi-line-comments
Improve support for multi-line comments
2019-03-11 11:35:33 +01:00
John Sundell
18dd016aa1 Improve support for multi-line comments
This change enables Splash to highlight multi-line comments that begin
with two asterisks, rather than just one. A test has also been added to
verify that documentation-style multi-line comments with an asterisk on
each line are also highlighted correctly.
2019-03-11 00:40:57 +01:00
John Sundell
73ffdd2e0c
Merge pull request #46 from JohnSundell/html-merging
HTMLOutputFormat: Merge same-type tokens along with whitespace
2019-03-10 21:50:00 +01:00
John Sundell
6dff287cd2 HTMLOutputFormat: Merge same-type tokens along with whitespace
This change makes Splash merge tokens of the same type (along with any
whitespace in between them) when generating HTML. The result is much
smaller HTML, since less tags have to be used to produce the same result.

This was most obvious with comment highlighting, for example, this comment:

```
// Hello I’m a comment
```

Would generate 5 different <span class="comment"></span> elements. Now
it’s just one!
2019-03-10 21:17:08 +01:00
John Sundell
e4718f3053
Merge pull request #45 from JohnSundell/function-pre-processors
Support function argument pre-processors
2019-03-09 13:43:36 +01:00
John Sundell
74c3b8af27
Merge pull request #44 from JohnSundell/optional-pattern-matching
Support switch statements with nil pattern matching
2019-03-09 13:12:34 +01:00
John Sundell
59161f2724 Support function argument pre-processors
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.
2019-03-09 13:12:23 +01:00
John Sundell
d74074f409 Support switch statements with nil pattern matching
This change adds support for highlighting `nil` when
it occurs inside of a `switch` statement’s `case`.
2019-03-09 13:02:33 +01:00
John Sundell
c9425f5b60
Merge pull request #43 from JohnSundell/type-pattern-matching
Support ‘is’ keyword
2019-03-08 22:11:06 +01:00
John Sundell
88650438c8
Merge pull request #42 from JohnSundell/deinit
Support the deinit keyword
2019-03-08 22:04:19 +01:00
John Sundell
d72e816cd8 Support ‘is’ keyword
This change makes Splash support the `is` keyword, for example in type
pattern matching in `switch` statements.
2019-03-08 22:04:10 +01:00
John Sundell
6536fe5400
Merge pull request #41 from JohnSundell/private-set
Support highlighting of setters with an explicit access level
2019-03-08 21:58:03 +01:00
John Sundell
45ca85e299 Support the deinit keyword
This patch makes Splash correctly highlight the `deinit` keyword.
2019-03-08 21:57:56 +01:00
John Sundell
9a01bb7b85
Merge pull request #40 from JohnSundell/xctassert
Add special case for `XCTAssert` family of functions
2019-03-08 21:53:12 +01:00
John Sundell
c85d8d9d4d Support highlighting of setters with an explicit access level
This change makes Splash correctly highlight property setters that have
an explicit access level defined — such as `private(set) var`.
2019-03-08 21:50:07 +01:00
John Sundell
9fbdb92edb Add special case for XCTAssert family of functions
Normally, we don’t want Splash to contain too many special cases for
individual symbol names — but the `XCTAssert` family of functions are
so common that it warrants it. The problem is that Splash would currently
highlight those functions as types, since they are capitalized, which
has now been changed to function calls instead.
2019-03-08 19:14:18 +01:00
John Sundell
fdc0e22d5f
Merge pull request #39 from JohnSundell/associatedtypes
Correctly highlight associated types
2019-03-08 18:58:16 +01:00
John Sundell
f9ad32a0a6 Correctly highlight associated types
This patch makes Splash correctly highlight associated types within
protocol declarations. Like other declarations, typed declared using
the `associatedtype` keyword should not be highlighted.
2019-03-08 18:43:12 +01:00
John Sundell
a7df9b171f
Merge pull request #38 from JohnSundell/bool-as-argument
Correctly highlight Bools passed as unnamed function arguments
2019-03-08 18:38:40 +01:00
John Sundell
45740696d0 Correctly highlight Bools passed as unnamed function arguments
This patch fixes highlighting of `Bool` values passed as arguments that
don’t have an external parameter label.
2019-03-08 18:32:12 +01:00
John Sundell
48449ae5b1
Merge pull request #37 from JohnSundell/multiple-protocols
Correctly highlight types conforming to multiple protocols
2019-03-08 18:24:41 +01:00
John Sundell
7f2421cd99 Correctly highlight types conforming to multiple protocols
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.
2019-03-08 18:20:36 +01:00
John Sundell
b6232fc67f
Merge pull request #36 from JohnSundell/keywords-as-function-names
Don’t treat keywords used as function names as keywords
2019-03-08 18:05:20 +01:00
John Sundell
ddd2bf9020 Don’t treat keywords used as function names as keywords
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.
2019-03-08 17:55:44 +01:00
John Sundell
50a4c6a15e
Merge pull request #35 from JohnSundell/init-dot-syntax
Don’t treat .init() as an enum
2019-03-08 17:40:31 +01:00
John Sundell
87437d7425 Don’t treat .init() as an enum
This change adds a special condition not to treat `.init()` as an enum
(or any other kind of dot access), just like we previously had for `self`.
2019-03-08 17:26:10 +01:00
John Sundell
b72ba08cfc
README: Declare Swift version as 4.2 2019-03-06 11:08:32 +01:00
John Sundell
e6aa6129e0
Merge pull request #34 from JohnSundell/Swift-4.2
Bump Swift version to 4.2
2019-03-06 11:07:48 +01:00
John Sundell
f7732d1b23 Bump Swift version to 4.2 2019-03-06 10:44:59 +01:00
John Sundell
a3f7fb43c2
Merge pull request #33 from JohnSundell/indirect-enums
Add support for indirect enums
2019-03-06 10:42:30 +01:00
John Sundell
5d075f7168 Add support for indirect enums
This patch makes Splash correctly highlight `indirect` enums. The keyword
was missing from the grammar definition.
2019-03-06 10:40:03 +01:00
John Sundell
79ce0efd0e
Merge pull request #28 from kelvinlauKL/master
Fixes a typo
2019-01-16 23:56:58 +00:00
Kelvin Lau
4a42e6c582 Fixes typo 2019-01-15 17:41:19 -08:00
John Sundell
787d3ed127
Merge pull request #27 from ldstreet/patch-1
Update readme to include final html example
2019-01-14 00:23:05 +00:00
Luke Street
7186bd6548
Spaces not tabs
updated to use spaces instead of tabs to be consistent
2019-01-12 01:14:36 -06:00
Luke Street
f1796eb99b
Update readme to include final html example
Adding an example of a finished html file for those that might be less experienced in html (such as myself). Also added link to  HTMLOutputFormat and SPM declaration snippet for convenience. Thanks for the great library!
2019-01-07 22:39:47 -06:00
John Sundell
41f04573a4
Merge pull request #26 from mannberg/mannberg/splashtag
Added splashtag info to README
2018-12-17 00:46:20 +01:00
Anders Mannberg
ef8c745f31 Added splashtag info to README 2018-12-15 21:39:35 +01:00
John Sundell
0d1c781af1
Merge pull request #20 from MaciejGad/background_color
Add support for different background colors
2018-10-09 23:30:25 +02:00
John Sundell
6eda8586cc
Merge pull request #23 from viktorgardart/patch-1
Added webkit-overflow-scrolling to improve scrolling on iOS devices.
2018-10-09 23:28:09 +02:00
John Sundell
183224503f
Theme: Nitpicky code style fix 2018-10-09 23:22:50 +02:00
John Sundell
59d45d39e3
Theme: Documentation fix for backgroundColor 2018-10-09 23:22:18 +02:00
John Sundell
cb3f05d3e2
Theme+Defaults: Nitpicky code style fixes 2018-10-09 23:21:35 +02:00
Viktor Gardart
56bb70fb7f
Added webkit-overflow-scrolling to improve scrolling on iOS devices. 2018-10-05 23:20:26 +02:00
John Sundell
1dfa17227f
Merge pull request #22 from JohnSundell/custom-grammars
Make it easier to build custom grammars
2018-09-28 19:03:27 +02:00