kayler-renslow / arma-intellij-plugin

A plugin for Intellij IDEA that allows for syntactical analysis, code inspections, and other nifty features for the SQF scripting language in Arma 3.
MIT License
41 stars 9 forks source link

various syntax things #5

Closed Ragebone closed 8 years ago

Ragebone commented 8 years ago

Hi, 1: if ! (....) Message: '(' expected got ! 2: Boolean operators, AND OR work but expected is || and && 3: the last statement in { } does not need a ' ; ' , i know that its cleaner but for the sake of compatibility :D 4:[] call compile PreprocessFileLineNumbers "core/clientValidator.sqf"; big error message, that i don't understand ?

How to Mute error messages ?

Thx! Great Work so far !

kayler-renslow commented 8 years ago

Won't fix the first issue: https://github.com/kayler-renslow/arma-intellij-plugin/issues/4

AND OR as well as PreprocessFileLineNumbers must be camel case: https://github.com/kayler-renslow/arma-intellij-plugin/issues/3. So use 'or', 'and', and preprocessFileLineNumbers

As for 3, it should work. What version are you using?

Ragebone commented 8 years ago

the latest release version from a few days ago, loaded up a random sqf file and a 100 errors awaited me.

thinking about this, you are right, it should work! And i cant reproduce it right now..... guess ill come back with detailed info when i find it again.

Windmolders commented 8 years ago

@Ragebone

Some info about number 3 It has nothing to do with being clean.

If you don't have a ';' it means the if statement returns that value. If you do have the ';' nothing is returned.

eg - this is without the ;

_retVal = if (1 > 0) then 
            {
            "It's true" 
            } else { 
            "It's false" 
            };
Ragebone commented 8 years ago

Explains why stuff didn't work .... Thanks, i guess that happens when you learn it yourself, just missed that little fu**n detail...

But i found something else :D Namespaces, i cant find them, reason or am i stupid again ?

Thx guys, great work :D

kayler-renslow commented 8 years ago

So there is no issue then? Just simple misunderstanding of SQF?

kayler-renslow commented 8 years ago

The namespaces don't have auto completion right now. I'll put those in now.

Ragebone commented 8 years ago

no 3 is a misunderstanding of me, yes! There is no Problem with it anymore!

Thx for putting in the namespaces!

darderik commented 8 years ago

What about third point? I know that avoiding to put a ; at the end of a statement could result messy,but in-line things should have the possibility to stay without ; , for example:

if (var) then { obj setDamage 1 };

Right now the plugin want a semicolon even after the code inside the statement,resulting like this:

if (var) then { obj setDamage 1; };

Personally I think this is not clean.

kayler-renslow commented 8 years ago

The plugin doesn't require a semicolon inside the curly braces unless there is more than one statement on the inside, or is an assignment.

if (var) then { obj setDamage 1 }; //not required
if (var) then { obj setDamage 1; obj setDamage 0.5 }; //required only for first setDamage
if (var) then { obj setDamage 1; obj = 1; }; //required for both
if (var) then { obj = 1; }; //required

In short, not having semicolons means you are returning a value. Assignments can't return values, so they require semicolon. Really, SQF is such a freaking mess that it's unclear what is supposed to work, what is not supposed to work, what does work, what does not work, what works by chance, and what doesn't work by chance.

darderik commented 8 years ago

Thanks for the explanation ,i thought that the original syntax rules differed from the plugin ones.

kayler-renslow commented 8 years ago

To be fair, the plugin's grammar (syntax checker) has been all over the place the past few months. I'm trying to not touch it anymore and I think I have written it in such a way that I won't need to touch it ever again.