Tool Galaxy parser

phyrex1an

Staff Member and irregular helper
Staff member
Reaction score
447
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.

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.
 

phyrex1an

Staff Member and irregular helper
Staff member
Reaction score
447
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 :p
 

Jesus4Lyf

Good Idea™
Reaction score
396
@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 :p
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... :p
 

Jesus4Lyf

Good Idea™
Reaction score
396
Failed to parse this:
JASS:
//==================================================================================================
// 
// Generated Map Script
// 
// Name:   First TD
// Author: Jesus4Lyf
// 
//==================================================================================================
include &quot;TriggerLibs/NativeLib&quot;
//include &quot;TriggerLibs/natives&quot;

//--------------------------------------------------------------------------------------------------
// Library Initialization
//--------------------------------------------------------------------------------------------------
void InitLibs () {
    libNtve_InitLib();
}

//--------------------------------------------------------------------------------------------------
// Snippets
//--------------------------------------------------------------------------------------------------
unitgroup PlayerUnits(int player){
	return AIFindUnits(player,null,Point(0,0),500000,c_noMaxCount);
}


//--------------------------------------------------------------------------------------------------
// Trigger Variables
//--------------------------------------------------------------------------------------------------
trigger gt_MeleeInitialization;

void testFunc(){
	unitgroup GG=PlayerUnits(1);
	UIDisplayMessage(PlayerGroupAll(), c_messageAreaSubtitle, StringToText(IntToString(UnitGroupCount(GG,c_unitCountAll))));
}

/////
// Super cool
bool gt_OnChat_Func (bool testConds, bool runActions) {
	int i=32;
	
	testFunc();
	
//	while (i&gt;0){
//		i-=1;
//		UIDisplayMessage(PlayerGroupAll(), c_messageAreaSubtitle, StringToText(IntToString(i)));
//		UIDisplayMessage(PlayerGroupAll(), 3, StringToText(IntToString(i)));
//		Wait(0,0);
//	}
	
	return true;
}

//--------------------------------------------------------------------------------------------------
// Trigger: Melee Initialization
//--------------------------------------------------------------------------------------------------
bool gt_MeleeInitialization_Func (bool testConds, bool runActions) {
    // Actions
    if (runActions) {
        MeleeInitResources();
        MeleeInitUnits();
        MeleeInitAI();
        MeleeInitOptions();
    }
	gt_OnChat_Func(false,false);
    return true;
}

//--------------------------------------------------------------------------------------------------
void gt_MeleeInitialization_Init () {
    gt_MeleeInitialization = TriggerCreate(&quot;gt_MeleeInitialization_Func&quot;);
    TriggerAddEventMapInit(gt_MeleeInitialization);
	
	TriggerAddEventChatMessage(TriggerCreate(&quot;gt_OnChat_Func&quot;), 1, &quot;&quot;, false);
	TriggerAddEventChatMessage(TriggerCreate(&quot;gt_OnChat_Func&quot;), 1, &quot;&quot;, true);
}

//--------------------------------------------------------------------------------------------------
// Trigger Initialization
//--------------------------------------------------------------------------------------------------
void InitTriggers () {
    gt_MeleeInitialization_Init();
}

//--------------------------------------------------------------------------------------------------
// Map Initialization
//--------------------------------------------------------------------------------------------------
void InitMap () {
    InitLibs();
    InitTriggers();
}

(Just some demo code I'm working on, mindlessly. It compiles in SC2 beta.)
 

Renendaru

(Evol)ution is nothing without love.
Reaction score
309
Galaxy looks really promising, hopefully it follows through at release. :s
 

Jesus4Lyf

Good Idea™
Reaction score
396
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){
	//UIDisplayMessage(PlayerGroupAll(), c_messageAreaSubtitle, StringToText(IntToString(ar[2])));
}

:D
>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 = &amp;testArr;
	testArr[2]=7;
	testArr[1]=9;
	testArr[0]=3;
	readattwo(someVar);
    return true;
}

Compiles. This is getting cooler and cooler. :D

Whee. I'm the first person to use array pointers in SC2 and post about it online... :p
 

Lyerae

I keep popping up on this site from time to time.
Reaction score
105
What are pointers in Galaxy? They can't be like C ones... Can they? o_O
 

Renendaru

(Evol)ution is nothing without love.
Reaction score
309
Ooo.. Maybe I should start playing around with this.
 

Jesus4Lyf

