New WMLChecker

The place to post your WML questions and answers.

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.
oesis
Posts: 32
Joined: July 12th, 2007, 8:26 pm

New WMLChecker

Post by oesis »

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.
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.
Anonymissimus
Inactive Developer
Posts: 2461
Joined: August 15th, 2008, 8:46 pm
Location: Germany

Re: New WMLChecker

Post by Anonymissimus »

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

Code: Select all

C:\Program Files\Java\jdk1.5.0_09\bin\javaw.exe -jar "C:\... directory_with_WMLCHECKER.zip\WMLCHECKER\WMLCHECKER\WMLChecker.jar"
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 ?
projects (BfW 1.12):
A Simple Campaign: campaign draft for wml startersPlan Your Advancements: mp mod
The Earth's Gut: sp campaignSettlers of Wesnoth: mp scenarioWesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign
User avatar
KunoNoOni
Posts: 41
Joined: August 17th, 2009, 6:11 am

Re: New WMLChecker

Post by KunoNoOni »

oesis wrote:\I'd like to know if anyone knows where a more complete list of tags and keys are.
There is a thread that provides syntax highlighting, so you should find a nice list in one of those.


-Bill
User avatar
melinath
Posts: 1298
Joined: May 20th, 2009, 7:42 am

Re: New WMLChecker

Post by melinath »

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.
Exasperation
Posts: 462
Joined: June 8th, 2006, 3:25 am

Re: New WMLChecker

Post by Exasperation »

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.
User avatar
melinath
Posts: 1298
Joined: May 20th, 2009, 7:42 am

Re: New WMLChecker

Post by melinath »

*slaps forehead* of course.

But the first-non-whitespace solution would cover that.
oesis
Posts: 32
Joined: July 12th, 2007, 8:26 pm

Re: New WMLChecker

Post by oesis »

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
User avatar
melinath
Posts: 1298
Joined: May 20th, 2009, 7:42 am

Re: New WMLChecker

Post by melinath »

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
Okay. Running Ubuntu Jaunty here. I've successfully extracted the jar file... here's the directory tree.

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
I see no "File Chooser" to select anything, nor do I see Errors.txt, and I'm also confused about why your instructions don't include, say, running anything.

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.
User avatar
Sapient
Inactive Developer
Posts: 4453
Joined: November 26th, 2005, 7:41 am
Contact:

Re: New WMLChecker

Post by Sapient »

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.
http://www.wesnoth.org/wiki/User:Sapient... "Looks like your skills saved us again. Uh, well at least, they saved Soarin's apple pie."
User avatar
ancestral
Inactive Developer
Posts: 1108
Joined: August 1st, 2006, 5:29 am
Location: Motion City

Re: New WMLChecker

Post by ancestral »

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.
What is wmllint_gui?
Wesnoth BestiaryPREVIEW IT HERE )
Unit tree and stat browser
CanvasPREVIEW IT HERE )
Exp. map viewer
User avatar
KunoNoOni
Posts: 41
Joined: August 17th, 2009, 6:11 am

Re: New WMLChecker

Post by KunoNoOni »

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
oesis
Posts: 32
Joined: July 12th, 2007, 8:26 pm

Re: New WMLChecker

Post by oesis »

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.
User avatar
melinath
Posts: 1298
Joined: May 20th, 2009, 7:42 am

Re: New WMLChecker

Post by melinath »

I did get it to run (see my last post), but as Anonymissimus said, double clicking opens an archive manager.
User avatar
Sapient
Inactive Developer
Posts: 4453
Joined: November 26th, 2005, 7:41 am
Contact:

Re: New WMLChecker

Post by Sapient »

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
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.
http://www.wesnoth.org/wiki/User:Sapient... "Looks like your skills saved us again. Uh, well at least, they saved Soarin's apple pie."
User avatar
KunoNoOni
Posts: 41
Joined: August 17th, 2009, 6:11 am

Re: New WMLChecker

Post by KunoNoOni »

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 :P


-KunoNoOni
Post Reply