Check the script for curly bracket mistakes (linux) -
Doddinger - 05.04.2019
Hello samp-forum community,
I had some problems with curly brackets in the past. I read it also very often already, that people had to deal with these problems already.
I just created a tool for finding these curly bracket mistakes and I also tested it. It was really annoying for me to find these curly bracket mistakes. I found them relatively quickly because I know what I have done before etc. but it's better and easier if I use my little tool.
Example code (with the known problem):
Code:
if(ianduisnotme == 1)
{
put some code in here
}
}
Example code (without the known problem):
Code:
if(ianduisnotme == 1)
{
put some code in here
}
Code:
Y_Less suggestion:
How does it deal with code like:
Code:
#if A
Func(a) {
#else
Func(b) {
#endif
}
It also deals with this code.
It also tells you if there's a mistake; for instance:
Code:
#if A
Func(a) {
#else
Func(b) //Mistake is here
#endif
}
or
Code:
#if A
Func(a) {
#else
Func(b) //Mistake is here, missing opening bracket
#endif
//Mistake here also, missing closing bracket
Code:
#if A
Func(a) //Mistake here, missing closing bracket
#else
Func(b) //Mistake is here, missing closing bracket
#endif
}
}
Use:
Code:
perl syncor.pl -f <file.pwn>
What doesn't do the script? It doesn't tell you the kind of mistake! It's simply unecessary for you because you know how to script pawno right
?
Have fun and enjoy the future without doing a long long search for the curly bracket mistake!
-Doddinger
PS. If you have any suggestions, simply write them down and reply here.
Re: Check the script for curly bracket mistakes (linux) -
Doddinger - 05.04.2019
I think that I put it in the wrong section. It was not a tutorial. Can a mod move it please to Tools?
Re: Check the script for curly bracket mistakes (linux) -
Doddinger - 05.04.2019
Quote:
Originally Posted by Y_Less
How does it deal with code like:
Code:
#if A
Func(a) {
#else
Func(b) {
#endif
}
|
I didn't know about this kind of thing in pawno. Does it exist? If so then I would use another regex and I would add an extra block for it to check it so there won't be a mistake. My current code can't deal with it at the moment.
I always thought: If there's an opening bracket, then there must be a closing bracket.
Have to add it then. Thx Y_Less.
Re: Check the script for curly bracket mistakes (linux) -
Doddinger - 05.04.2019
I'm away for now! I add it then (tomorrow for example). Just write your suggestions if you want!
Re: Check the script for curly bracket mistakes (linux) -
Doddinger - 07.04.2019
Quote:
Originally Posted by Y_Less
How does it deal with code like:
Code:
#if A
Func(a) {
#else
Func(b) {
#endif
}
|
I updated it. I simply added two new cases.
Re: Check the script for curly bracket mistakes (linux) -
Doddinger - 12.04.2019
The script is fully useable now it can also deal with "Y_Less problem" which he tried to make. I'm sorry that I found the time today only and not earlier. I said that I would update it soon but I didn't have the time for it. I had it today. Have fun!