• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

PJass updates

Status
Not open for further replies.

LeP

LeP

Level 13
Joined
Feb 13, 2008
Messages
537
@LeP is PJASS updated to 1.29?

As i mentioned i have problems with the newest patch.
I can't really test what valid jass is; for example if return null is still bugged or what kind of type-casting is allowed now. That being said, pjass doesn't really need to be adapted to the new patch (modulo the modulo operator) since it always gets passed the common.j and Blizzard.j from somewhere. So the new natives and such should just work, if your World Editor of choice passes the right files.

That being said, i have a 1.29 branch in my git but i can only modify it based on heresay at the moment. I will attach it but this is pjass for 1.29 ptr so it might no be 100% correct anymore.

And i just hope that blizzard will release quick patch.
 

Attachments

  • pjass-git-6598575.zip
    25.3 KB · Views: 202
  • pjass-git-6598575-src.zip
    53.3 KB · Views: 167
As i mentioned i have problems with the newest patch.
I can't really test what valid jass is; for example if return null is still bugged or what kind of type-casting is allowed now. That being said, pjass doesn't really need to be adapted to the new patch (modulo the modulo operator) since it always gets passed the common.j and Blizzard.j from somewhere. So the new natives and such should just work, if your World Editor of choice passes the right files.

That being said, i have a 1.29 branch in my git but i can only modify it based on heresay at the moment. I will attach it but this is pjass for 1.29 ptr so it might no be 100% correct anymore.

And i just hope that blizzard will release quick patch.

Yeah I think it just needs support for the modulo operator. The return null bug has been fixed.

Typecasting no longer works but shadowing still does so you shouldn't need to update much.
 

LeP

LeP

Level 13
Joined
Feb 13, 2008
Messages
537
Yeah I think it just needs support for the modulo operator. The return null bug has been fixed.

Typecasting no longer works but shadowing still does so you shouldn't need to update much.
The return null stuff for example is just a git revert away. The typing rules are a bit more delicate and i would like to test them myself. Otherwise the best way is to send code snippets which either should compile but dont or which shouldnt compile but do. That should atleast be sufficient for the short run.
 
Level 4
Joined
Mar 20, 2014
Messages
67
@LeP thank you by the way for your work. You, Vexorian, and everyone else who has created the tools that allow us Map Developers to just learn ZINC/vJASS and just use it is all because of you guys.
 

LeP

LeP

Level 13
Joined
Feb 13, 2008
Messages
537
I therefore understand that this post was unfortunately of no help?
unfortunatley not. I ofcourse tried your suggestion and redownloaded directx. and 1.29.1 also didn't fix my problems. maybe wex works around it? i haven't tried it yet. i have reported my issues, now it's up to blizzard to fix them.
 

LeP

LeP

Level 13
Joined
Feb 13, 2008
Messages
537
@Wareditor requested to report the line where a block was opened when the corresponding endblock is missing. Consider this beta though.
JASS:
function f takes nothing returns nothing
    local integer x
    local integer y
    if true then
        set x = 4
        loop
        exitwhen true
      set y = 3
   set y = 8
endfunction
Code:
$ pjass test.j
test.j:11: Missing endloop for block opened in line 7.
test.j:11: Missing endif for block opened in line 5.
test.j failed with 2 errors
Parse failed: 2 errors total
 

Attachments

  • pjass-git-d2763ae.zip
    39.9 KB · Views: 145
  • pjass-git-d2763ae-src.zip
    53.9 KB · Views: 140
Level 14
Joined
Jan 16, 2009
Messages
716
Thank you for the update! Gonna test it soon :)
Can you make it so next update has a max recursion limit of 1000000 so I don't have to recompile it each time? If you don't want to do it just for one person, that's okay.

EDIT: my pjass crash when trying to compile my map. The map has not syntax error as my previous pjass didn't find any mistake and the map compiled fine. Funny enough when I try to compile this same map but this time with a missing endblock error it doesn't crash but report the error like it used to (without actually giving the line of the start of the block). @LeP
 
Last edited:

LeP

LeP

Level 13
Joined
Feb 13, 2008
Messages
537
Thank you for the update! Gonna test it soon :)
Can you make it so next update has a max recursion limit of 1000000 so I don't have to recompile it each time? If you don't want to do it just for one person, that's okay.

EDIT: my pjass crash when trying to compile my map. The map has not syntax error as my previous pjass didn't find any mistake and the map compiled fine. Funny enough when I try to compile this same map but this time with a missing endblock error it doesn't crash but report the error like it used to (without actually giving the line of the start of the block). @LeP
eh. i guess i would need the map/war3map.j. or maybe the core dump. or come to irc :)
 

LeP

LeP

