Stabel

Check-in [b8ab950864]
Login
Overview
Comment:Added fully qualified refs as possible outcomes of parsing. Qualifier now handles them correctly. Now we need tests and actual parser implementation.
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: b8ab950864dd7034c3f4948646c64c0b2934709ecbe2992a5600bdb630abc3d5
User & Date: robin.hansen on 2021-09-25 09:22:34
Other Links: manifest | tags
Context
2021-09-25
09:48
Happy path implementaton of fully qualified references. Still needs error handling and an integratio... check-in: d9f4e595b8 user: robin.hansen tags: trunk
09:22
Added fully qualified refs as possible outcomes of parsing. Qualifier now handles them correctly. No... check-in: b8ab950864 user: robin.hansen tags: trunk
2021-09-24
10:04
Remove unused alias. check-in: 968f800bd9 user: robin.hansen tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Modified src/Stabel/Parser.elm from [0ae4b446a0] to [6a1081c128].

77
78
79
80
81
82
83

84
85
86
87
88
89
90


type AstNode
    = Integer SourceLocationRange Int
    | Function SourceLocationRange String
    | PackageFunction SourceLocationRange (List String) String
    | ExternalFunction SourceLocationRange (List String) String

    | InlineFunction SourceLocationRange (List AstNode)
    | ConstructType String
    | GetMember String String
    | SetMember String String
    | ArrayLiteral SourceLocationRange (List AstNode)
    | StringLiteral SourceLocationRange String








>







77
78
79
80
81
82
83
84
85
86
87
88
89
90
91


type AstNode
    = Integer SourceLocationRange Int
    | Function SourceLocationRange String
    | PackageFunction SourceLocationRange (List String) String
    | ExternalFunction SourceLocationRange (List String) String
    | FullyQualifiedFunction SourceLocationRange String
    | InlineFunction SourceLocationRange (List AstNode)
    | ConstructType String
    | GetMember String String
    | SetMember String String
    | ArrayLiteral SourceLocationRange (List AstNode)
    | StringLiteral SourceLocationRange String

Modified src/Stabel/Parser/Type.elm from [dbf5078492] to [cf5fe697e9].

5
6
7
8
9
10
11

12
13
14
15
16
17
18
19
20
21
22
23
24
    )


type PossiblyQualifiedType
    = LocalRef String (List PossiblyQualifiedType)
    | InternalRef (List String) String (List PossiblyQualifiedType)
    | ExternalRef (List String) String (List PossiblyQualifiedType)

    | Generic String
    | FunctionType FunctionSignature


type PossiblyQualifiedTypeOrStackRange
    = StackRange String
    | NotStackRange PossiblyQualifiedType


type alias FunctionSignature =
    { input : List PossiblyQualifiedTypeOrStackRange
    , output : List PossiblyQualifiedTypeOrStackRange
    }







>













5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
    )


type PossiblyQualifiedType
    = LocalRef String (List PossiblyQualifiedType)
    | InternalRef (List String) String (List PossiblyQualifiedType)
    | ExternalRef (List String) String (List PossiblyQualifiedType)
    | FullyQualifiedRef String (List PossiblyQualifiedType)
    | Generic String
    | FunctionType FunctionSignature


type PossiblyQualifiedTypeOrStackRange
    = StackRange String
    | NotStackRange PossiblyQualifiedType


type alias FunctionSignature =
    { input : List PossiblyQualifiedTypeOrStackRange
    , output : List PossiblyQualifiedTypeOrStackRange
    }

Modified src/Stabel/Qualifier.elm from [8ec9cb1f71] to [baeb6b0c2a].

524
525
526
527
528
529
530



531
532
533
534
535
536
537
....
1306
1307
1308
1309
1310
1311
1312
















1313
1314
1315
1316
1317
1318
1319
                qualifiedName =
                    Dict.get pathString config.externalModules
                        |> Maybe.map (\prefix -> "/" ++ prefix ++ pathString ++ "/" ++ name)
                        |> Maybe.withDefault ""
            in
            refLookup qualifiedName binds




        Parser.Generic sym ->
            Ok (Type.Generic sym)

        Parser.FunctionType sign ->
            let
                inputResult =
                    sign.input
................................................................................
                        Just def ->
                            if def.exposed then
                                { acc | qualifiedNodes = Ok (Function qLoc def) :: acc.qualifiedNodes }

                            else
                                { acc | qualifiedNodes = Err (FunctionNotExposed qLoc fullReference) :: acc.qualifiedNodes }

















        Parser.ConstructType typeName ->
            let
                qualifiedName =
                    qualifyName config typeName
            in
            case Dict.get qualifiedName acc.qualifiedTypes of
                Just t ->







>
>
>







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
....
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
                qualifiedName =
                    Dict.get pathString config.externalModules
                        |> Maybe.map (\prefix -> "/" ++ prefix ++ pathString ++ "/" ++ name)
                        |> Maybe.withDefault ""
            in
            refLookup qualifiedName binds

        Parser.FullyQualifiedRef ref binds ->
            refLookup ref binds

        Parser.Generic sym ->
            Ok (Type.Generic sym)

        Parser.FunctionType sign ->
            let
                inputResult =
                    sign.input
................................................................................
                        Just def ->
                            if def.exposed then
                                { acc | qualifiedNodes = Ok (Function qLoc def) :: acc.qualifiedNodes }

                            else
                                { acc | qualifiedNodes = Err (FunctionNotExposed qLoc fullReference) :: acc.qualifiedNodes }

        Parser.FullyQualifiedFunction loc ref ->
            let
                qLoc =
                    mapLoc loc
            in
            case Dict.get ref config.inProgressAST.functions of
                Nothing ->
                    { acc | qualifiedNodes = Err (UnknownFunctionRef qLoc ref) :: acc.qualifiedNodes }

                Just def ->
                    if def.exposed then
                        { acc | qualifiedNodes = Ok (Function qLoc def) :: acc.qualifiedNodes }

                    else
                        { acc | qualifiedNodes = Err (FunctionNotExposed qLoc ref) :: acc.qualifiedNodes }

        Parser.ConstructType typeName ->
            let
                qualifiedName =
                    qualifyName config typeName
            in
            case Dict.get qualifiedName acc.qualifiedTypes of
                Just t ->