It's written in sablecc, and based on a java compiler I wrote for a school project, which is why there are a few references to java in the naming.
The tokens are listed in the order of precedence. Helpers are not tokens.
I treat all variable types as identifiers in the parser, so you will not find the galaxy variable types among the tokens.
Also, except for the function string Galaxy_pp_Deobfuscate(string s), all functions added by the compiler are given a unique name (renamed in case of collisions).
The warning was: "You can only make a dynamic instansiations of classes"
But i thought this is the right way =O
Then Kueken told me to try this:
c_Dialog*[]c_Dialog_RaceDialog=newc_Dialog*[4]();
First it seems that this works, but i was wrong, i always had only one class, i could work with the indices but i only had the values in the class whcih was "created" last.
Now i have no idea how i can create an array of classes...
thanks to you ;) , but how can i create a static array of a classes? I always get the warning, that i have to create it dynamic! I though it isnt possible =O
What I have created there is a static array of classes.
I assume you are getting the error that you can only make dynamic instansiations of classes. That means that every time you want an instance of c_Dialog, you have to call new c_Dialog(...). Consequently, if you want a variable of type c_Dialog, it has to be a pointer to it (c_Dialog* var). This is because for normal structs in galaxy, just typing c_Dialog var; actually allocates the instance in memory at runtime, but you can't get a pointer to that instance.
If you want to be able to just write c_Dialog[4] c_Dialog_RaceDialog; you should make c_Dialog a struct rather than a class. Just don't pass them around to functions too much, since that might be a bit expensive.
I'd like to report a couple of bugs, or some questions needed answers.
A note at the list: When I say the editor is crashing, it means that I get the crash report window.
1) Warning remains
I closed my project, and the warning I got before when compiling it ("You have unused definitions", if that matters), but the warning remains. Clicking on the warning message results in a crash/crash report.
2) Project and files
When you start the editor, you get the list of all projects. Shouldn't they be listed each as nodes to the Project root/parent?
When you create a new project and open it, there is a space character before the project name. If you try to rename it to remove the spacing, it refuses, saying there already exists a project with that name (which is correct since it does).
When renaming a file without the .galaxy++ ending, the .galaxy++ extension is visually lost in the editor, but the file stays with the extension. Restarting the editor fixes it, but still.
When creating a new project, filling a " " or \n or similar, the editor crashes. (May I suggest you using the Path class in the .net framework to check if a path is valid if you aren't doing already)?
Creating a project name called foo\bar for instance, will create the project bar, in the folder foo. However, when closing the project only foo will appear in the project list (which is empty with the exception of bar).
Creating a project, then removing the default mapscript file which was created, and then create your own files (say A first, then B then C etc) will cause the compiler to output a file called A.galaxy
It's possible to name a file " ". The resulting file is then " .galaxy++". How that was possible, I have no idea, since normally, " "+an extension is not allowed.
3) Folders
Right-clicking on a folder entry, then doing either "new file" or "new folder" creates a folder or file as a node of the clicked folder's parent. It would at least be more convenient if the file/folder was put as a child node to the clicked folder.
Naming a folder " " crashes the editor.
Regards
Mexa
PS: As a suggestion, it would be convenient to have a API browser or similar, as a choice, instead of the map browser toolwindow.
Additionally, perhaps splitting up the bottom panel to have tabs, for instance, one for errors and one for warnings.
This is just a design choise. I didn't see much reason for the ability to collapse the projects node, so I added everything to the root.
I hadn't noticed :) I shall fix
Yeah, I did notice that. It's only a visual bug though.. but still :)
I did that for files, actually - forgot doing it for projects.
Yeah - didn't consider that
Well, the compiler just chooses some file to be the root file, and if you choose 1 output file, everything is put into that file, and all other files are removed.. The code generation phase works the same regardless of if one output file was chosen.. hence the name.. Still, I can check and rename it to mapscript.
Windows consists of a lot of underlying systems with a pretty gui on top. The file system can handle files called " .foo".. I guess it just needs a unique string. Windows explorer doesn't like it though. But since I obviously don't create files through windows explorer, it's easy to create files like that. Another example is that you can create files with a path longer than 260 characters if you don't use windows explorer.. but explorer can't navigate to them, or delete them.. at least, I overheard people talking about that at school :)
3)
Yeah, guess it would be more intuitive to have it created inside.
I shall fix
PS stuff: I guess my screen is so big that it doesn't bother me that the object browser takes up space. I'll make it optional.
Edit:
How are things going with that dialog system?
So, now, instead of a project displaying a " " before the actual name, it is now showing " " (3 space characters) afterwards the name ;) (The same goes on the "Output" node)
Another bug: Switching between enabled and not enabled on items is inconsistent. It messed up the enabling and reenabling several times. At least, visually.
@The dialog system, I'm not happy to say that it's abit halted, mainly because of studies, and mainly because of a few issues. I'm starting to look for other options, since I'm perhaps hesitating whether or not .net and XNA is a good idea for the project. But yeah, it's mainly halted due to studies, I'll report back about it further on..
The reason for the spaces afterwards is that the component I'm using for the treeview messes up the with of nodes when they are bold. The with is still calculated as if the text wasn't bold. So it's either spaces after the bold text, or having the text cut off because the node is too short - try making a really long project name to see what I mean (like abcdefghijklmnopqrstuvwxyz).
When you experience inconsistent enabled states, are you by any chance moving the program to another place on the harddisk, or renaming the project?
Nope, they are static, I can enable/disable the readonly mapscript, and further on any folder or file I like through the editor.
(*Below, when I say enabled state, I'm referring to the checkbox "enabled" which appears when you rightclick on an item. I suspect it should all in all be directly be linked to the text being grayed or not as well, but that may not be the case.)
Perhaps the answer is lying when you compile (the first time or so). I decided to create a new project again just for testing. What I see after compiling are folders being grayed out, without actually being disabled (or well folders that were empty gets grayed out, and disabled, with the contrast to being in a disabled state before but with black text). And enabling them sets their font back to black, but it doesn't change the enabled state (perhaps since they are folders?). At first, the Ouput is also locked, and I can't enable/disable those, but then after some messing around with the other, it goes possible.
Oh, another note, it's perhaps when folders are not containing any files that they can be tampered with. I'm not exactly sure what order I am doing things, but I hope it gives you any ideas of the problem.
Yeah, I agree - it should do implicit casts in method calls.. which it now does :)
Edit:
@Mexaprone: Go
Folders are gray unless there is an enabled file in them.. When they are empty, they aren't really used in the compilation process. Enabling/disabling a folder just applies the setting to all files in the folder, so doing it on an empty folder doesn't really do anything - I could make it impossible.
Currently, the g
++
editor crashes every time I compile any script. I need to restart the editor and compile the script again for it to work properly.It would be nice if you posted a full list of all known tokens for syntax parsers (keywords, data types, STL functions and types, etc.).
For a full and precise list of tokens for parsers, I think it would be easiest if I just give you that part of my parser.
http://www.sc2mapster.com/paste/4094/
It's written in sablecc, and based on a java compiler I wrote for a school project, which is why there are a few references to java in the naming.
The tokens are listed in the order of precedence. Helpers are not tokens.
I treat all variable types as identifiers in the parser, so you will not find the galaxy variable types among the tokens.
Also, except for the function
string Galaxy_pp_Deobfuscate(string s)
, all functions added by the compiler are given a unique name (renamed in case of collisions).Hey i have a problem!
i wanted to create a array of a classes. I got a warning when i tried this:
The warning was: "You can only make a dynamic instansiations of classes" But i thought this is the right way =O
Then Kueken told me to try this:
First it seems that this works, but i was wrong, i always had only one class, i could work with the indices but i only had the values in the class whcih was "created" last. Now i have no idea how i can create an array of classes...
I hope u can help me ;)
MfG Artery
You are forgetting to create each element of the array.
There is really no need for a dynamic array if you always use the same constant size.
Edit:
Unless of course you plan to pass the array to other functions.
Yeha this was it :D
thanks to you ;) , but how can i create a static array of a classes? I always get the warning, that i have to create it dynamic! I though it isnt possible =O
MfG Artery
What I have created there is a static array of classes.
I assume you are getting the error that you can only make dynamic instansiations of classes. That means that every time you want an instance of c_Dialog, you have to call new c_Dialog(...). Consequently, if you want a variable of type c_Dialog, it has to be a pointer to it (c_Dialog* var). This is because for normal structs in galaxy, just typing c_Dialog var; actually allocates the instance in memory at runtime, but you can't get a pointer to that instance.
If you want to be able to just write c_Dialog[4] c_Dialog_RaceDialog; you should make c_Dialog a struct rather than a class. Just don't pass them around to functions too much, since that might be a bit expensive.
I'd like to report a couple of bugs, or some questions needed answers. A note at the list: When I say the editor is crashing, it means that I get the crash report window.
1) Warning remains I closed my project, and the warning I got before when compiling it ("You have unused definitions", if that matters), but the warning remains. Clicking on the warning message results in a crash/crash report.
2) Project and files
++
ending, the .galaxy++
extension is visually lost in the editor, but the file stays with the extension. Restarting the editor fixes it, but still.++
". How that was possible, I have no idea, since normally, " "+an extension is not allowed.3) Folders
Regards Mexa
PS: As a suggestion, it would be convenient to have a API browser or similar, as a choice, instead of the map browser toolwindow. Additionally, perhaps splitting up the bottom panel to have tabs, for instance, one for errors and one for warnings.
1) I shall fix that!
2)
3)
PS stuff: I guess my screen is so big that it doesn't bother me that the object browser takes up space. I'll make it optional.
Edit:
How are things going with that dialog system?
Now you cannot test your code without renaming one of the source files to MapScript.galaxy
++
, it seems.After the update, if i try to test my code i get the warning: "Unable to find the root file. Did you forget to define the main entry?"
I only can fix this if i just rename my initialization file to "MapScript.galaxy+ +", like Kueken said :/
MfG Artery
Yeah, should be fixed now.. Visual studio was an asshole an destroyed some of my main form - sorry for the wait.
Ahhh.. thx it works ;)
@SBeier: Go
So, now, instead of a project displaying a " " before the actual name, it is now showing
" "
(3 space characters) afterwards the name ;) (The same goes on the "Output" node)Another bug: Switching between enabled and not enabled on items is inconsistent. It messed up the enabling and reenabling several times. At least, visually.
@The dialog system, I'm not happy to say that it's abit halted, mainly because of studies, and mainly because of a few issues. I'm starting to look for other options, since I'm perhaps hesitating whether or not .net and XNA is a good idea for the project. But yeah, it's mainly halted due to studies, I'll report back about it further on..
The reason for the spaces afterwards is that the component I'm using for the treeview messes up the with of nodes when they are bold. The with is still calculated as if the text wasn't bold. So it's either spaces after the bold text, or having the text cut off because the node is too short - try making a really long project name to see what I mean (like abcdefghijklmnopqrstuvwxyz).
When you experience inconsistent enabled states, are you by any chance moving the program to another place on the harddisk, or renaming the project?
Nope, they are static, I can enable/disable the readonly mapscript, and further on any folder or file I like through the editor.
(*Below, when I say enabled state, I'm referring to the checkbox "enabled" which appears when you rightclick on an item. I suspect it should all in all be directly be linked to the text being grayed or not as well, but that may not be the case.)
Perhaps the answer is lying when you compile (the first time or so). I decided to create a new project again just for testing. What I see after compiling are folders being grayed out, without actually being disabled (or well folders that were empty gets grayed out, and disabled, with the contrast to being in a disabled state before but with black text). And enabling them sets their font back to black, but it doesn't change the enabled state (perhaps since they are folders?). At first, the Ouput is also locked, and I can't enable/disable those, but then after some messing around with the other, it goes possible.
Oh, another note, it's perhaps when folders are not containing any files that they can be tampered with. I'm not exactly sure what order I am doing things, but I hope it gives you any ideas of the problem.
Is it intentional, that toString typecasts are only executed, if you concatenate strings? If yes, whats wrong about typecasting always?
Yeah, I agree - it should do implicit casts in method calls.. which it now does :)
Edit:
@Mexaprone: Go
Folders are gray unless there is an enabled file in them.. When they are empty, they aren't really used in the compilation process. Enabling/disabling a folder just applies the setting to all files in the folder, so doing it on an empty folder doesn't really do anything - I could make it impossible.
@SBeier: Go
I got that, now that wasn't my overall bug report. There's still an inconsistency where grayed out items do not match the enabled/disabled option. ;)
I have a question..
I have a trigger-variable and a trigger-pointer:
Thats not possible! So how its possible to link my pointer to my trigger?
MfG Artery