Stabel

Check-in [a046fe223a]
Login
Overview
Comment:Possible finished implementation of strings, need to verify with wasm test.
Timelines: family | ancestors | descendants | both | strings
Files: files | file ages | folders
SHA3-256: a046fe223ad7fc6150cdfe7c8dd4bd4662d33336675046fccc78996f74b763d4
User & Date: robin.hansen on 2021-09-06 19:36:18
Other Links: branch diff | manifest | tags
Context
2021-09-06
20:37
Strings now work. Closed-Leaf check-in: b730446f95 user: robin.hansen tags: strings
19:36
Possible finished implementation of strings, need to verify with wasm test. check-in: a046fe223a user: robin.hansen tags: strings
2021-09-05
19:59
Module definitions can now contain documentation strings. check-in: 1a0f42978d user: robin.hansen tags: strings
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Modified elm.json from [696f8df2ff] to [6ed21b8cff].

7
8
9
10
11
12
13
14

15
16
17
18
19
20
21
    "dependencies": {
        "direct": {
            "elm/core": "1.0.5",
            "elm/json": "1.1.3",
            "elm/parser": "1.1.0",
            "elm-community/dict-extra": "2.4.0",
            "elm-community/list-extra": "8.3.0",
            "elm-community/result-extra": "2.4.0"

        },
        "indirect": {}
    },
    "test-dependencies": {
        "direct": {
            "elm-community/string-extra": "4.0.1",
            "elm-explorations/test": "1.2.2"







|
>







7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
    "dependencies": {
        "direct": {
            "elm/core": "1.0.5",
            "elm/json": "1.1.3",
            "elm/parser": "1.1.0",
            "elm-community/dict-extra": "2.4.0",
            "elm-community/list-extra": "8.3.0",
            "elm-community/result-extra": "2.4.0",
            "zwilias/elm-utf-tools": "2.0.1"
        },
        "indirect": {}
    },
    "test-dependencies": {
        "direct": {
            "elm-community/string-extra": "4.0.1",
            "elm-explorations/test": "1.2.2"

Modified src/Stabel/Qualifier.elm from [24dab28864] to [b3bf682249].

23
24
25
26
27
28
29

30
31
32
33
34
35
36
....
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475














1476
1477
1478
1479
1480
1481
1482
import Stabel.Data.Type as Type exposing (FunctionType, Type)
import Stabel.Data.TypeSignature as TypeSignature exposing (TypeSignature)
import Stabel.Parser as Parser
import Stabel.Parser.AssociatedFunctionSignature as AssociatedFunctionSignature
import Stabel.Parser.ModuleDefinition as ModuleDefinition
import Stabel.Parser.Type as Parser
import Stabel.Qualifier.Problem exposing (Problem(..))



type alias AST =
    { types : Dict String TypeDefinition
    , functions : Dict String FunctionDefinition
    , referenceableFunctions : Set String
    }
................................................................................
                            Ok (ArrayLiteral (mapLoc loc) qualifiedNodes)
                                :: acc.qualifiedNodes
                    }

                Err err ->
                    { acc | qualifiedNodes = Err err :: acc.qualifiedNodes }

        Parser.StringLiteral _ _ ->
            -- TODO
            acc
















isMultiFunction : Parser.FunctionDefinition -> Bool
isMultiFunction def =
    case def.implementation of
        Parser.SoloImpl _ ->
            False







>







 







|
<
<
>
>
>
>
>
>
>
>
>
>
>
>
>
>







23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
....
1467
1468
1469
1470
1471
1472
1473
1474


1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
import Stabel.Data.Type as Type exposing (FunctionType, Type)
import Stabel.Data.TypeSignature as TypeSignature exposing (TypeSignature)
import Stabel.Parser as Parser
import Stabel.Parser.AssociatedFunctionSignature as AssociatedFunctionSignature
import Stabel.Parser.ModuleDefinition as ModuleDefinition
import Stabel.Parser.Type as Parser
import Stabel.Qualifier.Problem exposing (Problem(..))
import String.UTF8 as UTF8


type alias AST =
    { types : Dict String TypeDefinition
    , functions : Dict String FunctionDefinition
    , referenceableFunctions : Set String
    }
................................................................................
                            Ok (ArrayLiteral (mapLoc loc) qualifiedNodes)
                                :: acc.qualifiedNodes
                    }

                Err err ->
                    { acc | qualifiedNodes = Err err :: acc.qualifiedNodes }

        Parser.StringLiteral loc value ->


            let
                stringBytes =
                    UTF8.toBytes value

                stringNode =
                    -- locations are all wrong, but should always be correct
                    -- therefore it should never be visible to the user
                    Parser.InlineFunction loc
                        [ Parser.ArrayLiteral loc <|
                            List.map (Parser.Integer loc) stringBytes
                        , Parser.ExternalFunction loc [ "string" ] "from-bytes"
                        ]
            in
            qualifyNode config currentDefName stringNode acc


isMultiFunction : Parser.FunctionDefinition -> Bool
isMultiFunction def =
    case def.implementation of
        Parser.SoloImpl _ ->
            False