Tool Galaxy parser

phyrex1an

Staff Member and irregular helper
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
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
397
@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
397
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
397
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
397
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
397
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
397
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.
  • WildTurkey WildTurkey:
    is there a stephen green in the house?
    +1
  • The Helper The Helper:
    What is up WildTurkey?
  • The Helper The Helper:
    Looks like Google fixed whatever mistake that made the recipes on the site go crazy and we are no longer trending towards a recipe site lol - I don't care though because it motivated me to spend alot of time on the site improving it and at least now the content people are looking at is not stupid and embarrassing like it was when I first got back into this like 5 years ago.
  • The Helper The Helper:
    Plus - I have a pretty bad ass recipe collection now! That section of the site is 10 thousand times better than it was before
  • The Helper The Helper:
    We now have a web designer at my job. A legit talented professional! I am going to get him to redesign the site theme. It is time.
  • Varine Varine:
    I got one more day of community service and then I'm free from this nonsense! I polished a cop car today for a funeral or something I guess
  • Varine Varine:
    They also were digging threw old shit at the sheriff's office and I tried to get them to give me the old electronic stuff, but they said no. They can't give it to people because they might use it to impersonate a cop or break into their network or some shit? idk but it was a shame to see them take a whole bunch of radios and shit to get shredded and landfilled
  • The Helper The Helper:
    whatever at least you are free
  • Monovertex Monovertex:
    How are you all? :D
    +1
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?

      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