Skip to content

Commit

Permalink
Consolidate ASTTokenizable conformations into one file
Browse files Browse the repository at this point in the history
  • Loading branch information
ryuichis committed Sep 1, 2017
1 parent 09e29b2 commit 29426d8
Show file tree
Hide file tree
Showing 9 changed files with 60 additions and 164 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,18 @@

import AST

// MARK: - ASTNode

extension ASTNode: ASTTokenizable {}

// MARK: - Attribute

extension Attribute: ASTTokenizable {}
extension Attribute.ArgumentClause: ASTTokenizable {}
extension Attribute.ArgumentClause.BalancedToken: ASTTokenizable {}

// MARK: - Declaration

extension ProtocolDeclaration.InitializerMember: ASTTokenizable {}
extension GetterSetterBlock.GetterClause: ASTTokenizable {}
extension GetterSetterBlock.SetterClause: ASTTokenizable {}
Expand Down Expand Up @@ -44,3 +56,51 @@ extension ProtocolDeclaration.PropertyMember: ASTTokenizable {}
extension ProtocolDeclaration.SubscriptMember: ASTTokenizable {}
extension ProtocolDeclaration.AssociativityTypeMember: ASTTokenizable {}
extension VariableDeclaration.Body: ASTTokenizable {}

// MARK: - Expression

extension ClosureExpression.Signature: ASTTokenizable {}
extension ClosureExpression.Signature.CaptureItem: ASTTokenizable {}
extension ClosureExpression.Signature.CaptureItem.Specifier: ASTTokenizable {}
extension ClosureExpression.Signature.ParameterClause: ASTTokenizable {}
extension ClosureExpression.Signature.ParameterClause.Parameter: ASTTokenizable {}
extension FunctionCallExpression.Argument: ASTTokenizable {}
extension TupleExpression.Element: ASTTokenizable {}
extension DictionaryEntry: ASTTokenizable {}
extension SubscriptArgument: ASTTokenizable {}

// MARK: - Generic

extension GenericParameterClause: ASTTokenizable {}
extension GenericParameterClause.GenericParameter: ASTTokenizable {}
extension GenericWhereClause: ASTTokenizable {}
extension GenericWhereClause.Requirement: ASTTokenizable {}
extension GenericArgumentClause: ASTTokenizable {}

// MARK: - Pattern

extension PatternBase: ASTTokenizable {}
extension TuplePattern.Element: ASTTokenizable {}

// MARK: - statement

extension DoStatement.CatchClause: ASTTokenizable {}
extension IfStatement.ElseClause: ASTTokenizable {}
extension SwitchStatement.Case: ASTTokenizable {}
extension SwitchStatement.Case.Item: ASTTokenizable {}
extension Condition: ASTTokenizable {}
extension AvailabilityCondition: ASTTokenizable {}
extension AvailabilityCondition.Argument: ASTTokenizable {}

// MARK: - Type

extension TypeBase: ASTTokenizable {}
extension FunctionType.Argument: ASTTokenizable {}
extension TupleType.Element: ASTTokenizable {}
extension TypeAnnotation: ASTTokenizable {}
extension TypeIdentifier.TypeName: ASTTokenizable {}
extension TypeInheritanceClause: ASTTokenizable {}

// MARK: - Throws

extension ThrowsKind: ASTTokenizable {}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,3 @@ extension ASTTokenizable {
return Token(origin: self, node: node, kind: kind, value: value)
}
}


// TODO: Remove and make it per element?
extension ASTNode: ASTTokenizable {}
22 changes: 0 additions & 22 deletions Sources/Transform/Tokenizer/Tokenizer+Attribute.swift

This file was deleted.

27 changes: 0 additions & 27 deletions Sources/Transform/Tokenizer/Tokenizer+Expression.swift

This file was deleted.

23 changes: 0 additions & 23 deletions Sources/Transform/Tokenizer/Tokenizer+Generic.swift

This file was deleted.

20 changes: 0 additions & 20 deletions Sources/Transform/Tokenizer/Tokenizer+Pattern.swift

This file was deleted.

25 changes: 0 additions & 25 deletions Sources/Transform/Tokenizer/Tokenizer+Statement.swift

This file was deleted.

24 changes: 0 additions & 24 deletions Sources/Transform/Tokenizer/Tokenizer+Types.swift

This file was deleted.

19 changes: 0 additions & 19 deletions Sources/Transform/Tokenizer/Tokenizer+Util.swift

This file was deleted.

0 comments on commit 29426d8

Please sign in to comment.