Jump to content


Photo

Gml Beautifier (parser)-- Beta Release


  • Please log in to reply
16 replies to this topic

#1 Josh @ Dreamland

Josh @ Dreamland

    GMC Member

  • New Member
  • 455 posts
  • Version:GM8

Posted 16 July 2006 - 09:19 PM

This is for anybody making say, G-Java, G-Pascal, and, if there is one, a GM-C :)

Whatever you may need a beautifier (parser) for, find it here. :lol:

This is a script library.

For use, simply call

parse(inputfile,outputfile)

argument0=input file
argument1=output file


Good luck with your project.



Unfortunately, this forum screws everything up when you post this much text, so you will have to download it. :(
I hate that.
Fortunately, 64Digits has quick, Direct, reliable downloads. ;)
I love 64Digits.


CLICK HERE TO DOWNLOAD

NOTE: This was originally intended for G-Java; so the code is personalized for it. You may change the error message, and should just ignore the G_Java part in the notes.


Please beta test this; It has passed my original tests, but I have not yet exploited more complicated scenarios. Thusly, do not use this in a big project yet.

Thanks!

Edited by Josh @ Dreamland, 17 July 2006 - 12:54 PM.

  • 0

#2 ari_aaron

ari_aaron

    GMC Member

  • New Member
  • 295 posts

Posted 16 July 2006 - 09:46 PM

What does this do exactly?
  • 0

#3 Josh @ Dreamland

Josh @ Dreamland

    GMC Member

  • New Member
  • 455 posts
  • Version:GM8

Posted 16 July 2006 - 10:52 PM

It parses GML code, converting
if a=1
a=0
else { b=1 c=1 }

To something like this:
if (a=1)
{
    a=0;
};
else 
{
    b=1;
    c=1;
};

This is the beta though. I'm not sure how it will handle more complicated codes.

Could everyone please pitch in and give it everything you have?

Try to freeze it, or get it to screw up. Then PLEASE tell me what did it in.

Thanks in advance.
  • 0

#4 ChIkEn AtE mY dOnUtS

ChIkEn AtE mY dOnUtS

    Pwner of barcodes

  • GMC Member
  • 2410 posts

Posted 16 July 2006 - 11:17 PM

HAHA!!

You mentioned my G-Pascal :(

Thanks ;)

That made me happy

That should be helpful if i continue G-Pascal..
  • 0

#5 Josh @ Dreamland

Josh @ Dreamland

    GMC Member

  • New Member
  • 455 posts
  • Version:GM8

Posted 17 July 2006 - 12:23 AM

Okay... you're.. welcome.. chicken... :)
Yeah... ;)

Have you tried it out?
  • 0

#6 kovreu01

kovreu01

    Gary Z

  • New Member
  • 173 posts

Posted 17 July 2006 - 04:39 AM

Umm...

This is great! For ages I've been sick of downloading stupid games where the owners put in crappy coding like

a=0
if john<peter
dosomething
return false

Good work!

Right now I'm visiting Watersoft Games.
  • 0

#7 Yourself

Yourself

    The Ultimate Pronoun

  • Retired Staff
  • 7352 posts
  • Version:Unknown

Posted 17 July 2006 - 05:10 AM

Wouldn't it be better to call this a GML beautifier? True it parses GML, but that's not particularly descriptive since it leaves you wondering what it parses it into. And it doesn't really parse it into a different structure as the code is left essentially the same, but in a better and more structured form.

In one of the exampels you gave I saw semi-colons after a right bracket '}'. That's not really what I'd call proper as a pair of brackets isn't itself a statement, but merely a group of statements. There shouldn't be a semi-colon following it.
  • 0

#8 9_6

9_6

    Guest

  • GMC Member
  • 3627 posts

Posted 17 July 2006 - 10:52 AM

I can't seem to get this copied propperly out of that code box.
It always inserts linebreaks and leaves parts away.

Might one ask for a gm6 or a txt file with the script?
  • 0

#9 Josh @ Dreamland

Josh @ Dreamland

    GMC Member

  • New Member
  • 455 posts
  • Version:GM8

Posted 17 July 2006 - 12:50 PM

@kovreu-
Glad it'll be of use. :)

@Yourself-
Changed the name and will remove the semicolon after the right braces.

@9_6- Done. Anyone who copied and pasted may want to download in case worst comoes to worst.
  • 0

#10 TGMG

TGMG

    G-java creator

  • New Member
  • 706 posts
  • Version:GM8

Posted 17 July 2006 - 06:28 PM

Amazing work :) I actually thought you had forgotten.

This is very, very useful and will use it in the latest version of g-java. I will give you full credit and will merge this with another gml parser I have from Blijbol.

The latest version of G-java is written in java so I (or Ismavatar, BZGaming) will rewrite this code to java ;)

So if all goes well it will be able to convert code!

Thank you.
  • 0

#11 Josh @ Dreamland

Josh @ Dreamland

    GMC Member

  • New Member
  • 455 posts
  • Version:GM8

Posted 18 July 2006 - 10:21 PM

Excellent!! It looks like there are no bugs, but I would test it extensively, if I were you.

EDIT) I will fix any and all glitches you encounter. Please reply here or PM me if you find any.

Edited by Josh @ Dreamland, 18 July 2006 - 10:24 PM.

  • 0

#12 Sheik06

Sheik06

    GMC Member

  • New Member
  • 589 posts

Posted 18 July 2006 - 10:54 PM

Ha, awesome, its really great and usefull, I have old games all coded in this crappy way, Im gonna beautify them and work again. Thanks!
  • 0

#13 TGMG

TGMG

    G-java creator

  • New Member
  • 706 posts
  • Version:GM8

Posted 20 July 2006 - 11:21 PM

Can I request a few things?

For java code the code needs to hava:

() in if statements and ==
e.g if (1 == 2)
Not: if 1==2 or if (1=2)

All lines have to have ";" (Already done this?)

Not statements have to be:
if (1!=2)

And statemens have to use &&
if (1==2) && (1 !=2)

Or statements have to use ||
if (1==2) || (1 !=2)

Also you have to make sure it doesn't replace or,and,if... in comments or strings <_<

Thanks
  • 0

#14 BZGaming

BZGaming

    GMC Member

  • New Member
  • 514 posts

Posted 21 July 2006 - 12:07 AM

GM_Guru, why don't you modify the code?

BZ
  • 0

#15 J-Labs

J-Labs

    J-Labs

  • New Member
  • 339 posts

Posted 21 July 2006 - 01:27 AM

Well i am one of the non lazy peoplewho does this automatically, but good anyways.
  • 0

#16 Josh @ Dreamland

Josh @ Dreamland

    GMC Member

  • New Member
  • 455 posts
  • Version:GM8

Posted 21 July 2006 - 07:39 PM

Will do, GM Guru. <_<
  • 0

#17 TGMG

TGMG

    G-java creator

  • New Member
  • 706 posts
  • Version:GM8

Posted 23 July 2006 - 10:47 PM

Thanks :)
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users