Level 13
Joined
Feb 13, 2008
Messages
537
Fixed some really silly bug thanks to @Wareditor. Also enabled some optimisation in cross compiling (my gcc for cross-compiling is rather old... well what can you do)
Also if more people reach that stack limit error pls say so and i will increase it again.
 

Attachments

  • pjass-git-c15eac9.zip
    40.2 KB · Views: 137
  • pjass-git-c15eac9-src.zip
    53.9 KB · Views: 133

LeP

LeP

Level 13
Joined
Feb 13, 2008
Messages
537
Added modulo operator and merged the above release aswell.
 

Attachments

  • pjass-git-ea093b2.zip
    40.4 KB · Views: 149
  • pjass-git-ea093b2-src.zip
    54.5 KB · Views: 126
  • Like
Reactions: pyf

LeP

LeP

Level 13
Joined
Feb 13, 2008
Messages
537
And it's still passes next mistake.
JASS:
globals
    boolean B true
endglobals
Sorry can't replicate this one:
Code:
$ ./pjass -v
./pjass version git-ea093b2
$ cat tests/should-fail/vardecl-missing-equal.j
globals
    boolean B true
endglobals
$ ./pjass tests/should-fail/vardecl-missing-equal.j
tests/should-fail/vardecl-missing-equal.j:2: syntax error
tests/should-fail/vardecl-missing-equal.j failed with 1 error
Parse failed: 1 error total
 
Level 9
Joined
Jul 20, 2018
Messages
176
I noticed that the latest pjass has problems with encoding.

%D0%A1%D0%BD%D0%B8%D0%BC%D0%BE%D0%BA-48-png.308552


No such bug with this version. Tested it because I had it on my computer.
Changing encoding in PowerShell with chcp command does not help.
 

Attachments

  • Снимок 48.PNG
    Снимок 48.PNG
    54.3 KB · Views: 1,105
  • Like
Reactions: pyf

LeP

LeP

Level 13
Joined
Feb 13, 2008
Messages
537
I noticed that the latest pjass has problems with encoding.

%D0%A1%D0%BD%D0%B8%D0%BC%D0%BE%D0%BA-48-png.308552


No such bug with this version. Tested it because I had it on my computer.
Changing encoding in PowerShell with chcp command does not help.
Having a script to reproduce it myself would help. Minimal example or whole mapscript is fine.
PM is also fine, if you dont want it to be public.
 

LeP

LeP

Level 13
Joined
Feb 13, 2008
Messages
537
Thanks to @Prometheus3375 i have fixed an off-by-one error in the error message construction.
 

Attachments

  • pjass-git-b458eb9.zip
    40.3 KB · Views: 143
  • pjass-git-b458eb9-src.zip
    54.5 KB · Views: 134
  • Like
Reactions: pyf
Level 19
Joined
Dec 12, 2010
Messages
2,069
JASS:
globals
trigger TriggerGoldPerSecond
endglobals

//somewhere else
call DisableTrigger(TriggerGoldPerSecond)
Would be great if Pjass could analyze that variable never being used withing "set" statement therefore using it will crash. Currently it only does it for local scopes
 

LeP

LeP

Level 13
Joined
Feb 13, 2008
Messages
537
JASS:
globals
trigger TriggerGoldPerSecond
endglobals

//somewhere else
call DisableTrigger(TriggerGoldPerSecond)
Would be great if Pjass could analyze that variable never being used withing "set" statement therefore using it will crash. Currently it only does it for local scopes
Sure that would be nice but it's also far from trivial. Even when you don't consider pjass' way of operation.
Also at one point one would be better served with a standalone jass linter or the like instead of stuffing everything into pjass.
 

LeP

LeP

Level 13
Joined
Feb 13, 2008
Messages
537
hm, I thought it's the same as finding non-init'd locals, just bigger scope. W/e, just saying
Thing with locals is that you can see the whole control flow. I would assume with globals it would give false positives due to interprocedural nature of globals. I think the local check never gives false positives.
I could use the same code for globals and see what happens.
 

LeP

LeP

Level 13
Joined
Feb 13, 2008
Messages
537
The uninitialized var check has been expanded. Now it also checks for uninitialized globals in the globals block by default.
Example:
JASS:
globals
    integer a
    integer b = a + 3
endglobals
Code:
$ ./pjass tests/should-fail/uninit-globals-in-globals.j
tests/should-fail/uninit-globals-in-globals.j:3: Variable a is uninitalized
tests/should-fail/uninit-globals-in-globals.j failed with 1 error
Parse failed: 1 error total

