[Tool/Web/Other] Check the script for curly bracket mistakes (linux)
#1

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.
Reply
#2

I think that I put it in the wrong section. It was not a tutorial. Can a mod move it please to Tools?
Reply
#3

Quote:
Originally Posted by Y_Less
View Post
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.
Reply
#4

I'm away for now! I add it then (tomorrow for example). Just write your suggestions if you want!
Reply
#5

Quote:
Originally Posted by Y_Less
View Post
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.
Reply
#6

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!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)