lep / pjass

The famous jass syntax checker.
BSD 2-Clause "Simplified" License
25 stars 6 forks source link

Integer Modulo test should be marked as fail #4

Closed Luashine closed 11 months ago

Luashine commented 11 months ago

https://github.com/lep/pjass/blob/ac58f84a23afe447621dff7ffd84e36a92295817/tests/should-check/modulo.j

I have tested the modulo operator in 1.27 and it's definitely breaking the script:

// OK
function hexadecimalNumber takes nothing returns nothing
    local integer i = 10

endfunction

vs

// script doesnt load
function hexadecimalNumber takes nothing returns nothing
    local integer i = 10 % 4

endfunction
Luashine commented 11 months ago

Hey I missed this opened tab:

Hi. Is there any way to make JassHelper shut up about it? I'm aware it's been added to pJass way back now, and I'm using the newest version, but when JassHelper runs in WE, it still throws a syntax error since it doesn't recognize the % operator added in 1.29.

Is it somehow possible to make it a warning, not an error for the people who are targetting 1.26 and others?

lep commented 11 months ago

Is it somehow possible to make it a warning, not an error for the people who are targetting 1.26 and others?

Well that is possible but i don't quite see the use-case; the script would not be useable under older patches anyway so why only emit a warning? I can add a flag like +nomodulooperator which would simply error on any % usage. I could also do the same with a warning instead but see above. The difference between warning and error would be the return code of pjass.exe which i guess jasshelper uses to see if pjass found errors? At least that's what i hope jasshelper does.

Luashine commented 11 months ago

Yeah you're right about JassHelper. I don't think anybody even knows about pjass backing it.

Yes a flag is a good choice. I'm just thinking how likely is that someone's gonna run JassHelper/pjass for an old game version, not working due to %, but also not knowing about an optional flag. Tough luck and rtfm I guess? At some point, game version (w3i) detection could be added to JassHelper if I so insist...

lep commented 11 months ago

Fixed by 501313704ffcc977d49b13d2160fd724b7070eac