| 09-14-2004, 01:52 PM | #1 |
Here it is. It checks for syntax errors and can clean unused globals, constants, locals, parameters and functions and simplify if-structures and expressions. The function/variable cleaner also takes ExecuteFunc and real variable events into account. The interpreter interprets all functions based off interpretable natives. It can parse all types of JASS-files including wct + wtg files. Get it here This is a beta so there might be some remaining bugs, feel free to post problems here. Please take the time to test it - I'm very proud of it. EDIT: AN UPDATED VERSION IS AVAILABE AT THE SAME LINK NOW Have fun! ![]() |
| 09-14-2004, 02:11 PM | #2 |
Nice. "Clear Locals" seems to reliably cause a runtime error. |
| 09-14-2004, 10:53 PM | #3 |
Nice tool indeed. However it got some things wrong there, lot of things it thinks "possibly" don't work in AI that actualy works fine. Runned a check on AMAIs common.ai Listing all natives it reported to maybe not be working here: CreateSound InitGameCache DisplayTimedTextToPlayer GetStoredBoolean GetStoredInteger GetStoredReal HaveStoredInteger StoreBoolean StoreInteger SetPlayerName GroupEnumUnitsOfType GroupTargetOrder GroupPointOrder GroupPointOrderLoc IssuePointOrder IssuePointOrderLoc IssueImmediateOrder I guess there is some more obvious ones that works as well that you can find out by looking at these. (functions that takes strings works in AI, but not that returns string.) Also encountered "Run time error: '9', Subscript out of range" when trying to run a simplify on this common.ai, maybe it's too big? But once this program gets patched up it will be a awssome tool I think :) |
| 09-14-2004, 11:36 PM | #4 |
Glad to see you're progessing well on it. I found a bug relating to ExecuteFunc. In the attached map script, it removes NotUsed function even though it does get called via ExecuteFunc. Also, I think the only reason it doesn't remove NotUse (no D) is because it is part of the constant string in the call that runs NotUsed(with a D) |
| 09-15-2004, 11:03 AM | #5 |
Very nice :) It would be good, to be able to optimize common.ai in context of a bunch of AI scripts so it does not remove things that are used in there (I think you can't do that right now). The same I guess would be good with Blizzard.j and map scripts. The run time error Zalamander reported seems to happen when Simplify Code is turned on. Most of the natives reported as not working do work properly (the ones that take strings, only those that return strings don't work). And it would be nice to be able to switch that report off. |
| 09-15-2004, 02:12 PM | #6 |
Sounds awesome, bad luck though I didn't have the chance to test it yet |
| 09-15-2004, 04:16 PM | #7 |
Oh, yeah, will have to care that only string returners don't work in AI but string parameters work fine. And yes, I'll add another checkbox to hide "minor" errors (such as the string returning natives in ai, endless loops, never used locals and the like) that arn't actually found by the WE compiler as well. I'll also test simlifying the AMAI common.ai, let's see if I also get errors. Anyone else came across the error Grater reported? Oh, and I didn't mention that you can place your custom common.j, blizzard.j or common.ai file in the same directory, so they will be loaded at startup. |
| 09-15-2004, 11:52 PM | #8 |
Pitzer I get that error message simply by loading the "test.j", ticking "Clear Locals" then hitting check. Nothing fancy required. Because all the other functions work fine for me, I can't really imagine it's a problem specific to my windows. |
| 09-17-2004, 11:32 AM | #9 |
Another thing that would be nice is a command line interface for JASSParse. That would allow other programs to easily use its functionality like including it in the AMAI Make process or maybe Lord Vexorian could include it in his map optimizer. |
| 09-17-2004, 02:57 PM | #10 |
Get the new version at the same link again: http://umswe.wc3campaigns.com/weu/JASSParse.rar Bugs fixed: -Grater's runtime error when cleaning locals -Zalamander's runtime error with AMAI common.ai -It won't complain about string taking functions in ai scripts any more -Fixed a bunch of errors in the scanner (new page characters and similar were not recognized, 0x hex integers ...) -Fixed a bunch of errors in parsing boolean expressions (comparisons) -It won't rewrite the new file automatically, you'll be prompted for the new file name, if you choose to rewrite it. Features Added: -I didn't mention that you can edit the errors directly in the error window (select a error and fix it in the line at the bottom) and then rewrite the file (by right clicking the error window) -It can clean libraries in context of other files (like AIAndy suggested). To achive that you will have to first check your custom common.ai file for example, then check all ai files you want and to finally compile the file you need to right-click in the error window and choose Rewrite Common.ai. -You can hide minor errors -It won't necessarily require WC installed (if you place custom common.j, common.ai, blizzard.j files in the same folder) Remaining Problems: - I didn't have the chance to check the ExecuteFunc error Extrarius mentioned (but I'm sure it's a simple one to be fixed) - The option to check wct/wtg files is bugged in the current version (because i had to rewrite some code in the parser and didn't yet update the trigger class) If someone can't wait to test the wct parser you can get the bugfixed older version (which cannont link files) here I'm now adding Lord Vexorian's great script optimizations (the loop merger for array initializatins is a great idea) and I think compiling a command-line app or a dll wouldn't be a problem. I can use a custom VB Linker to compile true windows dlls from VB code. |
| 09-18-2004, 11:28 AM | #11 |
Nice improvements but still not perfect. I dicovered one flaw now while I was searching for a bug in the new AMAI. after commenting out about 256 lines the checker seems to think the file ends where the comments start. like this at line 2000. As you can see it also halts on the special characters on these lines, seems it don't like them but when they are not commented out it at least check the file till the real end at line 16864. here is the file I was testing on so you can test it your self: http://zalamander.fragzone.se/common.zip there is also a syntax error int he file that PJASS can't find, we suspected it to be caused by a special character in the list I commented out that JASS don't work but after commenting out all of them and it still don't work I guess it have to be something else, I will continue to search for that error now. |
| 09-18-2004, 01:11 PM | #12 |
It's possible that I forgot about some special characters, I'll just check you file and it should be easy enough to fix. Also if it comes across a null-character 0x00 it will always think it's at the end of the file (even if it's in a string or wherever), this is because i wanted the same behavior as the World Editor's compiler. But I could change that for parsing AI files because there we obviously don't need such a behavior. I've found a bunch of new bugs myself today but I won't have the chance to upload a new version til Monday or Tuesday. For example some locals got cleaned even if they shouldn't. And I also found a runtime error when parsing a smaller map script after having parsed a larger map script. Wct files are working again and I found the ExecuteFunc bug, Extrarius posted. @ Extrarius: You know it won't interpret SubString(<your global here>,69,70) because you can never know the content of a global (except if you assigned a constant value to that global in the same function before) If it was a constant global it would be interpreted but as in your example it would only take into account that the unknown string is exactly 1 character large but it won't know the exact character. |
| 09-19-2004, 03:42 AM | #13 | |
Quote:
Of course, when you have multiple wildcard expressions like that that match a single identifer, things get trickier since you can only change the parts that don't match any of the wildcards. Also, since the global is only assigned one value and it is never changed, you can treat it as a constant for all intents and purposes, which would allow several kinds of usage. Even if it was assigned multiple constant values, you could know that that part of the string will always be one of 5 different values or something and reduce the .? wildcard to something like maybe [ABCDEF] where [] represents a character set (as in perl-compatable regex) |
| 09-28-2004, 04:59 PM | #14 |
Updated again, it should work fairly well now. Get it at the above link again. For now I won't be able to work on this tool because I don't have the time to. I hope it works well enough for now. |
