|
 |
|

February 28th, 2010, 06:43 PM
|
 |
Staff Member and irregular helper
|
|
Join Date: Mar 2005
Location: Sweden
Posts: 3,776
|
|
|
Galaxy parser
http://github.com/phyrex1an/galaxy-parser
Parses all .galaxy files I (read Azlier) found. Completely without comments and otherwise untested. But hey, what is a beta-less coder to do?
You need the haskell platform for it to compile.
Or try the online galaxy syntax checker.
Last edited by phyrex1an; March 5th, 2010 at 08:24 AM.
|

March 1st, 2010, 02:43 PM
|
|
Hai.
|
|
Join Date: May 2009
Posts: 1,882
|
|
|
What exactly does it parse into? O.o
|

March 2nd, 2010, 01:17 AM
|
|
Good Idea™
|
|
Join Date: Jul 2007
Location: Australia
Posts: 3,857
|
|
Can we has [GALAXY] tagz nao? 
They can has highlight native list.
|

March 2nd, 2010, 02:32 AM
|
 |
Staff Member and irregular helper
|
|
Join Date: Mar 2005
Location: Sweden
Posts: 3,776
|
|
Quote:
Originally Posted by Lyerae
What exactly does it parse into? O.o
|
A haskell data structure. Check src/Galaxy/SyntaxTree.hs. As such, this doesn't really do that much. Think of it as a library for more useful tools.
Quote:
Originally Posted by Jesus4Lyf
Can we has [GALAXY] tagz nao? 
They can has highlight native list.
|
This is not really related to a syntax highlighter but yeah, it is coming.
|

March 2nd, 2010, 10:21 AM
|
 |
Staff Member and irregular helper
|
|
Join Date: Mar 2005
Location: Sweden
Posts: 3,776
|
|
Parser has been updated based on j4l's array example.
@Jesus4Lyf: Have you tried to get the parser running? It should function as a poor syntax checker (with plenty of false positives/negatives and somewhat cryptic error messages). I guess that you don't get any error reporting from sc2 itself so it should be an improvement
|

March 2nd, 2010, 04:46 PM
|
|
Good Idea™
|
|
Join Date: Jul 2007
Location: Australia
Posts: 3,857
|
|
Quote:
Originally Posted by phyrex1an
@Jesus4Lyf: Have you tried to get the parser running? It should function as a poor syntax checker (with plenty of false positives/negatives and somewhat cryptic error messages). I guess that you don't get any error reporting from sc2 itself so it should be an improvement 
|
I can't be stuffed trying to compile it. >.<' (ie. I can't double click it, so I'm not sure what to do.  )
So far I'm just writing in Notepad++, importing into a map with Ladik's, then having it run in SC2 BETA, and seeing if it works...
|

March 2nd, 2010, 05:29 PM
|
 |
Staff Member and irregular helper
|
|
Join Date: Mar 2005
Location: Sweden
Posts: 3,776
|
|
Quote:
Originally Posted by Jesus4Lyf
I can't be stuffed trying to compile it. >.<' (ie. I can't double click it, so I'm not sure what to do.  )
|
Well, I'm partly to blame since I forgot to include the example implementation
Anyway, perhaps more noob friendly: http://phyrex1an.net/galaxy.php
|

