<commit_before>﻿using Microsoft.CodeAnalysis.CSharp.Syntax;

namespace SharpSwift.Converters
{
    partial class ConvertToSwift
    {
        /// <summary>
        /// Returns the Swift equivilant for a C# type
        /// </summary>
        /// <param name="typeName">The C# type's identifier as a string</param>
        /// <returns>The Swift equivilant type as a string</returns>
        private static string Type(string typeName, bool implyUnwrapped = true)
        {
            switch (typeName)
            {
                case "string":
                    return "String";
                case "char":
                    return "Character";
                case "int":
                    return "Int";
                case "void":
                    return "Void";
                case "bool":
                    return "Bool";
            }
            return typeName + (implyUnwrapped ? "!" : "");
        }

        [ParsesType(typeof (ArrayTypeSyntax))]
        public static string ArrayType(ArrayTypeSyntax node)
        {
            return "[" + SyntaxNode(node.ElementType) + "]"; //TODO: rankspecifiers
        }

        [ParsesType(typeof (PredefinedTypeSyntax))]
        public static string PredefinedType(PredefinedTypeSyntax node)
        {
            return Type(node.Keyword.Text);
        }
    }
}<commit_msg>commented up TypeParser<commit_after>﻿using Microsoft.CodeAnalysis.CSharp.Syntax;

namespace SharpSwift.Converters
{
    partial class ConvertToSwift
    {
        /// <summary>
        /// Returns the Swift equivilant for a C# type
        /// </summary>
        /// <param name="typeName">The C# type's identifier as a string</param>
        /// <param name="implyUnwrapped">If true, unwraps the type with an ! at the end</param>
        /// <returns>The Swift equivilant type as a string</returns>
        private static string Type(string typeName, bool implyUnwrapped = true)
        {
            switch (typeName)
            {
                case "string":
                    return "String";
                case "char":
                    return "Character";
                case "int":
                    return "Int";
                case "void":
                    return "Void";
                case "bool":
                    return "Bool";
            }
            return typeName + (implyUnwrapped ? "!" : "");
        }

        /// <summary>
        /// Converts an array type to Swift
        /// </summary>
        /// <param name="array">The array type to convert</param>
        /// <returns>The converted Swift type</returns>
        [ParsesType(typeof (ArrayTypeSyntax))]
        public static string ArrayType(ArrayTypeSyntax array)
        {
            return "[" + SyntaxNode(array.ElementType) + "]"; //TODO: rankspecifiers
        }

        /// <summary>
        /// Converts a PredefinedType to Swift
        /// </summary>
        /// <param name="type">The type to convert</param>
        /// <returns>The converted Swift type</returns>
        [ParsesType(typeof (PredefinedTypeSyntax))]
        public static string PredefinedType(PredefinedTypeSyntax type)
        {
            return Type(type.Keyword.Text);
        }
    }
}
{'fraction_non_alphanumeric': 0.11149068322981366, 'fraction_numerical': 0.0, 'mean_word_length': 1.5685805422647527, 'pattern_counts': {'":': 10, '<': 29, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2265168', 'n_tokens_mistral': 847, 'n_tokens_neox': 807, 'n_words': 217}