Results 1 to 4 of 4

Thread: Source code formatting

  1. #1
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,813
    Rep Power
    10

    Source code formatting

    Released a new tool able to analize source code and create a formatted copy.
    Code will be indented by IF, FOR, WHILE, DO, SELECT levels.

    This tool if available in thinAir menu: Tools/Utilities/Format code

    At the time this message is posted, this tool is still under development.
    For this reason this tool, when executed, will produce a new script file in order not to create any interference with your valuable scripts.
    New file will have the same name and path of your original follower by an "_" char.
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  2. #2

    Re: Source code formatting

    Hi Eros,

    Thanks very much for new Tool - Format Code in ThinAir.
    Very, very useful indeed for spacing out code and making it more readable.

    I gave it a spin using TAB Editor sourcefile which is quite a lengthy one.
    The resultant code formatted file produced a few errors when I ran it however...

    This is what I found to be the cause. The comparison operators ">=" and "<=" are translated into the formatted file as "> =" and "< =" (***Note Spaces***)

    The spaces can cause script errors by ThinBasic when the formatted sourcefile is run.
    After doing a 'replace all' occurrences within the listing to correct these my program ran OK in ThinBasic.
    You may have already fixed this but just letting you know in case you are not already aware of the situation, that is all.
    It's a fine addition to ThinAir/ThinBasic.



    Cheers,
    catventure
    http://tab.thinbasic.com - Home Of The ThinBasic Adventure Builder Project. (Interactive Fiction/Text Adventure Maker)

  3. #3
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,813
    Rep Power
    10

    Re: Source code formatting

    catventure,

    thanks a lot, Roberto will be happy.
    No, I didn't fix it because Roberto added it at the very last time.
    We will fix in next release. We want also fix some blank lines added here and there and show a window with some options like:
    • number of spaces to indent
    • number of lines to add before a function declaration
    • an option to apply format only to selected text or complete file
    • others


    Ciao
    Eros

    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  4. #4

    Re: Source code formatting

    Hi Catventure,

    I fixed the translation of the comparison operators, now they are translated as following:
    • ">=" reformatted to " >= "
    • "<=" reformatted to " <= "

    One space as head and one for tail.

    Ciao,
    Roberto
    http://www.thinbasic.com

Members who have read this thread: 0

There are no members to list at the moment.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •