| |
|
|
- Page 1 - |
|
RudiB. | Hello together,
I stand well at a for me sheer unlösbaren task. i want one Program-Listing with Befehlszeilentrennung through Doppelpunkte, aufsplitten in self-contained Program lines. as Sonderfall should however a row with "Case" or "CaseNot" to maintain go.
here time one utterly Sinnfreies Listing and thereafter the Listing bereinigt.
...and so reserves then looks.....I utterly not hinkriege !!!!
....z.B: on my own already the String VAR a$ with a colon therein position a challenge dar...because here too yet The eigentliche Befehlszeile with a Backslash aufgesplittet becomes...
here in the Forum becomes the first Listing with the Strings farblich not correctly displayed....
stand straight fully on the Hose... can me here someone on The Sprünge help ??? |
|
|
| |
|
|
| |
|
- Page 2 - |
|
|
RudiB. | Yes Walter really so.....is already calm however would like I a complete Befehlszeilen-Auftrennung (except Case/Casenot) .... speak, too to one Case/Casenot should command separated go.... I knows Yes this is Tricky..difficult...sch..heavy.
but i think here can I fasten.... I need the for my proposition "VarFinder".... Have there yet so many Baustellen open....
but thanks first.... Rudi |
|
|
| |
|
|
|
Walter | my mistake - I fit the case/caseNot on, so it so runs, How You it need... |
|
|
| |
|
|
|
Georg Teles | Hmpf be confused, time Case with If supplant possible ?
so reserves looks
here with Trennung
Regards |
|
|
| |
|
|
|
RudiB. | Hello Walter,
many Thanks for your trouble... is already not simply,,,,, however have You very good Approaches......
my Test-Objekt-Listings/challenges here Forum are: for example: CPU-Simulation....https://XProfan.net/intl/de/Applications/8bit-cpu-simulation/
and [...] |
|
|
| |
|
|
|
RudiB. | Hello Georg,
...thanks for your comment....
i don't know so really, whether I here konkret enough framed have. I work still on my proposition "VarFinder". there's it even important, Program lines To analyse..... speak the program must Befehlszeilen undo can. straight in reference on If and Endif of/ one row, too this should aufgetrennt go can. in this example GEHTS time only therefore circa a Programmformatierung sensible durchzuführen. And so GEHTS moreover ......Problems...Problems...etc. |
|
|
| |
|
|
|
Georg Teles | Hmpf,
severe taken symbolize the colon already a new row with Case/Casenote
means, that You through Parsen whom colon before entfernst and a new row from it make or depending on, whether You whom colon as new row interpretierst, time so as idea
Regards |
|
|
| |
|
|
|
RudiB. | OK... mal as background for my Intension. my Program "VarFinder" should any variables in a Program find can, speak in which row "Deklariert" in whom Lines comes tappt im dunkeln yet to, is tappt im dunkeln Global declared or comes tappt im dunkeln too still in of/ one "Proc" to etc. gives it creep, inquire " If Endif"" etc. For this, must I now time each Programmzeile auseinanderfieseln/decompose... isn't straight simply... I thought already I would almost on the target, however watts on the ground the reality gotten,as i in the Praxistest with Programs from this Forum, check had I still distant be of target...... |
|
|
| |
|
|
|
Georg Teles | Puh, Yes then must akribisch row for row with Structures compared and decided go, what there vorliegt
simply sound not |
|
|
| |
|
|
|
RudiB. | No simply certainly not ...however think I, that I on one good lane be. there's with safety yet many Error in the program.....be but constantly thereby these auszumerzen...even on this ways and always in the hope the it somebody gives, the a new "PROFANE" idea reinwirft |
|
|
| |
|
|
|
Walter | New attempt...
' the Codestück divides Befehlszeilen with ":" in new Lines on,
' except
' a) the ":" is within one Stringliterals; or
' b) to case/caseNot.
' here remaining the first ":" with the subesquent commands in same
' row receive.
' Kommentarzeilen are not berücksichtigt;
' The must ggf before ausgeschieden go
cls
Declare File$
declare StringAn%,i%,in$,out$,a$[]
declare AnzDP%
StringAn%=0
AnzDP%=0
Datei$=Loadfile$("ÖFFNE:","*.prf")
Assign #1,File$
reset #1
Print "Working.....Please Wait"
WhileNot EOF(#1)
input #1,in$
a$[]=explode(in $)' characters the Line in aray write
'any characters the row go through
for i%,len(in $)
' check, whether one itself within one Strings befindet
if (a$[i%-1]=Chr$(34)) and (StringAn%=0)
StringAn%=1
elseif (a$[i%-1]=Chr$(34)) and (StringAn%=1)
StringAn%=0
endif
if a$[i%-1]=":"
' case UND first : ?
if (left$(trim$(lower$(out $)),5)="case ") or (left$(trim$(lower$(out $)),8)="casenot ")
if AnzDP%=0' first colon - row continue
out$=out $+a$[i%-1]
inc AnzDP%
else'row share
print out$
out$=""
AnzDP%=0
endif
elseIf StringAn%=0' : isn't within one Strings - row share
print out$
out$=""
else
out$=out $+a$[i%-1]' : is within one Strings - row continue
endif
else' other characters as :
out$=out $+a$[i%-1]
endif
endfor
print out$
out$=""
EndWhile
Close #1
Print "FERTIG"
waitinput
|
|
|
| |
|
|
|
RudiB. | the sees super from !!!
have the whole yet extended, so the ganzzeilige comments übersprungen and be Endkommentare first of all abgetrennt and be on the Schluss restored go. Ausserdem as Besonderheit yet Sprungmarker, The on a colon terminate....
' the Codestück divides Befehlszeilen with ":" in new Lines on,
' except
' a) the ":" is within one Stringliterals; or
' b) to case/caseNot.
' here remaining the first ":" with the subesquent commands in same
' row receive.
' Kommentarzeilen are not berücksichtigt;
' The must ggf before ausgeschieden go
cls
Declare File$,End_Kommentar$,spending%
declare StringAn%,i%,in$,out$,a$[],pos%
declare AnzDP%,comment%
StringAn%=0
AnzDP%=0
Datei$=Loadfile$("ÖFFNE:","*.prf")
Assign #1,File$
reset #1
Assign #2,"Test_Datei.prf"
rewrite #2
While 1
If (spending%<1) Or (spending%>2)
Print "Bitte valid worth dial ( 1 or 2 )"
spending%=Input$("1- on screen spend / 2- in File screiben","Bitte selection treffen",spending%)
Else
break
EndIf
Endwhile
Print "Working.....Please Wait"
WhileNot EOF(#1)
'-----------------------------------------------------------------------------------------------------------------------
' *ganzzeilige comments skipping
'-----------------------------------------------------------------------------------------------------------------------
input #1,in$
If left$(trim$(in $),2)="/*"
If spending%=1
Print in$
Else
print #2,in$
Endif
comment%=1
continue
Endif
If left$(trim$(in $),2)="*/"
If spending%=1
Print in$
Else
print #2,in$
Endif
comment%=0
Continue
Endif
If (left$(trim$(in $),1)="'") Or (left$(trim$(in $),2)="//") Or (comment%=1)
If spending%=1
Print in$
Else
Print #2, in$
Endif
continue
EndIf
'-----------------------------------------------------------------------------------------------------------------------
' Endkommentare cut off
'-----------------------------------------------------------------------------------------------------------------------
If (Instr("'",Trim $(in $),2)) Or (Instr("//",Trim $(in $),2))
pos%=0
End_kommentar$=""
Whileloop Len(in $)
If mid$(in$,&loop,1)=chr $(34)
pos%=hardship(pos%)
EndIf
If (mid$(in$,&loop,1)="'") And (pos%=0)
End_kommentar$=Right$(in$,Len(in $)-&loop+1)
in$=Left$(in$,&loop-1)
Break
EndIf
If (mid$(in$,&loop,2)="//") And (pos%=0)
End_kommentar$=Right$(in$,Len(in $)-&loop+1)
in$=Left$(in$,&loop-1)
Break
EndIf
EndWhile
EndIf
'--------------------------------------------------------------------------------------------------------------------------
If right$(Trim $(in $),1)=":"' if letztes characters colon / Sprungmarker
If spending%=1
Print in$
Else
Print #2, in$
Endif
Continue
Endif
a$[]=explode(in $)' characters the Line in aray write
'any characters the row go through
for i%,len(in $)
' check, whether one itself within one Strings befindet
if (a$[i%-1]=Chr$(34)) and (StringAn%=0)
StringAn%=1
elseif (a$[i%-1]=Chr$(34)) and (StringAn%=1)
StringAn%=0
endif
if a$[i%-1]=":"
' case UND first : ?
if (left$(trim$(lower$(out $)),5)="case ") or (left$(trim$(lower$(out $)),8)="casenot ")
if AnzDP%=0' first colon - row continue
out$=out $+a$[i%-1]
inc AnzDP%
else'row share
If spending%=1
print out$
Else
print #2,out$
Endif
out$=""
AnzDP%=0
endif
elseIf StringAn%=0' : isn't within one Strings - row share
If spending%=1
print out$
Else
print #2,out$
Endif
out$=""
else
out$=out $+a$[i%-1]' : is within one Strings - row continue
endif
else' other characters as :
out$=out $+a$[i%-1]
endif
endfor
If spending%=1
print out$+End_Kommentar$
Else
print #2,out$+End_Kommentar$
Endif
End_Kommentar$=""
out$=""
EndWhile
Close #1
close #2
Print "FERTIG"
waitinput
have it then with the Source "CPU-Simulation" run. it shining Fehlerfrei durchzulaufen... |
|
|
| |
|
|
|
Walter | this is but already very nice. then plenty Happiness - and moreover so! |
|
|
| |
|
|