[Tool/Web/Other] Missing Brackets Finder [1.1.0] - NOW WITH GUI
#1

PAWN: Missing angle brackets finder
Picture of the new GUI


About


This script, written in Perl, analyses your script in terms of angle brackets ( { }).
It tells you which bracket(s) have/has a missing bracket, so you can fix your code (the pawn compiler is buggy in this aspect. If there is one or more angle bracket missing somewhere, it outputs wrong errors or even crashes, so you have to go line-by-line).
It can also help you if you don't even know whether brackets are the problem and where to find them. This script isn't 100% accurate because it isn't psychic:

if(..)
{
if(..)
{
}

How could the script guess whether the first if or the seconds if has the missing pair?
But this script helps you in this case by telling you roughly where to look for a missing bracket.

It is released under the creativecommons 3 (http://creativecommons.org/licenses/by/3.0/)


Installation

You need to have the Perl VM installed. If you are using Windows, you have to install Perl at first.
Linux based systems and many other operating systems have it installed by default.

1. Go to http://www.activestate.com/activeperl/downloads and download it (the first one, Windows (x86))
2. Install activeperl
3. Download and unzip brackets.zip and start „missing brackets finder.exe“.
If activeperl is installed, a GUI should shown up.

The „perl“ folder inside is needed by the executable, so don't delete the folder.

If you are using a linux based system, just open the terminal and run „perl GUI.pl“. You also need to have the perl module „Tkx“ installed (you can install Tkx with the package installer: apt-get, yum, ..).

("missing bracket finder.exe" is compiled with mingw, "missing brackets finder alternative.exe" is compiled with the VC++ one (could complained about missing .dlls if you don't have the latest .net installed, thats why I replaced it))

Download (1.1.0 final)
1. Attachment
2. http://jeffersongta.de/downloads/brackets.zip

Source of everything is included


Known issues

- it reported a line, you go to the line but there isn't a missing bracket: Look for the missing bracket around the area where the bracket was reported (the function, ..) (should happen rarely - in investigation)
- works with large scripts (80k+ lines), but at the cost of memory (~60 MB) and execution time (won't be fixed. Rewritting in a programming language such as C++ would take too much time. I needed the dynamics of languages such as perl for this application)
- you are not able to move and touch the window while it is analyzing a script (won't be fixed.)

Changelog

Beta 5 → Final 1:
- Fixed problems with ' and „ in comments („// don't“ << made the script not working)
- create a how-to gallery, so EVERYONE is able to use this


Final 1 → Final 1.1:
- Easier to use
- Fixed many bugs
- GUI
- faster, improved most of the code



Credits
www.perl-community.de (GwenDragon and MatthiasW): Helped me using Text::Balanced, fixing some bugs and stripping out strings (text inside quotes) and gave me more tips in perl
Reply
#2

Thanks, this is great.

Now to attempt to install it.
Reply
#3

this can really be handfull, sometimes i'm searching for hours to find that missing }
Reply
#4

Can really be helpfull, if youre missing one you will get A LOT of erros (26 most cases) and then the errors are all like sub/function not found/declared so you cant find where the problem is either. But is this only for linux ? (i dont want to install VM, with another OS onlt for one tool )
Reply
#5

Quote:
Originally Posted by gamer931215
View Post
Can really be helpfull, if youre missing one you will get A LOT of erros (26 most cases) and then the errors are all like sub/function not found/declared so you cant find where the problem is either. But is this only for linux ? (i dont want to install VM, with another OS onlt for one tool )
No, Perl is available on over 100 platforms - including Windows.
You only need to install the VM. "Perl VM" sounds like something big, but it is just 20 MB or so (not sure). And it will be likewise a "normal" installation.
And I added a small "Why perl?".

Also to everyone who replied, thanks for the feedback!
Reply
#6

7.Type in : perl brackets.pl scriptname (scriptname is the name of your script)

WHAT? I typed: perl brackets.pl lvdm
and it wrote: "Can't Open Perl Script "brackets.pl":No such file or directory"

What now?
Reply
#7

Quote:
Originally Posted by sushihusi
View Post
7.Type in : perl brackets.pl scriptname (scriptname is the name of your script)

WHAT? I typed: perl brackets.pl lvdm
and it wrote: "Can't Open Perl Script "brackets.pl":No such file or directory"

What now?
You didn't switch to the folder, where you unzipped the brackets.zip (cd ..).
And you forgot the .pwn extension: perl brackets.pl lvdm.pwn

I added pictures in my main post to demonstrate it better. (Look at the pictures of step 6).
In my example I downloaded the brackets.zip to the desktop, unzipped it and moved grandlarc.pwn to the folder, where I unzipped the brackets.zip.


Moreover I discovered a small bug (it doesn't have anything to do with this). I will fix it in the next days.

Edit: Bug fixed and topic updated
Reply
#8

not working... i did everything correctly, anyhelp?
Reply
#9

Quote:
Originally Posted by The_Gangstas
View Post
not working... i did everything correctly, anyhelp?
I don\'t know the success rate for this tool, but I would go ahead and give "notepad++" a shot - it seems to point things like that out.
Reply
#10

yes y_less recommended it, but how do we use notepad? i already downloaded it
Reply
#11

Quote:
Originally Posted by The_Gangstas
View Post
yes y_less recommended it, but how do we use notepad? i already downloaded it
I believe this will provide you with an answer.
Reply
#12

* ColdXX gives Remis a giant Cookeh!
Reply
#13

Quote:
Originally Posted by The_Gangstas
View Post
not working... i did everything correctly, anyhelp?
At which step it isn\'t working? And why do you think it isn\'t working?


If you switched to N++, thats ok, too. Just use what you like.
Reply
#14

I believe this is amazingly useful, even though I\'m not scripter.
Reply
#15

Not working!
pawn Code:
enum bInfo
{
    bID,
    bType,
    bool:bOwned,
    bOwner[ MAX_PLAYER_NAME ],
    bName [ 38 ],
    bValue,
    bBank,
    bEntCost,
    Float:bEntrance_x,
    Float:bEntrance_y,
    Float:bEntrance_z,
    Float:bExit_x,
    Float:bExit_y,
    Float:bExit_z,
    bInt,
    bLocked,
    Float:cp_x,
    Float:cp_y,
    Float:cp_z,
    cp_type
No bracket at the end, script outputs that everything is fine.
Reply
#16

Quote:
Originally Posted by kLx
View Post
Not working!

No bracket at the end, script outputs that everything is fine.
Hello and thanks for testing and reporting,


either you are an older version (are you using the beta - with a bug - or the final?) or something in your script

is causing a bug (a bug in this script).


Because I have tested this script with various gamemodes, removed a bracket and it worked fine (meaning that this script DID report the missing bracket).


I was also testing you snippet: I took lvdm.pwn and added you code with the missing bracket near the beginning - it worked fine (the script did report the missing bracket):
http://ultraupload.de/hosted/1292085189_df0e.png


If you are using the latest version, I am sorry that I can\'t do something. I don\'t know what is causing this and I would have to analyse your whole script what is causing this - which Iam not allowed to ofc -.

One thing you could try is using "brackets_Matthias.pl" instead of "brackets.pl".
Reply
#17

Quote:
Originally Posted by RealCop228
View Post
I don\'t know the success rate for this tool, but I would go ahead and give "notepad++" a shot - it seems to point things like that out.
Yeah, Slice ( Or whatever is his name ) made a tut how to make PAWN scripts in notepad++ ^^
Reply
#18

It doesnt work.
Reply
#19

well it can\'t find my missing bracket
Reply
#20

Quote:
Originally Posted by yarrum3
View Post
well it can\'t find my missing bracket
Hello,


It should work for most scripts, but it seem to be incompatible with some scripts. Before analyzing, the script removes all comments (// and /* */). Since it can be complex to do this and make it work for all scripts, there could be a bug in the way of removing the comments.


I will post a new version with a GUI and easier use in general (you don\'t need to do anything with cmd.exe anymore). Moreover it should fix the problems with incompatible scripts ofc.

The new version is nearly ready, it has only one issue left and it needs some testing with various gamemodes (also some complex ones with lots of lines).
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)