Pages: [1]
  Print  
Author Topic: Auto Formatter for LGM  (Read 702 times)
Offline (Male) Fede-lasse
Posted on: March 30, 2011, 04:24:09 AM

AI Programmer
Fede
Location: Denmark, Europe
Joined: Oct 2008
Posts: -2342534e-10
MSN Messenger - lasse1706@hotmail.com
View Profile WWW Email
http://jsbeautifier.org/

The above thing is a JavaScript beautifier (auto formatter). It works 99% with GML. The only issues I've had with it is sometimes improper formatting when using var. Works with C++? I dunno. With EDL? Hopefully.

It's written in Python and the source code is provided. I thought that it may be of some use and may save some time.
Logged
Call me Fede.
Offline (Unknown gender) MrGriggs
Reply #1 Posted on: March 30, 2011, 05:02:24 AM

Member
Joined: Dec 2010
Posts: 129

View Profile Email
Hey, this is pretty cool!

An auto commentation program would be nice too :P.
Logged
Offline (Male) Fede-lasse
Reply #2 Posted on: March 30, 2011, 01:26:46 PM

AI Programmer
Fede
Location: Denmark, Europe
Joined: Oct 2008
Posts: -2342534e-10
MSN Messenger - lasse1706@hotmail.com
View Profile WWW Email
It's because an auto format option for LGM has been mentioned, so I thought I'd show this tool that I often use in connection with GM.
Logged
Call me Fede.
Offline (Male) RetroX
Reply #3 Posted on: March 30, 2011, 03:31:37 PM

Master of all things Linux
Contributor
Location: US
Joined: Apr 2008
Posts: 1121
MSN Messenger - classixretrox@gmail.com
View Profile Email
Python != Java and it won't work here.

Plus, I'm sure that the people here are stubborn and will want to make things on their own.
Logged
My Box: Phenom II 3.4GHz X4 | ASUS ATI RadeonHD 5770, 1GB GDDR5 RAM | 1x4GB DDR3 SRAM | Arch Linux, x86_64 (Cube) / Windows 7 x64 (Blob)
Quote from: Fede-lasse
Why do all the pro-Microsoft people have troll avatars? :(
Offline (Female) IsmAvatar
Reply #4 Posted on: March 30, 2011, 03:42:36 PM

LateralGM Developer
LGM Developer
Location: Pennsylvania/USA
Joined: Apr 2008
Posts: 849

View Profile Email
As RetroX said, Python != Java, so in order for this to work, LGM would have to call the formatter externally, using Python (hoping the user has it installed), adding one more dependency on LGM. It'd be great if it were in C/++ or Java.
Logged
Offline (Male) Fede-lasse
Reply #5 Posted on: March 31, 2011, 05:08:33 AM

AI Programmer
Fede
Location: Denmark, Europe
Joined: Oct 2008
Posts: -2342534e-10
MSN Messenger - lasse1706@hotmail.com
View Profile WWW Email
Actually, it's available in JavaScript, too. Can't you somehow convert it?

@Retro, stop being so pessimistic, please?
« Last Edit: March 31, 2011, 05:25:56 AM by Fede-lasse » Logged
Call me Fede.
Offline (Unknown gender) luiscubal
Reply #6 Posted on: March 31, 2011, 11:22:27 AM
Member
Joined: Jun 2009
Posts: 476

View Profile Email
Quote
Actually, it's available in JavaScript, too. Can't you somehow convert it?
JavaScript != Java

Yes, one can convert JS to Java, but that also applies to Python.
Also, about EDL, be aware of the existence of begin/end, which will probably screw up the beautifier in epic proportions.
Logged
Offline (Unknown gender) TGMG
Reply #7 Posted on: March 31, 2011, 05:01:00 PM

Developer
Joined: Jun 2008
Posts: 103

View Profile Email
You could probably use Jython to compile the python into java classes, but that would add a dependency to Jython in lgm. Probably best just to convert it into java manually.
Logged
forums.G-creator.org
GMbed 2.0 :: Embed you gm games in websites.
Offline (Male) RetroX
Reply #8 Posted on: March 31, 2011, 06:23:18 PM

Master of all things Linux
Contributor
Location: US
Joined: Apr 2008
Posts: 1121
MSN Messenger - classixretrox@gmail.com
View Profile Email
@Retro, stop being so pessimistic, please?
I'm not really trying to be pessimistic; just stating the fact that it won't work.

Java still isn't JavaScript, and while they share a vague similarity in syntax, it's still a giant chore to convert it.

As in, it's less of a chore to code it from scratch than to convert it.  Not to mention that using Java's mechanisms rather than JS's hacks will be a lot faster.
Logged
My Box: Phenom II 3.4GHz X4 | ASUS ATI RadeonHD 5770, 1GB GDDR5 RAM | 1x4GB DDR3 SRAM | Arch Linux, x86_64 (Cube) / Windows 7 x64 (Blob)
Quote from: Fede-lasse
Why do all the pro-Microsoft people have troll avatars? :(
Offline (Male) Josh @ Dreamland
Reply #9 Posted on: April 01, 2011, 12:11:16 AM

Prince of all Goldfish
Developer
Location: Ohio, United States
Joined: Feb 2008
Posts: 2339

View Profile Email
Or, I mean, we could just write our own and not fuck with python-java conversions and javascript-EDL differences (The largest of which have already been mentioned).

It's not about being stubborn. If you find me a beautifier specifically tailored to a language between C++ and GML, I'd be happy to slap it in. If you want to point me to tools that might help me, that most people ultimately avoid, I'm going to say, "fuck you," and do it my way.
Logged
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble
"I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
Pages: [1]
  Print