I don't know about you but I've spent too much time debugging macros only to find out I've missed a square bracket, curly bracket, or paren (From now on I will refer to all 3 as brackets) . So I've come up with simple tool. Actually it's code I modified that I found on the Internet.
Basically it checks for matching brackets and parens. It's not very sophisticated. It does not take into account the context of the code. So if you have one half of a bracket in a comment it will alert of missing bracket. It will report more than 1 issue at each run, however, the way it works it that for each issue it displays from the beginning of the file to the location of the problem. So I recommend directing output to a file.
Note: It requires at least Java 1.5
Simple method to use:
1. copy BracketChecker.class and Stack.class to the directory where the files you want to check.
1a. Alternatively you could place the two files in a directory and then add that directory to your java class path.
2. java -cp . BracketChecker fileToCheck.macro > check.txt
2a. If you alternatively performed 1a, you just need to execute: java BracketChecker fileToCheck.macro > check.txt
3. Examine check.txt if the file is empty no problems were found. Probably should display a message to that effect. Maybe later.
Remove the .txt extensions from each file. I added those in order to be able to upload the files.
The BrackerChecker.java file is the source code in case anyone wants to improve it.
Thanks.
Macro Bracket Checker
Moderators: dorpond, trevor, Azhrei, giliath, Gamerdude, jay, Mr.Ice
Macro Bracket Checker
- Attachments
-
- BracketChecker.java.txt
- (3.72 KiB) Downloaded 347 times
-
- Stack.class.txt
- (619 Bytes) Downloaded 172 times
-
- BracketChecker.class.txt
- (2.81 KiB) Downloaded 189 times
My Stuff:
-- Easy navigation Maptool macro function doc
-- Bracket Checker
-- Notepad++ code completion for maptool macro language
Ramblings of a Dead Marshal: http://louis-davout.blogspot.com/
-- Easy navigation Maptool macro function doc
-- Bracket Checker
-- Notepad++ code completion for maptool macro language
Ramblings of a Dead Marshal: http://louis-davout.blogspot.com/
Re: Macro Bracket Checker
Aliasmask created a erm MT language def. file for np++. Which highlights brackets open and close (and the others as well) So if you're on so if you're on windows I would suggest using that. Link to it can be found in his sig.
For non windows users this is however great to use!!
For non windows users this is however great to use!!
GETTING STARTED WITH MAPTOOLS - TUTORIALS, DOCS, VIDEOS, TOOLS, ETC
DISCORD (the new MT forum!)
My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS
DISCORD (the new MT forum!)
My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS
Re: Macro Bracket Checker
Yes I have and use that. But at least for me it's still easy to miss one.
My Stuff:
-- Easy navigation Maptool macro function doc
-- Bracket Checker
-- Notepad++ code completion for maptool macro language
Ramblings of a Dead Marshal: http://louis-davout.blogspot.com/
-- Easy navigation Maptool macro function doc
-- Bracket Checker
-- Notepad++ code completion for maptool macro language
Ramblings of a Dead Marshal: http://louis-davout.blogspot.com/
Re: Macro Bracket Checker
Yeah, I'm always leaving off ending ] or )'s, but I just rely on whatever I'm doing to crash so I can catch it. I probably would be easy enough to add a bracket checker to rpedit when uploading code. Well, for normal code at least. I'm always doing funky things that wouldn't make it useful for me.. ie I put []'s inside of quotes as a code segment I can run later. But I could just do a count as well to make sure the number of [ equal the number ] rather than checking to see if ['s get nested incorrectly.
Downloads:
- Notepad++ MapTool addon
- RPEdit details (v1.3)
- Coding Tips: Modularity and Design
- Videos: Macro Writing Tools