New WMLChecker
Moderator: Forum Moderators
Forum rules
- Please use [code] BBCode tags in your posts for embedding WML snippets.
- To keep your code readable so that others can easily help you, make sure to indent it following our conventions.
New WMLChecker
Recently I started on my 2nd attempt at a WML checker. My goal behind it was to give clearer error messages as well as line numbers. It checks keys as well as tags. Currently the main problems are due to macros ,though it can parse them, and a limited library of tags and keys which cause false errors. Due to this it considers anything between [ ] to be a tag. I would appreciate any response to how well this actually finds errors in your documents as for the most part it has only parsed functional code and I'd like to know if anyone knows where a more complete list of tags and keys are. The program is in jar format in the folder and the ouput is in Errors.txt.
Click Check, do not click Add.
This is now a slightly updated version.
Click Check, do not click Add.
This is now a slightly updated version.
- Attachments
-
- WMLCHECKER.zip
- (66.86 KiB) Downloaded 170 times
Last edited by oesis on August 27th, 2009, 11:49 pm, edited 2 times in total.
-
- Inactive Developer
- Posts: 2461
- Joined: August 15th, 2008, 8:46 pm
- Location: Germany
Re: New WMLChecker
for all who are trying to "open the jar file" - double clicking only leads to winrar, ey !?
You need the software package "Java Runtime Environment" or "Java Development Kit" which also works for me, I already have had this because of eclipse. On my machine it is called jdk1.5.0_09. Go to the homepage of Sun Microsystems, should be available somewhere there.
unzip the downloaded file with winrar (Extract to WMLCHECKER)
Then create a link to WMLChecker.jar and edit in the link's properties the target box
And then doubleclick on the link.
Thread that helped me
http://www.techsupportforum.com/microso ... -file.html
@oesis
Wow, looks quite promising. Although it reports a lot of supposed wml mistakes that aren't - for example
id on line 69 key cannot be in tag [unit] from line 67 to 80
which is wrong.
If you want your program to be used you should provide some help like I did above btw.
/edit
What about custom macros defined somewhere in another file ?
You need the software package "Java Runtime Environment" or "Java Development Kit" which also works for me, I already have had this because of eclipse. On my machine it is called jdk1.5.0_09. Go to the homepage of Sun Microsystems, should be available somewhere there.
unzip the downloaded file with winrar (Extract to WMLCHECKER)
Then create a link to WMLChecker.jar and edit in the link's properties the target box
Code: Select all
C:\Program Files\Java\jdk1.5.0_09\bin\javaw.exe -jar "C:\... directory_with_WMLCHECKER.zip\WMLCHECKER\WMLCHECKER\WMLChecker.jar"
Thread that helped me
http://www.techsupportforum.com/microso ... -file.html
@oesis
Wow, looks quite promising. Although it reports a lot of supposed wml mistakes that aren't - for example
id on line 69 key cannot be in tag [unit] from line 67 to 80
which is wrong.
If you want your program to be used you should provide some help like I did above btw.
/edit
What about custom macros defined somewhere in another file ?
projects (BfW 1.12):
A Simple Campaign: campaign draft for wml starters • Plan Your Advancements: mp mod
The Earth's Gut: sp campaign • Settlers of Wesnoth: mp scenario • Wesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign
A Simple Campaign: campaign draft for wml starters • Plan Your Advancements: mp mod
The Earth's Gut: sp campaign • Settlers of Wesnoth: mp scenario • Wesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign
Re: New WMLChecker
There is a thread that provides syntax highlighting, so you should find a nice list in one of those.oesis wrote:\I'd like to know if anyone knows where a more complete list of tags and keys are.
-Bill
Re: New WMLChecker
It may be an advantage to treat everything between [] as a tag. Take for example custom ability tags - you want to be able to check them, too. Conversely, I can't think of many situations where [] wouldn't be a tag. Maybe just check if it's inside quotes, or the first non-whitespace in the line, or something.
-
- Posts: 462
- Joined: June 8th, 2006, 3:25 am
Re: New WMLChecker
The biggest one is probably accessing arrays.
If you're using an array foo, then you're going to be doing a lot of foo[$i].bar or foo[3].baz.
If you're using an array foo, then you're going to be doing a lot of foo[$i].bar or foo[3].baz.
Re: New WMLChecker
*slaps forehead* of course.
But the first-non-whitespace solution would cover that.
But the first-non-whitespace solution would cover that.
Re: New WMLChecker
Im not sure about arrays, can the contents of them be a tag or key. I thought they could only store data so my parser skips them.
Anonymissimus: It could not take macros defined in another file. But I added that functionality since and the current version can.
Since you wanted instructions here;
1. First open the Jar File
2. In the File chooser select the file you want to check
3. Click the check button
4. Open Errors.txt and thats where the errors are
If you want to access macros from other files while checking your file drag the files you want the macros from into the File Library folder. The checker will not check these files but just load the macro. The Error message will specify what file an error came from for each line. If no file is specified that means it is the main fail where the error is.
Errors are split into 5 types
Unclosed tags; these are tags which have an opening tag but no closing tag
UnOpened tags; this is a closing tag with no opening tag
Improper Tag cross; This means that tags are not properly nested, IE [if] [then] [/if] [/then]
Cannot be in; This means that a tag is not supposed to be in another tag
Key cannot be in; This means that a particular key is not supposed to be inside of the tag
I edited my post and put in the updated version of the checker
Anonymissimus: It could not take macros defined in another file. But I added that functionality since and the current version can.
Since you wanted instructions here;
1. First open the Jar File
2. In the File chooser select the file you want to check
3. Click the check button
4. Open Errors.txt and thats where the errors are
If you want to access macros from other files while checking your file drag the files you want the macros from into the File Library folder. The checker will not check these files but just load the macro. The Error message will specify what file an error came from for each line. If no file is specified that means it is the main fail where the error is.
Errors are split into 5 types
Unclosed tags; these are tags which have an opening tag but no closing tag
UnOpened tags; this is a closing tag with no opening tag
Improper Tag cross; This means that tags are not properly nested, IE [if] [then] [/if] [/then]
Cannot be in; This means that a tag is not supposed to be in another tag
Key cannot be in; This means that a particular key is not supposed to be inside of the tag
I edited my post and put in the updated version of the checker
Re: New WMLChecker
Okay. Running Ubuntu Jaunty here. I've successfully extracted the jar file... here's the directory tree.oesis wrote:1. First open the Jar File
2. In the File chooser select the file you want to check
3. Click the check button
4. Open Errors.txt and thats where the errors are
Code: Select all
./MacroUtil.class
./Face.class
./Face$1.class
./AERROR.class
./WMLChecker.class
./ReadTags.class
./Line.class
./Linstener.class
./Check.class
./CreateTags.class
./Reader.class
./Tag.class
./Macro.class
EDIT:: Aha! Thanks to Soliton for providing the complete solution on IRC.
How to open the jar file in Linux:
1-0. Extract the directory WMLCHECKER somewhere.
1-1. Navigate to it in a console.
1-2. Type: java -jar WMLChecker.jar
You may need to install specific packages if they aren't already installed.
Re: New WMLChecker
you know, it would probably be a lot more valuable for wesnoth development if you designed a GUI front-end for wmllint, since that is the WML sanity checker which is being actively maintained in trunk.
however, since wmllint is written in python, it'd make a heckuvalot more sense to write a GUI front end in that language as well.
however, since wmllint is written in python, it'd make a heckuvalot more sense to write a GUI front end in that language as well.
http://www.wesnoth.org/wiki/User:Sapient... "Looks like your skills saved us again. Uh, well at least, they saved Soarin's apple pie."
Re: New WMLChecker
What is wmllint_gui?Sapient wrote:however, since wmllint is written in python, it'd make a heckuvalot more sense to write a GUI front end in that language as well.
Wesnoth Bestiary ( PREVIEW IT HERE )
Unit tree and stat browser
Canvas ( PREVIEW IT HERE )
Exp. map viewer
Unit tree and stat browser
Canvas ( PREVIEW IT HERE )
Exp. map viewer
Re: New WMLChecker
I just checked and wmllint_gui is a GUI for wmllint written in wxPython. I just added the extension .pyw to the end of it so that I could run the program without the console popping up.
-KunoNoOni
-KunoNoOni
Re: New WMLChecker
melinath I find it odd that you can't run it from the jar file, I thought all you had to do was double click it to get it to run.
Re: New WMLChecker
I did get it to run (see my last post), but as Anonymissimus said, double clicking opens an archive manager.
Re: New WMLChecker
That's true, but it's very simplistic and IMO it would also be more convenient for windows users if it were distributed as an executable binary rather than requiring them to download and install the wx modules. So there's definitely a lot of room for improvement.KunoNoOni wrote:I just checked and wmllint_gui is a GUI for wmllint written in wxPython. I just added the extension .pyw to the end of it so that I could run the program without the console popping up.
-KunoNoOni
http://www.wesnoth.org/wiki/User:Sapient... "Looks like your skills saved us again. Uh, well at least, they saved Soarin's apple pie."
Re: New WMLChecker
Oh I completely agree... when I tried it nothing happened, it wasn't until I tried to run it in the command prompt that I saw why it wasn't working. it didn't recognize the word python as a command. seems my environment variables weren't set correctly
-KunoNoOni
-KunoNoOni