Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow declarations that start with a multiline comment #82

Merged
merged 1 commit into from
Dec 31, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion corpus/classes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ Class with methods and expressions
==================

class Strings {
/// Some awesome docummentation!
/// Yay
func aString() -> String { return "Hello World!" }

func anotherString() -> String { return "Hello" + " " + "World" }
Expand All @@ -55,6 +57,8 @@ class Strings {
(source_file
(class_declaration (type_identifier)
(class_body
(comment)
(comment)
(function_declaration
(simple_identifier)
(user_type (type_identifier))
Expand All @@ -77,7 +81,7 @@ Class with modifiers
internal open class Test {
private(set) var isRunning: Bool
internal(set) var isFailed: Bool
private final func test() { }
/* some comment */ private final func test() { }
}

---
Expand All @@ -95,6 +99,7 @@ internal open class Test {
(modifiers (visibility_modifier))
(value_binding_pattern (non_binding_pattern (simple_identifier)))
(type_annotation (user_type (type_identifier))))
(multiline_comment)
(function_declaration
(modifiers (visibility_modifier) (inheritance_modifier))
(simple_identifier)
Expand Down
6 changes: 5 additions & 1 deletion grammar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1399,8 +1399,12 @@ module.exports = grammar({
$._type
),

_class_member_separator: ($) => choice($._semi, $.multiline_comment),
_class_member_declarations: ($) =>
seq(sep1($._type_level_declaration, $._semi), optional($._semi)),
seq(
sep1($._type_level_declaration, $._class_member_separator),
optional($._class_member_separator)
),

_function_value_parameters: ($) =>
seq("(", optional(sep1($._function_value_parameter, ",")), ")"),
Expand Down
1 change: 0 additions & 1 deletion script-data/known_failures.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@ RxSwift/RxExample/RxExample/Examples/GitHubSearchRepositories/GitHubSearchReposi
RxSwift/Rx.playground/Pages/Transforming_Operators.xcplaygroundpage/Contents.swift
SwiftLint/Source/SwiftLintFramework/Extensions/String+SwiftLint.swift
GRDB/GRDB/Core/Row.swift
GRDB/GRDB/Core/Statement.swift