diff --git a/src/providers/swift/parsing/parser.ml b/src/providers/swift/parsing/parser.ml index ef39531..66373de 100644 --- a/src/providers/swift/parsing/parser.ml +++ b/src/providers/swift/parsing/parser.ml @@ -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) ) diff --git a/tests/swift_parser/valid/annotation.swift b/tests/swift_parser/valid/annotation.swift new file mode 100644 index 0000000..d6ffd5b --- /dev/null +++ b/tests/swift_parser/valid/annotation.swift @@ -0,0 +1,7 @@ +// RUN: %neal-swift + +final class Foo { + @available(*, unavailable, message: "Unavailable, use baz()") + func bar() { + } +}