mirror of
https://github.com/Smaug123/WoofWare.Whippet
synced 2025-10-05 15:58:39 +00:00
Some checks failed
.NET / build (Debug) (push) Has been cancelled
.NET / build (Release) (push) Has been cancelled
.NET / analyzers (push) Has been cancelled
.NET / build-nix (push) Has been cancelled
.NET / check-dotnet-format (push) Has been cancelled
.NET / check-nix-format (push) Has been cancelled
.NET / Check links (push) Has been cancelled
.NET / Check flake (push) Has been cancelled
.NET / nuget-pack (push) Has been cancelled
.NET / expected-pack (push) Has been cancelled
.NET / all-required-checks-complete (push) Has been cancelled
34 lines
1.2 KiB
Forth
34 lines
1.2 KiB
Forth
namespace WoofWare.Whippet.Fantomas
|
|
|
|
open Fantomas.FCS.Syntax
|
|
open Fantomas.FCS.Text.Range
|
|
|
|
/// Module for manipulating primitive types like `int` or `string`.
|
|
[<RequireQualifiedAccess>]
|
|
module Primitives =
|
|
/// Given e.g. "byte", returns "System.Byte".
|
|
let qualifyType (typeName : string) : LongIdent option =
|
|
match typeName with
|
|
| "float32"
|
|
| "single" -> [ "System" ; "Single" ] |> Some
|
|
| "float"
|
|
| "double" -> [ "System" ; "Double" ] |> Some
|
|
| "byte"
|
|
| "uint8" -> [ "System" ; "Byte" ] |> Some
|
|
| "sbyte"
|
|
| "int8" -> [ "System" ; "SByte" ] |> Some
|
|
| "int16" -> [ "System" ; "Int16" ] |> Some
|
|
| "int"
|
|
| "int32" -> [ "System" ; "Int32" ] |> Some
|
|
| "int64" -> [ "System" ; "Int64" ] |> Some
|
|
| "uint16" -> [ "System" ; "UInt16" ] |> Some
|
|
| "uint"
|
|
| "uint32" -> [ "System" ; "UInt32" ] |> Some
|
|
| "uint64" -> [ "System" ; "UInt64" ] |> Some
|
|
| "char" -> [ "System" ; "Char" ] |> Some
|
|
| "decimal" -> [ "System" ; "Decimal" ] |> Some
|
|
| "string" -> [ "System" ; "String" ] |> Some
|
|
| "bool" -> [ "System" ; "Boolean" ] |> Some
|
|
| _ -> None
|
|
|> Option.map (List.map (fun i -> (Ident (i, range0))))
|