Skip to content
Open
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
16 changes: 10 additions & 6 deletions src/providers/swift/parsing/parser.ml
Original file line number Diff line number Diff line change
Expand Up @@ -3088,19 +3088,23 @@ and balancedTokens _ =
(*| balanced-token -> Any identifier, keyword, literal, or operator |*)
(*| balanced-token -> Any punctuation except "(" , ")" , "[" , "]" , "{" , or "}" |*)
and balancedToken _ =
wchar '(' *> fix balancedTokens <* wchar '*'
wchar '(' *> fix balancedTokens <* wchar ')'
<|>
wchar '[' *> fix balancedTokens <* wchar ']'
<|>
wchar '{' *> fix balancedTokens <* wchar '}'
<|>
identifier () (*| this includes keywords |*)
<|>
literal ()
<|>
operator ()
<|> (
pos >>= fun pos ->
many1(fun () -> satisfy(function
| '(' | ')'
| '[' | ']'
| '{' | '}'
-> false
| _ -> true
| '.' | ',' | ':' | ';' | '=' | '@' | '#' | '&' | '`' | '?' | '!'
-> true
| _ -> false
)) >>| fun chars ->
NodeHolder(pos, string_of_chars chars)
)
Expand Down
7 changes: 7 additions & 0 deletions tests/swift_parser/valid/annotation.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// RUN: %neal-swift

final class Foo {
@available(*, unavailable, message: "Unavailable, use baz()")
func bar() {
}
}