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

some parsing problems i found so far #10

Closed BangL closed 8 years ago

BangL commented 8 years ago

the latest update fixed some false positives, which is cool, but i have 1 new problem now, and 1 old one left:

  1. codes in if statements are not parsed correctly: example: _bla = _this select 0; if (isNull _bla && {_bla != ""}) then { // ... };

problem: this method is used to prevent null-pointer-exceptions, and is absolutely valid in SQF. however your plugin marks it as invalid syntax in 1.0.4.

  1. dikCode values like 0x00 and 0x01 example: if (_dikCode in [0x3F,0x3E,0x3D,0x3C,0x3B,0x44,0x43,0x42,0x41,0x40,0x58,0x57]) then { _handled = true; };

problem: all these are considered as invalid values, but theyre prefectly fine. your plugin seems to notice the first 0 as number, and the following x is then notices as global-var. my advise: handle anything starting with "0x" as number as well. (maybe also check for valid Hex-numbers after it, i guess you know what i mean)

BangL commented 8 years ago

the code-block problem also applies to code-blocks in function params: example: player addAction ["Party Menu", {[] call PMC_fnc_partyShow;}, nil, -999, false, true];

this is valid because the second param of "addAction" can be either code OR a functionname as string.

EDIT: my bad, the problem here isnt the code-block. its the negative number (which is valid as well) ..still a false positive though.

EDIT2: yep, this seems to apply to all negative numbers: another example: if (_cIndex != -1) then{};

kayler-renslow commented 8 years ago

simple grammar mistake. I should have caught this. will be fixed in hotfix

kayler-renslow commented 8 years ago

Fixed in 1.0.4_1