You can also now use the same check there already is for locals on globals with the flag +checkglobalsinit
It is not default since it might be reporting false positives such as this
Code:
$ ./pjass +checkglobalsinit tests/common.j tests/Blizzard.j
Parse successful:     2418 lines: tests/common.j
tests/Blizzard.j:19891: Variable bj_stockPickedItemType might be uninitalized
tests/Blizzard.j failed with 1 error
Parse failed: 1 error total
 

Attachments

  • pjass-git-efb384f.zip
    40.4 KB · Views: 137
  • pjass-git-efb384f-src.zip
    56.1 KB · Views: 142

LeP

LeP

Level 13
Joined
Feb 13, 2008
Messages
537
Just to bring this in sync with git.
  • Various performance improvments
  • Better error message for non-integer array indices
    JASS:
    globals
            integer array foo
            integer bla = foo[3.1]
    endglobals
    function xx takes nothing returns integer
            local integer array asdf
            return asdf["foo"]
    endfunction
    Code:
    $ pjass test.j
    test.j:3: Cannot convert real to integer as index for array foo
    test.j:7: Cannot convert string to integer as index for array asdf
    test.j failed with 2 errors
    Parse failed: 2 errors total
 

Attachments

  • pjass-git-4be0d72.zip
    43.4 KB · Views: 256
  • pjass-git-4be0d72-src.zip
    56.7 KB · Views: 138

LeP

LeP

Level 13
Joined
Feb 13, 2008
Messages
537
Why _SomeCharSequence is invalid identifier? Used for name of globals.
In other words, must not names in JASS2 start with _ or is it pjass mistake?
Indeed, names in jass have to start with a letter and have to end in either a letter or a number. inbetween numbers, letters and underscores are allowed.
 

LeP

LeP

Level 13
Joined
Feb 13, 2008
Messages
537
Small update triggered by this. But some other stuff added aswell.
Here's the shortlog from the last version released here.
Code:
Jesse Rogers (1):
    Support Apple by defining _aligned_malloc
lep (8):
    Merge pull request #1 from theQuazz/feature/support-apple
    Specify minimum bison version in readme
    Report natives after function defintions
    Merge branch 'master' of ssh://192.168.1.5:52/home/git/pjass
    More newline stuff
    Added reserved keyword 'alias'
    Better error message for `type` as a name
    Fix release target
 

Attachments

  • pjass-git-6eca932.zip
    43.5 KB · Views: 177
  • pjass-git-6eca932-src.zip
    57.9 KB · Views: 156

LeP

LeP

Level 13
Joined
Feb 13, 2008
Messages
537
Added a new option +checkstringhash which looks for calls to StringHash with a literal string as its argument. If pjass finds two calls with different strings which would hash to the same integer pjass will report an error. Do note though that you have to enable that option yourself; it's not on by default.
To do this i use the code i have reversed years ago. But afaik there have been changes to the StringHash native; it should still work for plain old ASCII strings but for multibyte characters my reversed code produces different hashes. If anyone wants to dump the new asm i will happily reverse engineer it (or maybe Blizzard sees their mistake and reverses the change).
While we're at it: some patches ago Blizzard made the backward incompatible change of giving alias a keyword. From what i know it never did anything so maybe remove it again? Or atleast document such things.

I've also taken this opportunity to bring the Github page up-to date.
 

Attachments

  • pjass-git-814075e.zip
    44.3 KB · Views: 76
  • pjass-git-814075e-src.zip
    62 KB · Views: 79

LeP

LeP

Level 13
Joined
Feb 13, 2008
Messages
537
pjass does not report an error when the operand of 'function' is a native:

JASS:
native foo takes nothing returns nothing
globals
    code c = function foo // no error
endglobals

Tested with "pjass version git-814075e".
I think this crashes the game at runtime.
Checking that is easy. If you make sure that this actually crashes ingame i will gladly add this as a check. For testing purpose you can use native TriggerSyncStart takes nothing returns nothing.
 
Level 13
Joined
Nov 7, 2014
Messages
571
Tested on 1.31 and it crashes when trying to execute the instruction that implements the 'function' operation:
JASS:
    local code c = function ClearSelection