Good Idea™
Reaction score
396
WIN
JASS:
struct murder {
    string means;
    string time;
};
murder[128] pool;
void apply(murder* attempt, string target){
    UIDisplayMessage(PlayerGroupAll(), c_messageAreaSubtitle, StringToText(target+&quot; has died at &quot;+attempt-&gt;time+&quot; by: &quot;+attempt-&gt;means+&quot;.&quot;));
}
bool testthings (bool testConds, bool runActions) {
    murder* how=&amp;(pool[0]);
    how-&gt;time=&quot;midnight&quot;;
    how-&gt;means=&quot;axe to the fricking face&quot;;
    apply(how,&quot;A young boy&quot;);
    return true;
}

Compiles. The first example of structs in Galaxy! Just took 5 hours or so of sitting here trial and erroring. :D

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.
 

Lyerae

I keep popping up on this site from time to time.
Reaction score
105
Oh damn. I think we're going to have some fun with this.
 

Renendaru

(Evol)ution is nothing without love.
Reaction score
309
Jesus is the first coder. Watch he figures out bytecode all over again. That would be hilarious.
 

Jesus4Lyf

Good Idea™
Reaction score
396
Jesus is the first coder. Watch he figures out bytecode all over again.
I'm already giving that a shot.
JASS:
int[128] byteCode;
bool testthings (bool testConds, bool runActions) {
    trigger t=TriggerCreate(&quot;byteCode&quot;);
    if (t!=null){
        UIDisplayMessage(PlayerGroupAll(), c_messageAreaSubtitle, StringToText(&quot;Problems.&quot;));
    }
    TriggerAddEventChatMessage(t, 1, &quot;&quot;, false);
    return true;
}

Amusingly enough, this spells problems. But it also throws a function not found error, so I'm not sure if something can be done with it..
 

Lyerae

I keep popping up on this site from time to time.
Reaction score
105
How are you trying all this? Inserting the code into a map and running it?
 

Jesus4Lyf

Good Idea™
Reaction score
396
Inserting the code into a map and running it?
Yeah. Using Ladik's MPQ to import it into the galaxy mapscript of a map. It's kind of tedious... There's no syntax error messages, any syntax errors causes the entire script to be discarded. Actually, I found any XML errors cause the XML data files to be discarded, also, it seems...
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • The Helper The Helper:
    Happy Sunday!
    +1
  • The Helper The Helper:
    I will be out of town until Sunday evening
    +1
  • The Helper The Helper:
    I am back! Did you miss me LOL
    +1
  • jonas jonas:
    where did you go?
  • The Helper The Helper:
    Jefferson TX on a Paranormal Investigation of a haunted bed and breakfast - I got some friends that are paranormal investigators and they have an RV and do YouTubes
    +1
  • The Helper The Helper:
    It was a lot of fun. The RV was bad ass
  • jonas jonas:
    That sounds like fun!
    +1
  • The Helper The Helper:
    it was a blast!
  • The Helper The Helper:
    I am going to post the Youtube of the investigation in the forums when it is ready
    +1
  • jonas jonas:
    cool!
  • vypur85 vypur85:
    Sounds cool TH.
  • tom_mai78101 tom_mai78101:
    I was on a Legend of Zelda marathon...
  • tom_mai78101 tom_mai78101:
    Am still doing it now
    +1
  • jonas jonas:
    which one(s) are you playing?
  • jonas jonas:
    I played a little bit of the switch title two weeks ago and found it quite boring
  • The Helper The Helper:
    just got back from San Antonio this weekend had the best Buffalo Chicken Cheesesteak sandwhich in Universal City, TX - place was called Yous Guys freaking awesome! Hope everyone had a fantastic weekend!
    +1
  • The Helper The Helper:
    Happy Tuesday!
  • The Helper The Helper:
    We have been getting crazy numbers reported by the forum of people online the bots are going crazy on us I think it is AI training bots going at it at least that is what it looks like to me.
  • The Helper The Helper:
    Most legit traffic is tracked on multiple Analytics and we have Cloud Flare setup to block a ton of stuff but still there is large amount of bots that seem to escape detection and show up in the user list of the forum. I have been watching this bullshit for a year and still cannot figure it out it is drving me crazy lol.
    +1
  • Ghan Ghan:
    Beep boop
    +1
  • The Helper The Helper:
    hears robot sounds while 250 bots are on the forum lol
  • The Helper The Helper:
    Happy Saturday!
    +1

    The Helper Discord

    Members online

    No members online now.

    Affiliates

    Hive Workshop NUON Dome World Editor Tutorials

    Network Sponsors

    Apex Steel Pipe - Buys and sells Steel Pipe.
    Top