yanagiba / swift-ast

A Swift AST parser and visitor that is written in Swift.
Apache License 2.0
354 stars 40 forks source link

Semicolons not handled as expected #61

Closed keeptyping closed 6 years ago

keeptyping commented 6 years ago

Issue Summary

Semicolons not handled as expected.

Environment

Reproduction Steps

Every _const_decl/vardecl which ends with a semicolon is treated as an error.

Sample code ``` struct SemicolonIssue { private let issue = ""; } ``` Command to run `swift-ast` with the code above: `swift-ast SemicolonIssue.swift`

Expected Result

A successfully parsed TopLevelDeclaration.

Actual Behavior

The parser failed with a badDeclaration error.

SemicolonIssue.swift:13:25 fatal: badDeclaration
petermichaux commented 6 years ago

I'm using SwiftKotlin (https://github.com/angelolloqui/SwiftKotlin) and unfortunately it does not accept semicolons in swift code (see https://github.com/angelolloqui/SwiftKotlin/issues/45). I think it because swift-ast does not accept semicolons. I hope swift-ast can be adjusted to accept semicolons.