I suppose instead of giving an error (which it doesn't) the compiler could've generated an anonymous stub like:
JASS:
function ClearSelection* takes nothing retuns nothing
    call ClearSelection()
endfunction
or something, but that would've been too clever for very little gain.
 
  • Like
Reactions: LeP

LeP

LeP

Level 13
Joined
Feb 13, 2008
Messages
537
Tested on 1.31 and it crashes when trying to execute the instruction that implements the 'function' operation:
JASS:
    local code c = function ClearSelection

I suppose instead of giving an error (which it doesn't) the compiler could've generated an anonymous stub like:
JASS:
function ClearSelection* takes nothing retuns nothing
    call ClearSelection()
endfunction
or something, but that would've been too clever for very little gain.
Thanks for testing. Indeed the fix is very easy but it's not pjass' domain to do so.
Here is a fresh pjass version which reports this.

Code:
$ cat tests/should-fail/native-as-code.j
native TriggerSyncStart takes nothing returns nothing

function foo takes nothing returns nothing
    local code bla = function TriggerSyncStart
endfunction

$ ./pjass tests/should-fail/native-as-code.j
tests/should-fail/native-as-code.j:4: Cannot use native 'TriggerSyncStart' as code
tests/should-fail/native-as-code.j failed with 1 error
Parse failed: 1 error total
 

Attachments

  • pjass-git-1b14ec5.zip
    44.2 KB · Views: 120
  • pjass-git-1b14ec5-src.zip
    62.3 KB · Views: 67
Level 13
Joined
Nov 7, 2014
Messages
571
More nit-picking:

Hex literals using the '0X' prefix are not recognized:
JASS:
globals
    integer a1 = 0x0
    integer a2 = 0X0 // error
endglobals

Variable shadowing interacting with constant function:
JASS:
globals
    integer x
endglobals
constant function foo takes nothing returns nothing
    local integer x
    set x = 5 // Assignment to global variable x in constant function
endfunction
 

LeP

LeP

Level 13
Joined
Feb 13, 2008
Messages
537
More nit-picking:

Hex literals using the '0X' prefix are not recognized:
JASS:
globals
    integer a1 = 0x0
    integer a2 = 0X0 // error
endglobals

Variable shadowing interacting with constant function:
JASS:
globals
    integer x
endglobals
constant function foo takes nothing returns nothing
    local integer x
    set x = 5 // Assignment to global variable x in constant function
endfunction
Cheers m8 keep 'em coming.
 

Attachments

  • pjass-git-0920290.zip
    44.2 KB · Views: 213
  • pjass-git-0920290-src.zip
    63 KB · Views: 109
Level 9
Joined
Jul 20, 2018
Messages
176
Too many errors (~25) due to missing call. Is it OK?

JASS:
function Trig_Vampirizm_Actions takes nothing returns nothing
    local real h= ( GetUnitState(GetTriggerUnit(), UNIT_STATE_LIFE) / 400 ) * GetUnitAbilityLevel(udg_VampirizmU, 'A018')
    SetUnitState(GetTriggerUnit(), UNIT_STATE_LIFE, GetUnitState(GetTriggerUnit(), UNIT_STATE_LIFE) - h)
    SetUnitState(udg_VampirizmU, UNIT_STATE_LIFE, GetUnitState(udg_VampirizmU, UNIT_STATE_LIFE) + h)
    call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Human\\Heal\\HealTarget.mdl", udg_VampirizmU, "origin"))
endfunction

1617897328474.png
 
Last edited:

LeP

LeP

Level 13
Joined
Feb 13, 2008
Messages
537
Too many errors (~25) due to missing call. Is it OK?

JASS:
function Trig_Vampirizm_Actions takes nothing returns nothing
    local real h= ( GetUnitState(GetTriggerUnit(), UNIT_STATE_LIFE) / 400 ) * GetUnitAbilityLevel(udg_VampirizmU, 'A018')
    SetUnitState(GetTriggerUnit(), UNIT_STATE_LIFE, GetUnitState(GetTriggerUnit(), UNIT_STATE_LIFE) - h)
    SetUnitState(udg_VampirizmU, UNIT_STATE_LIFE, GetUnitState(udg_VampirizmU, UNIT_STATE_LIFE) + h)
    call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Human\\Heal\\HealTarget.mdl", udg_VampirizmU, "origin"))
endfunction

View attachment 376998

Error recovery is rather hard, it can only be handled case by case (in pjass). I can try if i can give a better experience for this but no promises.

It also seems like that such an error makes pjass to freeze on Win7. Does pjass still support Win7? If not, which version is the latest for Win7?

I also still have a win7 machine as my only windows machine. Feel free to PM me a freezing .j file and i can have a look.
 

LeP

LeP

Level 13
Joined
Feb 13, 2008
Messages
537
Added special case for missing call which should both provide a better error message and also doesn't mess up the following checking.
Code:
$ cat tests/should-fail/no-call.j
function foo takes nothing returns nothing
    return
    foo()
    call foo()
endfunction
$ pjass tests/should-fail/no-call.j
tests/should-fail/no-call.j:3: Missing 'call'
tests/should-fail/no-call.j failed with 1 error
Parse failed: 1 error total
 

Attachments

  • pjass-git-ffc7122.zip
    44.9 KB · Views: 88
  • pjass-git-ffc7122-src.zip
    63.3 KB · Views: 47
Status
Not open for further replies.
Top