├── .codebeatignore ├── .gitignore ├── .python-version ├── .ruby-version ├── .swift-format ├── .swiftlint.yml ├── .vscode └── settings.json ├── AntlrGrammars ├── .gitignore ├── GrammarTransformer │ ├── .gitignore │ ├── .vscode │ │ ├── launch.json │ │ └── tasks.json │ ├── Package.resolved │ ├── Package.swift │ ├── Sources │ │ └── AntlrGrammars │ │ │ ├── IO │ │ │ ├── FileDisk.swift │ │ │ └── FileIOType.swift │ │ │ ├── MainCommand.swift │ │ │ ├── SourceTransformer │ │ │ ├── LexerTransformer.swift │ │ │ ├── ParserTransformer.swift │ │ │ ├── SourceGenerator.swift │ │ │ ├── SwiftFormatterTransformer.swift │ │ │ └── TransformerType.swift │ │ │ └── SwiftSyntax+Ext │ │ │ ├── StringMatcher.swift │ │ │ ├── SwiftSyntax+Ext.swift │ │ │ ├── SwiftSyntax+Search.swift │ │ │ ├── SyntaxGeneration.swift │ │ │ └── TokenSyntax+Ext.swift │ └── Tests │ │ └── AntlrGrammarsTests │ │ ├── AntlrGrammarsTests.swift │ │ ├── SourceTransformer │ │ ├── LexerTransformerTests.swift │ │ └── ParserTransformerTests.swift │ │ └── TestUtils │ │ ├── FileIOTypeStub.swift │ │ ├── String+Ext.swift │ │ └── StringDiffTesting.swift ├── ObjcGrammar │ ├── .gitignore │ ├── Makefile │ ├── ObjectiveCLexer.g4 │ ├── ObjectiveCLexer.tokens │ ├── ObjectiveCParser.g4 │ ├── README.md │ ├── one-step-processing │ │ ├── ObjectiveCLexer.g4 │ │ └── ObjectiveCPreprocessorParser.g4 │ ├── pom.xml │ └── two-step-processing │ │ ├── ObjectiveCLexer.g4 │ │ ├── ObjectiveCPreprocessor.java │ │ ├── ObjectiveCPreprocessorLexer.g4 │ │ ├── ObjectiveCPreprocessorLexer.tokens │ │ └── ObjectiveCPreprocessorParser.g4 └── README.md ├── Architecture.md ├── Gemfile ├── Gemfile.lock ├── LICENSE.md ├── Package.resolved ├── Package.swift ├── README.md ├── Sources ├── Core │ ├── Analysis │ │ ├── CallGraph │ │ │ ├── CallGraph+Creation.swift │ │ │ ├── CallGraph+Graphviz.swift │ │ │ └── CallGraph.swift │ │ ├── ControlFlowGraph │ │ │ └── ControlFlowGraph+Creation.swift │ │ ├── DefinitionTypePropagator.swift │ │ ├── DirectedGraphBase.swift │ │ ├── Graphviz │ │ │ └── NodeDefinition.swift │ │ ├── ReachingDefinitionAnalyzer.swift │ │ └── UsageAnalysis │ │ │ ├── BaseUsageAnalyzer.swift │ │ │ ├── DefinitionUsage.swift │ │ │ ├── IntentionCollectionUsageAnalyzer.swift │ │ │ ├── LocalUsageAnalyzer.swift │ │ │ ├── LocalUsageAnalyzerType.swift │ │ │ └── UsageAnalysis.swift │ ├── AntlrCommons │ │ ├── AntlrDiagnosticsErrorListener.swift │ │ ├── AntlrParser.swift │ │ ├── AntlrSettings.swift │ │ └── AntlrTypeAliases.swift │ ├── Commons │ │ ├── ArgumentRewritingStrategy.swift │ │ ├── CompoundedMappingType.swift │ │ ├── CompoundedMappingTypeList.swift │ │ ├── CoreGraphicsCompoundTypes.swift │ │ ├── FoundationCompoundTypes.swift │ │ ├── FunctionInvocationTransformer.swift │ │ ├── Helpers.swift │ │ ├── IncompleteKnownType+CompoundType.swift │ │ ├── MethodInvocationRewriter.swift │ │ ├── PostfixInvocationTransformer.swift │ │ ├── PostfixTransformation.swift │ │ ├── SignatureMapper.swift │ │ ├── SwiftAttributeTransformationsExtractor.swift │ │ ├── SwiftClassInterfaceParser.swift │ │ ├── UIColorCompoundType.swift │ │ ├── UIControlCompoundType.swift │ │ ├── UIGestureRecognizerCompoundType.swift │ │ ├── UILabelCompoundType.swift │ │ ├── UIResponderCompoundType.swift │ │ ├── UIViewCompoundType.swift │ │ └── UIViewControllerCompoundType.swift │ ├── ExpressionPasses │ │ ├── ASTRewriterPass.swift │ │ ├── ASTRewriterPassApplier.swift │ │ ├── ASTRewriterPassContext.swift │ │ ├── ASTSimplifier.swift │ │ ├── AllocInitExpressionPass.swift │ │ ├── BaseExpressionPass.swift │ │ ├── CanonicalNameExpressionPass.swift │ │ ├── CompoundTypeApplierExpressionPass.swift │ │ ├── CoreGraphicsExpressionPass.swift │ │ ├── EnumRewriterExpressionPass.swift │ │ ├── FoundationExpressionPass.swift │ │ ├── InitRewriterExpressionPass.swift │ │ ├── LocalConstantPromotionExpressionPass.swift │ │ ├── MethodInvocationTransformer.swift │ │ ├── MethodsToPropertyTransformer.swift │ │ ├── NilValueTransformationsPass.swift │ │ ├── NumberCommonsExpressionPass.swift │ │ ├── PropertyAsMethodAccessCorrectingExpressionPass.swift │ │ ├── PropertyInvocationTransformer.swift │ │ ├── StaticConstructorTransformer.swift │ │ ├── UIKitExpressionPass.swift │ │ ├── ValueTransformer+PostfixTransformer.swift │ │ └── VariableNullabilityPromotionExpressionPass.swift │ ├── GrammarModelBase │ │ ├── ASTNode.swift │ │ ├── ASTVisitor.swift │ │ ├── CommentQuerier.swift │ │ ├── CommentedASTNodeType.swift │ │ └── RawCodeComment.swift │ ├── IntentionPasses │ │ ├── AnonymousIntentionVisitor.swift │ │ ├── DetectNoReturnsIntentionPass.swift │ │ ├── DetectNonnullReturnsIntentionPass.swift │ │ ├── DetectTypePropertiesBySelfAssignmentIntentionPass.swift │ │ ├── FileTypeMergingIntentionPass.swift │ │ ├── FunctionIntentionVisitor.swift │ │ ├── ImportDirectiveIntentionPass.swift │ │ ├── InitAnalysisIntentionPass.swift │ │ ├── IntentionPass.swift │ │ ├── IntentionPassSource.swift │ │ ├── PromoteProtocolPropertyConformanceIntentionPass.swift │ │ ├── ProtocolNullabilityPropagationToConformersIntentionPass.swift │ │ ├── RemoveEmptyExtensionsIntentionPass.swift │ │ ├── Shared │ │ │ └── ReturnStatementVisitor.swift │ │ ├── Sources │ │ │ └── ArrayIntentionPassSource.swift │ │ ├── StoredPropertyToNominalTypesIntentionPass.swift │ │ ├── SubscriptDeclarationIntentionPass.swift │ │ ├── SwiftifyMethodSignaturesIntentionPass.swift │ │ ├── TypeMerger.swift │ │ ├── TypeVisitingIntentionPass.swift │ │ └── UIKitCorrectorIntentionPass.swift │ ├── Intentions │ │ ├── BaseClassIntention.swift │ │ ├── FileLevelIntention.swift │ │ ├── FromSourceIntention.swift │ │ ├── FunctionBodyCarryingIntention.swift │ │ ├── FunctionBodyQueue.swift │ │ ├── FunctionIntention.swift │ │ ├── Historic │ │ │ ├── Historic.swift │ │ │ ├── IntentionHistory.swift │ │ │ ├── IntentionHistoryEntry.swift │ │ │ ├── IntentionHistoryEntryEcho.swift │ │ │ └── IntentionHistoryTracker.swift │ │ ├── InstanceVariableContainerIntention.swift │ │ ├── Intention.swift │ │ ├── IntentionCollection.swift │ │ ├── Intentions │ │ │ ├── ClassExtensionGenerationIntention.swift │ │ │ ├── ClassGenerationIntention.swift │ │ │ ├── DeinitGenerationIntention.swift │ │ │ ├── EnumCaseGenerationIntention.swift │ │ │ ├── EnumGenerationIntention.swift │ │ │ ├── FileGenerationIntention.swift │ │ │ ├── FunctionBodyIntention.swift │ │ │ ├── GlobalFunctionGenerationIntention.swift │ │ │ ├── GlobalVariableGenerationIntention.swift │ │ │ ├── GlobalVariableInitialValueIntention.swift │ │ │ ├── InitGenerationIntention.swift │ │ │ ├── InstanceVariableGenerationIntention.swift │ │ │ ├── MethodGenerationIntention.swift │ │ │ ├── PropertyGenerationIntention.swift │ │ │ ├── PropertyInitialValueGenerationIntention.swift │ │ │ ├── PropertySynthesizationIntention.swift │ │ │ ├── ProtocolGenerationIntention.swift │ │ │ ├── ProtocolInheritanceIntention.swift │ │ │ ├── ProtocolMethodGenerationIntention.swift │ │ │ ├── ProtocolPropertyGenerationIntention.swift │ │ │ ├── StructGenerationIntention.swift │ │ │ ├── SubscriptGenerationIntention.swift │ │ │ └── TypealiasIntention.swift │ │ ├── KnownType+IntentionBuild.swift │ │ ├── MemberGenerationIntention.swift │ │ ├── Metadata │ │ │ ├── SerializableMetadata.swift │ │ │ ├── SerializableMetadataEntry.swift │ │ │ └── SerializableMetadataSerializerType.swift │ │ ├── NonNullScopedIntention.swift │ │ ├── OverridableMemberGenerationIntention.swift │ │ ├── Serialization │ │ │ ├── IntentionSerializer.swift │ │ │ ├── KeyedDecodingContainerProtocol+Intention.swift │ │ │ ├── KeyedEncodingContainerProtocol+Intention.swift │ │ │ ├── UnkeyedDecodingContainer+Intention.swift │ │ │ └── UnkeyedEncodingContainer+Intention.swift │ │ ├── StatementContainer.swift │ │ ├── TypeFormatter+Intentions.swift │ │ ├── TypeGenerationIntention.swift │ │ ├── ValueStorageIntention.swift │ │ └── Visitor │ │ │ ├── AnonymousIntentionVisitor.swift │ │ │ └── IntentionVisitor.swift │ ├── KnownType │ │ ├── AttributeTaggableObject.swift │ │ ├── KnownAttribute.swift │ │ ├── KnownDeclaration.swift │ │ ├── KnownFile+Equality.swift │ │ ├── KnownFile.swift │ │ ├── KnownFileBuilder.swift │ │ ├── KnownType+Equality.swift │ │ ├── KnownType.swift │ │ ├── KnownTypeBuilder.swift │ │ ├── KnownTypeSerializer.swift │ │ ├── Semantic.swift │ │ ├── SemanticalObject.swift │ │ ├── Semantics.swift │ │ └── TypeFormatter+Ext.swift │ ├── SourcePreprocessors │ │ ├── QuickSpecPreprocessor.swift │ │ └── SourcePreprocessor.swift │ ├── SwiftSyntaxRewriterPasses │ │ ├── DefaultSyntaxPassProvider.swift │ │ └── StatementSpacingSyntaxPass.swift │ ├── SwiftSyntaxSupport │ │ ├── DecoratableElement.swift │ │ ├── ModifiersDecorators.swift │ │ ├── StatementEmitter+Expression.swift │ │ ├── StatementEmitter+Statement.swift │ │ ├── StatementEmitter.swift │ │ ├── SwiftProducer.swift │ │ ├── SwiftProducerDelegate.swift │ │ ├── SwiftSyntaxRewriterPass.swift │ │ ├── SwiftSyntaxRewriterPassApplier.swift │ │ ├── SwiftTypeStringProducer.swift │ │ └── SwiftVariableDeclaration.swift │ ├── TypeSystem │ │ ├── CodeDefinition │ │ │ ├── CodeDefinition.swift │ │ │ ├── GlobalCodeDefinition.swift │ │ │ ├── GlobalIntentionCodeDefinition.swift │ │ │ ├── KnownMemberCodeDefinition.swift │ │ │ ├── LocalCodeDefinition.swift │ │ │ └── TypeCodeDefinition.swift │ │ ├── CodeScope │ │ │ ├── ArrayDefinitionsSource.swift │ │ │ ├── CodeScope.swift │ │ │ ├── CompoundDefinitionsSource.swift │ │ │ ├── DefaultCodeScope.swift │ │ │ ├── DefinitionsSource.swift │ │ │ └── SyntaxNode+CodeScope.swift │ │ ├── CompoundKnownType.swift │ │ ├── GlobalsProvider.swift │ │ ├── IntentionCollectionTypeSystem.swift │ │ ├── MemberLookup │ │ │ ├── DynamicMemberLookup.swift │ │ │ ├── KnownTypeMemberLookup.swift │ │ │ ├── MemberLookupType.swift │ │ │ ├── MemberSearchCache.swift │ │ │ ├── SwiftTypeMemberLookup.swift │ │ │ └── TypeMemberLookupContext.swift │ │ ├── OverloadResolver.swift │ │ ├── Providers │ │ │ ├── KnownTypeProvider.swift │ │ │ └── TypealiasProvider.swift │ │ ├── TypeCategory.swift │ │ ├── TypeMapper.swift │ │ ├── TypeMemberLookup.swift │ │ ├── TypeResolution │ │ │ ├── CallableTypeResolver.swift │ │ │ ├── CoercionVerifier.swift │ │ │ ├── DefaultLocalTypeResolverInvoker.swift │ │ │ ├── DefaultTypeResolverInvoker.swift │ │ │ ├── ExpressionTypeResolver+Context.swift │ │ │ ├── ExpressionTypeResolver.swift │ │ │ ├── IteratorTypeResolver.swift │ │ │ ├── LocalTypeResolverInvoker.swift │ │ │ ├── PatternMatcher.swift │ │ │ ├── TypeResolverIntrinsicsBuilder.swift │ │ │ └── TypeResolverInvoker.swift │ │ └── TypeSystem.swift │ └── WriterTargetOutput │ │ ├── NullRewriterOutputTarget.swift │ │ ├── RewriterOutputTarget.swift │ │ └── StringRewriterOutput.swift ├── Frontend │ └── Objective-C │ │ ├── GlobalsProviders │ │ ├── BaseGlobalsProvider.swift │ │ ├── CLibGlobalsProviders.swift │ │ ├── CompoundedMappingTypesGlobalsProvider.swift │ │ ├── DefaultGlobalsProvidersSource.swift │ │ ├── OpenGLESGlobalsProvider.swift │ │ └── UIKitGlobalsProvider.swift │ │ ├── ObjcGrammarModels │ │ ├── ASTNodeSerialization.swift │ │ ├── ObjcASTNode.swift │ │ ├── ObjcClass+Method.swift │ │ ├── ObjcClass+Property.swift │ │ ├── ObjcClassCategoryInterfaceNode.swift │ │ ├── ObjcClassImplementationNode.swift │ │ ├── ObjcClassInterfaceNode.swift │ │ ├── ObjcEnumDeclarationNode.swift │ │ ├── ObjcExpressionNode.swift │ │ ├── ObjcFunctionDefinitionNode.swift │ │ ├── ObjcGlobalContextNode.swift │ │ ├── ObjcIdentifierNode.swift │ │ ├── ObjcInitializableNode.swift │ │ ├── ObjcKeyword.swift │ │ ├── ObjcKeywordNode.swift │ │ ├── ObjcOperator.swift │ │ ├── ObjcPreprocessorDirective.swift │ │ ├── ObjcPropertyImplementationNode.swift │ │ ├── ObjcPropertySynthesizeListNode.swift │ │ ├── ObjcProtocolDeclarationNode.swift │ │ ├── ObjcStructDeclarationNode.swift │ │ ├── ObjcTokenType.swift │ │ ├── ObjcType.swift │ │ ├── ObjcTypeNameNode.swift │ │ ├── ObjcTypedefNode.swift │ │ ├── ObjcUnknownNode.swift │ │ └── ObjcVariableDeclarationNode.swift │ │ ├── ObjcParser │ │ ├── ConstantExtractor.swift │ │ ├── DeclarationExtractor │ │ │ ├── AntlrDeclarationParser.swift │ │ │ ├── DeclarationExtractor.swift │ │ │ ├── DeclarationSyntaxElementType+ObjcType.swift │ │ │ ├── DeclarationSyntaxElementType.swift │ │ │ └── Syntax │ │ │ │ ├── Basic │ │ │ │ ├── ConstantExpressionSyntax.swift │ │ │ │ ├── ExpressionSyntax.swift │ │ │ │ ├── IdentifierSyntax.swift │ │ │ │ ├── InitializerSyntax.swift │ │ │ │ ├── ParameterDeclarationSyntax.swift │ │ │ │ ├── ParameterListSyntax.swift │ │ │ │ ├── ParameterTypeListSyntax.swift │ │ │ │ ├── PointerSyntax.swift │ │ │ │ ├── ProtocolReferenceListSyntax.swift │ │ │ │ ├── SpecifierQualifierListSyntax.swift │ │ │ │ └── TypeQualifierListSyntax.swift │ │ │ │ ├── DeclarationSpecifierSyntax.swift │ │ │ │ ├── DeclarationSpecifiers │ │ │ │ ├── AlignmentSpecifierSyntax.swift │ │ │ │ ├── ArcBehaviourSpecifierSyntax.swift │ │ │ │ ├── BlockDeclarationSpecifierSyntax.swift │ │ │ │ ├── FunctionSpecifierSyntax.swift │ │ │ │ ├── IBOutletQualifierSyntax.swift │ │ │ │ ├── NullabilitySpecifierSyntax.swift │ │ │ │ ├── ProtocolQualifierSyntax.swift │ │ │ │ ├── StorageClassSpecifierSyntax.swift │ │ │ │ ├── TypePrefixSyntax.swift │ │ │ │ ├── TypeQualifierSyntax.swift │ │ │ │ ├── TypeSpecifierSyntax.swift │ │ │ │ └── TypeSpecifiers │ │ │ │ │ ├── EnumSpecifierSyntax.swift │ │ │ │ │ ├── GenericTypeSpecifierSyntax.swift │ │ │ │ │ ├── ScalarTypeSpecifierSyntax.swift │ │ │ │ │ ├── StructOrUnionSpecifierSyntax.swift │ │ │ │ │ └── TypeIdentifierSyntax.swift │ │ │ │ ├── DeclarationSpecifiersSyntax.swift │ │ │ │ ├── DeclarationSyntax.swift │ │ │ │ ├── Declarators │ │ │ │ ├── DeclaratorSyntax.swift │ │ │ │ ├── DirectDeclaratorSyntax.swift │ │ │ │ ├── DirectDeclarators │ │ │ │ │ ├── ArrayDeclaratorSyntax.swift │ │ │ │ │ ├── BlockDeclaratorSyntax.swift │ │ │ │ │ └── FunctionDeclaratorSyntax.swift │ │ │ │ └── FieldDeclaratorSyntax.swift │ │ │ │ ├── FieldDeclarationSyntax.swift │ │ │ │ ├── InitDeclarationListSyntax.swift │ │ │ │ ├── InitDeclarationSyntax.swift │ │ │ │ ├── TypeName │ │ │ │ ├── AbstractDeclaratorSyntax.swift │ │ │ │ ├── DirectAbstractDeclaratorSyntax.swift │ │ │ │ └── DirectAbstractDeclarators │ │ │ │ │ ├── ArrayAbstractDeclaratorSyntax.swift │ │ │ │ │ ├── BlockAbstractDeclaratorSyntax.swift │ │ │ │ │ └── FunctionAbstractDeclaratorSyntax.swift │ │ │ │ ├── TypeNameSyntax.swift │ │ │ │ └── TypeVariableDeclaratorSyntax.swift │ │ ├── DeclarationTranslator.swift │ │ ├── DefinitionCollector.swift │ │ ├── Lexer+ObjcLexing.swift │ │ ├── NodeContext.swift │ │ ├── NonnullContextQuerier.swift │ │ ├── ObjcASTNodeFactory+DeclarationSyntax.swift │ │ ├── ObjcASTNodeFactory.swift │ │ ├── ObjcCommentApplier.swift │ │ ├── ObjcImportDecl.swift │ │ ├── ObjcParser.swift │ │ ├── ObjcParserListener.swift │ │ ├── ObjcParserState.swift │ │ ├── ObjcPreprocessorListener.swift │ │ ├── ObjcTokenType+TokenProtocol.swift │ │ ├── ObjcTypeParser.swift │ │ ├── ObjectiveCParser+ParserRuleContext.swift │ │ ├── ObjectiveCParser+RuleExt.swift │ │ ├── ObjectiveCPreprocessor.swift │ │ ├── Source+Ext.swift │ │ └── VarDeclarationIdentifierNameExtractor.swift │ │ ├── ObjcParserAntlr │ │ ├── ObjectiveCLexer.swift │ │ ├── ObjectiveCParser.swift │ │ ├── ObjectiveCParserBaseListener.swift │ │ ├── ObjectiveCParserBaseVisitor.swift │ │ ├── ObjectiveCParserListener.swift │ │ ├── ObjectiveCParserVisitor.swift │ │ ├── ObjectiveCPreprocessorLexer.swift │ │ ├── ObjectiveCPreprocessorParser.swift │ │ ├── ObjectiveCPreprocessorParserBaseListener.swift │ │ ├── ObjectiveCPreprocessorParserBaseVisitor.swift │ │ ├── ObjectiveCPreprocessorParserListener.swift │ │ ├── ObjectiveCPreprocessorParserVisitor.swift │ │ └── shim.swift │ │ ├── ObjectiveCFrontend │ │ ├── CPreprocessorDirectiveConverter.swift │ │ ├── ExpressionPasses │ │ │ └── ObjectiveCASTCorrectorExpressionPass.swift │ │ ├── Intention+Metadata.swift │ │ ├── Intention+TypedSource.swift │ │ ├── IntentionPasses │ │ │ └── ObjectiveCPropertyMergeIntentionPass.swift │ │ ├── MandatoryIntentionPass.swift │ │ ├── MandatorySyntaxNodePass.swift │ │ ├── ObjcParserStatePool.swift │ │ ├── ObjectiveC2SwiftRewriter.swift │ │ ├── ObjectiveC2SwiftRewriterJob.swift │ │ ├── ObjectiveC2SwiftRewriterJobBuilder.swift │ │ ├── ObjectiveCASTReader.swift │ │ ├── ObjectiveCASTReaderContext.swift │ │ ├── ObjectiveCExprASTReader.swift │ │ ├── ObjectiveCFileCollectionStep.swift │ │ ├── ObjectiveCFileCollectionStepDelegate.swift │ │ ├── ObjectiveCFrontend.swift │ │ ├── ObjectiveCImportDirectiveFileCollectionDelegate.swift │ │ ├── ObjectiveCIntentionCollector.swift │ │ ├── ObjectiveCMethodSignatureConverter.swift │ │ ├── ObjectiveCParserCache.swift │ │ ├── ObjectiveCStatementASTReader.swift │ │ └── ObjectiveCSwiftRewriterService.swift │ │ └── TypeDefinitions │ │ ├── TypeDefinitions.swift │ │ ├── ios-framework-classes.json │ │ └── ios-framework-protocols.json ├── SwiftRewriter │ ├── GlobalOptions.swift │ ├── Objective-C │ │ ├── ObjectiveCCommand.swift │ │ ├── ObjectiveCFrontendImpl.swift │ │ ├── ObjectiveCStdoutFileCollectionStepListener.swift │ │ └── ObjectiveCSwiftRewriterServiceImpl.swift │ ├── SwiftRewriterCommand.swift │ ├── Target.swift │ └── main.swift ├── SwiftRewriterCLI │ ├── FilesExplorer.swift │ ├── Menu.swift │ ├── Stopwatch.swift │ └── SwiftRewriterFrontend.swift ├── SwiftRewriterLib │ ├── ColorizeSyntaxVisitor.swift │ ├── DiskInputFile.swift │ ├── FileDiskProvider.swift │ ├── FileProvider.swift │ ├── FileWriterOutput.swift │ ├── InputSourcesProvider.swift │ ├── NullWriterOutput.swift │ ├── PathFilter.swift │ ├── SingleInputProvider.swift │ ├── StdoutWriterOutput.swift │ ├── SwiftASTCommentApplier.swift │ ├── SwiftRewriterService.swift │ ├── SwiftSyntaxOptions.swift │ ├── SwiftWriter.swift │ └── WriterOutput.swift ├── TestCommons │ ├── Array+Testing.swift │ ├── Asserter.swift │ ├── Asserters │ │ ├── Antlr+Asserter.swift │ │ ├── Asserter+KeyPath.swift │ │ ├── GrammarModelBase │ │ │ ├── ASTNode+Asserter.swift │ │ │ └── RawCodeComment+Asserter.swift │ │ ├── Intentions │ │ │ ├── ClassExtensionGenerationIntention+Asserter.swift │ │ │ ├── FileGenerationIntention+Asserter.swift │ │ │ ├── FromSourceIntention+Asserter.swift │ │ │ ├── FunctionBodyIntention+Asserter.swift │ │ │ ├── FunctionIntention+Asserter.swift │ │ │ ├── Historic+Asserter.swift │ │ │ ├── IntentionCollection+Asserter.swift │ │ │ ├── MethodGenerationIntention+Asserter.swift │ │ │ ├── PropertyGenerationIntention+Asserter.swift │ │ │ ├── SubscriptGenerationIntention+Asserter.swift │ │ │ ├── TypeGenerationIntention+Asserter.swift │ │ │ └── ValueStorageIntention+Asserter.swift │ │ ├── ObjcGrammarModels │ │ │ ├── ObjcASTNode+Asserter.swift │ │ │ ├── ObjcClassCategoryInterfaceNode+Asserter.swift │ │ │ ├── ObjcClassInterfaceNode+Asserter.swift │ │ │ ├── ObjcConstantExpressionNode+Asserter.swift │ │ │ ├── ObjcEnumCaseNode+Asserter.swift │ │ │ ├── ObjcEnumDeclarationNode+Asserter.swift │ │ │ ├── ObjcExpressionNode+Asserter.swift │ │ │ ├── ObjcFunctionDefinitionNode+Asserter.swift │ │ │ ├── ObjcFunctionParameterNode+Asserter.swift │ │ │ ├── ObjcIdentifierNode+Asserter.swift │ │ │ ├── ObjcInitialExpressionNode+Asserter.swift │ │ │ ├── ObjcMethodBodyNode+Asserter.swift │ │ │ ├── ObjcMethodDefinitionNode+Asserter.swift │ │ │ ├── ObjcPropertyAttributesListNode+Asserter.swift │ │ │ ├── ObjcPropertyDefinitionNode+Asserter.swift │ │ │ ├── ObjcPropertyImplementationNode+Asserter.swift │ │ │ ├── ObjcPropertySynthesizeListNode+Asserter.swift │ │ │ ├── ObjcProtocolDeclaration+Asserter.swift │ │ │ ├── ObjcStructDeclarationNode+Asserter.swift │ │ │ ├── ObjcStructFieldNode+Asserter.swift │ │ │ ├── ObjcTypeNameNode+Asserter.swift │ │ │ ├── ObjcTypedefNode+Asserter.swift │ │ │ └── ObjcVariableDeclarationNode+Asserter.swift │ │ ├── ObjcParser │ │ │ └── ObjcImportDecl+Asserter.swift │ │ ├── Stdlib │ │ │ ├── AnyObject+Asserter.swift │ │ │ ├── Bool+Asserter.swift │ │ │ ├── Collection+Asserter.swift │ │ │ ├── Equatable+Asserter.swift │ │ │ ├── IteratorProtocol+Asserter.swift │ │ │ └── Sequence+Asserter.swift │ │ ├── SwiftAST │ │ │ ├── Expression+Asserter.swift │ │ │ ├── FunctionSignature+Asserter.swift │ │ │ ├── ParameterSignature+Asserter.swift │ │ │ └── Statement+Asserter.swift │ │ └── Utils │ │ │ └── SourceRange+Asserter.swift │ ├── Builders │ │ ├── DeclarationBuilder.swift │ │ ├── IntentionCollectionBuilder.swift │ │ ├── MemberBuilder.swift │ │ ├── TypeBuilder.swift │ │ └── _FunctionBuilder.swift │ ├── ExpressionPassTestCase.swift │ ├── ExpressionPrinter.swift │ ├── MersenneTwister.swift │ ├── StatementPrinter.swift │ ├── StringDiffTesting.swift │ ├── SyntaxNode+TestUtils.swift │ ├── TestWriterOutput.swift │ └── VirtualFileDisk.swift └── Utils │ ├── CodeSource.swift │ ├── ConcurrentOperationQueue.swift │ ├── ConcurrentValue.swift │ ├── Diagnostics.swift │ ├── InvalidSource.swift │ ├── LinuxSupport.swift │ ├── Mutex.swift │ ├── Source.swift │ ├── SourceLength.swift │ ├── SourceLocation.swift │ ├── SourceRange.swift │ ├── String.swift │ ├── StringCodeSource.swift │ └── Utils.swift ├── SwiftRewriter.code-workspace ├── SwiftRewriter.xcodeproj ├── AnalysisTests_Info.plist ├── Analysis_Info.plist ├── Antlr4_Info.plist ├── AntlrCommons_Info.plist ├── ArgumentParserToolInfo_Info.plist ├── ArgumentParser_Info.plist ├── Basic_Info.plist ├── CAntlrShims_Info.plist ├── CYaml_Info.plist ├── Clang_C_Info.plist ├── CommonsTests_Info.plist ├── Commons_Info.plist ├── Console_Info.plist ├── ExpressionPassesTests_Info.plist ├── ExpressionPasses_Info.plist ├── GlobalsProvidersTests_Info.plist ├── GlobalsProviders_Info.plist ├── GrammarModelBaseTests_Info.plist ├── GrammarModelBase_Info.plist ├── GrammarModelsTests_Info.plist ├── GrammarModels_Info.plist ├── GraphvizLibTests_Info.plist ├── GraphvizLib_Info.plist ├── GraphvizTests_Info.plist ├── Graphviz_Info.plist ├── IntentionPassesTests_Info.plist ├── IntentionPasses_Info.plist ├── IntentionsTests_Info.plist ├── Intentions_Info.plist ├── JavaScriptFrontendTests_Info.plist ├── JavaScriptFrontend_Info.plist ├── JsGrammarModels_Info.plist ├── JsParserAntlr_Info.plist ├── JsParserTests_Info.plist ├── JsParser_Info.plist ├── KnownTypeTests_Info.plist ├── KnownType_Info.plist ├── MiniLexer_Info.plist ├── ObjcGrammarModelsTests_Info.plist ├── ObjcGrammarModels_Info.plist ├── ObjcParserAntlr_Info.plist ├── ObjcParserTests_Info.plist ├── ObjcParser_Info.plist ├── ObjectiveCFrontendTests_Info.plist ├── ObjectiveCFrontend_Info.plist ├── POSIX_Info.plist ├── SPMLibc_Info.plist ├── SPMUtility_Info.plist ├── SWXMLHash_Info.plist ├── SourceKit_Info.plist ├── SourceKittenFramework_Info.plist ├── SourcePreprocessorsTests_Info.plist ├── SourcePreprocessors_Info.plist ├── SwiftASTTests_Info.plist ├── SwiftAST_Info.plist ├── SwiftFormatConfiguration_Info.plist ├── SwiftFormatCore_Info.plist ├── SwiftFormatPrettyPrint_Info.plist ├── SwiftFormatRules_Info.plist ├── SwiftFormatWhitespaceLinter_Info.plist ├── SwiftFormat_Info.plist ├── SwiftRewriterCLI_Info.plist ├── SwiftRewriterLibTests_Info.plist ├── SwiftRewriterLib_Info.plist ├── SwiftRewriterTests_Info.plist ├── SwiftSyntaxParser_Info.plist ├── SwiftSyntaxRewriterPassesTests_Info.plist ├── SwiftSyntaxRewriterPasses_Info.plist ├── SwiftSyntaxSupportTests_Info.plist ├── SwiftSyntaxSupport_Info.plist ├── SwiftSyntax_Info.plist ├── TestCommonsTests_Info.plist ├── TestCommons_Info.plist ├── TypeDefinitions_Info.plist ├── TypeLexing_Info.plist ├── TypeSystemTests_Info.plist ├── TypeSystem_Info.plist ├── Utility_Info.plist ├── UtilsTests_Info.plist ├── Utils_Info.plist ├── WriterTargetOutputTests_Info.plist ├── WriterTargetOutput_Info.plist ├── Yams_Info.plist ├── _CSwiftSyntax_Info.plist ├── clibc_Info.plist ├── project.pbxproj └── xcshareddata │ └── xcschemes │ ├── SwiftRewriter-Package.xcscheme │ └── SwiftRewriter.xcscheme ├── Tests ├── AllTests.xctestplan ├── Core │ ├── AnalysisTests │ │ ├── CallGraph │ │ │ ├── CallGraph+CreationTests.swift │ │ │ ├── CallGraphTestUtils.swift │ │ │ └── CallGraphTests.swift │ │ ├── ControlFlowGraph │ │ │ ├── ControlFlowGraph+CreationTests.swift │ │ │ └── ControlFlowGraphTestUtils.swift │ │ ├── DefinitionTypePropagatorTests.swift │ │ ├── Graphviz+TestUtils.swift │ │ ├── ReachingDefinitionAnalyzerTests.swift │ │ └── UsageAnalysis │ │ │ ├── BaseUsageAnalyzerTests.swift │ │ │ ├── IntentionCollectionUsageAnalyzerTests.swift │ │ │ ├── LocalUsageAnalyzerTests.swift │ │ │ └── UsageAnalysisTests.swift │ ├── CommonsTests │ │ ├── CoreGraphicsCompoundTypeTests.swift │ │ ├── FoundationCompoundTypesTests.swift │ │ ├── FunctionInvocationTransformerTests.swift │ │ ├── SwiftClassInterfaceParserTests.swift │ │ ├── UIColorCompoundTypeTests.swift │ │ ├── UIControlCompoundTypeTests.swift │ │ ├── UIGestureRecognizerCompoundTypeTests.swift │ │ ├── UILabelCompoundTypeTests.swift │ │ ├── UIResponderCompoundTypeTests.swift │ │ ├── UIViewCompoundTypeTests.swift │ │ └── UIViewControllerCompoundTypeTests.swift │ ├── ExpressionPassesTests │ │ ├── ASTRewriterPassApplierTests.swift │ │ ├── ASTSimplifierTests.swift │ │ ├── Adapters │ │ │ └── ObjectiveCExpressionPassTestAdapter.swift │ │ ├── AllocInitExpressionPassTests.swift │ │ ├── CanonicalNameExpressionPassTests.swift │ │ ├── CompoundTypeApplierExpressionPassTests.swift │ │ ├── CoreGraphicsExpressionPassTests.swift │ │ ├── EnumRewriterExpressionPassTests.swift │ │ ├── ExpressionPassTestCase.swift │ │ ├── FoundationExpressionPassTests.swift │ │ ├── InitRewriterExpressionPassTests.swift │ │ ├── LocalConstantPromotionExpressionPassTests.swift │ │ ├── NilValueTransformationsPassTests.swift │ │ ├── NumberCommonsExpressionPassTests.swift │ │ ├── PropertyAsMethodAccessCorrectingExpressionPassTests.swift │ │ ├── UIKitExpressionPassTests.swift │ │ └── VariableNullabilityPromotionExpressionPassTests.swift │ ├── GrammarModelBaseTests │ │ └── ASTNodeTests.swift │ ├── IntentionPassesTests │ │ ├── DetectNoReturnsIntentionPassTests.swift │ │ ├── DetectNonnullReturnsIntentionPassTests.swift │ │ ├── DetectTypePropertiesBySelfAssignmentIntentionPassTests.swift │ │ ├── FileTypeMergingIntentionPassTests.swift │ │ ├── ImportDirectiveIntentionPassTests.swift │ │ ├── InitAnalysisIntentionPassTests.swift │ │ ├── PromoteProtocolPropertyConformanceIntentionPassTests.swift │ │ ├── ProtocolNullabilityPropagationToConformersIntentionPassTests.swift │ │ ├── RemoveEmptyExtensionsIntentionPassTests.swift │ │ ├── StoredPropertyToNominalTypesIntentionPassTests.swift │ │ ├── SubscriptDeclarationIntentionPassTests.swift │ │ ├── SwiftifyMethodSignaturesIntentionPassTests.swift │ │ ├── TestUtils.swift │ │ └── UIKitCorrectorIntentionPassTests.swift │ ├── IntentionsTests │ │ ├── FromSourceIntentionTests.swift │ │ ├── FunctionBodyQueueTests.swift │ │ ├── Intention+FileTests.swift │ │ ├── Intentions │ │ │ ├── ClassExtensionGenerationIntentionTests.swift │ │ │ ├── ClassGenerationIntentionTests.swift │ │ │ ├── DeinitGenerationIntentionTests.swift │ │ │ ├── EnumCaseGenerationIntentionTests.swift │ │ │ ├── EnumGenerationIntentionTests.swift │ │ │ ├── FileGenerationIntentionTests.swift │ │ │ ├── FunctionBodyIntentionTests.swift │ │ │ ├── GlobalFunctionGenerationIntentionTests.swift │ │ │ ├── GlobalVariableGenerationIntentionTests.swift │ │ │ ├── GlobalVariableInitialValueIntentionTests.swift │ │ │ ├── InitGenerationIntentionTests.swift │ │ │ ├── InstanceVariableGenerationIntentionTests.swift │ │ │ ├── MethodGenerationIntentionTests.swift │ │ │ ├── PropertyGenerationIntentionTests.swift │ │ │ ├── PropertyInitialValueGenerationIntentionTests.swift │ │ │ ├── PropertySynthesizationIntentionTests.swift │ │ │ ├── ProtocolGenerationIntentionTests.swift │ │ │ ├── ProtocolInheritanceIntentionTests.swift │ │ │ ├── ProtocolMethodGenerationIntentionTests.swift │ │ │ ├── ProtocolPropertyGenerationIntentionTests.swift │ │ │ ├── StructGenerationIntentionTests.swift │ │ │ ├── SubscriptGenerationIntentionTests.swift │ │ │ └── TypealiasIntentionTests.swift │ │ ├── Serialization │ │ │ └── IntentionSerializerTests.swift │ │ └── TestUtils │ │ │ └── TestIntentionVisitor.swift │ ├── KnownTypeTests │ │ ├── KnownFileBuilderTests.swift │ │ ├── KnownTypeSerializerTests.swift │ │ └── TypeFormatter+ExtTests.swift │ ├── SourcePreprocessorsTests │ │ └── QuickSpecPreprocessorTests.swift │ ├── SwiftSyntaxRewriterPassesTests │ │ ├── BaseSyntaxRewriterPassTest.swift │ │ ├── DefaultSyntaxPassProviderTests.swift │ │ └── StatementSpacingSyntaxPassTests.swift │ ├── SwiftSyntaxSupportTests │ │ ├── ModifiersDecoratorsTests.swift │ │ ├── StatementEmitter+ExpressionTests.swift │ │ ├── StatementEmitter+StatementTests.swift │ │ ├── SwiftProducerTests.swift │ │ └── SwiftTypeStringProducerTests.swift │ ├── TypeSystemTests │ │ ├── CodeDefinition │ │ │ └── CodeDefinitionTests.swift │ │ ├── CodeScope │ │ │ └── DefaultCodeScopeTests.swift │ │ ├── DefaultTypeMapperTests.swift │ │ ├── DefaultTypeResolverInvokerTests.swift │ │ ├── FixtureBuilders │ │ │ └── ExpressionTypeResolverTests+Fixtures.swift │ │ ├── IntentionCollectionTypeSystemTests.swift │ │ ├── MemberLookup │ │ │ └── KnownTypeMemberLookupTests.swift │ │ ├── OverloadResolverTests.swift │ │ ├── TypeResolution │ │ │ ├── CallableTypeResolverTests.swift │ │ │ ├── CoercionVerifierTests.swift │ │ │ ├── ExpressionTypeResolverTests+DynamicMemberLookup.swift │ │ │ ├── ExpressionTypeResolverTests.swift │ │ │ ├── IteratorTypeResolverTests.swift │ │ │ └── PatternMatcherTests.swift │ │ └── TypeSystemTests.swift │ └── WriterTargetOutputTests │ │ ├── RewriterOutputTarget.swift │ │ └── StringRewriterOutputTests.swift ├── FastTests.xctestplan ├── Frontend │ └── Objective-C │ │ ├── GlobalsProvidersTests │ │ ├── BaseGlobalsProviderTestCase.swift │ │ ├── CLibGlobalsProvidersTests.swift │ │ ├── DefaultGlobalsProvidersSourceTests.swift │ │ ├── OpenGLESGlobalsProviderTests.swift │ │ └── UIKitGlobalsProviderTests.swift │ │ ├── ObjcGrammarModelsTests │ │ └── ObjcGrammarModelsTests.swift │ │ ├── ObjcParserTests │ │ ├── DeclarationExtractor │ │ │ ├── AntlrDeclarationParserTests.swift │ │ │ └── DeclarationExtractorTests.swift │ │ ├── DeclarationTranslatorTests.swift │ │ ├── DefinitionCollectorTests.swift │ │ ├── ObjcParserTests.swift │ │ ├── ObjcTypeParserTests.swift │ │ └── TestFixture │ │ │ ├── AntlrErrorListener.swift │ │ │ ├── BaseParserTestFixture.swift │ │ │ ├── DeclarationExtractor+Asserter.swift │ │ │ ├── DeclarationSyntaxElementType+Asserter.swift │ │ │ └── DeclarationTranslator+Asserter.swift │ │ └── ObjectiveCFrontendTests │ │ ├── ASTRewriterPassTests.swift │ │ ├── CPreprocessorDirectiveConverterTests.swift │ │ ├── ExpressionPasses │ │ └── ObjectiveCASTCorrectorExpressionPassTests.swift │ │ ├── FixtureBuilders │ │ ├── MultiFileTestBuilder.swift │ │ └── SingleFileTestUtils.swift │ │ ├── IntentionPasses │ │ └── ObjectiveCPropertyMergeIntentionPassTests.swift │ │ ├── ObjectiveC2SwiftRewriter+Crashers.swift │ │ ├── ObjectiveC2SwiftRewriter+GlobalsProvidersTests.swift │ │ ├── ObjectiveC2SwiftRewriter+IntentionPassHistoryTests.swift │ │ ├── ObjectiveC2SwiftRewriter+IntentionPassTests.swift │ │ ├── ObjectiveC2SwiftRewriter+MultiFilesTests.swift │ │ ├── ObjectiveC2SwiftRewriter+NullabilityTests.swift │ │ ├── ObjectiveC2SwiftRewriter+SourcePreprocessor.swift │ │ ├── ObjectiveC2SwiftRewriter+StmtTests.swift │ │ ├── ObjectiveC2SwiftRewriter+ThreadingTests.swift │ │ ├── ObjectiveC2SwiftRewriter+TypingTests.swift │ │ ├── ObjectiveC2SwiftRewriterJobBuilderTests.swift │ │ ├── ObjectiveC2SwiftRewriterJobTests.swift │ │ ├── ObjectiveC2SwiftRewriterTests.swift │ │ ├── ObjectiveCASTReaderContextTests.swift │ │ ├── ObjectiveCExprASTReaderTests.swift │ │ ├── ObjectiveCFileCollectionStepTests.swift │ │ ├── ObjectiveCImportDirectiveFileCollectionDelegateTests.swift │ │ ├── ObjectiveCIntentionCollectorTests.swift │ │ ├── ObjectiveCMethodSignatureConverterTests.swift │ │ ├── ObjectiveCStatementASTReaderTests.swift │ │ ├── PropertyMergeIntentionPassTests.swift │ │ └── TestUtils.swift ├── IntegrationTests.xctestplan ├── SwiftRewriterLibTests │ ├── ColorizeSyntaxVisitorTests.swift │ └── SwiftWriterTests.swift ├── SwiftRewriterTests │ └── SwiftRewriterTests.swift ├── TestCommonsTests │ ├── StringDiffTestingTests.swift │ └── VirtualFileDiskTests.swift └── UtilsTests │ ├── ConcurrentOperationQueueTests.swift │ ├── ConcurrentValueTests.swift │ ├── InvalidSourceTests.swift │ ├── MutexTests.swift │ ├── SourceLocationTests.swift │ ├── SourceRangeTests.swift │ ├── StringCodeSourceTests.swift │ └── StringTests.swift ├── azure-pipelines.yml ├── codecov.yml ├── copy-libswiftsyntax.sh ├── gen-_cswiftsyntax-module-map.sh ├── utils ├── antlr_grammar_gen.py ├── build.py ├── console_color.py ├── mypy.ini ├── objc_grammar_gen.py ├── parser_generate.py ├── paths.py └── process.py └── xcodeproj-prep.rb /.codebeatignore: -------------------------------------------------------------------------------- 1 | Sources/Frontend/Objective-C/ObjcParserAntlr/* 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /build 4 | /Packages 5 | .swiftpm/ 6 | *.xcodeproj/* 7 | !*.xcodeproj/project.pbxproj 8 | !*.xcodeproj/*.plist 9 | !*.xcodeproj/xcshareddata/ 10 | !*.xcworkspace/contents.xcworkspacedata 11 | **/xcshareddata/WorkspaceSettings.xcsettings 12 | default.profraw 13 | default.profdata 14 | coverage.profdata 15 | /coverage.txt 16 | __pycache__/ 17 | .mypy_cache/ 18 | *.profraw 19 | -------------------------------------------------------------------------------- /.python-version: -------------------------------------------------------------------------------- 1 | 3.10.0 2 | -------------------------------------------------------------------------------- /.ruby-version: -------------------------------------------------------------------------------- 1 | 2.7.1 2 | -------------------------------------------------------------------------------- /.swift-format: -------------------------------------------------------------------------------- 1 | { 2 | "version": 1, 3 | "lineLength": 100, 4 | "indentation": { 5 | "spaces": 4 6 | }, 7 | "maximumBlankLines": 1, 8 | "respectsExistingLineBreaks": true, 9 | "lineBreakBeforeControlFlowKeywords": true, 10 | "lineBreakBeforeEachArgument": true, 11 | "prioritizeKeepingFunctionOutputTogether": true 12 | } 13 | -------------------------------------------------------------------------------- /.swiftlint.yml: -------------------------------------------------------------------------------- 1 | disabled_rules: 2 | - colon 3 | - comma 4 | - control_statement 5 | - identifier_name 6 | - trailing_whitespace 7 | - type_name 8 | - todo 9 | - nesting 10 | - cyclomatic_complexity 11 | - function_body_length 12 | - shorthand_operator 13 | opt_in_rules: 14 | - empty_count 15 | excluded: 16 | - Sources/ObjcParserAntlr 17 | - Tests 18 | - Packages 19 | - .build 20 | 21 | force_cast: warning 22 | force_try: warning 23 | line_length: 120 24 | type_body_length: 25 | warning: 300 26 | error: 1200 27 | file_length: 28 | warning: 500 29 | error: 2000 30 | cyclomatic_complexity: 31 | error: 50 32 | reporter: "xcode" -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "mypy.configFile": "utils/mypy.ini", 3 | "mypy.targets": [ 4 | "utils", 5 | ], 6 | } 7 | -------------------------------------------------------------------------------- /AntlrGrammars/.gitignore: -------------------------------------------------------------------------------- 1 | .build 2 | *.profraw 3 | -------------------------------------------------------------------------------- /AntlrGrammars/GrammarTransformer/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | xcuserdata/ 6 | DerivedData/ 7 | .swiftpm/config/registries.json 8 | .swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata 9 | .netrc 10 | -------------------------------------------------------------------------------- /AntlrGrammars/GrammarTransformer/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "type": "swift", 6 | "args": [ 7 | "build", 8 | "--build-tests" 9 | ], 10 | "cwd": "/home/luiz/dev/SwiftRewriter/AntlrGrammars/GrammarTransformer", 11 | "problemMatcher": [ 12 | "$swiftc" 13 | ], 14 | "group": "build", 15 | "label": "swift: Build All AntlrGrammars", 16 | "detail": "swift build --build-tests" 17 | } 18 | ] 19 | } 20 | -------------------------------------------------------------------------------- /AntlrGrammars/GrammarTransformer/Sources/AntlrGrammars/IO/FileDisk.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | class FileDisk: FileIOType { 4 | func readData(from url: URL) throws -> Data { 5 | try Data(contentsOf: url) 6 | } 7 | 8 | func readText(from url: URL, encoding: String.Encoding) throws -> String { 9 | try String(contentsOf: url, encoding: encoding) 10 | } 11 | 12 | func writeData(to url: URL, data: Data, options: Data.WritingOptions) throws { 13 | try data.write(to: url, options: options) 14 | } 15 | 16 | func writeText(to url: URL, text: String, encoding: String.Encoding) throws { 17 | try text.write(to: url, atomically: true, encoding: encoding) 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /AntlrGrammars/GrammarTransformer/Sources/AntlrGrammars/IO/FileIOType.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | /// Abstraction over a file IO for loading/saving files. 4 | protocol FileIOType { 5 | func readData(from url: URL) throws -> Data 6 | func readText(from url: URL, encoding: String.Encoding) throws -> String 7 | func writeData(to url: URL, data: Data, options: Data.WritingOptions) throws 8 | func writeText(to url: URL, text: String, encoding: String.Encoding) throws 9 | } 10 | 11 | extension FileIOType { 12 | func readText(from url: URL) throws -> String { 13 | try readText(from: url, encoding: .utf8) 14 | } 15 | 16 | func writeData(to url: URL, data: Data) throws { 17 | try writeData(to: url, data: data, options: []) 18 | } 19 | 20 | func writeText(to url: URL, text: String) throws { 21 | try writeText(to: url, text: text, encoding: .utf8) 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /AntlrGrammars/GrammarTransformer/Sources/AntlrGrammars/SourceTransformer/TransformerType.swift: -------------------------------------------------------------------------------- 1 | import struct Foundation.URL 2 | import SwiftSyntax 3 | 4 | protocol TransformerType { 5 | var filePath: URL { get } 6 | 7 | /// Validates if the transformation can be performed. 8 | func validate(_ fileIO: FileIOType) throws 9 | 10 | /// Performs the transformation of the file associated with this transformer, 11 | /// and returns the result. 12 | func transform(_ fileIO: FileIOType, formatter: SwiftFormatterTransformer?) throws -> SourceFileSyntax 13 | } 14 | 15 | extension TransformerType { 16 | func transform(_ fileIO: FileIOType) throws -> SourceFileSyntax { 17 | try transform(fileIO, formatter: nil) 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /AntlrGrammars/GrammarTransformer/Tests/AntlrGrammarsTests/AntlrGrammarsTests.swift: -------------------------------------------------------------------------------- 1 | import XCTest 2 | @testable import AntlrGrammars 3 | 4 | final class AntlrGrammarsTests: XCTestCase { 5 | func testExample() throws { 6 | 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /AntlrGrammars/ObjcGrammar/.gitignore: -------------------------------------------------------------------------------- 1 | # Created by https://www.gitignore.io/api/maven 2 | 3 | ### Maven ### 4 | target/ 5 | pom.xml.tag 6 | pom.xml.releaseBackup 7 | pom.xml.versionsBackup 8 | pom.xml.next 9 | release.properties 10 | dependency-reduced-pom.xml 11 | buildNumber.properties 12 | .mvn/timing.properties 13 | 14 | # Avoid ignoring Maven wrapper jar file (.jar files are usually ignored) 15 | !/.mvn/wrapper/maven-wrapper.jar 16 | 17 | 18 | # End of https://www.gitignore.io/api/maven 19 | 20 | .antlr/ 21 | gen/ 22 | .idea/ 23 | *.iml 24 | -------------------------------------------------------------------------------- /AntlrGrammars/ObjcGrammar/Makefile: -------------------------------------------------------------------------------- 1 | generate: 2 | antlr4 \ 3 | -Dlanguage=Swift \ 4 | -visitor \ 5 | -lib ObjectiveCLexer.g4 ObjectiveCParser.g4 two-step-processing/ObjectiveCLexer.g4 two-step-processing/ObjectiveCPreprocessorLexer.g4 two-step-processing/ObjectiveCPreprocessorParser.g4 \ 6 | -o gen -Xexact-output-dir 7 | -------------------------------------------------------------------------------- /AntlrGrammars/ObjcGrammar/two-step-processing/ObjectiveCPreprocessorLexer.tokens: -------------------------------------------------------------------------------- 1 | SHARP=1 2 | CODE=2 3 | IMPORT=3 4 | INCLUDE=4 5 | PRAGMA=5 6 | DEFINE=6 7 | DEFINED=7 8 | IF=8 9 | ELIF=9 10 | ELSE=10 11 | UNDEF=11 12 | IFDEF=12 13 | IFNDEF=13 14 | ENDIF=14 15 | TRUE=15 16 | FALSE=16 17 | ERROR=17 18 | WARNING=18 19 | BANG=19 20 | LPAREN=20 21 | RPAREN=21 22 | EQUAL=22 23 | NOTEQUAL=23 24 | AND=24 25 | OR=25 26 | LT=26 27 | GT=27 28 | LE=28 29 | GE=29 30 | DIRECTIVE_WHITESPACES=30 31 | DIRECTIVE_STRING=31 32 | CONDITIONAL_SYMBOL=32 33 | DECIMAL_LITERAL=33 34 | FLOAT=34 35 | NEW_LINE=35 36 | DIRECITVE_COMMENT=36 37 | DIRECITVE_LINE_COMMENT=37 38 | DIRECITVE_NEW_LINE=38 39 | DIRECITVE_TEXT_NEW_LINE=39 40 | TEXT=40 41 | SLASH=41 42 | '#'=1 43 | 'pragma'=5 44 | 'defined'=7 45 | 'if'=8 46 | 'elif'=9 47 | 'else'=10 48 | 'undef'=11 49 | 'ifdef'=12 50 | 'ifndef'=13 51 | 'endif'=14 52 | 'error'=17 53 | 'warning'=18 54 | '!'=19 55 | '('=20 56 | ')'=21 57 | '=='=22 58 | '!='=23 59 | '&&'=24 60 | '||'=25 61 | '<'=26 62 | '>'=27 63 | '<='=28 64 | '>='=29 65 | -------------------------------------------------------------------------------- /AntlrGrammars/README.md: -------------------------------------------------------------------------------- 1 | # AntlrGrammars 2 | 3 | Folder containing the Antlr grammar files used by SwiftRewriter's frontend and the grammar transformer that prepares the generated Swift code for multithreading. 4 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source "http://rubygems.org" 2 | 3 | gem 'xcodeproj' 4 | -------------------------------------------------------------------------------- /Gemfile.lock: -------------------------------------------------------------------------------- 1 | GEM 2 | remote: http://rubygems.org/ 3 | specs: 4 | CFPropertyList (3.0.5) 5 | rexml 6 | atomos (0.1.3) 7 | claide (1.1.0) 8 | colored2 (3.1.2) 9 | nanaimo (0.3.0) 10 | rexml (3.2.8) 11 | strscan (>= 3.0.9) 12 | strscan (3.1.0) 13 | xcodeproj (1.22.0) 14 | CFPropertyList (>= 2.3.3, < 4.0) 15 | atomos (~> 0.1.3) 16 | claide (>= 1.0.2, < 2.0) 17 | colored2 (~> 3.1) 18 | nanaimo (~> 0.3.0) 19 | rexml (~> 3.2.4) 20 | 21 | PLATFORMS 22 | ruby 23 | 24 | DEPENDENCIES 25 | xcodeproj 26 | 27 | BUNDLED WITH 28 | 2.1.4 29 | -------------------------------------------------------------------------------- /Sources/Core/Analysis/Graphviz/NodeDefinition.swift: -------------------------------------------------------------------------------- 1 | import MiniGraphviz 2 | 3 | struct NodeDefinition { 4 | var node: Node 5 | 6 | /// Rank of the node, or the minimal number of edges that connect the node 7 | /// to the entry of the graph. 8 | /// 9 | /// Is `0` for the entry node, and the maximal value for the exit node. 10 | /// 11 | /// If the node is not connected to the entry node, this value is `nil`. 12 | var rankFromStart: Int? 13 | 14 | /// Rank of the node, or the minimal number of edges that connect the node 15 | /// to the exit of the graph. 16 | /// 17 | /// Is `0` for the exit node, and the maximal value for the entry node. 18 | /// 19 | /// If the node is not connected to the exit node, this value is `nil`. 20 | var rankFromEnd: Int? 21 | 22 | /// Display label for the graphviz node. 23 | var label: String 24 | 25 | /// An integer used to differentiate nodes for ordering purposes. 26 | var id: Int = 0 27 | 28 | /// Extra set of attributes for a graphviz node. 29 | var attributes: GraphViz.Attributes = [:] 30 | } 31 | -------------------------------------------------------------------------------- /Sources/Core/Analysis/UsageAnalysis/UsageAnalysis.swift: -------------------------------------------------------------------------------- 1 | import SwiftAST 2 | import KnownType 3 | import Intentions 4 | import TypeSystem 5 | 6 | /// Simplified API interface to find usages of symbols across intentions 7 | public protocol UsageAnalyzer { 8 | /// Finds all usages of a known method 9 | func findUsagesOf(method: KnownMethod) -> [DefinitionUsage] 10 | 11 | /// Finds all usages of a known property 12 | func findUsagesOf(property: KnownProperty) -> [DefinitionUsage] 13 | } 14 | -------------------------------------------------------------------------------- /Sources/Core/AntlrCommons/AntlrParser.swift: -------------------------------------------------------------------------------- 1 | import class Antlr4.ANTLRInputStream 2 | import class Antlr4.CommonTokenStream 3 | import class Antlr4.Lexer 4 | import class Antlr4.Parser 5 | 6 | /// A tuple of lexer/parser pair and related objects to hold onto memory during 7 | /// parsing. 8 | public struct AntlrParser { 9 | public var lexer: Lexer 10 | public var parser: Parser 11 | public var tokens: CommonTokenStream 12 | 13 | public init(lexer: Lexer, parser: Parser, tokens: CommonTokenStream) { 14 | self.lexer = lexer 15 | self.parser = parser 16 | self.tokens = tokens 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Sources/Core/AntlrCommons/AntlrSettings.swift: -------------------------------------------------------------------------------- 1 | 2 | /// Describes settings for ANTLR parsing for an `ObjcParser` instance. 3 | public struct AntlrSettings { 4 | public static let `default` = AntlrSettings(forceUseLLPrediction: false) 5 | 6 | public var forceUseLLPrediction: Bool 7 | 8 | public init(forceUseLLPrediction: Bool) { 9 | self.forceUseLLPrediction = forceUseLLPrediction 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Sources/Core/AntlrCommons/AntlrTypeAliases.swift: -------------------------------------------------------------------------------- 1 | import Antlr4 2 | 3 | #if true 4 | 5 | public typealias DFAParser = DFA 6 | public typealias DFALexer = DFA 7 | public typealias ATNConfigSetParser = ATNConfigSet 8 | 9 | #else 10 | 11 | public typealias DFAParser = DFA 12 | public typealias DFALexer = DFA 13 | public typealias ATNConfigSetParser = ATNConfigSet 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /Sources/Core/Commons/Helpers.swift: -------------------------------------------------------------------------------- 1 | import SwiftAST 2 | import MiniLexer 3 | 4 | func makeType(from typeString: String, typeName: String) -> CompoundedMappingType { 5 | do { 6 | let incomplete = try SwiftClassInterfaceParser.parseDeclaration(from: typeString) 7 | let type = try incomplete.toCompoundedKnownType() 8 | 9 | return type 10 | } catch let error as LexerError { 11 | fatalError( 12 | """ 13 | Found error while parsing class interface '\(typeName)': \ 14 | \(error.description(withOffsetsIn: typeString)) 15 | """ 16 | ) 17 | } catch { 18 | fatalError( 19 | "Found error while parsing Calendar class interface: \(error)" 20 | ) 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Sources/Core/Commons/PostfixTransformation.swift: -------------------------------------------------------------------------------- 1 | import SwiftAST 2 | 3 | /// Represents a transformation of a postfix invocation for types or instances of 4 | /// a type. 5 | public enum PostfixTransformation { 6 | case method(MethodInvocationTransformerMatcher) 7 | case function(FunctionInvocationTransformer) 8 | case property(old: String, new: String) 9 | case propertyFromMethods( 10 | property: String, 11 | getterName: String, 12 | setterName: String?, 13 | resultType: SwiftType, 14 | isStatic: Bool 15 | ) 16 | case propertyFromFreeFunctions( 17 | property: String, 18 | getterName: String, 19 | setterName: String? 20 | ) 21 | case initializer(old: [String?], new: [String?]) 22 | case valueTransformer(ValueTransformer) 23 | } 24 | -------------------------------------------------------------------------------- /Sources/Core/Commons/SignatureMapper.swift: -------------------------------------------------------------------------------- 1 | import SwiftAST 2 | 3 | /// Provides simple signature mapping support by alowing rewriting the signature 4 | /// keywords of a method signature or invocation 5 | public class SignatureMapper { 6 | public let transformer: MethodInvocationTransformerMatcher 7 | 8 | /// Creates a new `SignatureConversion` instance with a given method invocation 9 | /// transformer. 10 | public init(transformer: MethodInvocationTransformerMatcher) { 11 | self.transformer = transformer 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Sources/Core/Commons/UIGestureRecognizerCompoundType.swift: -------------------------------------------------------------------------------- 1 | import SwiftAST 2 | 3 | public enum UIGestureRecognizerCompoundType { 4 | private static var singleton = makeType(from: typeString(), typeName: "UIGestureRecognizer") 5 | 6 | public static func create() -> CompoundedMappingType { 7 | singleton 8 | } 9 | 10 | static func typeString() -> String { 11 | let type = """ 12 | class UIGestureRecognizer: NSObject { 13 | @_swiftrewriter(mapFrom: locationInView(_:)) 14 | func location(in view: UIView?) -> CGPoint 15 | 16 | @_swiftrewriter(mapFrom: requireGestureRecognizerToFail(_:)) 17 | func require(toFail otherGestureRecognizer: UIGestureRecognizer) 18 | } 19 | """ 20 | 21 | return type 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Sources/Core/ExpressionPasses/CompoundTypeApplierExpressionPass.swift: -------------------------------------------------------------------------------- 1 | import Utils 2 | import SwiftAST 3 | import Commons 4 | 5 | /// Applies passes with transformations from compounded types 6 | public class CompoundTypeApplierExpressionPass: BaseExpressionPass { 7 | 8 | public required init(context: ASTRewriterPassContext) { 9 | super.init(context: context) 10 | 11 | addTypes() 12 | } 13 | } 14 | 15 | extension CompoundTypeApplierExpressionPass { 16 | func addTypes() { 17 | let types = CompoundedMappingTypeList.typeList() 18 | 19 | for type in types { 20 | addCompoundedType(type) 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Sources/Core/ExpressionPasses/ValueTransformer+PostfixTransformer.swift: -------------------------------------------------------------------------------- 1 | import SwiftAST 2 | import Commons 3 | 4 | struct ValueTransformerWrapper: PostfixInvocationTransformer { 5 | let valueTransformer: ValueTransformer 6 | 7 | init(valueTransformer: ValueTransformer) { 8 | self.valueTransformer = valueTransformer 9 | } 10 | 11 | public func canApply(to postfix: PostfixExpression) -> Bool { 12 | true 13 | } 14 | 15 | public func attemptApply(on postfix: PostfixExpression) -> Expression? { 16 | valueTransformer(transform: postfix) 17 | } 18 | } 19 | 20 | extension ValueTransformerWrapper: CustomStringConvertible { 21 | var description: String { 22 | "\(valueTransformer)" 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Sources/Core/GrammarModelBase/CommentedASTNodeType.swift: -------------------------------------------------------------------------------- 1 | /// Protocol for AST nodes that support preceding comments. 2 | public protocol CommentedASTNodeType: ASTNode { 3 | /// Gets or sets the preceding comments for this node. 4 | var precedingComments: [RawCodeComment] { get set } 5 | } 6 | -------------------------------------------------------------------------------- /Sources/Core/GrammarModelBase/RawCodeComment.swift: -------------------------------------------------------------------------------- 1 | import Utils 2 | 3 | /// A reference to a comment from an input file based on its range on the original 4 | /// file string. 5 | public struct RawCodeComment: Hashable, Codable { 6 | public var string: String 7 | public var range: Range 8 | public var location: SourceLocation 9 | public var length: SourceLength 10 | 11 | /// Returns a `SourceRange` representation of this comment's span. 12 | public var sourceRange: SourceRange { 13 | if length == .zero { 14 | return .location(location) 15 | } else { 16 | return .range(start: location, end: location + length) 17 | } 18 | } 19 | 20 | public init( 21 | string: String, 22 | range: Range, 23 | location: SourceLocation, 24 | length: SourceLength 25 | ) { 26 | 27 | self.string = string 28 | self.range = range 29 | self.location = location 30 | self.length = length 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Sources/Core/IntentionPasses/IntentionPassSource.swift: -------------------------------------------------------------------------------- 1 | /// A protocol for sourcing intention passes 2 | public protocol IntentionPassSource { 3 | var intentionPasses: [IntentionPass] { get } 4 | } 5 | -------------------------------------------------------------------------------- /Sources/Core/IntentionPasses/RemoveEmptyExtensionsIntentionPass.swift: -------------------------------------------------------------------------------- 1 | import Intentions 2 | 3 | /// An intention pass that removes all empty extensions that do not extend 4 | /// protocols or contain members. 5 | public class RemoveEmptyExtensionsIntentionPass: IntentionPass { 6 | public init() { 7 | 8 | } 9 | 10 | public func apply(on intentionCollection: IntentionCollection, 11 | context: IntentionPassContext) { 12 | 13 | for file in intentionCollection.fileIntentions() { 14 | for ext in file.extensionIntentions where ext.isEmptyType { 15 | file.removeClassTypes(where: { $0 === ext }) 16 | } 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Sources/Core/IntentionPasses/Sources/ArrayIntentionPassSource.swift: -------------------------------------------------------------------------------- 1 | /// A simple intention passes source that feeds from a contents array 2 | public struct ArrayIntentionPassSource: IntentionPassSource { 3 | public var intentionPasses: [IntentionPass] 4 | 5 | public init(intentionPasses: [IntentionPass]) { 6 | self.intentionPasses = intentionPasses 7 | } 8 | 9 | public init(source: IntentionPassSource) { 10 | self.intentionPasses = source.intentionPasses 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Sources/Core/Intentions/FileLevelIntention.swift: -------------------------------------------------------------------------------- 1 | /// An intention that is to be declared at the file-level, not contained within 2 | /// any types. 3 | public protocol FileLevelIntention: IntentionProtocol { 4 | /// The file this intention is contained within 5 | var file: FileGenerationIntention? { get } 6 | } 7 | -------------------------------------------------------------------------------- /Sources/Core/Intentions/Historic/Historic.swift: -------------------------------------------------------------------------------- 1 | /// Defines an object that features a history tracker instance 2 | public protocol Historic { 3 | /// Gets the history tracker for this intention 4 | var history: IntentionHistory { get } 5 | } 6 | -------------------------------------------------------------------------------- /Sources/Core/Intentions/Historic/IntentionHistoryEntry.swift: -------------------------------------------------------------------------------- 1 | /// An entry for an intention history 2 | public struct IntentionHistoryEntry: CustomStringConvertible, Codable { 3 | /// A textual tag to help when scrolling through history entries 4 | public var tag: String 5 | 6 | /// The description for this history entry, describing a change to an intention. 7 | public var description: String 8 | 9 | /// Returns a brief formatted summary string. 10 | public var summary: String { 11 | "[\(tag)] \(description)" 12 | } 13 | 14 | public init(tag: String, description: String) { 15 | self.tag = tag 16 | self.description = description 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Sources/Core/Intentions/Historic/IntentionHistoryEntryEcho.swift: -------------------------------------------------------------------------------- 1 | /// Allows 'echoing' the recording of a history entry into other history trackers. 2 | /// 3 | /// e.g.: 4 | /// 5 | /// ``` 6 | /// [...] 7 | /// myClass.removeMethod(method[0]) 8 | /// myClass.addMethod(newMethod) 9 | /// 10 | /// myClass 11 | /// .recordChange(tag: "MergePass", description: "Merging two methods into a single default method") 12 | /// .echoRecord(to: newMethod.history) 13 | /// ``` 14 | public struct IntentionHistoryEntryEcho { 15 | let entry: IntentionHistoryEntry 16 | 17 | @discardableResult 18 | public func echoRecord(to history: IntentionHistory) -> IntentionHistoryEntryEcho { 19 | history.record(entry) 20 | } 21 | 22 | @discardableResult 23 | public func echoRecord(to intention: Intention) -> IntentionHistoryEntryEcho { 24 | intention.history.record(entry) 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Sources/Core/Intentions/Historic/IntentionHistoryTracker.swift: -------------------------------------------------------------------------------- 1 | final class IntentionHistoryTracker: IntentionHistory, Codable { 2 | var entries: [IntentionHistoryEntry] = [] 3 | 4 | init(entries: [IntentionHistoryEntry] = []) { 5 | self.entries = entries 6 | } 7 | 8 | func mergeHistories(_ other: IntentionHistory) { 9 | entries.append(contentsOf: other.entries) 10 | } 11 | 12 | @discardableResult 13 | func record(_ entry: IntentionHistoryEntry) -> IntentionHistoryEntryEcho { 14 | entries.append(entry) 15 | 16 | return IntentionHistoryEntryEcho(entry: entry) 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Sources/Core/Intentions/InstanceVariableContainerIntention.swift: -------------------------------------------------------------------------------- 1 | /// An intention for a type that can contain instance variables 2 | public protocol InstanceVariableContainerIntention: IntentionProtocol { 3 | var instanceVariables: [InstanceVariableGenerationIntention] { get } 4 | 5 | func addInstanceVariable(_ intention: InstanceVariableGenerationIntention) 6 | func hasInstanceVariable(named name: String) -> Bool 7 | func instanceVariable(named name: String) -> InstanceVariableGenerationIntention? 8 | } 9 | 10 | public extension InstanceVariableContainerIntention { 11 | func hasInstanceVariable(named name: String) -> Bool { 12 | instanceVariables.contains(where: { $0.name == name }) 13 | } 14 | 15 | func instanceVariable(named name: String) -> InstanceVariableGenerationIntention? { 16 | instanceVariables.first(where: { $0.name == name }) 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Sources/Core/Intentions/Intentions/ProtocolGenerationIntention.swift: -------------------------------------------------------------------------------- 1 | import KnownType 2 | 3 | /// An intention to create a protocol. 4 | public final class ProtocolGenerationIntention: TypeGenerationIntention { 5 | public override var kind: KnownTypeKind { 6 | .protocol 7 | } 8 | 9 | public override func accept(_ visitor: T) -> T.Result { 10 | visitor.visitProtocol(self) 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Sources/Core/Intentions/Intentions/ProtocolMethodGenerationIntention.swift: -------------------------------------------------------------------------------- 1 | /// An intention to generate a protocol method 2 | public class ProtocolMethodGenerationIntention: MethodGenerationIntention { 3 | public var isOptional: Bool = false 4 | 5 | public override var optional: Bool { 6 | isOptional 7 | } 8 | 9 | public override func accept(_ visitor: T) -> T.Result { 10 | visitor.visitProtocolMethod(self) 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Sources/Core/Intentions/Intentions/ProtocolPropertyGenerationIntention.swift: -------------------------------------------------------------------------------- 1 | /// An intention to generate a protocol property 2 | public class ProtocolPropertyGenerationIntention: PropertyGenerationIntention { 3 | public var isOptional: Bool = false 4 | 5 | public override var optional: Bool { 6 | isOptional 7 | } 8 | 9 | public override func accept(_ visitor: T) -> T.Result { 10 | visitor.visitProtocolProperty(self) 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Sources/Core/Intentions/Metadata/SerializableMetadataSerializerType.swift: -------------------------------------------------------------------------------- 1 | /// A key to provide in Decoder.userInfo dictionary to store a 2 | /// `SerializableMetadataSerializerType` object that SerializableMetadataEntry 3 | /// objects can use to load objects. 4 | public let SerializableMetadataSerializerTypeUserInfoKey: CodingUserInfoKey = .init(rawValue: "SerializableMetadataSerializerType")! 5 | 6 | /// Provides an interface for serializing and deserializing attached metadata 7 | /// from `Intention` objects. 8 | public protocol SerializableMetadataSerializerType { 9 | /// Requests that a serializable object be decoded. 10 | func deserialize(type: String, decoder: Decoder) throws -> Any 11 | 12 | /// Requests that a serializable object be encoded. 13 | func serialize(type: String, value: Any, encoder: Encoder) throws 14 | } 15 | -------------------------------------------------------------------------------- /Sources/Core/Intentions/NonNullScopedIntention.swift: -------------------------------------------------------------------------------- 1 | /// Represents an intention that has a value associated that indicates whether it 2 | /// was defined within NS_ASSUME_NONNULL contexts 3 | public protocol NonNullScopedIntention: IntentionProtocol { 4 | /// Gets a value indicating whether this intention was defined within 5 | /// NS_ASSUME_NONNULL contexts 6 | var inNonnullContext: Bool { get } 7 | } 8 | -------------------------------------------------------------------------------- /Sources/Core/Intentions/OverridableMemberGenerationIntention.swift: -------------------------------------------------------------------------------- 1 | /// Specifies an intention for a member that can be overriden by subtypes 2 | public protocol OverridableMemberGenerationIntention: IntentionProtocol { 3 | /// Whether this member overrides a base member matching its signature. 4 | var isOverride: Bool { get set } 5 | } 6 | -------------------------------------------------------------------------------- /Sources/Core/Intentions/Serialization/KeyedEncodingContainerProtocol+Intention.swift: -------------------------------------------------------------------------------- 1 | public extension KeyedEncodingContainerProtocol { 2 | 3 | mutating func encodeIntention(_ intention: Intention, forKey key: Key) throws { 4 | let container = try IntentionSerializer.IntentionContainer(intention: intention) 5 | 6 | try self.encode(container, forKey: key) 7 | } 8 | 9 | mutating func encodeIntentions(_ intentions: [Intention], forKey key: Key) throws { 10 | var nested = self.nestedUnkeyedContainer(forKey: key) 11 | 12 | for stmt in intentions { 13 | try nested.encodeIntention(stmt) 14 | } 15 | } 16 | 17 | mutating func encodeIntentionIfPresent(_ intention: Intention?, forKey key: Key) throws { 18 | guard let intention = intention else { 19 | return 20 | } 21 | 22 | let container = try IntentionSerializer.IntentionContainer(intention: intention) 23 | 24 | try self.encode(container, forKey: key) 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Sources/Core/Intentions/Serialization/UnkeyedDecodingContainer+Intention.swift: -------------------------------------------------------------------------------- 1 | public extension UnkeyedDecodingContainer { 2 | 3 | mutating func decodeIntention(_ type: I.Type = I.self) throws -> I { 4 | let container = try self.decode(IntentionSerializer.IntentionContainer.self) 5 | 6 | if let intention = container.intention as? I { 7 | return intention 8 | } 9 | 10 | throw IntentionSerializer.Error.unexpectedIntentionType(Swift.type(of: container.intention)) 11 | } 12 | 13 | mutating func decodeIntentionIfPresent(_ type: I.Type = I.self) throws -> I? { 14 | guard let container = try self.decodeIfPresent(IntentionSerializer.IntentionContainer.self) else { 15 | return nil 16 | } 17 | 18 | if let intention = container.intention as? I { 19 | return intention 20 | } 21 | 22 | throw IntentionSerializer.Error.unexpectedIntentionType(Swift.type(of: container.intention)) 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Sources/Core/Intentions/Serialization/UnkeyedEncodingContainer+Intention.swift: -------------------------------------------------------------------------------- 1 | public extension UnkeyedEncodingContainer { 2 | 3 | mutating func encodeIntention(_ intention: Intention) throws { 4 | let container = try IntentionSerializer.IntentionContainer(intention: intention) 5 | 6 | try self.encode(container) 7 | } 8 | 9 | mutating func encodeIntentionIfPresent(_ intention: Intention?) throws { 10 | guard let intention = intention else { 11 | return 12 | } 13 | 14 | let container = try IntentionSerializer.IntentionContainer(intention: intention) 15 | 16 | try self.encode(container) 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Sources/Core/Intentions/ValueStorageIntention.swift: -------------------------------------------------------------------------------- 1 | import SwiftAST 2 | 3 | /// Defines a protocol for a value storage intention. 4 | public protocol ValueStorageIntention: IntentionProtocol { 5 | var name: String { get } 6 | var storage: ValueStorage { get } 7 | var initialValue: Expression? { get } 8 | } 9 | 10 | public extension ValueStorageIntention { 11 | var type: SwiftType { 12 | storage.type 13 | } 14 | 15 | var ownership: Ownership { 16 | storage.ownership 17 | } 18 | 19 | var isConstant: Bool { 20 | storage.isConstant 21 | } 22 | } 23 | 24 | /// Defines a value storage intention that can be mutated at any point. 25 | public protocol MutableValueStorageIntention: ValueStorageIntention { 26 | var name: String { get set } 27 | var storage: ValueStorage { get set } 28 | var initialValue: Expression? { get set } 29 | } 30 | -------------------------------------------------------------------------------- /Sources/Core/KnownType/AttributeTaggableObject.swift: -------------------------------------------------------------------------------- 1 | /// An object that supports attribute markings 2 | public protocol AttributeTaggableObject { 3 | /// Gets an array of all known attributes for this object 4 | var knownAttributes: [KnownAttribute] { get } 5 | 6 | /// Returns `true` if this object contains a known attribute with a specified 7 | /// name. 8 | func hasAttribute(named name: String) -> Bool 9 | } 10 | 11 | public extension AttributeTaggableObject { 12 | func hasAttribute(named name: String) -> Bool { 13 | knownAttributes.contains(where: { $0.name == name }) 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Sources/Core/KnownType/KnownDeclaration.swift: -------------------------------------------------------------------------------- 1 | /// Specifies a known declaration. Declarations can be types, or global 2 | /// functions/variables. 3 | public protocol KnownDeclaration { 4 | /// If non-nil, specifies the originating file for this declaration. 5 | var knownFile: KnownFile? { get } 6 | } 7 | -------------------------------------------------------------------------------- /Sources/Core/KnownType/Semantic.swift: -------------------------------------------------------------------------------- 1 | /// Represents a semantic annotation on a source type, method or property. 2 | public struct Semantic: Hashable, Codable { 3 | public let name: String 4 | 5 | public init(name: String) { 6 | self.name = name 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /Sources/Core/KnownType/SemanticalObject.swift: -------------------------------------------------------------------------------- 1 | /// Describes a type that can contain semantic annotations. 2 | public protocol SemanticalObject { 3 | var semantics: Set { get } 4 | } 5 | 6 | public extension SemanticalObject where Self: KnownMember { 7 | /// Returns `true` iff this member type is known to mutate arrays if either 8 | /// called, if this is a method, or set, in case this is a property/field. 9 | var isArrayMutator: Bool { 10 | semantics.isSuperset(of: Semantics.collectionMutator) 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Sources/Core/KnownType/Semantics.swift: -------------------------------------------------------------------------------- 1 | /// Common semantic annotations 2 | public enum Semantics { 3 | /// Represents a semantic annotation for method invocations that mutate 4 | /// collections, like NSMutableArray, NSMutableDictionary, and NSMutableSet. 5 | public static let collectionMutator: Set = [ 6 | Semantic(name: "_collector_mutator") 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /Sources/Core/SourcePreprocessors/SourcePreprocessor.swift: -------------------------------------------------------------------------------- 1 | /// Protocol for pre-parsing source transformers. 2 | /// Source preprocessors take in raw text describing each file and have the opportunity 3 | /// to change the text before it's fed to the parser. 4 | public protocol SourcePreprocessor { 5 | /// Preprocesses a source file before parsing. 6 | /// 7 | /// - Parameter source: Raw text to process. 8 | /// - Returns: Return of pre-transformation. The transformation must always 9 | /// generate a parseable code. 10 | func preprocess(source: String, context: PreprocessingContext) -> String 11 | } 12 | 13 | /// Context for a preprocessor 14 | public protocol PreprocessingContext { 15 | /// The original source file path 16 | var filePath: String { get } 17 | } 18 | -------------------------------------------------------------------------------- /Sources/Core/SwiftSyntaxRewriterPasses/DefaultSyntaxPassProvider.swift: -------------------------------------------------------------------------------- 1 | import SwiftSyntaxSupport 2 | 3 | public class DefaultSyntaxPassProvider: SwiftSyntaxRewriterPassProvider { 4 | public let passes: [SwiftSyntaxRewriterPass] = [ 5 | StatementSpacingSyntaxPass() 6 | ] 7 | 8 | public init() { 9 | 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Sources/Core/SwiftSyntaxSupport/DecoratableElement.swift: -------------------------------------------------------------------------------- 1 | import SwiftAST 2 | import Intentions 3 | 4 | enum DecoratableElement { 5 | case intention(IntentionProtocol) 6 | case variableDecl(StatementVariableDeclaration) 7 | 8 | var intention: IntentionProtocol? { 9 | switch self { 10 | case .intention(let intention): 11 | return intention 12 | default: 13 | return nil 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Sources/Core/SwiftSyntaxSupport/SwiftProducerDelegate.swift: -------------------------------------------------------------------------------- 1 | import Intentions 2 | import SwiftAST 3 | 4 | /// Delegate for controlling some aspects of SwiftSyntax AST generation 5 | public protocol SwiftProducerDelegate: AnyObject { 6 | /// Returns whether or not to emit the type annotation for a variable declaration 7 | /// with a given initial value. 8 | func swiftProducer(_ producer: SwiftProducer, 9 | shouldEmitTypeFor storage: ValueStorage, 10 | intention: IntentionProtocol?, 11 | initialValue: Expression?) -> Bool 12 | 13 | /// Returns the initial value for a given value storage intention of a property, 14 | /// instance variable, or global variable. 15 | func swiftProducer(_ producer: SwiftProducer, 16 | initialValueFor intention: ValueStorageIntention) -> Expression? 17 | } 18 | -------------------------------------------------------------------------------- /Sources/Core/SwiftSyntaxSupport/SwiftSyntaxRewriterPass.swift: -------------------------------------------------------------------------------- 1 | import SwiftSyntax 2 | 3 | /// Protocol to be implemented by objects that work on rewriting the syntax of 4 | /// a file. 5 | public protocol SwiftSyntaxRewriterPass { 6 | /// Returns a given source file syntax, transformed by this syntax pass. 7 | func rewrite(_ file: SourceFileSyntax) -> SourceFileSyntax 8 | } 9 | -------------------------------------------------------------------------------- /Sources/Core/TypeSystem/CodeDefinition/GlobalCodeDefinition.swift: -------------------------------------------------------------------------------- 1 | import SwiftAST 2 | 3 | public class GlobalCodeDefinition: CodeDefinition { 4 | public override func isEqual(to other: CodeDefinition) -> Bool { 5 | switch other { 6 | case let other as GlobalCodeDefinition: 7 | return isEqual(to: other) 8 | default: 9 | return super.isEqual(to: other) 10 | } 11 | } 12 | 13 | public func isEqual(to other: GlobalCodeDefinition) -> Bool { 14 | kind == other.kind 15 | } 16 | } 17 | 18 | public extension CodeDefinition { 19 | static func forGlobalFunction(signature: FunctionSignature) -> GlobalCodeDefinition { 20 | GlobalCodeDefinition(functionSignature: signature) 21 | } 22 | 23 | static func forGlobalVariable(name: String, isConstant: Bool, type: SwiftType) -> GlobalCodeDefinition { 24 | if isConstant { 25 | return GlobalCodeDefinition(constantNamed: name, type: type) 26 | } 27 | 28 | return GlobalCodeDefinition(variableNamed: name, type: type) 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Sources/Core/TypeSystem/CodeDefinition/TypeCodeDefinition.swift: -------------------------------------------------------------------------------- 1 | /// A code definition that refers to a type of matching name 2 | public class TypeCodeDefinition: CodeDefinition { 3 | public override func isEqual(to other: CodeDefinition) -> Bool { 4 | switch other { 5 | case let other as TypeCodeDefinition: 6 | return isEqual(to: other) 7 | default: 8 | return super.isEqual(to: other) 9 | } 10 | } 11 | 12 | public func isEqual(to other: TypeCodeDefinition) -> Bool { 13 | name == other.name 14 | } 15 | } 16 | 17 | public extension CodeDefinition { 18 | static func forType(named name: String) -> TypeCodeDefinition { 19 | TypeCodeDefinition( 20 | constantNamed: name, 21 | type: .metatype(for: .typeName(name)) 22 | ) 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Sources/Core/TypeSystem/GlobalsProvider.swift: -------------------------------------------------------------------------------- 1 | import SwiftAST 2 | 3 | /// Source for `GlobalsProvider` instances 4 | public protocol GlobalsProvidersSource { 5 | var globalsProviders: [GlobalsProvider] { get } 6 | } 7 | 8 | /// Protocol for objects to register global definitions to a target global definitions 9 | /// scope 10 | public protocol GlobalsProvider { 11 | /// Gets a source for definitions for this globals provider 12 | func definitionsSource() -> DefinitionsSource 13 | 14 | /// Gets a typealias provider for this globals provider 15 | func typealiasProvider() -> TypealiasProvider 16 | 17 | /// Gets a known type provider for this globals provider 18 | func knownTypeProvider() -> KnownTypeProvider 19 | } 20 | 21 | /// Sources globals providers through an input array 22 | public struct ArrayGlobalProvidersSource: GlobalsProvidersSource { 23 | public var globalsProviders: [GlobalsProvider] 24 | 25 | public init(globalsProviders: [GlobalsProvider]) { 26 | self.globalsProviders = globalsProviders 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Sources/Core/TypeSystem/MemberLookup/TypeMemberLookupContext.swift: -------------------------------------------------------------------------------- 1 | import SwiftAST 2 | import KnownType 3 | 4 | class TypeMemberLookupContext { 5 | let typeSystem: TypeSystem 6 | let memberSearchCache: MemberSearchCache 7 | var visitedTypes: Set 8 | 9 | init( 10 | typeSystem: TypeSystem, 11 | memberSearchCache: MemberSearchCache, 12 | visitedTypes: Set 13 | ) { 14 | self.typeSystem = typeSystem 15 | self.memberSearchCache = memberSearchCache 16 | self.visitedTypes = visitedTypes 17 | } 18 | 19 | func makeKnownTypeLookup(_ type: KnownType) -> KnownTypeMemberLookup { 20 | KnownTypeMemberLookup( 21 | type: type, 22 | context: self 23 | ) 24 | } 25 | 26 | func makeSwiftTypeLookup(_ swiftType: SwiftType) -> SwiftTypeMemberLookup { 27 | SwiftTypeMemberLookup( 28 | type: swiftType, 29 | context: self 30 | ) 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Sources/Core/TypeSystem/TypeCategory.swift: -------------------------------------------------------------------------------- 1 | public enum TypeCategory { 2 | case integer 3 | case float 4 | case boolean 5 | case void 6 | case `struct` 7 | case `protocol` 8 | case `enum` 9 | case `class` 10 | case unknown 11 | } 12 | -------------------------------------------------------------------------------- /Sources/Core/TypeSystem/TypeResolution/LocalTypeResolverInvoker.swift: -------------------------------------------------------------------------------- 1 | import SwiftAST 2 | import Intentions 3 | 4 | /// A type resolver for resolving types of statement and expressions for a single 5 | /// local context, like a function definition or global variable's initializer. 6 | public protocol LocalTypeResolverInvoker { 7 | /// Resolves the type of a single expression, optionally forcing the resolution 8 | /// to overwrite any existing typing information. 9 | func resolveType(_ expression: Expression, force: Bool) -> Expression 10 | 11 | /// Resolves the types of a given statement's expressions recursively, 12 | /// optionally forcing the resolution to overwrite any existing typing 13 | /// information. 14 | func resolveTypes(in statement: Statement, force: Bool) -> Statement 15 | } 16 | -------------------------------------------------------------------------------- /Sources/Core/WriterTargetOutput/NullRewriterOutputTarget.swift: -------------------------------------------------------------------------------- 1 | import SwiftSyntax 2 | 3 | /// A rewriter output target that ignores all incoming data requests and produces 4 | /// no output. 5 | public class NullRewriterOutputTarget: RewriterOutputTarget { 6 | public init() { 7 | 8 | } 9 | 10 | public func outputFile(_ file: SourceFileSyntax) { 11 | 12 | } 13 | 14 | public func outputInline(_ content: String, style: TextStyle) { 15 | 16 | } 17 | 18 | public func output(line: String, style: TextStyle) { 19 | 20 | } 21 | 22 | public func outputRaw(_ text: String) { 23 | 24 | } 25 | 26 | public func outputLineFeed() { 27 | 28 | } 29 | 30 | public func outputIndentation() { 31 | 32 | } 33 | 34 | public func increaseIndentation() { 35 | 36 | } 37 | 38 | public func decreaseIndentation() { 39 | 40 | } 41 | 42 | public func onAfterOutput() { 43 | 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /Sources/Frontend/Objective-C/GlobalsProviders/DefaultGlobalsProvidersSource.swift: -------------------------------------------------------------------------------- 1 | import TypeSystem 2 | 3 | /// Default global providers source 4 | public class DefaultGlobalsProvidersSource: GlobalsProvidersSource { 5 | public var globalsProviders: [GlobalsProvider] = [ 6 | CLibGlobalsProviders(), 7 | UIKitGlobalsProvider(), 8 | OpenGLESGlobalsProvider(), 9 | CompoundedMappingTypesGlobalsProvider() 10 | ] 11 | 12 | public init() { 13 | 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Sources/Frontend/Objective-C/ObjcGrammarModels/ASTNodeSerialization.swift: -------------------------------------------------------------------------------- 1 | // TODO: Implement ObjcASTNode serialization support 2 | class ASTNodeSerialization { 3 | 4 | } 5 | -------------------------------------------------------------------------------- /Sources/Frontend/Objective-C/ObjcGrammarModels/ObjcASTNode.swift: -------------------------------------------------------------------------------- 1 | import GrammarModelBase 2 | import Utils 3 | 4 | /// Base Objective-C node type 5 | open class ObjcASTNode: ASTNode { 6 | 7 | /// Indicates whether this node was completely contained within the range of 8 | /// a `NS_ASSUME_NONNULL_BEGIN`/`NS_ASSUME_NONNULL_END` region. 9 | public var isInNonnullContext: Bool 10 | 11 | /// Instantiates a bare ObjcASTNode with a given range. 12 | /// Defaults to an invalid range 13 | public init( 14 | isInNonnullContext: Bool, 15 | location: SourceLocation = .invalid, 16 | length: SourceLength = .zero, 17 | existsInSource: Bool = true 18 | ) { 19 | 20 | self.isInNonnullContext = isInNonnullContext 21 | 22 | super.init( 23 | location: location, 24 | length: length, 25 | existsInSource: existsInSource 26 | ) 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Sources/Frontend/Objective-C/ObjcGrammarModels/ObjcClassImplementationNode.swift: -------------------------------------------------------------------------------- 1 | import GrammarModelBase 2 | 3 | /// A syntax node for an Objective-C class implementation (`@implementation`) 4 | /// declaration. 5 | public class ObjcClassImplementationNode: ObjcASTNode, ObjcInitializableNode, CommentedASTNodeType { 6 | public var identifier: ObjcIdentifierNode? { 7 | firstChild() 8 | } 9 | 10 | public required init(isInNonnullContext: Bool) { 11 | super.init(isInNonnullContext: isInNonnullContext) 12 | } 13 | } 14 | 15 | public extension ObjcClassImplementationNode { 16 | var superclass: ObjcSuperclassNameNode? { 17 | firstChild() 18 | } 19 | 20 | var ivarsList: ObjcIVarsListNode? { 21 | firstChild() 22 | } 23 | 24 | var methods: [ObjcMethodDefinitionNode] { 25 | childrenMatching() 26 | } 27 | 28 | var propertyImplementations: [ObjcPropertyImplementationNode] { 29 | childrenMatching() 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Sources/Frontend/Objective-C/ObjcGrammarModels/ObjcEnumDeclarationNode.swift: -------------------------------------------------------------------------------- 1 | import GrammarModelBase 2 | 3 | /// A C / Objective-C enumeration 4 | public class ObjcEnumDeclarationNode: ObjcASTNode, ObjcInitializableNode, CommentedASTNodeType { 5 | public var isOptionSet: Bool = false 6 | 7 | public var identifier: ObjcIdentifierNode? { 8 | firstChild() 9 | } 10 | 11 | public var type: ObjcTypeNameNode? { 12 | firstChild() 13 | } 14 | 15 | public var cases: [ObjcEnumCaseNode] { 16 | childrenMatching() 17 | } 18 | 19 | public required init(isInNonnullContext: Bool) { 20 | super.init(isInNonnullContext: isInNonnullContext) 21 | } 22 | } 23 | 24 | public class ObjcEnumCaseNode: ObjcASTNode, CommentedASTNodeType { 25 | public var identifier: ObjcIdentifierNode? { 26 | firstChild() 27 | } 28 | public var expression: ObjcExpressionNode? { 29 | firstChild() 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Sources/Frontend/Objective-C/ObjcGrammarModels/ObjcExpressionNode.swift: -------------------------------------------------------------------------------- 1 | import ObjcParserAntlr 2 | 3 | /// A node containing an unprocessed expression parser rule context. 4 | public final class ObjcExpressionNode: ObjcASTNode { 5 | public var expression: ExpressionKind? 6 | 7 | /// Specifies how an expression is stored in this `ExpressionNode`. 8 | public enum ExpressionKind { 9 | /// Expression is stored as a parsed ANTLR context. 10 | case antlr(ObjectiveCParser.ExpressionContext) 11 | 12 | /// Expression is stored as a string representation of the original source 13 | /// code that the expression represents. 14 | /// 15 | /// Must be parsable back into an Objective-C expression later. 16 | case string(String) 17 | 18 | public var expressionContext: ObjectiveCParser.ExpressionContext? { 19 | switch self { 20 | case .antlr(let value): 21 | return value 22 | default: 23 | return nil 24 | } 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Sources/Frontend/Objective-C/ObjcGrammarModels/ObjcIdentifierNode.swift: -------------------------------------------------------------------------------- 1 | import Utils 2 | import GrammarModelBase 3 | 4 | /// An identifier node 5 | public class ObjcIdentifierNode: ObjcASTNode { 6 | /// String identifier 7 | public var name: String 8 | 9 | public override var shortDescription: String { 10 | name 11 | } 12 | 13 | public init( 14 | name: String, 15 | isInNonnullContext: Bool, 16 | location: SourceLocation = .invalid, 17 | length: SourceLength = .zero 18 | ) { 19 | 20 | self.name = name 21 | 22 | super.init( 23 | isInNonnullContext: isInNonnullContext, 24 | location: location, 25 | length: length 26 | ) 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Sources/Frontend/Objective-C/ObjcGrammarModels/ObjcInitializableNode.swift: -------------------------------------------------------------------------------- 1 | /// Describes a node with a default parameterized `init` which is a known 2 | /// base node requirement initializer. 3 | public protocol ObjcInitializableNode: ObjcASTNode { 4 | init(isInNonnullContext: Bool) 5 | } 6 | -------------------------------------------------------------------------------- /Sources/Frontend/Objective-C/ObjcGrammarModels/ObjcKeyword.swift: -------------------------------------------------------------------------------- 1 | /// A known-keyword type 2 | public enum ObjcKeyword: String { 3 | case `if` 4 | case `else` 5 | case `for` 6 | case `while` 7 | case `switch` 8 | case `continue` 9 | case `break` 10 | case `return` 11 | case void 12 | case atInterface = "@interface" 13 | case atImplementation = "@implementation" 14 | case atProperty = "@property" 15 | case atEnd = "@end" 16 | case atProtocol = "@protocol" 17 | case atClass = "@class" 18 | case typedef 19 | case `struct` 20 | case `enum` 21 | case getter 22 | case setter 23 | case atPrivate = "@private" 24 | case atPublic = "@public" 25 | case atProtected = "@protected" 26 | case atPackage = "@package" 27 | case atOptional = "@optional" 28 | case atRequired = "@required" 29 | case atSynthesize = "@synthesize" 30 | case atDynamic = "@dynamic" 31 | } 32 | -------------------------------------------------------------------------------- /Sources/Frontend/Objective-C/ObjcGrammarModels/ObjcKeywordNode.swift: -------------------------------------------------------------------------------- 1 | import Utils 2 | import GrammarModelBase 3 | 4 | /// A node that represents a special keyword-type token 5 | public class ObjcKeywordNode: ObjcASTNode { 6 | public var keyword: ObjcKeyword 7 | 8 | public override var shortDescription: String { 9 | keyword.rawValue 10 | } 11 | 12 | public init( 13 | keyword: ObjcKeyword, 14 | isInNonnullContext: Bool, 15 | location: SourceLocation = .invalid, 16 | length: SourceLength = .zero 17 | ) { 18 | 19 | self.keyword = keyword 20 | 21 | super.init( 22 | isInNonnullContext: isInNonnullContext, 23 | location: location, 24 | length: length 25 | ) 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Sources/Frontend/Objective-C/ObjcGrammarModels/ObjcPreprocessorDirective.swift: -------------------------------------------------------------------------------- 1 | import Utils 2 | import GrammarModelBase 3 | 4 | /// An Objective-C preprocessor from an input file 5 | public struct ObjcPreprocessorDirective: Codable { 6 | public var string: String 7 | public var range: Range 8 | public var location: SourceLocation 9 | public var length: SourceLength 10 | 11 | public var sourceRange: SourceRange { 12 | .init(forStart: location, end: location + length) 13 | } 14 | 15 | public init( 16 | string: String, 17 | range: Range, 18 | location: SourceLocation, 19 | length: SourceLength 20 | ) { 21 | 22 | self.string = string 23 | self.range = range 24 | self.location = location 25 | self.length = length 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Sources/Frontend/Objective-C/ObjcGrammarModels/ObjcPropertyImplementationNode.swift: -------------------------------------------------------------------------------- 1 | import GrammarModelBase 2 | 3 | /// Node for a @synthesize/@dynamic declaration in a class implementation. 4 | public class ObjcPropertyImplementationNode: ObjcASTNode, ObjcInitializableNode, CommentedASTNodeType { 5 | /// Returns the kind of this property implementation node. 6 | /// Defaults to `@synthesize`, if it's missing the required keyword nodes. 7 | public var kind: Kind { 8 | let kws = childrenMatching(type: ObjcKeywordNode.self) 9 | 10 | if kws.contains(where: { $0.keyword == ObjcKeyword.atDynamic }) { 11 | return .dynamic 12 | } else { 13 | return .synthesize 14 | } 15 | } 16 | 17 | public var list: ObjcPropertySynthesizeListNode? { 18 | firstChild() 19 | } 20 | 21 | public required init(isInNonnullContext: Bool) { 22 | super.init(isInNonnullContext: isInNonnullContext) 23 | } 24 | 25 | public enum Kind { 26 | case synthesize 27 | case dynamic 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Sources/Frontend/Objective-C/ObjcGrammarModels/ObjcPropertySynthesizeListNode.swift: -------------------------------------------------------------------------------- 1 | /// List of synthesizes in a @synthesize property implementation. 2 | public class ObjcPropertySynthesizeListNode: ObjcASTNode, ObjcInitializableNode { 3 | public var synthesizations: [ObjcPropertySynthesizeItemNode] { 4 | childrenMatching() 5 | } 6 | 7 | public required init(isInNonnullContext: Bool) { 8 | super.init(isInNonnullContext: isInNonnullContext) 9 | } 10 | } 11 | 12 | /// Single item of a @synthesize property implementation list. 13 | public class ObjcPropertySynthesizeItemNode: ObjcASTNode, ObjcInitializableNode { 14 | public var propertyName: ObjcIdentifierNode? { 15 | firstChild() 16 | } 17 | public var instanceVarName: ObjcIdentifierNode? { 18 | child(atIndex: 1) 19 | } 20 | public var isDynamic: Bool = false 21 | 22 | public required init(isInNonnullContext: Bool) { 23 | super.init(isInNonnullContext: isInNonnullContext) 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Sources/Frontend/Objective-C/ObjcGrammarModels/ObjcProtocolDeclarationNode.swift: -------------------------------------------------------------------------------- 1 | import GrammarModelBase 2 | 3 | /// A syntax node for an Objective-C protocol (`@protocol`) declaration. 4 | public class ObjcProtocolDeclarationNode: ObjcASTNode, ObjcInitializableNode, CommentedASTNodeType { 5 | public var identifier: ObjcIdentifierNode? { 6 | firstChild() 7 | } 8 | 9 | public required init(isInNonnullContext: Bool) { 10 | super.init(isInNonnullContext: isInNonnullContext) 11 | } 12 | } 13 | 14 | public extension ObjcProtocolDeclarationNode { 15 | var properties: [ObjcPropertyDefinitionNode] { 16 | childrenMatching() 17 | } 18 | 19 | var protocolList: ObjcProtocolReferenceListNode? { 20 | firstChild() 21 | } 22 | 23 | var methods: [ObjcMethodDefinitionNode] { 24 | childrenMatching() 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Sources/Frontend/Objective-C/ObjcGrammarModels/ObjcTypeNameNode.swift: -------------------------------------------------------------------------------- 1 | import Utils 2 | import GrammarModelBase 3 | 4 | public class ObjcTypeNameNode: ObjcASTNode { 5 | /// Full type name 6 | public var type: ObjcType 7 | 8 | public override var shortDescription: String { 9 | type.description 10 | } 11 | 12 | public init( 13 | type: ObjcType, 14 | isInNonnullContext: Bool, 15 | location: SourceLocation = .invalid, 16 | length: SourceLength = .zero 17 | ) { 18 | 19 | self.type = type 20 | 21 | super.init( 22 | isInNonnullContext: isInNonnullContext, 23 | location: location, 24 | length: length 25 | ) 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Sources/Frontend/Objective-C/ObjcGrammarModels/ObjcUnknownNode.swift: -------------------------------------------------------------------------------- 1 | /// A node with no proper type. 2 | public class ObjcUnknownNode: ObjcASTNode { 3 | 4 | } 5 | -------------------------------------------------------------------------------- /Sources/Frontend/Objective-C/ObjcParser/DeclarationExtractor/Syntax/Basic/ConstantExpressionSyntax.swift: -------------------------------------------------------------------------------- 1 | import Utils 2 | 3 | /// A generic C-compatible `constantExpression` syntax node for declarations. 4 | public struct ConstantExpressionSyntax: Hashable, Codable { 5 | public var sourceRange: SourceRange = .invalid 6 | 7 | /// A valid C `constantExpression`-compatible syntax string. 8 | public var constantExpressionString: String 9 | } 10 | 11 | extension ConstantExpressionSyntax: DeclarationSyntaxElementType { 12 | public var children: [DeclarationSyntaxElementType] { toChildrenList() } 13 | } 14 | 15 | extension ConstantExpressionSyntax: CustomStringConvertible { 16 | public var description: String { 17 | constantExpressionString 18 | } 19 | } 20 | extension ConstantExpressionSyntax: ExpressibleByStringLiteral { 21 | public init(stringLiteral value: String) { 22 | self.init(constantExpressionString: value) 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Sources/Frontend/Objective-C/ObjcParser/DeclarationExtractor/Syntax/Basic/ExpressionSyntax.swift: -------------------------------------------------------------------------------- 1 | import Utils 2 | 3 | /// A generic C-compatible `expression` syntax node for declarations. 4 | public struct ExpressionSyntax: Hashable, Codable { 5 | public var sourceRange: SourceRange = .invalid 6 | 7 | /// A valid C `expression`-compatible syntax string. 8 | public var expressionString: String 9 | } 10 | 11 | extension ExpressionSyntax: DeclarationSyntaxElementType { 12 | public var children: [DeclarationSyntaxElementType] { toChildrenList() } 13 | } 14 | 15 | extension ExpressionSyntax: CustomStringConvertible { 16 | public var description: String { 17 | expressionString 18 | } 19 | } 20 | extension ExpressionSyntax: ExpressibleByStringLiteral { 21 | public init(stringLiteral value: String) { 22 | self.init(expressionString: value) 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Sources/Frontend/Objective-C/ObjcParser/DeclarationExtractor/Syntax/Basic/IdentifierSyntax.swift: -------------------------------------------------------------------------------- 1 | import Utils 2 | 3 | /// Leaf syntax elements for identifiers in declarations. 4 | public struct IdentifierSyntax: Hashable, Codable { 5 | public var sourceRange: SourceRange = .invalid 6 | 7 | public var identifier: String 8 | } 9 | 10 | extension IdentifierSyntax: DeclarationSyntaxElementType { 11 | public var children: [DeclarationSyntaxElementType] { toChildrenList() } 12 | } 13 | 14 | extension IdentifierSyntax: CustomStringConvertible { 15 | public var description: String { 16 | identifier 17 | } 18 | } 19 | extension IdentifierSyntax: ExpressibleByStringLiteral { 20 | public init(stringLiteral value: String) { 21 | self.init(identifier: value) 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Sources/Frontend/Objective-C/ObjcParser/DeclarationExtractor/Syntax/Basic/ParameterListSyntax.swift: -------------------------------------------------------------------------------- 1 | /// Syntax element for parameter lists in declarations. 2 | public struct ParameterListSyntax: Hashable, Codable { 3 | /// List of parameter declarations. 4 | /// May be empty. 5 | public var parameterDeclarations: [ParameterDeclarationSyntax] 6 | } 7 | 8 | // MARK: - DeclarationSyntaxElementType conformance 9 | 10 | extension ParameterListSyntax: DeclarationSyntaxElementType { 11 | public var children: [DeclarationSyntaxElementType] { 12 | parameterDeclarations 13 | } 14 | } 15 | extension ParameterListSyntax: CustomStringConvertible { 16 | public var description: String { 17 | parameterDeclarations.map(\.description).joined(separator: ", ") 18 | } 19 | } 20 | extension ParameterListSyntax: ExpressibleByArrayLiteral { 21 | public init(arrayLiteral elements: ParameterDeclarationSyntax...) { 22 | self.init(parameterDeclarations: elements) 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Sources/Frontend/Objective-C/ObjcParser/DeclarationExtractor/Syntax/Basic/ParameterTypeListSyntax.swift: -------------------------------------------------------------------------------- 1 | /// A parameter type list syntax for declarations. 2 | public struct ParameterTypeListSyntax: Hashable, Codable { 3 | public var parameterList: ParameterListSyntax 4 | 5 | /// Whether this parameter type list contains an ellipsis variadic parameter 6 | /// specifier at the end, i.e. `...`. 7 | public var isVariadic: Bool 8 | } 9 | 10 | extension ParameterTypeListSyntax: DeclarationSyntaxElementType { 11 | public var children: [DeclarationSyntaxElementType] { 12 | toChildrenList(parameterList) 13 | } 14 | } 15 | extension ParameterTypeListSyntax: CustomStringConvertible { 16 | public var description: String { 17 | return parameterList.description + (isVariadic ? ", ..." : "") 18 | } 19 | } 20 | extension ParameterTypeListSyntax: ExpressibleByArrayLiteral { 21 | public init(arrayLiteral elements: ParameterDeclarationSyntax...) { 22 | self.init( 23 | parameterList: .init(parameterDeclarations: elements), 24 | isVariadic: false 25 | ) 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Sources/Frontend/Objective-C/ObjcParser/DeclarationExtractor/Syntax/Basic/TypeQualifierListSyntax.swift: -------------------------------------------------------------------------------- 1 | import Utils 2 | 3 | /// Syntax node for a list of type qualifiers for declarations. 4 | public struct TypeQualifierListSyntax: Hashable, Codable { 5 | public var typeQualifiers: [TypeQualifierSyntax] 6 | } 7 | 8 | extension TypeQualifierListSyntax: DeclarationSyntaxElementType { 9 | public var children: [DeclarationSyntaxElementType] { 10 | typeQualifiers 11 | } 12 | 13 | public var sourceRange: SourceRange { 14 | SourceRange(union: typeQualifiers.map(\.sourceRange)) 15 | } 16 | } 17 | extension TypeQualifierListSyntax: CustomStringConvertible { 18 | public var description: String { 19 | typeQualifiers.map(\.description).joined(separator: " ") 20 | } 21 | } 22 | extension TypeQualifierListSyntax: ExpressibleByArrayLiteral { 23 | public init(arrayLiteral elements: TypeQualifierSyntax...) { 24 | self.init(typeQualifiers: elements) 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Sources/Frontend/Objective-C/ObjcParser/DeclarationExtractor/Syntax/DeclarationSpecifiers/TypeSpecifiers/TypeIdentifierSyntax.swift: -------------------------------------------------------------------------------- 1 | /// Syntax element for type identifiers in declarations. 2 | public struct TypeIdentifierSyntax: Hashable, Codable { 3 | public var identifier: IdentifierSyntax 4 | } 5 | 6 | extension TypeIdentifierSyntax: DeclarationSyntaxElementType { 7 | public var children: [DeclarationSyntaxElementType] { 8 | toChildrenList(identifier) 9 | } 10 | } 11 | extension TypeIdentifierSyntax: CustomStringConvertible { 12 | public var description: String { 13 | "\(identifier)" 14 | } 15 | } 16 | extension TypeIdentifierSyntax: ExpressibleByStringLiteral { 17 | public init(stringLiteral value: String) { 18 | self.init(identifier: .init(identifier: value)) 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Sources/Frontend/Objective-C/ObjcParser/DeclarationExtractor/Syntax/DeclarationSpecifiersSyntax.swift: -------------------------------------------------------------------------------- 1 | /// Syntax element for declaration specifiers in declarations. 2 | public struct DeclarationSpecifiersSyntax: Hashable, Codable { 3 | /// List of declaration specifiers. 4 | public var declarationSpecifier: [DeclarationSpecifierSyntax] 5 | } 6 | 7 | extension DeclarationSpecifiersSyntax: DeclarationSyntaxElementType { 8 | public var children: [DeclarationSyntaxElementType] { 9 | return declarationSpecifier 10 | } 11 | } 12 | extension DeclarationSpecifiersSyntax: CustomStringConvertible { 13 | public var description: String { 14 | return declarationSpecifier.map(\.description).joined(separator: " ") 15 | } 16 | } 17 | extension DeclarationSpecifiersSyntax: ExpressibleByArrayLiteral { 18 | public init(arrayLiteral elements: DeclarationSpecifierSyntax...) { 19 | self.init(declarationSpecifier: elements) 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Sources/Frontend/Objective-C/ObjcParser/DeclarationExtractor/Syntax/DeclarationSyntax.swift: -------------------------------------------------------------------------------- 1 | /// Syntax for a declaration. 2 | public struct DeclarationSyntax: Hashable, Codable { 3 | public var declarationSpecifiers: DeclarationSpecifiersSyntax 4 | public var initDeclaratorList: InitDeclaratorListSyntax? 5 | } 6 | 7 | extension DeclarationSyntax: DeclarationSyntaxElementType { 8 | public var children: [DeclarationSyntaxElementType] { 9 | toChildrenList(declarationSpecifiers, initDeclaratorList) 10 | } 11 | } 12 | extension DeclarationSyntax: CustomStringConvertible { 13 | public var description: String { 14 | if let initDeclaratorList { 15 | return "\(declarationSpecifiers) \(initDeclaratorList)" 16 | } 17 | 18 | return "\(declarationSpecifiers)" 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Sources/Frontend/Objective-C/ObjcParser/DeclarationExtractor/Syntax/Declarators/DeclaratorSyntax.swift: -------------------------------------------------------------------------------- 1 | /// Syntax element for declarators in declarations. 2 | public struct DeclaratorSyntax: Hashable, Codable { 3 | public var pointer: PointerSyntax? 4 | public var directDeclarator: DirectDeclaratorSyntax 5 | // TODO: Support GCC declarator extensions 6 | // public var gccDeclaratorExtensions: [GCCDeclaratorExtensionSyntax] 7 | } 8 | 9 | extension DeclaratorSyntax: DeclarationSyntaxElementType { 10 | public var children: [DeclarationSyntaxElementType] { 11 | toChildrenList(pointer, directDeclarator) 12 | } 13 | } 14 | extension DeclaratorSyntax: CustomStringConvertible { 15 | public var description: String { 16 | "\(pointer?.description ?? "")\(directDeclarator)" 17 | } 18 | } 19 | extension DeclaratorSyntax: ExpressibleByStringLiteral { 20 | public init(stringLiteral value: String) { 21 | self.init(directDeclarator: .init(stringLiteral: value)) 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Sources/Frontend/Objective-C/ObjcParser/DeclarationExtractor/Syntax/Declarators/DirectDeclarators/FunctionDeclaratorSyntax.swift: -------------------------------------------------------------------------------- 1 | /// Syntax element for a function direct declarator. 2 | public struct FunctionDeclaratorSyntax: Hashable, Codable { 3 | /// The base direct declarator for this function declarator. 4 | public var directDeclarator: DirectDeclaratorSyntax 5 | 6 | /// Parameter type list associated with this function declarator. 7 | public var parameterTypeList: ParameterTypeListSyntax? 8 | } 9 | 10 | extension FunctionDeclaratorSyntax: DeclarationSyntaxElementType { 11 | public var children: [DeclarationSyntaxElementType] { 12 | toChildrenList(directDeclarator, parameterTypeList) 13 | } 14 | } 15 | extension FunctionDeclaratorSyntax: CustomStringConvertible { 16 | public var description: String { 17 | var result: String = "" 18 | result += "\(directDeclarator)" 19 | 20 | result += "(" 21 | if let parameterTypeList { 22 | result += "\(parameterTypeList)" 23 | } 24 | result += ")" 25 | 26 | return result 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Sources/Frontend/Objective-C/ObjcParser/DeclarationExtractor/Syntax/FieldDeclarationSyntax.swift: -------------------------------------------------------------------------------- 1 | /// Syntax element for field declarations. 2 | public struct FieldDeclarationSyntax: Hashable, Codable { 3 | public var declarationSpecifiers: DeclarationSpecifiersSyntax 4 | public var fieldDeclaratorList: [FieldDeclaratorSyntax] 5 | } 6 | 7 | extension FieldDeclarationSyntax: DeclarationSyntaxElementType { 8 | public var children: [DeclarationSyntaxElementType] { 9 | toChildrenList(declarationSpecifiers) + fieldDeclaratorList 10 | } 11 | } 12 | extension FieldDeclarationSyntax: CustomStringConvertible { 13 | public var description: String { 14 | return "\(declarationSpecifiers) \(fieldDeclaratorList);" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Sources/Frontend/Objective-C/ObjcParser/DeclarationExtractor/Syntax/InitDeclarationListSyntax.swift: -------------------------------------------------------------------------------- 1 | /// Declarator list with optional initializers for declarations. 2 | public struct InitDeclaratorListSyntax: Hashable, Codable { 3 | public var initDeclarators: [InitDeclaratorSyntax] 4 | } 5 | 6 | extension InitDeclaratorListSyntax: DeclarationSyntaxElementType { 7 | public var children: [DeclarationSyntaxElementType] { 8 | initDeclarators 9 | } 10 | } 11 | extension InitDeclaratorListSyntax: CustomStringConvertible { 12 | public var description: String { 13 | initDeclarators.map(\.description).joined(separator: ", ") 14 | } 15 | } 16 | extension InitDeclaratorListSyntax: ExpressibleByArrayLiteral { 17 | public init(arrayLiteral elements: InitDeclaratorSyntax...) { 18 | self.init(initDeclarators: elements) 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Sources/Frontend/Objective-C/ObjcParser/DeclarationExtractor/Syntax/InitDeclarationSyntax.swift: -------------------------------------------------------------------------------- 1 | /// Declarator with optional initializers for declarations. 2 | public struct InitDeclaratorSyntax: Hashable, Codable { 3 | public var declarator: DeclaratorSyntax 4 | public var initializer: InitializerSyntax? 5 | } 6 | 7 | extension InitDeclaratorSyntax: DeclarationSyntaxElementType { 8 | public var children: [DeclarationSyntaxElementType] { 9 | toChildrenList(declarator, initializer) 10 | } 11 | } 12 | extension InitDeclaratorSyntax: CustomStringConvertible { 13 | public var description: String { 14 | if let initializer { 15 | return "\(declarator) = \(initializer)" 16 | } 17 | 18 | return "\(declarator)" 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Sources/Frontend/Objective-C/ObjcParser/DeclarationExtractor/Syntax/TypeNameSyntax.swift: -------------------------------------------------------------------------------- 1 | /// Syntax element for type names in declarations. 2 | public struct TypeNameSyntax: Hashable, Codable { 3 | public var declarationSpecifiers: DeclarationSpecifiersSyntax 4 | public var abstractDeclarator: AbstractDeclaratorSyntax? 5 | } 6 | 7 | extension TypeNameSyntax: DeclarationSyntaxElementType { 8 | public var children: [DeclarationSyntaxElementType] { 9 | toChildrenList(declarationSpecifiers, abstractDeclarator) 10 | } 11 | } 12 | extension TypeNameSyntax: CustomStringConvertible { 13 | public var description: String { 14 | if let abstractDeclarator { 15 | return "\(declarationSpecifiers) \(abstractDeclarator)" 16 | } 17 | 18 | return "\(declarationSpecifiers)" 19 | } 20 | } 21 | extension TypeNameSyntax: ExpressibleByStringLiteral { 22 | public init(stringLiteral value: String) { 23 | self.init(declarationSpecifiers: [ 24 | .typeSpecifier(.init(stringLiteral: value)) 25 | ]) 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Sources/Frontend/Objective-C/ObjcParser/DeclarationExtractor/Syntax/TypeVariableDeclaratorSyntax.swift: -------------------------------------------------------------------------------- 1 | /// Syntax element for type variable declarators. 2 | public struct TypeVariableDeclaratorSyntax: Hashable, Codable { 3 | public var declarationSpecifiers: DeclarationSpecifiersSyntax 4 | public var declarator: DeclaratorSyntax 5 | } 6 | 7 | extension TypeVariableDeclaratorSyntax: DeclarationSyntaxElementType { 8 | public var children: [DeclarationSyntaxElementType] { 9 | toChildrenList(declarationSpecifiers, declarator) 10 | } 11 | } 12 | extension TypeVariableDeclaratorSyntax: CustomStringConvertible { 13 | public var description: String { 14 | return "\(declarationSpecifiers) \(declarator)" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Sources/Frontend/Objective-C/ObjcParser/ObjcImportDecl.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | import Utils 3 | 4 | public struct ObjcImportDecl { 5 | public var path: String 6 | public var sourceRange: SourceRange 7 | 8 | /// If `true`, indicates `#import` is of `#import ` variant, 9 | /// as opposed to `#import "local_file"` variant. 10 | public var isSystemImport: Bool 11 | 12 | public var pathComponents: [String] { 13 | (path as NSString).pathComponents 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Sources/Frontend/Objective-C/ObjcParser/ObjcPreprocessorListener.swift: -------------------------------------------------------------------------------- 1 | import Antlr4 2 | import ObjcParserAntlr 3 | 4 | class ObjcPreprocessorListener: ObjectiveCPreprocessorParserBaseListener { 5 | var preprocessorDirectiveIntervals: [Range] = [] 6 | 7 | override func enterText(_ ctx: ObjectiveCPreprocessorParser.TextContext) { 8 | if ctx.directive() != nil { 9 | guard let start = ctx.start?.getStartIndex(), let stop = ctx.stop?.getStopIndex() else { 10 | return 11 | } 12 | 13 | preprocessorDirectiveIntervals.append(start.. [Range] { 18 | let listener = ObjcPreprocessorListener() 19 | 20 | let walker = ParseTreeWalker() 21 | try? walker.walk(listener, tree) 22 | 23 | return listener.preprocessorDirectiveIntervals 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Sources/Frontend/Objective-C/ObjcParserAntlr/shim.swift: -------------------------------------------------------------------------------- 1 | import AntlrCommons 2 | 3 | typealias DFAParser = AntlrCommons.DFAParser 4 | typealias DFALexer = AntlrCommons.DFALexer 5 | typealias ATNConfigSetParser = AntlrCommons.ATNConfigSetParser 6 | -------------------------------------------------------------------------------- /Sources/Frontend/Objective-C/ObjectiveCFrontend/ObjcParserStatePool.swift: -------------------------------------------------------------------------------- 1 | import ObjcParser 2 | import Utils 3 | 4 | /// A class to aid in managing pooling of ObjcParserState instances 5 | public final class ObjcParserStatePool { 6 | let mutex = Mutex() 7 | 8 | private var pool: [ObjcParserState] = [] 9 | 10 | public init() { 11 | 12 | } 13 | 14 | /// Pulls a new instance of an `ObjcParserState` to parse with. 15 | /// 16 | /// - Returns: An `ObjcParserState` ready to parse data. 17 | public func pull() -> ObjcParserState { 18 | mutex.locking { 19 | if !pool.isEmpty { 20 | return pool.removeFirst() 21 | } 22 | 23 | return ObjcParserState() 24 | } 25 | } 26 | 27 | /// Repools and `ObjcParserState` instance for reusal. 28 | /// 29 | /// - Parameter parserState: Parser state to reuse. 30 | public func repool(_ parserState: ObjcParserState) { 31 | mutex.locking { 32 | pool.append(parserState) 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Sources/Frontend/Objective-C/ObjectiveCFrontend/ObjectiveCFileCollectionStepDelegate.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | import SwiftRewriterLib 3 | import Utils 4 | 5 | public protocol ObjectiveCFileCollectionStepDelegate: AnyObject { 6 | func objectiveCFileCollectionStep( 7 | _ fileCollectionStep: ObjectiveCFileCollectionStep, 8 | referencedFilesForFile file: InputSource 9 | ) throws -> [(file: URL, range: SourceRange?)] 10 | } 11 | -------------------------------------------------------------------------------- /Sources/Frontend/Objective-C/ObjectiveCFrontend/ObjectiveCFrontend.swift: -------------------------------------------------------------------------------- 1 | @_exported import ObjcParser 2 | @_exported import GlobalsProviders 3 | @_exported import ExpressionPasses 4 | @_exported import IntentionPasses 5 | @_exported import SwiftSyntaxRewriterPasses 6 | @_exported import SourcePreprocessors 7 | @_exported import SwiftRewriterLib 8 | -------------------------------------------------------------------------------- /Sources/Frontend/Objective-C/ObjectiveCFrontend/ObjectiveCSwiftRewriterService.swift: -------------------------------------------------------------------------------- 1 | import SwiftRewriterLib 2 | 3 | /// Refined protocol for Objective-C rewriter services. 4 | public protocol ObjectiveCSwiftRewriterService: SwiftRewriterService { 5 | /// Gets the shared parser cache. 6 | var parserCache: ObjectiveCParserCache { get } 7 | } 8 | -------------------------------------------------------------------------------- /Sources/SwiftRewriter/Objective-C/ObjectiveCStdoutFileCollectionStepListener.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | import Console 3 | import ObjectiveCFrontend 4 | import Utils 5 | 6 | class ObjectiveCStdoutFileCollectionStepListener: ObjectiveCFileCollectionStepListener { 7 | func objectiveCFileCollectionStep( 8 | _ collectionStep: ObjectiveCFileCollectionStep, 9 | didAddReferencedFile referencedUrl: URL, 10 | sourceRange: SourceRange?, 11 | forInputFile inputFile: DiskInputFile 12 | ) { 13 | 14 | var message = "Found referenced file \(referencedUrl.lastPathComponent) from input file \(inputFile.url.lastPathComponent)" 15 | if let location = sourceRange?.start { 16 | message += ":\(location.line)" 17 | if location.column != 1 { 18 | message += ":\(location.column)" 19 | } 20 | } 21 | 22 | print(message) 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Sources/SwiftRewriter/SwiftRewriterCommand.swift: -------------------------------------------------------------------------------- 1 | import ArgumentParser 2 | import Foundation 3 | import Console 4 | import ObjectiveCFrontend 5 | 6 | struct SwiftRewriterCommand: ParsableCommand { 7 | static let configuration = CommandConfiguration( 8 | commandName: "SwiftRewriter", 9 | discussion: """ 10 | Main frontend API for SwiftRewriter. Allows selection of specific source \ 11 | language modes. 12 | """, 13 | subcommands: [ 14 | ObjectiveCCommand.self, 15 | ], 16 | defaultSubcommand: ObjectiveCCommand.self 17 | ) 18 | 19 | func run() throws { 20 | 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Sources/SwiftRewriter/Target.swift: -------------------------------------------------------------------------------- 1 | import ArgumentParser 2 | 3 | enum Target: String, Codable { 4 | case stdout 5 | case filedisk 6 | } 7 | 8 | extension Target: ExpressibleByArgument { 9 | init?(argument: String) { 10 | if let value = Target(rawValue: argument) { 11 | self = value 12 | } else { 13 | return nil 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Sources/SwiftRewriter/main.swift: -------------------------------------------------------------------------------- 1 | SwiftRewriterCommand.main() 2 | -------------------------------------------------------------------------------- /Sources/SwiftRewriterCLI/Stopwatch.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | /// Unix-compatible stopwatch system 4 | public class Stopwatch { 5 | var start: timespec = timespec() 6 | 7 | private init() { 8 | if #available(OSX 10.12, *) { 9 | clock_gettime(CLOCK_MONOTONIC_RAW, &start) 10 | } else { 11 | fatalError() 12 | } 13 | } 14 | 15 | public func stop() -> TimeInterval { 16 | var end: timespec = timespec() 17 | if #available(OSX 10.12, *) { 18 | clock_gettime(CLOCK_MONOTONIC_RAW, &end) 19 | } else { 20 | fatalError() 21 | } 22 | 23 | let delta_us = (end.tv_sec - start.tv_sec) * 1000000 + (end.tv_nsec - start.tv_nsec) / 1000 24 | 25 | return TimeInterval(delta_us) / 1_000_000 26 | } 27 | 28 | public static func start() -> Stopwatch { 29 | Stopwatch() 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Sources/SwiftRewriterLib/DiskInputFile.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | import Utils 3 | 4 | public struct DiskInputFile: Equatable { 5 | public var url: URL 6 | 7 | /// Whether this file is a primary file for conversion. 8 | /// If `false`, indicates that this file should be parsed but not be present 9 | /// in the final transpilation step. 10 | public var isPrimary: Bool 11 | 12 | public init(url: URL, isPrimary: Bool) { 13 | self.url = url 14 | self.isPrimary = isPrimary 15 | } 16 | } 17 | 18 | extension DiskInputFile: InputSource { 19 | public func sourcePath() -> String { 20 | url.path 21 | } 22 | 23 | public func loadSource() throws -> CodeSource { 24 | let source = try String(contentsOf: url) 25 | 26 | return StringCodeSource(source: source, fileName: url.path) 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Sources/SwiftRewriterLib/FileProvider.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | public protocol FileProvider { 4 | func enumerator(atUrl url: URL) -> [URL]? 5 | func fileExists(atUrl url: URL) -> Bool 6 | func fileExists(atUrl url: URL, isDirectory: inout Bool) -> Bool 7 | func directoryExists(atUrl url: URL) -> Bool 8 | func contentsOfFile(atUrl url: URL) throws -> Data 9 | func contentsOfDirectory(atUrl url: URL, shallow: Bool) throws -> [URL] 10 | 11 | /// Requests the hard drive path for the current user's home directory. 12 | func homeDirectoryForCurrentUser() -> URL 13 | } 14 | -------------------------------------------------------------------------------- /Sources/SwiftRewriterLib/NullWriterOutput.swift: -------------------------------------------------------------------------------- 1 | import WriterTargetOutput 2 | 3 | /// A writer output target that sinks in all input and ignores data. 4 | public class NullWriterOutput: WriterOutput { 5 | public init() { 6 | 7 | } 8 | 9 | /// Opens a file for outputting contents to 10 | public func createFile(path: String) throws -> FileOutput { 11 | return NullFileOutput() 12 | } 13 | } 14 | 15 | /// A file output that produces a null rewriter output target and saves no data. 16 | public class NullFileOutput: FileOutput { 17 | public init() { 18 | 19 | } 20 | 21 | public func outputTarget() -> RewriterOutputTarget { 22 | return NullRewriterOutputTarget() 23 | } 24 | 25 | public func close() { 26 | 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Sources/SwiftRewriterLib/SingleInputProvider.swift: -------------------------------------------------------------------------------- 1 | import Utils 2 | 3 | /// A class that stands both as an input provider and as a input to a single 4 | /// input of a static code string. 5 | public class SingleInputProvider: InputSourcesProvider, InputSource { 6 | public var code: String 7 | public var isPrimary: Bool 8 | public var fileName: String 9 | 10 | public init(code: String, isPrimary: Bool, fileName: String) { 11 | self.code = code 12 | self.isPrimary = isPrimary 13 | self.fileName = fileName 14 | } 15 | 16 | public func sources() -> [InputSource] { 17 | return [self] 18 | } 19 | 20 | public func sourcePath() -> String { 21 | return fileName 22 | } 23 | 24 | public func loadSource() throws -> CodeSource { 25 | return StringCodeSource(source: code, fileName: sourcePath()) 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Sources/SwiftRewriterLib/SwiftRewriterService.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | /// Protocol for enabling Swift rewriting service from CLI 4 | public protocol SwiftRewriterService { 5 | /// Performs a rewrite of the given files 6 | func rewrite(files: [URL]) throws 7 | 8 | /// Performs a rewrite of the given files 9 | func rewrite(files: [DiskInputFile]) throws 10 | 11 | /// Performs a rewrite of the given inputs 12 | func rewrite(inputs: [InputSource]) throws 13 | } 14 | -------------------------------------------------------------------------------- /Sources/SwiftRewriterLib/WriterOutput.swift: -------------------------------------------------------------------------------- 1 | import WriterTargetOutput 2 | 3 | /// Manages output of a Swift Rewriter invocation by providing file targets to 4 | /// output Swift code to. 5 | public protocol WriterOutput { 6 | /// Opens a file for outputting contents to 7 | func createFile(path: String) throws -> FileOutput 8 | } 9 | 10 | /// An output target that points to a file 11 | public protocol FileOutput { 12 | /// Closes file and disallows further writing. 13 | func close() 14 | 15 | /// Requests an output target that can be used to write resulting source code 16 | /// to. 17 | func outputTarget() -> RewriterOutputTarget 18 | } 19 | -------------------------------------------------------------------------------- /Sources/TestCommons/Array+Testing.swift: -------------------------------------------------------------------------------- 1 | public extension Array { 2 | subscript(try index: Int) -> Element { 3 | get throws { 4 | if index >= 0 && index < count { 5 | return self[index] 6 | } 7 | 8 | throw ArrayError.indexNotFound(index: index) 9 | } 10 | } 11 | } 12 | 13 | public enum ArrayError: Error { 14 | case indexNotFound(index: Int) 15 | } 16 | -------------------------------------------------------------------------------- /Sources/TestCommons/Asserters/Antlr+Asserter.swift: -------------------------------------------------------------------------------- 1 | import XCTest 2 | import Antlr4 3 | 4 | public extension Asserter where Object: ParserRuleContext { 5 | /// Asserts that the underlying `ParserRuleContext` object being tested has 6 | /// a textual value from the underlying source code that matches a given 7 | /// string. 8 | /// 9 | /// Returns `nil` if the test failed, otherwise returns `self` for chaining 10 | /// further tests. 11 | @discardableResult 12 | func assert( 13 | textEquals expected: String, 14 | message: @autoclosure () -> String = "", 15 | file: StaticString = #file, 16 | line: UInt = #line 17 | ) -> Self? { 18 | 19 | let text = object.getText() 20 | guard text == expected else { 21 | return assertFailed( 22 | message: #"assert(textEquals:) failed: ("\#(text)") != ("\#(expected)"). \#(message())"#, 23 | file: file, 24 | line: line 25 | ) 26 | } 27 | 28 | return self 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Sources/TestCommons/Asserters/Asserter+KeyPath.swift: -------------------------------------------------------------------------------- 1 | public extension Asserter where Object: Collection, Object.Index == Int { 2 | /// Returns an asserter for the object at a given index in the underlying 3 | /// `Collection` being tested, asserting that the collection can has an index 4 | /// of `index`. 5 | /// 6 | /// Returns `nil` if the index is not available in the collection, otherwise 7 | /// returns `Asserter` for chaining further tests. 8 | subscript( 9 | index: Object.Index, 10 | file: StaticString = #file, 11 | line: UInt = #line 12 | ) -> Asserter? { 13 | 14 | guard object.count > index else { 15 | return assertFailed( 16 | message: #"subscript[\#(index)] failed: collection has less than \#(index + 1) item(s)."#, 17 | file: file, 18 | line: line 19 | ) 20 | } 21 | 22 | return .init(object: object[index]) 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Sources/TestCommons/Asserters/Intentions/ClassExtensionGenerationIntention+Asserter.swift: -------------------------------------------------------------------------------- 1 | import Intentions 2 | 3 | public extension Asserter where Object: ClassExtensionGenerationIntention { 4 | 5 | /// Asserts that the underlying `ClassExtensionGenerationIntention` being 6 | /// tested has a category name. 7 | /// 8 | /// Returns `nil` if the test failed, otherwise returns `self` for chaining 9 | /// further tests. 10 | @discardableResult 11 | func assert( 12 | categoryName: String, 13 | file: StaticString = #file, 14 | line: UInt = #line 15 | ) -> Self? { 16 | 17 | asserter(forKeyPath: \.categoryName) { 18 | $0.assert(equals: categoryName, file: file, line: line) 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Sources/TestCommons/Asserters/Intentions/FunctionBodyIntention+Asserter.swift: -------------------------------------------------------------------------------- 1 | import Intentions 2 | import SwiftAST 3 | 4 | public extension Asserter where Object == FunctionBodyIntention { 5 | /// Asserts that the underlying `FunctionBodyIntention` being tested has a 6 | /// specified compound statement as a body. 7 | /// 8 | /// Returns `nil` if the test failed, otherwise returns `self` for chaining 9 | /// further tests. 10 | @discardableResult 11 | func assert( 12 | body: CompoundStatement, 13 | file: StaticString = #file, 14 | line: UInt = #line 15 | ) -> Self? { 16 | 17 | asserter(forKeyPath: \.body) { 18 | $0.assert(equals: body, file: file, line: line) 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Sources/TestCommons/Asserters/ObjcGrammarModels/ObjcASTNode+Asserter.swift: -------------------------------------------------------------------------------- 1 | import ObjcGrammarModels 2 | 3 | public extension Asserter where Object: ObjcASTNode { 4 | /// Asserts that the underlying `ObjcASTNode` being tested has a specified 5 | /// `isInNonnullContext` value. 6 | /// 7 | /// Returns `nil` if the test failed, otherwise returns `self` for chaining 8 | /// further tests. 9 | @discardableResult 10 | func assert( 11 | isInNonnullContext inNonnullContext: Bool, 12 | file: StaticString = #file, 13 | line: UInt = #line 14 | ) -> Self? { 15 | 16 | asserter(forKeyPath: \.isInNonnullContext, file: file, line: line) { prop in 17 | prop.assert( 18 | equals: inNonnullContext, 19 | message: "Expected node \(object.shortDescription) to have isInNonnullContext value of \(inNonnullContext)", 20 | file: file, 21 | line: line 22 | ) 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Sources/TestCommons/Asserters/ObjcGrammarModels/ObjcIdentifierNode+Asserter.swift: -------------------------------------------------------------------------------- 1 | import Utils 2 | import ObjcGrammarModels 3 | 4 | public extension Asserter where Object: ObjcIdentifierNode { 5 | /// Asserts that the underlying `ObjcIdentifierNode` being tested has the 6 | /// specified `name` value. 7 | /// 8 | /// Returns `nil` if the test failed, otherwise returns `self` for chaining 9 | /// further tests. 10 | @discardableResult 11 | func assert( 12 | name: String, 13 | message: @autoclosure () -> String = "", 14 | file: StaticString = #file, 15 | line: UInt = #line 16 | ) -> Self? { 17 | 18 | asserter(forKeyPath: \.name, file: file, line: line) { 19 | $0.assert(equals: name, message: message(), file: file, line: line) 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Sources/TestCommons/Asserters/ObjcGrammarModels/ObjcInitialExpressionNode+Asserter.swift: -------------------------------------------------------------------------------- 1 | import Utils 2 | import ObjcGrammarModels 3 | 4 | public extension Asserter where Object == ObjcInitialExpressionNode { 5 | /// Asserts that the underlying `ObjcInitialExpressionNode` being tested has 6 | /// a parser rule expression that matches a specified string value exactly. 7 | /// 8 | /// Returns `nil` if the test failed, otherwise returns `self` for chaining 9 | /// further tests. 10 | @discardableResult 11 | func assert( 12 | expressionString: String, 13 | message: @autoclosure () -> String = "", 14 | file: StaticString = #file, 15 | line: UInt = #line 16 | ) -> Self? { 17 | 18 | asserter( 19 | forKeyPath: \.expression, 20 | file: file, 21 | line: line 22 | ) { 23 | $0.assertNotNil(file: file, line: line)? 24 | .assert(expressionString: expressionString, message: message(), file: file, line: line) 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Sources/TestCommons/Asserters/ObjcGrammarModels/ObjcPropertyAttributesListNode+Asserter.swift: -------------------------------------------------------------------------------- 1 | import Utils 2 | import ObjcGrammarModels 3 | 4 | public extension Asserter where Object == ObjcPropertyAttributesListNode { 5 | /// Asserts that the underlying `ObjcPropertyAttributesListNode` being tested 6 | /// has a specified attribute list. 7 | /// 8 | /// Returns `nil` if the test failed, otherwise returns `self` for chaining 9 | /// further tests. 10 | @discardableResult 11 | func assert( 12 | attributesList: [ObjcPropertyAttributeNode.Attribute], 13 | file: StaticString = #file, 14 | line: UInt = #line 15 | ) -> Self? { 16 | 17 | asserter(forKeyPath: \.attributes, file: file, line: line) { attr in 18 | let actual = attr.object.map(\.attribute) 19 | 20 | return asserter(for: actual) { actual in 21 | actual.assert(equals: attributesList, file: file, line: line) 22 | } 23 | } 24 | } 25 | } 26 | 27 | -------------------------------------------------------------------------------- /Sources/TestCommons/Asserters/ObjcGrammarModels/ObjcTypeNameNode+Asserter.swift: -------------------------------------------------------------------------------- 1 | import Utils 2 | import ObjcGrammarModels 3 | 4 | public extension Asserter where Object == ObjcTypeNameNode { 5 | /// Asserts that the underlying `ObjcTypeNameNode` being tested has the 6 | /// specified `type` value. 7 | /// 8 | /// Returns `nil` if the test failed, otherwise returns `self` for chaining 9 | /// further tests. 10 | @discardableResult 11 | func assert( 12 | type: ObjcType, 13 | message: @autoclosure () -> String = "", 14 | file: StaticString = #file, 15 | line: UInt = #line 16 | ) -> Self? { 17 | 18 | asserter(forKeyPath: \.type, file: file, line: line) { 19 | $0.assert(equals: type, message: message(), file: file, line: line) 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Sources/TestCommons/Builders/DeclarationBuilder.swift: -------------------------------------------------------------------------------- 1 | import Intentions 2 | 3 | /// Base class for builders for types, members and global variables and functions. 4 | public class DeclarationBuilder { 5 | var declaration: T 6 | 7 | init(declaration: T) { 8 | self.declaration = declaration 9 | } 10 | } 11 | 12 | extension DeclarationBuilder where T: Intention { 13 | public func addMetadata(forKey key: String, value: Any, type: String) { 14 | declaration.metadata.updateValue(value, type: type, forKey: key) 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Sources/TestCommons/ExpressionPrinter.swift: -------------------------------------------------------------------------------- 1 | import SwiftAST 2 | import WriterTargetOutput 3 | import SwiftSyntaxSupport 4 | 5 | public enum ExpressionPrinter { 6 | public static func print(expression: Expression) { 7 | let string = toString(expression: expression) 8 | 9 | Swift.print(string) 10 | } 11 | 12 | public static func toString(expression: Expression) -> String { 13 | return SwiftProducer.generateExpression(expression) 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Sources/TestCommons/StatementPrinter.swift: -------------------------------------------------------------------------------- 1 | import SwiftAST 2 | import WriterTargetOutput 3 | import SwiftSyntaxSupport 4 | 5 | public enum StatementPrinter { 6 | public static func print(statement: Statement) { 7 | let string = toString(statement: statement) 8 | 9 | Swift.print(string) 10 | } 11 | 12 | public static func toString(statement: Statement) -> String { 13 | return SwiftProducer.generateStatement(statement) 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Sources/Utils/CodeSource.swift: -------------------------------------------------------------------------------- 1 | /// Protocol for sourcing code strings from 2 | public protocol CodeSource: Source { 3 | func fetchSource() -> String 4 | } 5 | -------------------------------------------------------------------------------- /Sources/Utils/LinuxSupport.swift: -------------------------------------------------------------------------------- 1 | #if !canImport(ObjectiveC) 2 | @inlinable 3 | public func autoreleasepool(_ closure: () throws -> T) rethrows -> T { 4 | return try closure() 5 | } 6 | #endif 7 | -------------------------------------------------------------------------------- /Sources/Utils/Mutex.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | /// A simple, non-recursive mutex lock. 4 | public final class Mutex { 5 | 6 | private var _lock: NSLock 7 | 8 | public init() { 9 | _lock = NSLock() 10 | } 11 | 12 | public func lock() { 13 | _lock.lock() 14 | } 15 | 16 | public func unlock() { 17 | _lock.unlock() 18 | } 19 | 20 | public func tryLock() -> Bool { 21 | _lock.try() 22 | } 23 | 24 | public func locking(_ closure: () throws -> T) rethrows -> T { 25 | lock() 26 | defer { 27 | unlock() 28 | } 29 | 30 | return try closure() 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /SwiftRewriter.xcodeproj/AnalysisTests_Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CFBundleDevelopmentRegion 5 | en 6 | CFBundleExecutable 7 | $(EXECUTABLE_NAME) 8 | CFBundleIdentifier 9 | $(PRODUCT_BUNDLE_IDENTIFIER) 10 | CFBundleInfoDictionaryVersion 11 | 6.0 12 | CFBundleName 13 | $(PRODUCT_NAME) 14 | CFBundlePackageType 15 | BNDL 16 | CFBundleShortVersionString 17 | 1.0 18 | CFBundleSignature 19 | ???? 20 | CFBundleVersion 21 | $(CURRENT_PROJECT_VERSION) 22 | NSPrincipalClass 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /SwiftRewriter.xcodeproj/Analysis_Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CFBundleDevelopmentRegion 5 | en 6 | CFBundleExecutable 7 | $(EXECUTABLE_NAME) 8 | CFBundleIdentifier 9 | $(PRODUCT_BUNDLE_IDENTIFIER) 10 | CFBundleInfoDictionaryVersion 11 | 6.0 12 | CFBundleName 13 | $(PRODUCT_NAME) 14 | CFBundlePackageType 15 | FMWK 16 | CFBundleShortVersionString 17 | 1.0 18 | CFBundleSignature 19 | ???? 20 | CFBundleVersion 21 | $(CURRENT_PROJECT_VERSION) 22 | NSPrincipalClass 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /SwiftRewriter.xcodeproj/Antlr4_Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CFBundleDevelopmentRegion 5 | en 6 | CFBundleExecutable 7 | $(EXECUTABLE_NAME) 8 | CFBundleIdentifier 9 | $(PRODUCT_BUNDLE_IDENTIFIER) 10 | CFBundleInfoDictionaryVersion 11 | 6.0 12 | CFBundleName 13 | $(PRODUCT_NAME) 14 | CFBundlePackageType 15 | FMWK 16 | CFBundleShortVersionString 17 | 1.0 18 | CFBundleSignature 19 | ???? 20 | CFBundleVersion 21 | $(CURRENT_PROJECT_VERSION) 22 | NSPrincipalClass 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /SwiftRewriter.xcodeproj/AntlrCommons_Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CFBundleDevelopmentRegion 5 | en 6 | CFBundleExecutable 7 | $(EXECUTABLE_NAME) 8 | CFBundleIdentifier 9 | $(PRODUCT_BUNDLE_IDENTIFIER) 10 | CFBundleInfoDictionaryVersion 11 | 6.0 12 | CFBundleName 13 | $(PRODUCT_NAME) 14 | CFBundlePackageType 15 | FMWK 16 | CFBundleShortVersionString 17 | 1.0 18 | CFBundleSignature 19 | ???? 20 | CFBundleVersion 21 | $(CURRENT_PROJECT_VERSION) 22 | NSPrincipalClass 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /SwiftRewriter.xcodeproj/ArgumentParserToolInfo_Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CFBundleDevelopmentRegion 5 | en 6 | CFBundleExecutable 7 | $(EXECUTABLE_NAME) 8 | CFBundleIdentifier 9 | $(PRODUCT_BUNDLE_IDENTIFIER) 10 | CFBundleInfoDictionaryVersion 11 | 6.0 12 | CFBundleName 13 | $(PRODUCT_NAME) 14 | CFBundlePackageType 15 | FMWK 16 | CFBundleShortVersionString 17 | 1.0 18 | CFBundleSignature 19 | ???? 20 | CFBundleVersion 21 | $(CURRENT_PROJECT_VERSION) 22 | NSPrincipalClass 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /SwiftRewriter.xcodeproj/ArgumentParser_Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CFBundleDevelopmentRegion 5 | en 6 | CFBundleExecutable 7 | $(EXECUTABLE_NAME) 8 | CFBundleIdentifier 9 | $(PRODUCT_BUNDLE_IDENTIFIER) 10 | CFBundleInfoDictionaryVersion 11 | 6.0 12 | CFBundleName 13 | $(PRODUCT_NAME) 14 | CFBundlePackageType 15 | FMWK 16 | CFBundleShortVersionString 17 | 1.0 18 | CFBundleSignature 19 | ???? 20 | CFBundleVersion 21 | $(CURRENT_PROJECT_VERSION) 22 | NSPrincipalClass 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /SwiftRewriter.xcodeproj/Basic_Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CFBundleDevelopmentRegion 5 | en 6 | CFBundleExecutable 7 | $(EXECUTABLE_NAME) 8 | CFBundleIdentifier 9 | $(PRODUCT_BUNDLE_IDENTIFIER) 10 | CFBundleInfoDictionaryVersion 11 | 6.0 12 | CFBundleName 13 | $(PRODUCT_NAME) 14 | CFBundlePackageType 15 | FMWK 16 | CFBundleShortVersionString 17 | 1.0 18 | CFBundleSignature 19 | ???? 20 | CFBundleVersion 21 | $(CURRENT_PROJECT_VERSION) 22 | NSPrincipalClass 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /SwiftRewriter.xcodeproj/CAntlrShims_Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CFBundleDevelopmentRegion 5 | en 6 | CFBundleExecutable 7 | $(EXECUTABLE_NAME) 8 | CFBundleIdentifier 9 | $(PRODUCT_BUNDLE_IDENTIFIER) 10 | CFBundleInfoDictionaryVersion 11 | 6.0 12 | CFBundleName 13 | $(PRODUCT_NAME) 14 | CFBundlePackageType 15 | FMWK 16 | CFBundleShortVersionString 17 | 1.0 18 | CFBundleSignature 19 | ???? 20 | CFBundleVersion 21 | $(CURRENT_PROJECT_VERSION) 22 | NSPrincipalClass 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /SwiftRewriter.xcodeproj/CYaml_Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CFBundleDevelopmentRegion 5 | en 6 | CFBundleExecutable 7 | $(EXECUTABLE_NAME) 8 | CFBundleIdentifier 9 | $(PRODUCT_BUNDLE_IDENTIFIER) 10 | CFBundleInfoDictionaryVersion 11 | 6.0 12 | CFBundleName 13 | $(PRODUCT_NAME) 14 | CFBundlePackageType 15 | FMWK 16 | CFBundleShortVersionString 17 | 1.0 18 | CFBundleSignature 19 | ???? 20 | CFBundleVersion 21 | $(CURRENT_PROJECT_VERSION) 22 | NSPrincipalClass 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /SwiftRewriter.xcodeproj/Clang_C_Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CFBundleDevelopmentRegion 5 | en 6 | CFBundleExecutable 7 | $(EXECUTABLE_NAME) 8 | CFBundleIdentifier 9 | $(PRODUCT_BUNDLE_IDENTIFIER) 10 | CFBundleInfoDictionaryVersion 11 | 6.0 12 | CFBundleName 13 | $(PRODUCT_NAME) 14 | CFBundlePackageType 15 | FMWK 16 | CFBundleShortVersionString 17 | 1.0 18 | CFBundleSignature 19 | ???? 20 | CFBundleVersion 21 | $(CURRENT_PROJECT_VERSION) 22 | NSPrincipalClass 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /SwiftRewriter.xcodeproj/CommonsTests_Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CFBundleDevelopmentRegion 5 | en 6 | CFBundleExecutable 7 | $(EXECUTABLE_NAME) 8 | CFBundleIdentifier 9 | $(PRODUCT_BUNDLE_IDENTIFIER) 10 | CFBundleInfoDictionaryVersion 11 | 6.0 12 | CFBundleName 13 | $(PRODUCT_NAME) 14 | CFBundlePackageType 15 | BNDL 16 | CFBundleShortVersionString 17 | 1.0 18 | CFBundleSignature 19 | ???? 20 | CFBundleVersion 21 | $(CURRENT_PROJECT_VERSION) 22 | NSPrincipalClass 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /SwiftRewriter.xcodeproj/Commons_Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CFBundleDevelopmentRegion 5 | en 6 | CFBundleExecutable 7 | $(EXECUTABLE_NAME) 8 | CFBundleIdentifier 9 | $(PRODUCT_BUNDLE_IDENTIFIER) 10 | CFBundleInfoDictionaryVersion 11 | 6.0 12 | CFBundleName 13 | $(PRODUCT_NAME) 14 | CFBundlePackageType 15 | FMWK 16 | CFBundleShortVersionString 17 | 1.0 18 | CFBundleSignature 19 | ???? 20 | CFBundleVersion 21 | $(CURRENT_PROJECT_VERSION) 22 | NSPrincipalClass 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /SwiftRewriter.xcodeproj/Console_Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CFBundleDevelopmentRegion 5 | en 6 | CFBundleExecutable 7 | $(EXECUTABLE_NAME) 8 | CFBundleIdentifier 9 | $(PRODUCT_BUNDLE_IDENTIFIER) 10 | CFBundleInfoDictionaryVersion 11 | 6.0 12 | CFBundleName 13 | $(PRODUCT_NAME) 14 | CFBundlePackageType 15 | FMWK 16 | CFBundleShortVersionString 17 | 1.0 18 | CFBundleSignature 19 | ???? 20 | CFBundleVersion 21 | $(CURRENT_PROJECT_VERSION) 22 | NSPrincipalClass 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /SwiftRewriter.xcodeproj/ExpressionPassesTests_Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CFBundleDevelopmentRegion 5 | en 6 | CFBundleExecutable 7 | $(EXECUTABLE_NAME) 8 | CFBundleIdentifier 9 | $(PRODUCT_BUNDLE_IDENTIFIER) 10 | CFBundleInfoDictionaryVersion 11 | 6.0 12 | CFBundleName 13 | $(PRODUCT_NAME) 14 | CFBundlePackageType 15 | BNDL 16 | CFBundleShortVersionString 17 | 1.0 18 | CFBundleSignature 19 | ???? 20 | CFBundleVersion 21 | $(CURRENT_PROJECT_VERSION) 22 | NSPrincipalClass 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /SwiftRewriter.xcodeproj/ExpressionPasses_Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CFBundleDevelopmentRegion 5 | en 6 | CFBundleExecutable 7 | $(EXECUTABLE_NAME) 8 | CFBundleIdentifier 9 | $(PRODUCT_BUNDLE_IDENTIFIER) 10 | CFBundleInfoDictionaryVersion 11 | 6.0 12 | CFBundleName 13 | $(PRODUCT_NAME) 14 | CFBundlePackageType 15 | FMWK 16 | CFBundleShortVersionString 17 | 1.0 18 | CFBundleSignature 19 | ???? 20 | CFBundleVersion 21 | $(CURRENT_PROJECT_VERSION) 22 | NSPrincipalClass 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /SwiftRewriter.xcodeproj/GlobalsProvidersTests_Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CFBundleDevelopmentRegion 5 | en 6 | CFBundleExecutable 7 | $(EXECUTABLE_NAME) 8 | CFBundleIdentifier 9 | $(PRODUCT_BUNDLE_IDENTIFIER) 10 | CFBundleInfoDictionaryVersion 11 | 6.0 12 | CFBundleName 13 | $(PRODUCT_NAME) 14 | CFBundlePackageType 15 | BNDL 16 | CFBundleShortVersionString 17 | 1.0 18 | CFBundleSignature 19 | ???? 20 | CFBundleVersion 21 | $(CURRENT_PROJECT_VERSION) 22 | NSPrincipalClass 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /SwiftRewriter.xcodeproj/GlobalsProviders_Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CFBundleDevelopmentRegion 5 | en 6 | CFBundleExecutable 7 | $(EXECUTABLE_NAME) 8 | CFBundleIdentifier 9 | $(PRODUCT_BUNDLE_IDENTIFIER) 10 | CFBundleInfoDictionaryVersion 11 | 6.0 12 | CFBundleName 13 | $(PRODUCT_NAME) 14 | CFBundlePackageType 15 | FMWK 16 | CFBundleShortVersionString 17 | 1.0 18 | CFBundleSignature 19 | ???? 20 | CFBundleVersion 21 | $(CURRENT_PROJECT_VERSION) 22 | NSPrincipalClass 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /SwiftRewriter.xcodeproj/GrammarModelBaseTests_Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CFBundleDevelopmentRegion 5 | en 6 | CFBundleExecutable 7 | $(EXECUTABLE_NAME) 8 | CFBundleIdentifier 9 | $(PRODUCT_BUNDLE_IDENTIFIER) 10 | CFBundleInfoDictionaryVersion 11 | 6.0 12 | CFBundleName 13 | $(PRODUCT_NAME) 14 | CFBundlePackageType 15 | BNDL 16 | CFBundleShortVersionString 17 | 1.0 18 | CFBundleSignature 19 | ???? 20 | CFBundleVersion 21 | $(CURRENT_PROJECT_VERSION) 22 | NSPrincipalClass 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /SwiftRewriter.xcodeproj/GrammarModelBase_Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CFBundleDevelopmentRegion 5 | en 6 | CFBundleExecutable 7 | $(EXECUTABLE_NAME) 8 | CFBundleIdentifier 9 | $(PRODUCT_BUNDLE_IDENTIFIER) 10 | CFBundleInfoDictionaryVersion 11 | 6.0 12 | CFBundleName 13 | $(PRODUCT_NAME) 14 | CFBundlePackageType 15 | FMWK 16 | CFBundleShortVersionString 17 | 1.0 18 | CFBundleSignature 19 | ???? 20 | CFBundleVersion 21 | $(CURRENT_PROJECT_VERSION) 22 | NSPrincipalClass 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /SwiftRewriter.xcodeproj/GrammarModelsTests_Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CFBundleDevelopmentRegion 5 | en 6 | CFBundleExecutable 7 | $(EXECUTABLE_NAME) 8 | CFBundleIdentifier 9 | $(PRODUCT_BUNDLE_IDENTIFIER) 10 | CFBundleInfoDictionaryVersion 11 | 6.0 12 | CFBundleName 13 | $(PRODUCT_NAME) 14 | CFBundlePackageType 15 | BNDL 16 | CFBundleShortVersionString 17 | 1.0 18 | CFBundleSignature 19 | ???? 20 | CFBundleVersion 21 | $(CURRENT_PROJECT_VERSION) 22 | NSPrincipalClass 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /SwiftRewriter.xcodeproj/GrammarModels_Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CFBundleDevelopmentRegion 5 | en 6 | CFBundleExecutable 7 | $(EXECUTABLE_NAME) 8 | CFBundleIdentifier 9 | $(PRODUCT_BUNDLE_IDENTIFIER) 10 | CFBundleInfoDictionaryVersion 11 | 6.0 12 | CFBundleName 13 | $(PRODUCT_NAME) 14 | CFBundlePackageType 15 | FMWK 16 | CFBundleShortVersionString 17 | 1.0 18 | CFBundleSignature 19 | ???? 20 | CFBundleVersion 21 | $(CURRENT_PROJECT_VERSION) 22 | NSPrincipalClass 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /SwiftRewriter.xcodeproj/GraphvizLibTests_Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CFBundleDevelopmentRegion 5 | en 6 | CFBundleExecutable 7 | $(EXECUTABLE_NAME) 8 | CFBundleIdentifier 9 | $(PRODUCT_BUNDLE_IDENTIFIER) 10 | CFBundleInfoDictionaryVersion 11 | 6.0 12 | CFBundleName 13 | $(PRODUCT_NAME) 14 | CFBundlePackageType 15 | BNDL 16 | CFBundleShortVersionString 17 | 1.0 18 | CFBundleSignature 19 | ???? 20 | CFBundleVersion 21 | $(CURRENT_PROJECT_VERSION) 22 | NSPrincipalClass 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /SwiftRewriter.xcodeproj/GraphvizLib_Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CFBundleDevelopmentRegion 5 | en 6 | CFBundleExecutable 7 | $(EXECUTABLE_NAME) 8 | CFBundleIdentifier 9 | $(PRODUCT_BUNDLE_IDENTIFIER) 10 | CFBundleInfoDictionaryVersion 11 | 6.0 12 | CFBundleName 13 | $(PRODUCT_NAME) 14 | CFBundlePackageType 15 | FMWK 16 | CFBundleShortVersionString 17 | 1.0 18 | CFBundleSignature 19 | ???? 20 | CFBundleVersion 21 | $(CURRENT_PROJECT_VERSION) 22 | NSPrincipalClass 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /SwiftRewriter.xcodeproj/GraphvizTests_Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CFBundleDevelopmentRegion 5 | en 6 | CFBundleExecutable 7 | $(EXECUTABLE_NAME) 8 | CFBundleIdentifier 9 | $(PRODUCT_BUNDLE_IDENTIFIER) 10 | CFBundleInfoDictionaryVersion 11 | 6.0 12 | CFBundleName 13 | $(PRODUCT_NAME) 14 | CFBundlePackageType 15 | BNDL 16 | CFBundleShortVersionString 17 | 1.0 18 | CFBundleSignature 19 | ???? 20 | CFBundleVersion 21 | $(CURRENT_PROJECT_VERSION) 22 | NSPrincipalClass 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /SwiftRewriter.xcodeproj/Graphviz_Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CFBundleDevelopmentRegion 5 | en 6 | CFBundleExecutable 7 | $(EXECUTABLE_NAME) 8 | CFBundleIdentifier 9 | $(PRODUCT_BUNDLE_IDENTIFIER) 10 | CFBundleInfoDictionaryVersion 11 | 6.0 12 | CFBundleName 13 | $(PRODUCT_NAME) 14 | CFBundlePackageType 15 | FMWK 16 | CFBundleShortVersionString 17 | 1.0 18 | CFBundleSignature 19 | ???? 20 | CFBundleVersion 21 | $(CURRENT_PROJECT_VERSION) 22 | NSPrincipalClass 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /SwiftRewriter.xcodeproj/IntentionPassesTests_Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CFBundleDevelopmentRegion 5 | en 6 | CFBundleExecutable 7 | $(EXECUTABLE_NAME) 8 | CFBundleIdentifier 9 | $(PRODUCT_BUNDLE_IDENTIFIER) 10 | CFBundleInfoDictionaryVersion 11 | 6.0 12 | CFBundleName 13 | $(PRODUCT_NAME) 14 | CFBundlePackageType 15 | BNDL 16 | CFBundleShortVersionString 17 | 1.0 18 | CFBundleSignature 19 | ???? 20 | CFBundleVersion 21 | $(CURRENT_PROJECT_VERSION) 22 | NSPrincipalClass 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /SwiftRewriter.xcodeproj/IntentionPasses_Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CFBundleDevelopmentRegion 5 | en 6 | CFBundleExecutable 7 | $(EXECUTABLE_NAME) 8 | CFBundleIdentifier 9 | $(PRODUCT_BUNDLE_IDENTIFIER) 10 | CFBundleInfoDictionaryVersion 11 | 6.0 12 | CFBundleName 13 | $(PRODUCT_NAME) 14 | CFBundlePackageType 15 | FMWK 16 | CFBundleShortVersionString 17 | 1.0 18 | CFBundleSignature 19 | ???? 20 | CFBundleVersion 21 | $(CURRENT_PROJECT_VERSION) 22 | NSPrincipalClass 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /SwiftRewriter.xcodeproj/IntentionsTests_Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CFBundleDevelopmentRegion 5 | en 6 | CFBundleExecutable 7 | $(EXECUTABLE_NAME) 8 | CFBundleIdentifier 9 | $(PRODUCT_BUNDLE_IDENTIFIER) 10 | CFBundleInfoDictionaryVersion 11 | 6.0 12 | CFBundleName 13 | $(PRODUCT_NAME) 14 | CFBundlePackageType 15 | BNDL 16 | CFBundleShortVersionString 17 | 1.0 18 | CFBundleSignature 19 | ???? 20 | CFBundleVersion 21 | $(CURRENT_PROJECT_VERSION) 22 | NSPrincipalClass 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /SwiftRewriter.xcodeproj/Intentions_Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CFBundleDevelopmentRegion 5 | en 6 | CFBundleExecutable 7 | $(EXECUTABLE_NAME) 8 | CFBundleIdentifier 9 | $(PRODUCT_BUNDLE_IDENTIFIER) 10 | CFBundleInfoDictionaryVersion 11 | 6.0 12 | CFBundleName 13 | $(PRODUCT_NAME) 14 | CFBundlePackageType 15 | FMWK 16 | CFBundleShortVersionString 17 | 1.0 18 | CFBundleSignature 19 | ???? 20 | CFBundleVersion 21 | $(CURRENT_PROJECT_VERSION) 22 | NSPrincipalClass 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /SwiftRewriter.xcodeproj/JavaScriptFrontendTests_Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CFBundleDevelopmentRegion 5 | en 6 | CFBundleExecutable 7 | $(EXECUTABLE_NAME) 8 | CFBundleIdentifier 9 | $(PRODUCT_BUNDLE_IDENTIFIER) 10 | CFBundleInfoDictionaryVersion 11 | 6.0 12 | CFBundleName 13 | $(PRODUCT_NAME) 14 | CFBundlePackageType 15 | BNDL 16 | CFBundleShortVersionString 17 | 1.0 18 | CFBundleSignature 19 | ???? 20 | CFBundleVersion 21 | $(CURRENT_PROJECT_VERSION) 22 | NSPrincipalClass 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /SwiftRewriter.xcodeproj/JavaScriptFrontend_Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CFBundleDevelopmentRegion 5 | en 6 | CFBundleExecutable 7 | $(EXECUTABLE_NAME) 8 | CFBundleIdentifier 9 | $(PRODUCT_BUNDLE_IDENTIFIER) 10 | CFBundleInfoDictionaryVersion 11 | 6.0 12 | CFBundleName 13 | $(PRODUCT_NAME) 14 | CFBundlePackageType 15 | FMWK 16 | CFBundleShortVersionString 17 | 1.0 18 | CFBundleSignature 19 | ???? 20 | CFBundleVersion 21 | $(CURRENT_PROJECT_VERSION) 22 | NSPrincipalClass 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /SwiftRewriter.xcodeproj/JsGrammarModels_Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CFBundleDevelopmentRegion 5 | en 6 | CFBundleExecutable 7 | $(EXECUTABLE_NAME) 8 | CFBundleIdentifier 9 | $(PRODUCT_BUNDLE_IDENTIFIER) 10 | CFBundleInfoDictionaryVersion 11 | 6.0 12 | CFBundleName 13 | $(PRODUCT_NAME) 14 | CFBundlePackageType 15 | FMWK 16 | CFBundleShortVersionString 17 | 1.0 18 | CFBundleSignature 19 | ???? 20 | CFBundleVersion 21 | $(CURRENT_PROJECT_VERSION) 22 | NSPrincipalClass 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /SwiftRewriter.xcodeproj/JsParserAntlr_Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CFBundleDevelopmentRegion 5 | en 6 | CFBundleExecutable 7 | $(EXECUTABLE_NAME) 8 | CFBundleIdentifier 9 | $(PRODUCT_BUNDLE_IDENTIFIER) 10 | CFBundleInfoDictionaryVersion 11 | 6.0 12 | CFBundleName 13 | $(PRODUCT_NAME) 14 | CFBundlePackageType 15 | FMWK 16 | CFBundleShortVersionString 17 | 1.0 18 | CFBundleSignature 19 | ???? 20 | CFBundleVersion 21 | $(CURRENT_PROJECT_VERSION) 22 | NSPrincipalClass 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /SwiftRewriter.xcodeproj/JsParserTests_Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CFBundleDevelopmentRegion 5 | en 6 | CFBundleExecutable 7 | $(EXECUTABLE_NAME) 8 | CFBundleIdentifier 9 | $(PRODUCT_BUNDLE_IDENTIFIER) 10 | CFBundleInfoDictionaryVersion 11 | 6.0 12 | CFBundleName 13 | $(PRODUCT_NAME) 14 | CFBundlePackageType 15 | BNDL 16 | CFBundleShortVersionString 17 | 1.0 18 | CFBundleSignature 19 | ???? 20 | CFBundleVersion 21 | $(CURRENT_PROJECT_VERSION) 22 | NSPrincipalClass 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /SwiftRewriter.xcodeproj/JsParser_Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CFBundleDevelopmentRegion 5 | en 6 | CFBundleExecutable 7 | $(EXECUTABLE_NAME) 8 | CFBundleIdentifier 9 | $(PRODUCT_BUNDLE_IDENTIFIER) 10 | CFBundleInfoDictionaryVersion 11 | 6.0 12 | CFBundleName 13 | $(PRODUCT_NAME) 14 | CFBundlePackageType 15 | FMWK 16 | CFBundleShortVersionString 17 | 1.0 18 | CFBundleSignature 19 | ???? 20 | CFBundleVersion 21 | $(CURRENT_PROJECT_VERSION) 22 | NSPrincipalClass 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /SwiftRewriter.xcodeproj/KnownTypeTests_Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CFBundleDevelopmentRegion 5 | en 6 | CFBundleExecutable 7 | $(EXECUTABLE_NAME) 8 | CFBundleIdentifier 9 | $(PRODUCT_BUNDLE_IDENTIFIER) 10 | CFBundleInfoDictionaryVersion 11 | 6.0 12 | CFBundleName 13 | $(PRODUCT_NAME) 14 | CFBundlePackageType 15 | BNDL 16 | CFBundleShortVersionString 17 | 1.0 18 | CFBundleSignature 19 | ???? 20 | CFBundleVersion 21 | $(CURRENT_PROJECT_VERSION) 22 | NSPrincipalClass 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /SwiftRewriter.xcodeproj/KnownType_Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CFBundleDevelopmentRegion 5 | en 6 | CFBundleExecutable 7 | $(EXECUTABLE_NAME) 8 | CFBundleIdentifier 9 | $(PRODUCT_BUNDLE_IDENTIFIER) 10 | CFBundleInfoDictionaryVersion 11 | 6.0 12 | CFBundleName 13 | $(PRODUCT_NAME) 14 | CFBundlePackageType 15 | FMWK 16 | CFBundleShortVersionString 17 | 1.0 18 | CFBundleSignature 19 | ???? 20 | CFBundleVersion 21 | $(CURRENT_PROJECT_VERSION) 22 | NSPrincipalClass 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /SwiftRewriter.xcodeproj/MiniLexer_Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CFBundleDevelopmentRegion 5 | en 6 | CFBundleExecutable 7 | $(EXECUTABLE_NAME) 8 | CFBundleIdentifier 9 | $(PRODUCT_BUNDLE_IDENTIFIER) 10 | CFBundleInfoDictionaryVersion 11 | 6.0 12 | CFBundleName 13 | $(PRODUCT_NAME) 14 | CFBundlePackageType 15 | FMWK 16 | CFBundleShortVersionString 17 | 1.0 18 | CFBundleSignature 19 | ???? 20 | CFBundleVersion 21 | $(CURRENT_PROJECT_VERSION) 22 | NSPrincipalClass 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /SwiftRewriter.xcodeproj/ObjcGrammarModelsTests_Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CFBundleDevelopmentRegion 5 | en 6 | CFBundleExecutable 7 | $(EXECUTABLE_NAME) 8 | CFBundleIdentifier 9 | $(PRODUCT_BUNDLE_IDENTIFIER) 10 | CFBundleInfoDictionaryVersion 11 | 6.0 12 | CFBundleName 13 | $(PRODUCT_NAME) 14 | CFBundlePackageType 15 | BNDL 16 | CFBundleShortVersionString 17 | 1.0 18 | CFBundleSignature 19 | ???? 20 | CFBundleVersion 21 | $(CURRENT_PROJECT_VERSION) 22 | NSPrincipalClass 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /SwiftRewriter.xcodeproj/ObjcGrammarModels_Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CFBundleDevelopmentRegion 5 | en 6 | CFBundleExecutable 7 | $(EXECUTABLE_NAME) 8 | CFBundleIdentifier 9 | $(PRODUCT_BUNDLE_IDENTIFIER) 10 | CFBundleInfoDictionaryVersion 11 | 6.0 12 | CFBundleName 13 | $(PRODUCT_NAME) 14 | CFBundlePackageType 15 | FMWK 16 | CFBundleShortVersionString 17 | 1.0 18 | CFBundleSignature 19 | ???? 20 | CFBundleVersion 21 | $(CURRENT_PROJECT_VERSION) 22 | NSPrincipalClass 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /SwiftRewriter.xcodeproj/ObjcParserAntlr_Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CFBundleDevelopmentRegion 5 | en 6 | CFBundleExecutable 7 | $(EXECUTABLE_NAME) 8 | CFBundleIdentifier 9 | $(PRODUCT_BUNDLE_IDENTIFIER) 10 | CFBundleInfoDictionaryVersion 11 | 6.0 12 | CFBundleName 13 | $(PRODUCT_NAME) 14 | CFBundlePackageType 15 | FMWK 16 | CFBundleShortVersionString 17 | 1.0 18 | CFBundleSignature 19 | ???? 20 | CFBundleVersion 21 | $(CURRENT_PROJECT_VERSION) 22 | NSPrincipalClass 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /SwiftRewriter.xcodeproj/ObjcParserTests_Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CFBundleDevelopmentRegion 5 | en 6 | CFBundleExecutable 7 | $(EXECUTABLE_NAME) 8 | CFBundleIdentifier 9 | $(PRODUCT_BUNDLE_IDENTIFIER) 10 | CFBundleInfoDictionaryVersion 11 | 6.0 12 | CFBundleName 13 | $(PRODUCT_NAME) 14 | CFBundlePackageType 15 | BNDL 16 | CFBundleShortVersionString 17 | 1.0 18 | CFBundleSignature 19 | ???? 20 | CFBundleVersion 21 | $(CURRENT_PROJECT_VERSION) 22 | NSPrincipalClass 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /SwiftRewriter.xcodeproj/ObjcParser_Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CFBundleDevelopmentRegion 5 | en 6 | CFBundleExecutable 7 | $(EXECUTABLE_NAME) 8 | CFBundleIdentifier 9 | $(PRODUCT_BUNDLE_IDENTIFIER) 10 | CFBundleInfoDictionaryVersion 11 | 6.0 12 | CFBundleName 13 | $(PRODUCT_NAME) 14 | CFBundlePackageType 15 | FMWK 16 | CFBundleShortVersionString 17 | 1.0 18 | CFBundleSignature 19 | ???? 20 | CFBundleVersion 21 | $(CURRENT_PROJECT_VERSION) 22 | NSPrincipalClass 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /SwiftRewriter.xcodeproj/ObjectiveCFrontendTests_Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CFBundleDevelopmentRegion 5 | en 6 | CFBundleExecutable 7 | $(EXECUTABLE_NAME) 8 | CFBundleIdentifier 9 | $(PRODUCT_BUNDLE_IDENTIFIER) 10 | CFBundleInfoDictionaryVersion 11 | 6.0 12 | CFBundleName 13 | $(PRODUCT_NAME) 14 | CFBundlePackageType 15 | BNDL 16 | CFBundleShortVersionString 17 | 1.0 18 | CFBundleSignature 19 | ???? 20 | CFBundleVersion 21 | $(CURRENT_PROJECT_VERSION) 22 | NSPrincipalClass 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /SwiftRewriter.xcodeproj/ObjectiveCFrontend_Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CFBundleDevelopmentRegion 5 | en 6 | CFBundleExecutable 7 | $(EXECUTABLE_NAME) 8 | CFBundleIdentifier 9 | $(PRODUCT_BUNDLE_IDENTIFIER) 10 | CFBundleInfoDictionaryVersion 11 | 6.0 12 | CFBundleName 13 | $(PRODUCT_NAME) 14 | CFBundlePackageType 15 | FMWK 16 | CFBundleShortVersionString 17 | 1.0 18 | CFBundleSignature 19 | ???? 20 | CFBundleVersion 21 | $(CURRENT_PROJECT_VERSION) 22 | NSPrincipalClass 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /SwiftRewriter.xcodeproj/POSIX_Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CFBundleDevelopmentRegion 5 | en 6 | CFBundleExecutable 7 | $(EXECUTABLE_NAME) 8 | CFBundleIdentifier 9 | $(PRODUCT_BUNDLE_IDENTIFIER) 10 | CFBundleInfoDictionaryVersion 11 | 6.0 12 | CFBundleName 13 | $(PRODUCT_NAME) 14 | CFBundlePackageType 15 | FMWK 16 | CFBundleShortVersionString 17 | 1.0 18 | CFBundleSignature 19 | ???? 20 | CFBundleVersion 21 | $(CURRENT_PROJECT_VERSION) 22 | NSPrincipalClass 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /SwiftRewriter.xcodeproj/SPMLibc_Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CFBundleDevelopmentRegion 5 | en 6 | CFBundleExecutable 7 | $(EXECUTABLE_NAME) 8 | CFBundleIdentifier 9 | $(PRODUCT_BUNDLE_IDENTIFIER) 10 | CFBundleInfoDictionaryVersion 11 | 6.0 12 | CFBundleName 13 | $(PRODUCT_NAME) 14 | CFBundlePackageType 15 | FMWK 16 | CFBundleShortVersionString 17 | 1.0 18 | CFBundleSignature 19 | ???? 20 | CFBundleVersion 21 | $(CURRENT_PROJECT_VERSION) 22 | NSPrincipalClass 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /SwiftRewriter.xcodeproj/SPMUtility_Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CFBundleDevelopmentRegion 5 | en 6 | CFBundleExecutable 7 | $(EXECUTABLE_NAME) 8 | CFBundleIdentifier 9 | $(PRODUCT_BUNDLE_IDENTIFIER) 10 | CFBundleInfoDictionaryVersion 11 | 6.0 12 | CFBundleName 13 | $(PRODUCT_NAME) 14 | CFBundlePackageType 15 | FMWK 16 | CFBundleShortVersionString 17 | 1.0 18 | CFBundleSignature 19 | ???? 20 | CFBundleVersion 21 | $(CURRENT_PROJECT_VERSION) 22 | NSPrincipalClass 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /SwiftRewriter.xcodeproj/SWXMLHash_Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CFBundleDevelopmentRegion 5 | en 6 | CFBundleExecutable 7 | $(EXECUTABLE_NAME) 8 | CFBundleIdentifier 9 | $(PRODUCT_BUNDLE_IDENTIFIER) 10 | CFBundleInfoDictionaryVersion 11 | 6.0 12 | CFBundleName 13 | $(PRODUCT_NAME) 14 | CFBundlePackageType 15 | FMWK 16 | CFBundleShortVersionString 17 | 1.0 18 | CFBundleSignature 19 | ???? 20 | CFBundleVersion 21 | $(CURRENT_PROJECT_VERSION) 22 | NSPrincipalClass 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /SwiftRewriter.xcodeproj/SourceKit_Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CFBundleDevelopmentRegion 5 | en 6 | CFBundleExecutable 7 | $(EXECUTABLE_NAME) 8 | CFBundleIdentifier 9 | $(PRODUCT_BUNDLE_IDENTIFIER) 10 | CFBundleInfoDictionaryVersion 11 | 6.0 12 | CFBundleName 13 | $(PRODUCT_NAME) 14 | CFBundlePackageType 15 | FMWK 16 | CFBundleShortVersionString 17 | 1.0 18 | CFBundleSignature 19 | ???? 20 | CFBundleVersion 21 | $(CURRENT_PROJECT_VERSION) 22 | NSPrincipalClass 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /SwiftRewriter.xcodeproj/SourceKittenFramework_Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CFBundleDevelopmentRegion 5 | en 6 | CFBundleExecutable 7 | $(EXECUTABLE_NAME) 8 | CFBundleIdentifier 9 | $(PRODUCT_BUNDLE_IDENTIFIER) 10 | CFBundleInfoDictionaryVersion 11 | 6.0 12 | CFBundleName 13 | $(PRODUCT_NAME) 14 | CFBundlePackageType 15 | FMWK 16 | CFBundleShortVersionString 17 | 1.0 18 | CFBundleSignature 19 | ???? 20 | CFBundleVersion 21 | $(CURRENT_PROJECT_VERSION) 22 | NSPrincipalClass 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /SwiftRewriter.xcodeproj/SourcePreprocessorsTests_Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CFBundleDevelopmentRegion 5 | en 6 | CFBundleExecutable 7 | $(EXECUTABLE_NAME) 8 | CFBundleIdentifier 9 | $(PRODUCT_BUNDLE_IDENTIFIER) 10 | CFBundleInfoDictionaryVersion 11 | 6.0 12 | CFBundleName 13 | $(PRODUCT_NAME) 14 | CFBundlePackageType 15 | BNDL 16 | CFBundleShortVersionString 17 | 1.0 18 | CFBundleSignature 19 | ???? 20 | CFBundleVersion 21 | $(CURRENT_PROJECT_VERSION) 22 | NSPrincipalClass 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /SwiftRewriter.xcodeproj/SourcePreprocessors_Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CFBundleDevelopmentRegion 5 | en 6 | CFBundleExecutable 7 | $(EXECUTABLE_NAME) 8 | CFBundleIdentifier 9 | $(PRODUCT_BUNDLE_IDENTIFIER) 10 | CFBundleInfoDictionaryVersion 11 | 6.0 12 | CFBundleName 13 | $(PRODUCT_NAME) 14 | CFBundlePackageType 15 | FMWK 16 | CFBundleShortVersionString 17 | 1.0 18 | CFBundleSignature 19 | ???? 20 | CFBundleVersion 21 | $(CURRENT_PROJECT_VERSION) 22 | NSPrincipalClass 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /SwiftRewriter.xcodeproj/SwiftASTTests_Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CFBundleDevelopmentRegion 5 | en 6 | CFBundleExecutable 7 | $(EXECUTABLE_NAME) 8 | CFBundleIdentifier 9 | $(PRODUCT_BUNDLE_IDENTIFIER) 10 | CFBundleInfoDictionaryVersion 11 | 6.0 12 | CFBundleName 13 | $(PRODUCT_NAME) 14 | CFBundlePackageType 15 | BNDL 16 | CFBundleShortVersionString 17 | 1.0 18 | CFBundleSignature 19 | ???? 20 | CFBundleVersion 21 | $(CURRENT_PROJECT_VERSION) 22 | NSPrincipalClass 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /SwiftRewriter.xcodeproj/SwiftAST_Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CFBundleDevelopmentRegion 5 | en 6 | CFBundleExecutable 7 | $(EXECUTABLE_NAME) 8 | CFBundleIdentifier 9 | $(PRODUCT_BUNDLE_IDENTIFIER) 10 | CFBundleInfoDictionaryVersion 11 | 6.0 12 | CFBundleName 13 | $(PRODUCT_NAME) 14 | CFBundlePackageType 15 | FMWK 16 | CFBundleShortVersionString 17 | 1.0 18 | CFBundleSignature 19 | ???? 20 | CFBundleVersion 21 | $(CURRENT_PROJECT_VERSION) 22 | NSPrincipalClass 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /SwiftRewriter.xcodeproj/SwiftFormatConfiguration_Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CFBundleDevelopmentRegion 5 | en 6 | CFBundleExecutable 7 | $(EXECUTABLE_NAME) 8 | CFBundleIdentifier 9 | $(PRODUCT_BUNDLE_IDENTIFIER) 10 | CFBundleInfoDictionaryVersion 11 | 6.0 12 | CFBundleName 13 | $(PRODUCT_NAME) 14 | CFBundlePackageType 15 | FMWK 16 | CFBundleShortVersionString 17 | 1.0 18 | CFBundleSignature 19 | ???? 20 | CFBundleVersion 21 | $(CURRENT_PROJECT_VERSION) 22 | NSPrincipalClass 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /SwiftRewriter.xcodeproj/SwiftFormatCore_Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CFBundleDevelopmentRegion 5 | en 6 | CFBundleExecutable 7 | $(EXECUTABLE_NAME) 8 | CFBundleIdentifier 9 | $(PRODUCT_BUNDLE_IDENTIFIER) 10 | CFBundleInfoDictionaryVersion 11 | 6.0 12 | CFBundleName 13 | $(PRODUCT_NAME) 14 | CFBundlePackageType 15 | FMWK 16 | CFBundleShortVersionString 17 | 1.0 18 | CFBundleSignature 19 | ???? 20 | CFBundleVersion 21 | $(CURRENT_PROJECT_VERSION) 22 | NSPrincipalClass 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /SwiftRewriter.xcodeproj/SwiftFormatPrettyPrint_Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CFBundleDevelopmentRegion 5 | en 6 | CFBundleExecutable 7 | $(EXECUTABLE_NAME) 8 | CFBundleIdentifier 9 | $(PRODUCT_BUNDLE_IDENTIFIER) 10 | CFBundleInfoDictionaryVersion 11 | 6.0 12 | CFBundleName 13 | $(PRODUCT_NAME) 14 | CFBundlePackageType 15 | FMWK 16 | CFBundleShortVersionString 17 | 1.0 18 | CFBundleSignature 19 | ???? 20 | CFBundleVersion 21 | $(CURRENT_PROJECT_VERSION) 22 | NSPrincipalClass 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /SwiftRewriter.xcodeproj/SwiftFormatRules_Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CFBundleDevelopmentRegion 5 | en 6 | CFBundleExecutable 7 | $(EXECUTABLE_NAME) 8 | CFBundleIdentifier 9 | $(PRODUCT_BUNDLE_IDENTIFIER) 10 | CFBundleInfoDictionaryVersion 11 | 6.0 12 | CFBundleName 13 | $(PRODUCT_NAME) 14 | CFBundlePackageType 15 | FMWK 16 | CFBundleShortVersionString 17 | 1.0 18 | CFBundleSignature 19 | ???? 20 | CFBundleVersion 21 | $(CURRENT_PROJECT_VERSION) 22 | NSPrincipalClass 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /SwiftRewriter.xcodeproj/SwiftFormatWhitespaceLinter_Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CFBundleDevelopmentRegion 5 | en 6 | CFBundleExecutable 7 | $(EXECUTABLE_NAME) 8 | CFBundleIdentifier 9 | $(PRODUCT_BUNDLE_IDENTIFIER) 10 | CFBundleInfoDictionaryVersion 11 | 6.0 12 | CFBundleName 13 | $(PRODUCT_NAME) 14 | CFBundlePackageType 15 | FMWK 16 | CFBundleShortVersionString 17 | 1.0 18 | CFBundleSignature 19 | ???? 20 | CFBundleVersion 21 | $(CURRENT_PROJECT_VERSION) 22 | NSPrincipalClass 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /SwiftRewriter.xcodeproj/SwiftFormat_Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CFBundleDevelopmentRegion 5 | en 6 | CFBundleExecutable 7 | $(EXECUTABLE_NAME) 8 | CFBundleIdentifier 9 | $(PRODUCT_BUNDLE_IDENTIFIER) 10 | CFBundleInfoDictionaryVersion 11 | 6.0 12 | CFBundleName 13 | $(PRODUCT_NAME) 14 | CFBundlePackageType 15 | FMWK 16 | CFBundleShortVersionString 17 | 1.0 18 | CFBundleSignature 19 | ???? 20 | CFBundleVersion 21 | $(CURRENT_PROJECT_VERSION) 22 | NSPrincipalClass 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /SwiftRewriter.xcodeproj/SwiftRewriterCLI_Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CFBundleDevelopmentRegion 5 | en 6 | CFBundleExecutable 7 | $(EXECUTABLE_NAME) 8 | CFBundleIdentifier 9 | $(PRODUCT_BUNDLE_IDENTIFIER) 10 | CFBundleInfoDictionaryVersion 11 | 6.0 12 | CFBundleName 13 | $(PRODUCT_NAME) 14 | CFBundlePackageType 15 | FMWK 16 | CFBundleShortVersionString 17 | 1.0 18 | CFBundleSignature 19 | ???? 20 | CFBundleVersion 21 | $(CURRENT_PROJECT_VERSION) 22 | NSPrincipalClass 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /SwiftRewriter.xcodeproj/SwiftRewriterLibTests_Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CFBundleDevelopmentRegion 5 | en 6 | CFBundleExecutable 7 | $(EXECUTABLE_NAME) 8 | CFBundleIdentifier 9 | $(PRODUCT_BUNDLE_IDENTIFIER) 10 | CFBundleInfoDictionaryVersion 11 | 6.0 12 | CFBundleName 13 | $(PRODUCT_NAME) 14 | CFBundlePackageType 15 | BNDL 16 | CFBundleShortVersionString 17 | 1.0 18 | CFBundleSignature 19 | ???? 20 | CFBundleVersion 21 | $(CURRENT_PROJECT_VERSION) 22 | NSPrincipalClass 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /SwiftRewriter.xcodeproj/SwiftRewriterLib_Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CFBundleDevelopmentRegion 5 | en 6 | CFBundleExecutable 7 | $(EXECUTABLE_NAME) 8 | CFBundleIdentifier 9 | $(PRODUCT_BUNDLE_IDENTIFIER) 10 | CFBundleInfoDictionaryVersion 11 | 6.0 12 | CFBundleName 13 | $(PRODUCT_NAME) 14 | CFBundlePackageType 15 | FMWK 16 | CFBundleShortVersionString 17 | 1.0 18 | CFBundleSignature 19 | ???? 20 | CFBundleVersion 21 | $(CURRENT_PROJECT_VERSION) 22 | NSPrincipalClass 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /SwiftRewriter.xcodeproj/SwiftRewriterTests_Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CFBundleDevelopmentRegion 5 | en 6 | CFBundleExecutable 7 | $(EXECUTABLE_NAME) 8 | CFBundleIdentifier 9 | $(PRODUCT_BUNDLE_IDENTIFIER) 10 | CFBundleInfoDictionaryVersion 11 | 6.0 12 | CFBundleName 13 | $(PRODUCT_NAME) 14 | CFBundlePackageType 15 | BNDL 16 | CFBundleShortVersionString 17 | 1.0 18 | CFBundleSignature 19 | ???? 20 | CFBundleVersion 21 | $(CURRENT_PROJECT_VERSION) 22 | NSPrincipalClass 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /SwiftRewriter.xcodeproj/SwiftSyntaxParser_Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CFBundleDevelopmentRegion 5 | en 6 | CFBundleExecutable 7 | $(EXECUTABLE_NAME) 8 | CFBundleIdentifier 9 | $(PRODUCT_BUNDLE_IDENTIFIER) 10 | CFBundleInfoDictionaryVersion 11 | 6.0 12 | CFBundleName 13 | $(PRODUCT_NAME) 14 | CFBundlePackageType 15 | FMWK 16 | CFBundleShortVersionString 17 | 1.0 18 | CFBundleSignature 19 | ???? 20 | CFBundleVersion 21 | $(CURRENT_PROJECT_VERSION) 22 | NSPrincipalClass 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /SwiftRewriter.xcodeproj/SwiftSyntaxRewriterPassesTests_Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CFBundleDevelopmentRegion 5 | en 6 | CFBundleExecutable 7 | $(EXECUTABLE_NAME) 8 | CFBundleIdentifier 9 | $(PRODUCT_BUNDLE_IDENTIFIER) 10 | CFBundleInfoDictionaryVersion 11 | 6.0 12 | CFBundleName 13 | $(PRODUCT_NAME) 14 | CFBundlePackageType 15 | BNDL 16 | CFBundleShortVersionString 17 | 1.0 18 | CFBundleSignature 19 | ???? 20 | CFBundleVersion 21 | $(CURRENT_PROJECT_VERSION) 22 | NSPrincipalClass 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /SwiftRewriter.xcodeproj/SwiftSyntaxRewriterPasses_Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CFBundleDevelopmentRegion 5 | en 6 | CFBundleExecutable 7 | $(EXECUTABLE_NAME) 8 | CFBundleIdentifier 9 | $(PRODUCT_BUNDLE_IDENTIFIER) 10 | CFBundleInfoDictionaryVersion 11 | 6.0 12 | CFBundleName 13 | $(PRODUCT_NAME) 14 | CFBundlePackageType 15 | FMWK 16 | CFBundleShortVersionString 17 | 1.0 18 | CFBundleSignature 19 | ???? 20 | CFBundleVersion 21 | $(CURRENT_PROJECT_VERSION) 22 | NSPrincipalClass 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /SwiftRewriter.xcodeproj/SwiftSyntaxSupportTests_Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CFBundleDevelopmentRegion 5 | en 6 | CFBundleExecutable 7 | $(EXECUTABLE_NAME) 8 | CFBundleIdentifier 9 | $(PRODUCT_BUNDLE_IDENTIFIER) 10 | CFBundleInfoDictionaryVersion 11 | 6.0 12 | CFBundleName 13 | $(PRODUCT_NAME) 14 | CFBundlePackageType 15 | BNDL 16 | CFBundleShortVersionString 17 | 1.0 18 | CFBundleSignature 19 | ???? 20 | CFBundleVersion 21 | $(CURRENT_PROJECT_VERSION) 22 | NSPrincipalClass 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /SwiftRewriter.xcodeproj/SwiftSyntaxSupport_Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CFBundleDevelopmentRegion 5 | en 6 | CFBundleExecutable 7 | $(EXECUTABLE_NAME) 8 | CFBundleIdentifier 9 | $(PRODUCT_BUNDLE_IDENTIFIER) 10 | CFBundleInfoDictionaryVersion 11 | 6.0 12 | CFBundleName 13 | $(PRODUCT_NAME) 14 | CFBundlePackageType 15 | FMWK 16 | CFBundleShortVersionString 17 | 1.0 18 | CFBundleSignature 19 | ???? 20 | CFBundleVersion 21 | $(CURRENT_PROJECT_VERSION) 22 | NSPrincipalClass 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /SwiftRewriter.xcodeproj/SwiftSyntax_Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CFBundleDevelopmentRegion 5 | en 6 | CFBundleExecutable 7 | $(EXECUTABLE_NAME) 8 | CFBundleIdentifier 9 | $(PRODUCT_BUNDLE_IDENTIFIER) 10 | CFBundleInfoDictionaryVersion 11 | 6.0 12 | CFBundleName 13 | $(PRODUCT_NAME) 14 | CFBundlePackageType 15 | FMWK 16 | CFBundleShortVersionString 17 | 1.0 18 | CFBundleSignature 19 | ???? 20 | CFBundleVersion 21 | $(CURRENT_PROJECT_VERSION) 22 | NSPrincipalClass 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /SwiftRewriter.xcodeproj/TestCommonsTests_Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CFBundleDevelopmentRegion 5 | en 6 | CFBundleExecutable 7 | $(EXECUTABLE_NAME) 8 | CFBundleIdentifier 9 | $(PRODUCT_BUNDLE_IDENTIFIER) 10 | CFBundleInfoDictionaryVersion 11 | 6.0 12 | CFBundleName 13 | $(PRODUCT_NAME) 14 | CFBundlePackageType 15 | BNDL 16 | CFBundleShortVersionString 17 | 1.0 18 | CFBundleSignature 19 | ???? 20 | CFBundleVersion 21 | $(CURRENT_PROJECT_VERSION) 22 | NSPrincipalClass 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /SwiftRewriter.xcodeproj/TestCommons_Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CFBundleDevelopmentRegion 5 | en 6 | CFBundleExecutable 7 | $(EXECUTABLE_NAME) 8 | CFBundleIdentifier 9 | $(PRODUCT_BUNDLE_IDENTIFIER) 10 | CFBundleInfoDictionaryVersion 11 | 6.0 12 | CFBundleName 13 | $(PRODUCT_NAME) 14 | CFBundlePackageType 15 | FMWK 16 | CFBundleShortVersionString 17 | 1.0 18 | CFBundleSignature 19 | ???? 20 | CFBundleVersion 21 | $(CURRENT_PROJECT_VERSION) 22 | NSPrincipalClass 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /SwiftRewriter.xcodeproj/TypeDefinitions_Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CFBundleDevelopmentRegion 5 | en 6 | CFBundleExecutable 7 | $(EXECUTABLE_NAME) 8 | CFBundleIdentifier 9 | $(PRODUCT_BUNDLE_IDENTIFIER) 10 | CFBundleInfoDictionaryVersion 11 | 6.0 12 | CFBundleName 13 | $(PRODUCT_NAME) 14 | CFBundlePackageType 15 | FMWK 16 | CFBundleShortVersionString 17 | 1.0 18 | CFBundleSignature 19 | ???? 20 | CFBundleVersion 21 | $(CURRENT_PROJECT_VERSION) 22 | NSPrincipalClass 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /SwiftRewriter.xcodeproj/TypeLexing_Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CFBundleDevelopmentRegion 5 | en 6 | CFBundleExecutable 7 | $(EXECUTABLE_NAME) 8 | CFBundleIdentifier 9 | $(PRODUCT_BUNDLE_IDENTIFIER) 10 | CFBundleInfoDictionaryVersion 11 | 6.0 12 | CFBundleName 13 | $(PRODUCT_NAME) 14 | CFBundlePackageType 15 | FMWK 16 | CFBundleShortVersionString 17 | 1.0 18 | CFBundleSignature 19 | ???? 20 | CFBundleVersion 21 | $(CURRENT_PROJECT_VERSION) 22 | NSPrincipalClass 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /SwiftRewriter.xcodeproj/TypeSystemTests_Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CFBundleDevelopmentRegion 5 | en 6 | CFBundleExecutable 7 | $(EXECUTABLE_NAME) 8 | CFBundleIdentifier 9 | $(PRODUCT_BUNDLE_IDENTIFIER) 10 | CFBundleInfoDictionaryVersion 11 | 6.0 12 | CFBundleName 13 | $(PRODUCT_NAME) 14 | CFBundlePackageType 15 | BNDL 16 | CFBundleShortVersionString 17 | 1.0 18 | CFBundleSignature 19 | ???? 20 | CFBundleVersion 21 | $(CURRENT_PROJECT_VERSION) 22 | NSPrincipalClass 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /SwiftRewriter.xcodeproj/TypeSystem_Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CFBundleDevelopmentRegion 5 | en 6 | CFBundleExecutable 7 | $(EXECUTABLE_NAME) 8 | CFBundleIdentifier 9 | $(PRODUCT_BUNDLE_IDENTIFIER) 10 | CFBundleInfoDictionaryVersion 11 | 6.0 12 | CFBundleName 13 | $(PRODUCT_NAME) 14 | CFBundlePackageType 15 | FMWK 16 | CFBundleShortVersionString 17 | 1.0 18 | CFBundleSignature 19 | ???? 20 | CFBundleVersion 21 | $(CURRENT_PROJECT_VERSION) 22 | NSPrincipalClass 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /SwiftRewriter.xcodeproj/Utility_Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CFBundleDevelopmentRegion 5 | en 6 | CFBundleExecutable 7 | $(EXECUTABLE_NAME) 8 | CFBundleIdentifier 9 | $(PRODUCT_BUNDLE_IDENTIFIER) 10 | CFBundleInfoDictionaryVersion 11 | 6.0 12 | CFBundleName 13 | $(PRODUCT_NAME) 14 | CFBundlePackageType 15 | FMWK 16 | CFBundleShortVersionString 17 | 1.0 18 | CFBundleSignature 19 | ???? 20 | CFBundleVersion 21 | $(CURRENT_PROJECT_VERSION) 22 | NSPrincipalClass 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /SwiftRewriter.xcodeproj/UtilsTests_Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CFBundleDevelopmentRegion 5 | en 6 | CFBundleExecutable 7 | $(EXECUTABLE_NAME) 8 | CFBundleIdentifier 9 | $(PRODUCT_BUNDLE_IDENTIFIER) 10 | CFBundleInfoDictionaryVersion 11 | 6.0 12 | CFBundleName 13 | $(PRODUCT_NAME) 14 | CFBundlePackageType 15 | BNDL 16 | CFBundleShortVersionString 17 | 1.0 18 | CFBundleSignature 19 | ???? 20 | CFBundleVersion 21 | $(CURRENT_PROJECT_VERSION) 22 | NSPrincipalClass 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /SwiftRewriter.xcodeproj/Utils_Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CFBundleDevelopmentRegion 5 | en 6 | CFBundleExecutable 7 | $(EXECUTABLE_NAME) 8 | CFBundleIdentifier 9 | $(PRODUCT_BUNDLE_IDENTIFIER) 10 | CFBundleInfoDictionaryVersion 11 | 6.0 12 | CFBundleName 13 | $(PRODUCT_NAME) 14 | CFBundlePackageType 15 | FMWK 16 | CFBundleShortVersionString 17 | 1.0 18 | CFBundleSignature 19 | ???? 20 | CFBundleVersion 21 | $(CURRENT_PROJECT_VERSION) 22 | NSPrincipalClass 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /SwiftRewriter.xcodeproj/WriterTargetOutputTests_Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CFBundleDevelopmentRegion 5 | en 6 | CFBundleExecutable 7 | $(EXECUTABLE_NAME) 8 | CFBundleIdentifier 9 | $(PRODUCT_BUNDLE_IDENTIFIER) 10 | CFBundleInfoDictionaryVersion 11 | 6.0 12 | CFBundleName 13 | $(PRODUCT_NAME) 14 | CFBundlePackageType 15 | BNDL 16 | CFBundleShortVersionString 17 | 1.0 18 | CFBundleSignature 19 | ???? 20 | CFBundleVersion 21 | $(CURRENT_PROJECT_VERSION) 22 | NSPrincipalClass 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /SwiftRewriter.xcodeproj/WriterTargetOutput_Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CFBundleDevelopmentRegion 5 | en 6 | CFBundleExecutable 7 | $(EXECUTABLE_NAME) 8 | CFBundleIdentifier 9 | $(PRODUCT_BUNDLE_IDENTIFIER) 10 | CFBundleInfoDictionaryVersion 11 | 6.0 12 | CFBundleName 13 | $(PRODUCT_NAME) 14 | CFBundlePackageType 15 | FMWK 16 | CFBundleShortVersionString 17 | 1.0 18 | CFBundleSignature 19 | ???? 20 | CFBundleVersion 21 | $(CURRENT_PROJECT_VERSION) 22 | NSPrincipalClass 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /SwiftRewriter.xcodeproj/Yams_Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CFBundleDevelopmentRegion 5 | en 6 | CFBundleExecutable 7 | $(EXECUTABLE_NAME) 8 | CFBundleIdentifier 9 | $(PRODUCT_BUNDLE_IDENTIFIER) 10 | CFBundleInfoDictionaryVersion 11 | 6.0 12 | CFBundleName 13 | $(PRODUCT_NAME) 14 | CFBundlePackageType 15 | FMWK 16 | CFBundleShortVersionString 17 | 1.0 18 | CFBundleSignature 19 | ???? 20 | CFBundleVersion 21 | $(CURRENT_PROJECT_VERSION) 22 | NSPrincipalClass 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /SwiftRewriter.xcodeproj/_CSwiftSyntax_Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CFBundleDevelopmentRegion 5 | en 6 | CFBundleExecutable 7 | $(EXECUTABLE_NAME) 8 | CFBundleIdentifier 9 | $(PRODUCT_BUNDLE_IDENTIFIER) 10 | CFBundleInfoDictionaryVersion 11 | 6.0 12 | CFBundleName 13 | $(PRODUCT_NAME) 14 | CFBundlePackageType 15 | FMWK 16 | CFBundleShortVersionString 17 | 1.0 18 | CFBundleSignature 19 | ???? 20 | CFBundleVersion 21 | $(CURRENT_PROJECT_VERSION) 22 | NSPrincipalClass 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /SwiftRewriter.xcodeproj/clibc_Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CFBundleDevelopmentRegion 5 | en 6 | CFBundleExecutable 7 | $(EXECUTABLE_NAME) 8 | CFBundleIdentifier 9 | $(PRODUCT_BUNDLE_IDENTIFIER) 10 | CFBundleInfoDictionaryVersion 11 | 6.0 12 | CFBundleName 13 | $(PRODUCT_NAME) 14 | CFBundlePackageType 15 | FMWK 16 | CFBundleShortVersionString 17 | 1.0 18 | CFBundleSignature 19 | ???? 20 | CFBundleVersion 21 | $(CURRENT_PROJECT_VERSION) 22 | NSPrincipalClass 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /Tests/Core/AnalysisTests/CallGraph/CallGraphTests.swift: -------------------------------------------------------------------------------- 1 | import XCTest 2 | 3 | @testable import Analysis 4 | 5 | class CallGraphTests: XCTestCase { 6 | 7 | } 8 | -------------------------------------------------------------------------------- /Tests/Core/AnalysisTests/UsageAnalysis/BaseUsageAnalyzerTests.swift: -------------------------------------------------------------------------------- 1 | import Intentions 2 | import KnownType 3 | import SwiftAST 4 | import TestCommons 5 | import TypeSystem 6 | import XCTest 7 | 8 | @testable import Analysis 9 | 10 | class BaseUsageAnalyzerTests: XCTestCase { 11 | 12 | } 13 | -------------------------------------------------------------------------------- /Tests/Core/AnalysisTests/UsageAnalysis/UsageAnalysisTests.swift: -------------------------------------------------------------------------------- 1 | import Intentions 2 | import KnownType 3 | import SwiftAST 4 | import TestCommons 5 | import TypeSystem 6 | import XCTest 7 | 8 | @testable import Analysis 9 | 10 | class UsageAnalysisTests: XCTestCase { 11 | 12 | } 13 | -------------------------------------------------------------------------------- /Tests/Core/CommonsTests/UIGestureRecognizerCompoundTypeTests.swift: -------------------------------------------------------------------------------- 1 | import Commons 2 | import SwiftRewriterLib 3 | import Utils 4 | import XCTest 5 | 6 | class UIGestureRecognizerCompoundTypeTests: XCTestCase { 7 | 8 | func testUIGestureRecognizerDefinition() { 9 | let type = UIGestureRecognizerCompoundType.create() 10 | 11 | XCTAssert(type.nonCanonicalNames.isEmpty) 12 | XCTAssertEqual(type.transformations.count, 2) 13 | 14 | assertSignature( 15 | type: type, 16 | matches: """ 17 | class UIGestureRecognizer: NSObject { 18 | @_swiftrewriter(mapFrom: locationInView(_:)) 19 | func location(in view: UIView?) -> CGPoint 20 | 21 | @_swiftrewriter(mapFrom: requireGestureRecognizerToFail(_:)) 22 | func require(toFail otherGestureRecognizer: UIGestureRecognizer) 23 | } 24 | """ 25 | ) 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Tests/Core/ExpressionPassesTests/ExpressionPassTestCase.swift: -------------------------------------------------------------------------------- 1 | import TestCommons 2 | 3 | typealias ExpressionPassTestCase = TestCommons.ExpressionPassTestCase 4 | -------------------------------------------------------------------------------- /Tests/Core/IntentionPassesTests/ImportDirectiveIntentionPassTests.swift: -------------------------------------------------------------------------------- 1 | import SwiftRewriterLib 2 | import TestCommons 3 | import XCTest 4 | 5 | @testable import IntentionPasses 6 | 7 | class ImportDirectiveIntentionPassTests: XCTestCase { 8 | func testImportDirectiveIntentionPass() { 9 | let intentions = 10 | IntentionCollectionBuilder() 11 | .createFile(named: "file") { file in 12 | file.addHeaderComment("#import ") 13 | .addHeaderComment("#import ") 14 | .addHeaderComment("#import ") 15 | }.build() 16 | let sut = ImportDirectiveIntentionPass() 17 | 18 | sut.apply(on: intentions, context: makeContext(intentions: intentions)) 19 | 20 | Asserter(object: intentions).asserter(forTargetPathFile: "file") { file in 21 | file.assert(importDirectives: [ 22 | "UIKit", "Foundation", "Framework" 23 | ]) 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Tests/Core/IntentionPassesTests/TestUtils.swift: -------------------------------------------------------------------------------- 1 | import Intentions 2 | import SwiftRewriterLib 3 | import TypeSystem 4 | import XCTest 5 | 6 | @testable import IntentionPasses 7 | 8 | // Helper method for constructing intention pass contexts for tests 9 | func makeContext(intentions: IntentionCollection) -> IntentionPassContext { 10 | let system = IntentionCollectionTypeSystem(intentions: intentions) 11 | let invoker = DefaultTypeResolverInvoker( 12 | globals: ArrayDefinitionsSource(), 13 | typeSystem: system, 14 | numThreads: 8 15 | ) 16 | let typeMapper = DefaultTypeMapper(typeSystem: system) 17 | 18 | return IntentionPassContext( 19 | typeSystem: system, 20 | typeMapper: typeMapper, 21 | typeResolverInvoker: invoker, 22 | numThreads: 8 23 | ) 24 | } 25 | -------------------------------------------------------------------------------- /Tests/Core/IntentionsTests/Intentions/ClassExtensionGenerationIntentionTests.swift: -------------------------------------------------------------------------------- 1 | import XCTest 2 | 3 | @testable import Intentions 4 | 5 | class ClassExtensionGenerationIntentionTests: XCTestCase { 6 | typealias Sut = ClassExtensionGenerationIntention 7 | 8 | func testAccept() { 9 | class TestVisitor: TestIntentionVisitor { 10 | let exp: XCTestExpectation 11 | 12 | init(exp: XCTestExpectation) { 13 | self.exp = exp 14 | } 15 | 16 | override func visitClassExtension(_ intention: Sut) { 17 | exp.fulfill() 18 | } 19 | } 20 | let sut = Sut(typeName: "A") 21 | let exp = expectation(description: "visit") 22 | let visitor = TestVisitor(exp: exp) 23 | 24 | sut.accept(visitor) 25 | 26 | waitForExpectations(timeout: 0.0) 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Tests/Core/IntentionsTests/Intentions/ClassGenerationIntentionTests.swift: -------------------------------------------------------------------------------- 1 | import XCTest 2 | 3 | @testable import Intentions 4 | 5 | class ClassGenerationIntentionTests: XCTestCase { 6 | typealias Sut = ClassGenerationIntention 7 | 8 | func testAccept() { 9 | class TestVisitor: TestIntentionVisitor { 10 | let exp: XCTestExpectation 11 | 12 | init(exp: XCTestExpectation) { 13 | self.exp = exp 14 | } 15 | 16 | override func visitClass(_ intention: Sut) { 17 | exp.fulfill() 18 | } 19 | } 20 | let sut = Sut(typeName: "A") 21 | let exp = expectation(description: "visit") 22 | let visitor = TestVisitor(exp: exp) 23 | 24 | sut.accept(visitor) 25 | 26 | waitForExpectations(timeout: 0.0) 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Tests/Core/IntentionsTests/Intentions/DeinitGenerationIntentionTests.swift: -------------------------------------------------------------------------------- 1 | import XCTest 2 | 3 | @testable import Intentions 4 | 5 | class DeinitGenerationIntentionTests: XCTestCase { 6 | typealias Sut = DeinitGenerationIntention 7 | 8 | func testAccept() { 9 | class TestVisitor: TestIntentionVisitor { 10 | let exp: XCTestExpectation 11 | 12 | init(exp: XCTestExpectation) { 13 | self.exp = exp 14 | } 15 | 16 | override func visitDeinit(_ intention: Sut) { 17 | exp.fulfill() 18 | } 19 | } 20 | let sut = Sut() 21 | let exp = expectation(description: "visit") 22 | let visitor = TestVisitor(exp: exp) 23 | 24 | sut.accept(visitor) 25 | 26 | waitForExpectations(timeout: 0.0) 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Tests/Core/IntentionsTests/Intentions/EnumCaseGenerationIntentionTests.swift: -------------------------------------------------------------------------------- 1 | import XCTest 2 | 3 | @testable import Intentions 4 | 5 | class EnumCaseGenerationIntentionTests: XCTestCase { 6 | typealias Sut = EnumCaseGenerationIntention 7 | 8 | func testAccept() { 9 | class TestVisitor: TestIntentionVisitor { 10 | let exp: XCTestExpectation 11 | 12 | init(exp: XCTestExpectation) { 13 | self.exp = exp 14 | } 15 | 16 | override func visitEnumCase(_ intention: Sut) { 17 | exp.fulfill() 18 | } 19 | } 20 | let sut = Sut(name: "A", expression: nil) 21 | let exp = expectation(description: "visit") 22 | let visitor = TestVisitor(exp: exp) 23 | 24 | sut.accept(visitor) 25 | 26 | waitForExpectations(timeout: 0.0) 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Tests/Core/IntentionsTests/Intentions/EnumGenerationIntentionTests.swift: -------------------------------------------------------------------------------- 1 | import XCTest 2 | 3 | @testable import Intentions 4 | 5 | class EnumGenerationIntentionTests: XCTestCase { 6 | typealias Sut = EnumGenerationIntention 7 | 8 | func testAccept() { 9 | class TestVisitor: TestIntentionVisitor { 10 | let exp: XCTestExpectation 11 | 12 | init(exp: XCTestExpectation) { 13 | self.exp = exp 14 | } 15 | 16 | override func visitEnum(_ intention: Sut) { 17 | exp.fulfill() 18 | } 19 | } 20 | let sut = Sut(typeName: "A", rawValueType: .int) 21 | let exp = expectation(description: "visit") 22 | let visitor = TestVisitor(exp: exp) 23 | 24 | sut.accept(visitor) 25 | 26 | waitForExpectations(timeout: 0.0) 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Tests/Core/IntentionsTests/Intentions/FileGenerationIntentionTests.swift: -------------------------------------------------------------------------------- 1 | import XCTest 2 | 3 | @testable import Intentions 4 | 5 | class FileGenerationIntentionTests: XCTestCase { 6 | typealias Sut = FileGenerationIntention 7 | 8 | func testAccept() { 9 | class TestVisitor: TestIntentionVisitor { 10 | let exp: XCTestExpectation 11 | 12 | init(exp: XCTestExpectation) { 13 | self.exp = exp 14 | } 15 | 16 | override func visitFile(_ intention: Sut) { 17 | exp.fulfill() 18 | } 19 | } 20 | let sut = Sut(sourcePath: "A", targetPath: "A.swift") 21 | let exp = expectation(description: "visit") 22 | let visitor = TestVisitor(exp: exp) 23 | 24 | sut.accept(visitor) 25 | 26 | waitForExpectations(timeout: 0.0) 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Tests/Core/IntentionsTests/Intentions/FunctionBodyIntentionTests.swift: -------------------------------------------------------------------------------- 1 | import XCTest 2 | 3 | @testable import Intentions 4 | 5 | class FunctionBodyIntentionTests: XCTestCase { 6 | typealias Sut = FunctionBodyIntention 7 | 8 | func testAccept() { 9 | class TestVisitor: TestIntentionVisitor { 10 | let exp: XCTestExpectation 11 | 12 | init(exp: XCTestExpectation) { 13 | self.exp = exp 14 | } 15 | 16 | override func visitFunctionBody(_ intention: Sut) { 17 | exp.fulfill() 18 | } 19 | } 20 | let sut = Sut(body: []) 21 | let exp = expectation(description: "visit") 22 | let visitor = TestVisitor(exp: exp) 23 | 24 | sut.accept(visitor) 25 | 26 | waitForExpectations(timeout: 0.0) 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Tests/Core/IntentionsTests/Intentions/GlobalFunctionGenerationIntentionTests.swift: -------------------------------------------------------------------------------- 1 | import XCTest 2 | import SwiftAST 3 | 4 | @testable import Intentions 5 | 6 | class GlobalFunctionGenerationIntentionTests: XCTestCase { 7 | typealias Sut = GlobalFunctionGenerationIntention 8 | 9 | func testAccept() { 10 | class TestVisitor: TestIntentionVisitor { 11 | let exp: XCTestExpectation 12 | 13 | init(exp: XCTestExpectation) { 14 | self.exp = exp 15 | } 16 | 17 | override func visitGlobalFunction(_ intention: Sut) { 18 | exp.fulfill() 19 | } 20 | } 21 | let sut = Sut(signature: FunctionSignature(name: "a")) 22 | let exp = expectation(description: "visit") 23 | let visitor = TestVisitor(exp: exp) 24 | 25 | sut.accept(visitor) 26 | 27 | waitForExpectations(timeout: 0.0) 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Tests/Core/IntentionsTests/Intentions/GlobalVariableGenerationIntentionTests.swift: -------------------------------------------------------------------------------- 1 | import XCTest 2 | 3 | @testable import Intentions 4 | 5 | class GlobalVariableGenerationIntentionTests: XCTestCase { 6 | typealias Sut = GlobalVariableGenerationIntention 7 | 8 | func testAccept() { 9 | class TestVisitor: TestIntentionVisitor { 10 | let exp: XCTestExpectation 11 | 12 | init(exp: XCTestExpectation) { 13 | self.exp = exp 14 | } 15 | 16 | override func visitGlobalVariable(_ intention: Sut) { 17 | exp.fulfill() 18 | } 19 | } 20 | let sut = Sut(name: "a", type: .int) 21 | let exp = expectation(description: "visit") 22 | let visitor = TestVisitor(exp: exp) 23 | 24 | sut.accept(visitor) 25 | 26 | waitForExpectations(timeout: 0.0) 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Tests/Core/IntentionsTests/Intentions/GlobalVariableInitialValueIntentionTests.swift: -------------------------------------------------------------------------------- 1 | import XCTest 2 | 3 | @testable import Intentions 4 | 5 | class GlobalVariableInitialValueIntentionTests: XCTestCase { 6 | typealias Sut = GlobalVariableInitialValueIntention 7 | 8 | func testAccept() { 9 | class TestVisitor: TestIntentionVisitor { 10 | let exp: XCTestExpectation 11 | 12 | init(exp: XCTestExpectation) { 13 | self.exp = exp 14 | } 15 | 16 | override func visitGlobalVariableInitialValue(_ intention: Sut) { 17 | exp.fulfill() 18 | } 19 | } 20 | let sut = Sut(expression: .constant(0), source: nil) 21 | let exp = expectation(description: "visit") 22 | let visitor = TestVisitor(exp: exp) 23 | 24 | sut.accept(visitor) 25 | 26 | waitForExpectations(timeout: 0.0) 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Tests/Core/IntentionsTests/Intentions/InitGenerationIntentionTests.swift: -------------------------------------------------------------------------------- 1 | import XCTest 2 | 3 | @testable import Intentions 4 | 5 | class InitGenerationIntentionTests: XCTestCase { 6 | typealias Sut = InitGenerationIntention 7 | 8 | func testAccept() { 9 | class TestVisitor: TestIntentionVisitor { 10 | let exp: XCTestExpectation 11 | 12 | init(exp: XCTestExpectation) { 13 | self.exp = exp 14 | } 15 | 16 | override func visitInit(_ intention: Sut) { 17 | exp.fulfill() 18 | } 19 | } 20 | let sut = Sut(parameters: []) 21 | let exp = expectation(description: "visit") 22 | let visitor = TestVisitor(exp: exp) 23 | 24 | sut.accept(visitor) 25 | 26 | waitForExpectations(timeout: 0.0) 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Tests/Core/IntentionsTests/Intentions/InstanceVariableGenerationIntentionTests.swift: -------------------------------------------------------------------------------- 1 | import XCTest 2 | 3 | @testable import Intentions 4 | 5 | class InstanceVariableGenerationIntentionTests: XCTestCase { 6 | typealias Sut = InstanceVariableGenerationIntention 7 | 8 | func testAccept() { 9 | class TestVisitor: TestIntentionVisitor { 10 | let exp: XCTestExpectation 11 | 12 | init(exp: XCTestExpectation) { 13 | self.exp = exp 14 | } 15 | 16 | override func visitInstanceVariable(_ intention: Sut) { 17 | exp.fulfill() 18 | } 19 | } 20 | let sut = Sut(name: "a", storage: .constant(ofType: .int)) 21 | let exp = expectation(description: "visit") 22 | let visitor = TestVisitor(exp: exp) 23 | 24 | sut.accept(visitor) 25 | 26 | waitForExpectations(timeout: 0.0) 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Tests/Core/IntentionsTests/Intentions/MethodGenerationIntentionTests.swift: -------------------------------------------------------------------------------- 1 | import XCTest 2 | import SwiftAST 3 | 4 | @testable import Intentions 5 | 6 | class MethodGenerationIntentionTests: XCTestCase { 7 | typealias Sut = MethodGenerationIntention 8 | 9 | func testAccept() { 10 | class TestVisitor: TestIntentionVisitor { 11 | let exp: XCTestExpectation 12 | 13 | init(exp: XCTestExpectation) { 14 | self.exp = exp 15 | } 16 | 17 | override func visitMethod(_ intention: Sut) { 18 | exp.fulfill() 19 | } 20 | } 21 | let sut = Sut(signature: FunctionSignature(name: "a")) 22 | let exp = expectation(description: "visit") 23 | let visitor = TestVisitor(exp: exp) 24 | 25 | sut.accept(visitor) 26 | 27 | waitForExpectations(timeout: 0.0) 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Tests/Core/IntentionsTests/Intentions/PropertyGenerationIntentionTests.swift: -------------------------------------------------------------------------------- 1 | import XCTest 2 | 3 | @testable import Intentions 4 | 5 | class PropertyGenerationIntentionTests: XCTestCase { 6 | typealias Sut = PropertyGenerationIntention 7 | 8 | func testAccept() { 9 | class TestVisitor: TestIntentionVisitor { 10 | let exp: XCTestExpectation 11 | 12 | init(exp: XCTestExpectation) { 13 | self.exp = exp 14 | } 15 | 16 | override func visitProperty(_ intention: Sut) { 17 | exp.fulfill() 18 | } 19 | } 20 | let sut = Sut(name: "a", type: .int, objcAttributes: []) 21 | let exp = expectation(description: "visit") 22 | let visitor = TestVisitor(exp: exp) 23 | 24 | sut.accept(visitor) 25 | 26 | waitForExpectations(timeout: 0.0) 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Tests/Core/IntentionsTests/Intentions/PropertyInitialValueGenerationIntentionTests.swift: -------------------------------------------------------------------------------- 1 | import XCTest 2 | 3 | @testable import Intentions 4 | 5 | class PropertyInitialValueGenerationIntentionTests: XCTestCase { 6 | typealias Sut = PropertyInitialValueGenerationIntention 7 | 8 | func testAccept() { 9 | class TestVisitor: TestIntentionVisitor { 10 | let exp: XCTestExpectation 11 | 12 | init(exp: XCTestExpectation) { 13 | self.exp = exp 14 | } 15 | 16 | override func visitPropertyInitialValue(_ intention: Sut) { 17 | exp.fulfill() 18 | } 19 | } 20 | let sut = Sut(expression: .constant(0), source: nil) 21 | let exp = expectation(description: "visit") 22 | let visitor = TestVisitor(exp: exp) 23 | 24 | sut.accept(visitor) 25 | 26 | waitForExpectations(timeout: 0.0) 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Tests/Core/IntentionsTests/Intentions/PropertySynthesizationIntentionTests.swift: -------------------------------------------------------------------------------- 1 | import XCTest 2 | 3 | @testable import Intentions 4 | 5 | class PropertySynthesizationIntentionTests: XCTestCase { 6 | typealias Sut = PropertySynthesizationIntention 7 | 8 | func testAccept() { 9 | class TestVisitor: TestIntentionVisitor { 10 | let exp: XCTestExpectation 11 | 12 | init(exp: XCTestExpectation) { 13 | self.exp = exp 14 | } 15 | 16 | override func visitPropertySynthesization(_ intention: Sut) { 17 | exp.fulfill() 18 | } 19 | } 20 | let sut = Sut(propertyName: "a", ivarName: "a", isExplicit: true, type: .synthesize) 21 | let exp = expectation(description: "visit") 22 | let visitor = TestVisitor(exp: exp) 23 | 24 | sut.accept(visitor) 25 | 26 | waitForExpectations(timeout: 0.0) 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Tests/Core/IntentionsTests/Intentions/ProtocolGenerationIntentionTests.swift: -------------------------------------------------------------------------------- 1 | import XCTest 2 | 3 | @testable import Intentions 4 | 5 | class ProtocolGenerationIntentionTests: XCTestCase { 6 | typealias Sut = ProtocolGenerationIntention 7 | 8 | func testAccept() { 9 | class TestVisitor: TestIntentionVisitor { 10 | let exp: XCTestExpectation 11 | 12 | init(exp: XCTestExpectation) { 13 | self.exp = exp 14 | } 15 | 16 | override func visitProtocol(_ intention: Sut) { 17 | exp.fulfill() 18 | } 19 | } 20 | let sut = Sut(typeName: "A") 21 | let exp = expectation(description: "visit") 22 | let visitor = TestVisitor(exp: exp) 23 | 24 | sut.accept(visitor) 25 | 26 | waitForExpectations(timeout: 0.0) 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Tests/Core/IntentionsTests/Intentions/ProtocolInheritanceIntentionTests.swift: -------------------------------------------------------------------------------- 1 | import XCTest 2 | 3 | @testable import Intentions 4 | 5 | class ProtocolInheritanceIntentionTests: XCTestCase { 6 | typealias Sut = ProtocolInheritanceIntention 7 | 8 | func testAccept() { 9 | class TestVisitor: TestIntentionVisitor { 10 | let exp: XCTestExpectation 11 | 12 | init(exp: XCTestExpectation) { 13 | self.exp = exp 14 | } 15 | 16 | override func visitProtocolInheritance(_ intention: Sut) { 17 | exp.fulfill() 18 | } 19 | } 20 | let sut = Sut(protocolName: "A") 21 | let exp = expectation(description: "visit") 22 | let visitor = TestVisitor(exp: exp) 23 | 24 | sut.accept(visitor) 25 | 26 | waitForExpectations(timeout: 0.0) 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Tests/Core/IntentionsTests/Intentions/ProtocolMethodGenerationIntentionTests.swift: -------------------------------------------------------------------------------- 1 | import XCTest 2 | import SwiftAST 3 | 4 | @testable import Intentions 5 | 6 | class ProtocolMethodGenerationIntentionTests: XCTestCase { 7 | typealias Sut = ProtocolMethodGenerationIntention 8 | 9 | func testAccept() { 10 | class TestVisitor: TestIntentionVisitor { 11 | let exp: XCTestExpectation 12 | 13 | init(exp: XCTestExpectation) { 14 | self.exp = exp 15 | } 16 | 17 | override func visitProtocolMethod(_ intention: Sut) { 18 | exp.fulfill() 19 | } 20 | } 21 | let sut = Sut(signature: FunctionSignature(name: "a")) 22 | let exp = expectation(description: "visit") 23 | let visitor = TestVisitor(exp: exp) 24 | 25 | sut.accept(visitor) 26 | 27 | waitForExpectations(timeout: 0.0) 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Tests/Core/IntentionsTests/Intentions/ProtocolPropertyGenerationIntentionTests.swift: -------------------------------------------------------------------------------- 1 | import XCTest 2 | 3 | @testable import Intentions 4 | 5 | class ProtocolPropertyGenerationIntentionTests: XCTestCase { 6 | typealias Sut = ProtocolPropertyGenerationIntention 7 | 8 | func testAccept() { 9 | class TestVisitor: TestIntentionVisitor { 10 | let exp: XCTestExpectation 11 | 12 | init(exp: XCTestExpectation) { 13 | self.exp = exp 14 | } 15 | 16 | override func visitProtocolProperty(_ intention: Sut) { 17 | exp.fulfill() 18 | } 19 | } 20 | let sut = Sut(name: "a", storage: .constant(ofType: .int), objcAttributes: []) 21 | let exp = expectation(description: "visit") 22 | let visitor = TestVisitor(exp: exp) 23 | 24 | sut.accept(visitor) 25 | 26 | waitForExpectations(timeout: 0.0) 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Tests/Core/IntentionsTests/Intentions/StructGenerationIntentionTests.swift: -------------------------------------------------------------------------------- 1 | import XCTest 2 | 3 | @testable import Intentions 4 | 5 | class StructGenerationIntentionTests: XCTestCase { 6 | typealias Sut = StructGenerationIntention 7 | 8 | func testAccept() { 9 | class TestVisitor: TestIntentionVisitor { 10 | let exp: XCTestExpectation 11 | 12 | init(exp: XCTestExpectation) { 13 | self.exp = exp 14 | } 15 | 16 | override func visitStruct(_ intention: Sut) { 17 | exp.fulfill() 18 | } 19 | } 20 | let sut = Sut(typeName: "A") 21 | let exp = expectation(description: "visit") 22 | let visitor = TestVisitor(exp: exp) 23 | 24 | sut.accept(visitor) 25 | 26 | waitForExpectations(timeout: 0.0) 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Tests/Core/IntentionsTests/Intentions/SubscriptGenerationIntentionTests.swift: -------------------------------------------------------------------------------- 1 | import XCTest 2 | 3 | @testable import Intentions 4 | 5 | class SubscriptGenerationIntentionTests: XCTestCase { 6 | typealias Sut = SubscriptGenerationIntention 7 | 8 | func testAccept() { 9 | class TestVisitor: TestIntentionVisitor { 10 | let exp: XCTestExpectation 11 | 12 | init(exp: XCTestExpectation) { 13 | self.exp = exp 14 | } 15 | 16 | override func visitSubscript(_ intention: Sut) { 17 | exp.fulfill() 18 | } 19 | } 20 | let sut = Sut(parameters: [], returnType: .any, mode: .getter(.init(body: []))) 21 | let exp = expectation(description: "visit") 22 | let visitor = TestVisitor(exp: exp) 23 | 24 | sut.accept(visitor) 25 | 26 | waitForExpectations(timeout: 0.0) 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Tests/Core/IntentionsTests/Intentions/TypealiasIntentionTests.swift: -------------------------------------------------------------------------------- 1 | import XCTest 2 | 3 | @testable import Intentions 4 | 5 | class TypealiasIntentionTests: XCTestCase { 6 | typealias Sut = TypealiasIntention 7 | 8 | func testAccept() { 9 | class TestVisitor: TestIntentionVisitor { 10 | let exp: XCTestExpectation 11 | 12 | init(exp: XCTestExpectation) { 13 | self.exp = exp 14 | } 15 | 16 | override func visitTypealias(_ intention: Sut) { 17 | exp.fulfill() 18 | } 19 | } 20 | let sut = Sut(fromType: .any, named: "A") 21 | let exp = expectation(description: "visit") 22 | let visitor = TestVisitor(exp: exp) 23 | 24 | sut.accept(visitor) 25 | 26 | waitForExpectations(timeout: 0.0) 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Tests/Core/SwiftSyntaxRewriterPassesTests/BaseSyntaxRewriterPassTest.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | import SwiftSyntax 3 | import SwiftParser 4 | import SwiftSyntaxSupport 5 | import TestCommons 6 | import XCTest 7 | 8 | class BaseSyntaxRewriterPassTest: XCTestCase { 9 | var sut: SwiftSyntaxRewriterPass! 10 | 11 | func assertRewrite( 12 | input: String, 13 | expected: String, 14 | file: StaticString = #filePath, 15 | line: UInt = #line 16 | ) { 17 | do { 18 | let transformed = sut.rewrite(try createSyntax(input)) 19 | 20 | diffTest(expected: expected, highlightLineInEditor: false, file: file, line: line) 21 | .diff(transformed.description, file: file, line: line) 22 | 23 | } 24 | catch { 25 | XCTFail( 26 | "Error creating test file: \(error)", 27 | file: file, 28 | line: line 29 | ) 30 | } 31 | } 32 | 33 | func createSyntax(_ content: String) throws -> SourceFileSyntax { 34 | Parser.parse(source: content) 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Tests/Core/SwiftSyntaxRewriterPassesTests/DefaultSyntaxPassProviderTests.swift: -------------------------------------------------------------------------------- 1 | import SwiftSyntaxRewriterPasses 2 | import XCTest 3 | 4 | class DefaultSyntaxPassProviderTests: XCTestCase { 5 | 6 | func testDefaultSyntaxPasses() { 7 | let passes = DefaultSyntaxPassProvider().passes 8 | 9 | // Using iterator so we can test ordering without indexing into array 10 | // (could crash and abort tests halfway through) 11 | var passesIterator = passes.makeIterator() 12 | 13 | XCTAssert(passesIterator.next() is StatementSpacingSyntaxPass) 14 | XCTAssertNil(passesIterator.next()) 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Tests/Core/TypeSystemTests/CodeDefinition/CodeDefinitionTests.swift: -------------------------------------------------------------------------------- 1 | import XCTest 2 | import SwiftAST 3 | import TypeSystem 4 | 5 | @testable import TypeSystem 6 | 7 | class CodeDefinitionTests: XCTestCase { 8 | func testVariadicFunctionParameterDefinition() { 9 | let signature = FunctionSignature( 10 | name: "a", 11 | parameters: [ 12 | .init(name: "b", type: .int, isVariadic: true), 13 | ] 14 | ) 15 | 16 | let result = CodeDefinition.forParameters(inSignature: signature) 17 | 18 | XCTAssertEqual(result, [ 19 | .forLocalIdentifier( 20 | "b", 21 | type: .array(.int), 22 | isConstant: true, 23 | location: .parameter(index: 0) 24 | ) 25 | ]) 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Tests/Frontend/Objective-C/GlobalsProvidersTests/DefaultGlobalsProvidersSourceTests.swift: -------------------------------------------------------------------------------- 1 | import GlobalsProviders 2 | import XCTest 3 | 4 | class DefaultGlobalsProvidersSourceTests: XCTestCase { 5 | 6 | func testDefaultProviders() { 7 | let sut = DefaultGlobalsProvidersSource() 8 | var providers = sut.globalsProviders.makeIterator() 9 | 10 | XCTAssert(providers.next() is CLibGlobalsProviders) 11 | XCTAssert(providers.next() is UIKitGlobalsProvider) 12 | XCTAssert(providers.next() is OpenGLESGlobalsProvider) 13 | XCTAssert(providers.next() is CompoundedMappingTypesGlobalsProvider) 14 | XCTAssertNil(providers.next()) 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Tests/Frontend/Objective-C/GlobalsProvidersTests/OpenGLESGlobalsProviderTests.swift: -------------------------------------------------------------------------------- 1 | import GlobalsProviders 2 | import XCTest 3 | 4 | class OpenGLESGlobalsProviderTests: BaseGlobalsProviderTestCase { 5 | 6 | override func setUp() { 7 | super.setUp() 8 | 9 | sut = OpenGLESGlobalsProvider() 10 | 11 | globals = sut.definitionsSource() 12 | types = sut.knownTypeProvider() 13 | typealiases = sut.typealiasProvider() 14 | } 15 | 16 | func testDefinedTypealiases() { 17 | assertDefined(typealiasFrom: "GLenum", to: "UInt32") 18 | } 19 | 20 | func testDefinedVars() { 21 | assertDefined(variable: "GL_ES_VERSION_3_0", type: .typeName("Int32")) 22 | } 23 | 24 | func testDefinedFunctions() { 25 | assertDefined( 26 | function: "glAttachShader", 27 | paramTypes: [.typeName("GLuint"), .typeName("GLuint")], 28 | returnType: .void 29 | ) 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Tests/Frontend/Objective-C/ObjcGrammarModelsTests/ObjcGrammarModelsTests.swift: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Tests/Frontend/Objective-C/ObjcParserTests/TestFixture/AntlrErrorListener.swift: -------------------------------------------------------------------------------- 1 | import Antlr4 2 | 3 | class ErrorListener: BaseErrorListener { 4 | var errors: [String] = [] 5 | 6 | var errorDescription: String { 7 | return errors.joined(separator: "\n") 8 | } 9 | 10 | var hasErrors: Bool { 11 | return !errors.isEmpty 12 | } 13 | 14 | override func syntaxError( 15 | _ recognizer: Recognizer, 16 | _ offendingSymbol: AnyObject?, 17 | _ line: Int, 18 | _ charPositionInLine: Int, 19 | _ msg: String, 20 | _ e: AnyObject? 21 | ) where T : ATNSimulator { 22 | 23 | errors.append(msg) 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Tests/Frontend/Objective-C/ObjectiveCFrontendTests/TestUtils.swift: -------------------------------------------------------------------------------- 1 | import Intentions 2 | import SwiftRewriterLib 3 | import TypeSystem 4 | import IntentionPasses 5 | import XCTest 6 | 7 | // Helper method for constructing intention pass contexts for tests 8 | func makeContext(intentions: IntentionCollection) -> IntentionPassContext { 9 | let system = IntentionCollectionTypeSystem(intentions: intentions) 10 | let invoker = DefaultTypeResolverInvoker( 11 | globals: ArrayDefinitionsSource(), 12 | typeSystem: system, 13 | numThreads: 8 14 | ) 15 | let typeMapper = DefaultTypeMapper(typeSystem: system) 16 | 17 | return IntentionPassContext( 18 | typeSystem: system, 19 | typeMapper: typeMapper, 20 | typeResolverInvoker: invoker, 21 | numThreads: 8 22 | ) 23 | } 24 | -------------------------------------------------------------------------------- /codecov.yml: -------------------------------------------------------------------------------- 1 | ignore: 2 | - "Sources/Frontend/Objective-C/ObjcParserAntlr" 3 | -------------------------------------------------------------------------------- /copy-libswiftsyntax.sh: -------------------------------------------------------------------------------- 1 | DYLIB_PATH="$(xcode-select -p)/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/lib_InternalSwiftSyntaxParser.dylib" 2 | 3 | echo "Copying SwiftSyntax's dylib from path \"$DYLIB_PATH\"..." 4 | 5 | for path in ~/Library/Developer/Xcode/DerivedData/*/Build/Products/Debug/; do 6 | cp $DYLIB_PATH $path 7 | echo "Copied file to $path" 8 | done 9 | -------------------------------------------------------------------------------- /gen-_cswiftsyntax-module-map.sh: -------------------------------------------------------------------------------- 1 | ROOT=$(pwd) 2 | MMAP_FOLDER="SwiftRewriter.xcodeproj/GeneratedModuleMap/_CSwiftSyntax" 3 | MMAP="$MMAP_FOLDER/module.modulemap" 4 | 5 | if [[ -e "$MMAP" ]]; then 6 | rm "$MMAP" 7 | fi 8 | if [[ ! -e "$MMAP_FOLDER" ]]; then 9 | mkdir -p "$MMAP_FOLDER" 10 | fi 11 | 12 | touch "$MMAP" 13 | 14 | echo "module _CSwiftSyntax {" >> "$MMAP" 15 | echo " umbrella \"$ROOT/.build/checkouts/swift-syntax/Sources/_CSwiftSyntax/include\"" >> "$MMAP" 16 | echo " export *" >> "$MMAP" 17 | echo "}" >> "$MMAP" 18 | -------------------------------------------------------------------------------- /utils/mypy.ini: -------------------------------------------------------------------------------- 1 | [mypy] 2 | namespace_packages = True 3 | ignore_missing_imports_per_module = True 4 | ignore_missing_imports = True 5 | -------------------------------------------------------------------------------- /utils/paths.py: -------------------------------------------------------------------------------- 1 | from os import PathLike 2 | from pathlib import Path 3 | 4 | SOURCE_ROOT_PATH = Path(__file__).parents[1] 5 | SCRIPTS_ROOT_PATH = Path(__file__).parents[0] 6 | GRAMMARS_ROOT_PATH = Path(__file__).parents[1].joinpath("AntlrGrammars") 7 | GRAMMAR_TRANSFORMER_ROOT_PATH = GRAMMARS_ROOT_PATH.joinpath("GrammarTransformer") 8 | 9 | 10 | def path(root: Path | str, *args: str | PathLike[str]) -> Path: 11 | return Path(root).joinpath(*args) 12 | 13 | 14 | def srcroot_path(*args: str | PathLike[str]) -> Path: 15 | return path(SOURCE_ROOT_PATH, *args) 16 | 17 | 18 | def scripts_path(*args: str | PathLike[str]) -> Path: 19 | return path(SCRIPTS_ROOT_PATH, *args) 20 | 21 | 22 | def grammars_path(*args: str | PathLike[str]) -> Path: 23 | return path(GRAMMARS_ROOT_PATH, *args) 24 | 25 | 26 | def grammar_transformer_package_path(*args: str | PathLike[str]) -> Path: 27 | return path(GRAMMAR_TRANSFORMER_ROOT_PATH, *args) 28 | 29 | 30 | def make_relative( 31 | base_path: str | PathLike[str], other_path: str | PathLike[str] 32 | ) -> Path: 33 | return Path(other_path).relative_to(base_path) 34 | --------------------------------------------------------------------------------