Giter Club home page Giter Club logo

typecobol.templatetranspiler's People

Contributors

fm-117 avatar mayanje avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

typecobol.templatetranspiler's Issues

Ill transpiled code for a special script.

The Script below is not translated correctly.

        @{
        var items = "";
        if (@Model.definitions.nestedFunctions.Public.Count > 0) {
        items += "*\n";
        items += "*    IF CallIsCopy\n";
        items += "*      PERFORM Copy-Process-Mode\n";
        items += "*    ELSE\n";
        items += "    PERFORM FctList-Process-Mode\n";
        items += "    perform INIT-LIBRARY\n";
        items += "*    END-IF\n\n";

        items += "    GOBACK.\n\n";

        items += " FctList-Process-Mode.\n";
        items += "     IF NOT TC-" + @Model.programName8 + "-FctList-IsLoaded\n";
        foreach (var f in @Model.definitions.nestedFunctions.Concat(@Model.definitions.functions.Public, true)) {
        items += "       SET TC-"+@Model.programName8 + "-" +f.Hash+"   TO ENTRY '"+f.Hash+"'\n";
        }
        items += "       SET TC-" + @Model.programName8 + "-FctList-IsLoaded TO TRUE\n";
        items += "     END-IF\n";
        items += "        .\n\n";

        if (@Model.definitions.nestedFunctions.Public.Count > 0) {
        items += "     set PntTab-Pnt TO ADDRESS OF TC-"+@Model.programName8+"-PntTab\n";
        }
        }
        }
        @items

the resulting transpiled code is the following

@SelfResult.Append(@"
");        
        var items = "";
        if (@Model.definitions.nestedFunctions.Public.Count > 0) {
        items += "*\n";
        items += "*    IF CallIsCopy\n";
        items += "*      PERFORM Copy-Process-Mode\n";
        items += "*    ELSE\n";
        items += "    PERFORM FctList-Process-Mode\n";
        items += "    perform INIT-LIBRARY\n";
        items += "*    END-IF\n\n";

        items += "    GOBACK.\n\n";

        items += " FctList-Process-Mode.\n";
        items += "     IF NOT TC-" + @Model.programName8 + "-FctList-IsLoaded\n";
        foreach (var f in @Model.definitions.nestedFunctions.Concat(@Model.definitions.functions.Public, true)) {
        items += "       SET TC-"+@Model.programName8 + "-" +f.Hash+"   TO ENTRY '"+f.Hash+"'\n";
        }
        items += "       SET TC-" + @Model.programName8 + "-FctList-IsLoaded TO TRUE\n";
        items += "     END-IF\n";
        items += "        .\n\n";

        if (@Model.definitions.nestedFunctions.Public.Count > 0) {
        items += "     set PntTab-Pnt TO ADDRESS OF TC-"+@Model.programName8+"-PntTab\n";
        @SelfResult.Append(@"
        }
        }
");@SelfResult.Append(@"        ");@SelfResult.Append($@"{@items}");@SelfResult.Append(@"
");

The problem is that the two last } } brackets are considered by the CSharpCodeParser as Markup text thus the Tranpiler generates a String construction like:

        @SelfResult.Append(@"
        }
        }
");

This a Microsoft .Razor issue to be investigated, by taking the original CSharpCodeParser and seing what is wrong.
A work around for this issue is to transform the script like for instance like that:

        @{
        var items = "";
        if (@Model.definitions.nestedFunctions.Public.Count > 0) {
        items += "*\n";
        items += "*    IF CallIsCopy\n";
        items += "*      PERFORM Copy-Process-Mode\n";
        items += "*    ELSE\n";
        items += "    PERFORM FctList-Process-Mode\n";
        items += "    perform INIT-LIBRARY\n";
        items += "*    END-IF\n\n";

        items += "    GOBACK.\n\n";

        items += " FctList-Process-Mode.\n";
        items += "     IF NOT TC-" + @Model.programName8 + "-FctList-IsLoaded\n";
        foreach (var f in @Model.definitions.nestedFunctions.Concat(@Model.definitions.functions.Public, true))
        items += "       SET TC-"+@Model.programName8 + "-" +f.Hash+"   TO ENTRY '"+f.Hash+"'\n";
        
        items += "       SET TC-" + @Model.programName8 + "-FctList-IsLoaded TO TRUE\n";
        items += "     END-IF\n";
        items += "        .\n\n";

        if (@Model.definitions.nestedFunctions.Public.Count > 0) 
        items += "     set PntTab-Pnt TO ADDRESS OF TC-"+@Model.programName8+"-PntTab\n";        
        }
        }
        @items

AND the generated code will be:

@SelfResult.Append(@"
");        
        var items = "";
        if (@Model.definitions.nestedFunctions.Public.Count > 0) {
        items += "*\n";
        items += "*    IF CallIsCopy\n";
        items += "*      PERFORM Copy-Process-Mode\n";
        items += "*    ELSE\n";
        items += "    PERFORM FctList-Process-Mode\n";
        items += "    perform INIT-LIBRARY\n";
        items += "*    END-IF\n\n";

        items += "    GOBACK.\n\n";

        items += " FctList-Process-Mode.\n";
        items += "     IF NOT TC-" + @Model.programName8 + "-FctList-IsLoaded\n";
        foreach (var f in @Model.definitions.nestedFunctions.Concat(@Model.definitions.functions.Public, true)) {
        items += "       SET TC-"+@Model.programName8 + "-" +f.Hash+"   TO ENTRY '"+f.Hash+"'\n";
        }
        items += "       SET TC-" + @Model.programName8 + "-FctList-IsLoaded TO TRUE\n";
        items += "     END-IF\n";
        items += "        .\n\n";

        if (@Model.definitions.nestedFunctions.Public.Count > 0) {
        items += "     set PntTab-Pnt TO ADDRESS OF TC-"+@Model.programName8+"-PntTab\n";
        
        }
        }
        @SelfResult.Append($@"{@items}");@SelfResult.Append(@"
");

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.