• Welcome to Theos PowerBasic Museum 2017.

News:

Attachments are only available to registered users.
Please register using your full, real name.

Main Menu

Code-Formatter PB 10

Started by Theo Gottwald, January 18, 2011, 07:58:28 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Peter Weis

Hi Theo,

The final code is at the top to download! I put the code but always pure whom I've changed something! Yesterday, I'm not sorry to come!

regards Peter

Theo Gottwald

QuoteIch arbeite immer noch an DoFormat jede andere Funktion kann im Moment geändert werden also am aussehen oder der Progressbar oder oder oder! Ich könnte auch manchmal ein Feedback brauchen was mit der Formatierung nicht Funktioniert!

Peter says that he is actually working on the "DoFormat", but that any other function in the provided code can be cahnged by anybody want to take part in the project.

However i suggest just to wait until peter gives the sign that he's done. This way we make step by step.

Peter Weis

#137
Hello,
May have DoFormat and all the functions depend on it included in a separate #INCLUDE any work on it now!

regards Peter

Paul Elliott

Hello,

A couple observations.

1) move the #PBFORMS check/reformat into RebuildLine where it belongs. that will remove a
major indent that isn't needed.

2) it doesn't seem to reformat a line with only 1 variable. did you mean to do this change?

3) I am seeing problems with DIM x(1, 2) as long   and DIM x(a - 1, b - 1) as long. see if it
works with TO or : instead of the , in the parens.

4) nothing seems to work under the Class. suggest you get Larry charlton's GDI Plus code
from the PB forums and include all the INCs into the main BAS file for testing. Unless you have
several Class programs from different programmers available.

5) I think there is a much simpler way to handle the split variable routine and adds no multiple
scans trying to figure out parts of the line but haven't been able to figure out exactly what
your function is doing.

6) how are you planning to handle:

dim x as long, _
     y, _
     z as dword


Peter Weis

Hi Paul,
I will look at the issues and work through the points piece by piece!
But thank you that you have my attention!
regards Peter

Theo Gottwald

#140
Peter asked me to translate it.

Quote from: Paul Elliott on December 10, 2011, 03:25:41 PM
Hello,

A couple observations.
[Einige Beobachtungen]

1) move the #PBFORMS check/reformat into RebuildLine where it belongs. that will remove a
major indent that isn't needed.


[Verschiebe das  #PBFORMS nach "RebuildLine" wo es hignehört. Das sollte einen wichtigen ungewollten Einzug entfernen.]

2) it doesn't seem to reformat a line with only 1 variable. did you mean to do this change?

[Eine Zeile mit nur einer Variable wird nicht formattiert - ist das Absicht?]

3) I am seeing problems with DIM x(1, 2) as long   and DIM x(a - 1, b - 1) as long. see if it
works with TO or : instead of the , in the parens.


[Ich sehe probleme mit DIM ... s.o.] Das scheint nicht zu gehen.
 
4) nothing seems to work under the Class.
[ Alles nach CLASS scheint nicht zu funktionieren.]

suggest you get Larry charlton's GDI Plus code from the PB forums and include all the INCs into the main BAS file for testing.
[Hol dir einfach Larry Charltons GDI Plus Code aus dem PB-Forum und include das mal in dein Testfile]

Unless you have  several Class programs from different programmers available.
[Ausser du hast schon genug CLASS-Testfiles von verschiedenen Programmierern]

5) I think there is a much simpler way to handle the split variable routine and adds no multiple
scans trying to figure out parts of the line but haven't been able to figure out exactly what
your function is doing.


[Ich denke dass es beim formattieren der Variablen auch einfacher gehen sollte. Aber ich habe da auch nicht alles verstanden was du da machst]

6) how are you planning to handle:

dim x as long, _
     y, _
     z as dword
[/color]


[Wie willst du so einen Fall (s.oben) handhaben?]

Paul Elliott

An added note to my #5 ( just so you know it is possible ) I added about 50 lines of code and
managed to handle the code fragment I posted. It may be possible that I can shrink it but it
works for me and I may just leave it as is. Half the battle of working on a new function is
knowing that it can be solved.


Question:  Isn't anyone else testing this? I saw that the latest source has been downloaded
14 times. I do admit that the code is tough to follow ( I never did understand the RebuildLine
routine when first working on the split variable ) but the more code by different programmers
that it gets run against then the better the program will be. Even if you don't use the split
variable function.



Peter Weis

#142
Hi Paul,
I once fixed a bug.
The error in DIM x (1, 2)

regards Peter

Peter Weis

Hi Paul,
I think that we should dissolve the or. What do you think?

from:

dim x as long, _
     y, _
     z as dword



to:


    dim x as long
    dim y as long
    dim z as long


regards Peter

Theo Gottwald


Paul Elliott

#145
I take it that you wrote the output by hand? Notice the type of variables and spacing.

Don't forget to allow for multiple variables/types per individual line and remarks on each line.


Peter Weis

#146
Hello,
've Added new button for the underscore! The function is not yet. Who should the button is selected, the out come of it!

input:

DIM a, _
B as integer


output

  Dim a as integer
  Dim b as integer

Who does not:


     Dim a, _
         B as integer


regards Peter


Paul Elliott

Why not have it as a normal part of "split variables" ?

I don't see the reason for a new option.


Peter Weis

Hi Paul,
I can have it too. Always comes out the Sun


    Dim a as integer       ' Test
    Dim b as integer


But there are people who like to underscore

regards Peter














Peter Weis

#149
Hello,
  I got a bit further today! Wen Replace underscore is off! The result looks as follows!

input:

LOCAL a, b, _   'kdsjfjasdkfj
        c AS INTEGER           


output:


LOCAL    a, _                                           'kdsjfjasdkfj
         b, _
         c                          AS INTEGER   



regards Peter