March 2nd, 2010, 06:33 PM
|
|
Good Idea™
|
|
Join Date: Jul 2007
Location: Australia
Posts: 3,857
|
|
Failed to parse this:
Jass:
include "TriggerLibs/NativeLib"
void InitLibs () {
libNtve_InitLib();
}
unitgroup PlayerUnits(int player){
return AIFindUnits(player,null,Point(0,0),500000,c_noMaxCount);
}
trigger gt_MeleeInitialization;
void testFunc(){
unitgroup GG=PlayerUnits(1);
UIDisplayMessage(PlayerGroupAll(), c_messageAreaSubtitle, StringToText(IntToString(UnitGroupCount(GG,c_unitCountAll))));
}
bool gt_OnChat_Func (bool testConds, bool runActions) {
int i=32;
testFunc();
return true;
}
bool gt_MeleeInitialization_Func (bool testConds, bool runActions) {
if (runActions) {
MeleeInitResources();
MeleeInitUnits();
MeleeInitAI();
MeleeInitOptions();
}
gt_OnChat_Func(false,false);
return true;
}
void gt_MeleeInitialization_Init () {
gt_MeleeInitialization = TriggerCreate("gt_MeleeInitialization_Func");
TriggerAddEventMapInit(gt_MeleeInitialization);
TriggerAddEventChatMessage(TriggerCreate("gt_OnChat_Func"), 1, "", false);
TriggerAddEventChatMessage(TriggerCreate("gt_OnChat_Func"), 1, "", true);
}
void InitTriggers () {
gt_MeleeInitialization_Init();
}
void InitMap () {
InitLibs();
InitTriggers();
}
(Just some demo code I'm working on, mindlessly. It compiles in SC2 beta.)
|

March 2nd, 2010, 06:45 PM
|
 |
Swish swish, back and forth.
|
|
Join Date: Jun 2008
Location: ?
Posts: 3,965
|
|
|
Galaxy looks really promising, hopefully it follows through at release. :s
__________________
[14:43] <Vestras> I hate fags and jews
|

March 2nd, 2010, 08:53 PM
|
|
Good Idea™
|
|
Join Date: Jul 2007
Location: Australia
Posts: 3,857
|
|
Umm.
Jass:
typedef int[3] ArrType;
Works.
Jass:
void readattwo (ArrType ar){
UIDisplayMessage(PlayerGroupAll(), c_messageAreaSubtitle, StringToText(IntToString(ar[2])));
}
Works.
Jass:
void readattwo (int[3] ar){
UIDisplayMessage(PlayerGroupAll(), c_messageAreaSubtitle, StringToText(IntToString(ar[2])));
}
Works.
Jass:
void readattwo (int[] ar){
UIDisplayMessage(PlayerGroupAll(), c_messageAreaSubtitle, StringToText(IntToString(ar[2])));
}
Does not work.
Jass:
ArrType someVar;
readattwo(someVar);
Does not work. o.O
So I think it's half implemented.
Edit:
Holy crap, this compiles:
Jass:
typedef int[3] ArrType;
void readattwo (ArrType* ar){
}

>Galaxy looks really promising
Does now.
Edit: WINNER!
Figured out pointer syntax.
Jass:
typedef int[3] ArrType;
ArrType testArr;
void readattwo (ArrType* ar){
UIDisplayMessage(PlayerGroupAll(), c_messageAreaSubtitle, StringToText(IntToString((*ar)[2])));
}
bool testthings (bool testConds, bool runActions) {
ArrType* someVar = &testArr;
testArr[2]=7;
testArr[1]=9;
testArr[0]=3;
readattwo(someVar);
return true;
}
Compiles. This is getting cooler and cooler.
Whee. I'm the first person to use array pointers in SC2 and post about it online...
Last edited by Jesus4Lyf; March 2nd, 2010 at 09:05 PM.
|

March 2nd, 2010, 09:39 PM
|
|
Hai.
|
|
Join Date: May 2009
Posts: 1,882
|
|
|
What are pointers in Galaxy? They can't be like C ones... Can they? O.o
|

March 2nd, 2010, 09:57 PM
|
|
Good Idea™
|
|
Join Date: Jul 2007
Location: Australia
Posts: 3,857
|
|
|
Well that prints "7", so... yea..
|

March 2nd, 2010, 10:12 PM
|
 |
Swish swish, back and forth.
|
|
Join Date: Jun 2008
Location: ?
Posts: 3,965
|
|
|
Ooo.. Maybe I should start playing around with this.
__________________
[14:43] <Vestras> I hate fags and jews
|

March 2nd, 2010, 10:17 PM
|
|
Hai.
|
|
Join Date: May 2009
Posts: 1,882
|
|
Quote:
Originally Posted by Jesus4Lyf
Well that prints "7", so... yea..
|
Wait, your saying they ARE like in C?
|

March 2nd, 2010, 10:30 PM
|
|
Good Idea™
|
|
Join Date: Jul 2007
Location: Australia
Posts: 3,857
|
|
WIN
Jass:
struct murder {
string means;
string time;
};
murder[128] pool;
void apply(murder* attempt, string target){
UIDisplayMessage(PlayerGroupAll(), c_messageAreaSubtitle, StringToText(target+" has died at "+attempt->time+" by: "+attempt->means+"."));
}
bool testthings (bool testConds, bool runActions) {
murder* how=&(pool[0]);
how->time="midnight";
how->means="axe to the fricking face";
apply(how,"A young boy");
return true;
}
Compiles. The first example of structs in Galaxy! Just took 5 hours or so of sitting here trial and erroring.
Now I have to say... the learning curve is huge for newbies. People are gonna struggle.. =/
>Wait, your saying they ARE like in C?
Yes.
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|