1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still havn't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. The Lich King demands your service! We've reached the 19th edition of the Icon Contest. Come along and make some chilling servants for the one true king.
    Dismiss Notice
  4. The 4th SFX Contest has started. Be sure to participate and have a fun factor in it.
    Dismiss Notice
  5. The poll for the 21st Terraining Contest is LIVE. Be sure to check out the entries and vote for one.
    Dismiss Notice
  6. The results are out! Check them out.
    Dismiss Notice
  7. Don’t forget to sign up for the Hive Cup. There’s a 555 EUR prize pool. Sign up now!
    Dismiss Notice
  8. The Hive Workshop Cup contest results have been announced! See the maps that'll be featured in the Hive Workshop Cup tournament!
    Dismiss Notice
  9. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

PJass updates

Discussion in 'Warcraft Editing Tools' started by LeP, Oct 25, 2014.

  1. LeP

    LeP

    Joined:
    Feb 13, 2008
    Messages:
    451
    Resources:
    0
    Resources:
    0
    -->Latest version<--

    Hey,
    just wanted to release my pjass with some litte updates.
    1. pjass now handles rawcodes (more?) correct. I think most of the time it makes no difference as jasshelper doesn't accept those rawcodes.
    2. When pjass encounters some name it hasn't seen it also throws some suggestions in the error message.
    3. Increased max recursion limit to 100000. This should help with realy big scripts.

    Example:
    test.j
    Code (vJASS):
    type bla extends integner

    globals
        integer a = 'a\\bd'
        integer b = '\\'
        integer c = 'avc'
    endglobals

    function foo takes nothing returns nothing
    endfunction

    function go takes nothing returns nothing
    endfunction

    function bar takes nothing returns nothing
    endfunction

    function xxx takes nothing returns nothing
        local real abc
        set acb = 1
        call fo()
    endfunction


    Code (Text):

    $ pjass test.j
    test.j:1: Undefined type integner. Maybe you meant integer
    test.j:4: Escaped chars are only allowed if they are the only char in the rawcode.
    test.j:4: Escaped chars are only allowed if they are the only char in the rawcode.
    test.j:6: Rawcodes must be 1 or 4 characters.
    test.j:20: Undeclared variable acb. Maybe you meant abc
    test.j:21: Undeclared function fo. Maybe you meant go, foo
    test.j failed with 6 errors
    Parse failed: 6 errors total
     
    The code might be a bit ugly somtimes but i just wanted it working :)

    -->Latest version<--
     

    Attached Files:

    Last edited: Oct 17, 2019
  2. edo494

    edo494

    Joined:
    Apr 16, 2012
    Messages:
    3,846
    Resources:
    5
    Spells:
    1
    JASS:
    4
    Resources:
    5
    try putting
    local integer i = ' a   b'
    if this compiles.

    edit: both spaces are actual tabs, and they compile no problem in normal world editor(not \t but physical tabs. You can insert them by putting tab somwhere where it will eat it(Notepad++ will do) and copy-pasting them)
     
  3. LeP

    LeP

    Joined:
    Feb 13, 2008
    Messages:
    451
    Resources:
    0
    Resources:
    0
    I'm not quite sure what you're trying to tell...
    Yes, tabs are just as valid as any other byte. In fact the only values not allowed in rawcodes are \0, ' and \.
    Also you can test it just from the cmd:
    Code (Text):

    $ pjass
    globals
    integer asdf = '        a       b'
    endglobals
    ^D
    Parse successful:        4 lines: <stdin>
    Parse successful:        4 lines: <total>
     
     
  4. edo494

    edo494

    Joined:
    Apr 16, 2012
    Messages:
    3,846
    Resources:
    5
    Spells:
    1
    JASS:
    4
    Resources:
    5
    oh ok, nice you changed it so that it is a lot closer to the behaviour of editor's compiler
     
  5. PurgeandFire

    PurgeandFire

    Code Moderator

    Joined:
    Nov 11, 2006
    Messages:
    7,426
    Resources:
    18
    Icons:
    1
    Spells:
    4
    Tutorials:
    9
    JASS:
    4
    Resources:
    18
    Nice. Does this pjass include that update that extends the cap for pjass? (someone complained a while back about pjass stopping halfway through their 100k lines of code or something, and you attached an updated version). Either way, would you mind this being bundled into the latest JNGP (with credit, of course)?
     
  6. LeP

    LeP

    Joined:
    Feb 13, 2008
    Messages:
    451
    Resources:
    0
    Resources:
    0
    It didn't until now, changed YYMAXDEPTH to 100000.
    And i don't see a reason why you shouldn't or coulnd't use this in the new JNGP ;)
    As long as you test it good.

    Attached new source and exe to first post.
     
  7. edo494

    edo494

    Joined:
    Apr 16, 2012
    Messages:
    3,846
    Resources:
    5
    Spells:
    1
    JASS:
    4
    Resources:
    5
    big image

    [​IMG]


    So yea, either compile it statically against runtime, or spread the dll around.

    And since I cant test it, because I am too lazy to install it :D so can you say if this compiles successfully?

    Code (vJASS):

    function myF takes nothing returns integer
        return 4
    endfunction

    function myOtherF takes nothing returns nothing
        call TriggerAddCondition(null, Filter(function myF))
    endfunction
     
     
  8. LeP

    LeP

    Joined:
    Feb 13, 2008
    Messages:
    451
    Resources:
    0
    Resources:
    0
    Man, developing on windows is srsly pain. Compiled it with mingw and it doesn't show cygwin1.dll in ldd output any more, so that's good i guess. Someone other has to test it though.
    Updated .exe in first post.

    Also, the code above: is there a pjass version with codereturnsboolean check disabled? I mean i could disable it but i'm not sure. Maybe i'll add a command line flag.
     
  9. edo494

    edo494

    Joined:
    Apr 16, 2012
    Messages:
    3,846
    Resources:
    5
    Spells:
    1
    JASS:
    4
    Resources:
    5
    I dont know, Ive never seen pjass source I think :D but I know this is indeed valid, because I even tried with native editor just to make sure that return type is not part of function's signature
     
  10. LeP

    LeP

    Joined:
    Feb 13, 2008
    Messages:
    451
    Resources:
    0
    Resources:
    0
    Well adding functions which don't return booleans used to cause desyncs.
    So the worldedit always acceptet this but pjass knew better.
    It *seems* that this has stopped with some patch but im still hestiant to add such a behavior as default.
     
  11. LeP

    LeP

    Joined:
    Feb 13, 2008
    Messages:
    451
    Resources:
    0
    Resources:
    0
    Hey, i've made some more updates. As i've put pjass into git, the current version is pjass-git-0b81ede.
    • I removed the returnsboolean check for
      Filter
      /
      Condition
    • In courtesy to Gismo359 i've changed it so that pjass now accepts comments delimited by EOF in addition to a newline.
    • Removed the handling of multiline-comments. Don't even know why they were in pjass to begin with.
     

    Attached Files:

  12. Gismo359

    Gismo359

    Joined:
    Jul 14, 2011
    Messages:
    773
    Resources:
    44
    Packs:
    4
    Maps:
    40
    Resources:
    44
    Thank you :)
     
  13. LeP

    LeP

    Joined:
    Feb 13, 2008
    Messages:
    451
    Resources:
    0
    Resources:
    0
    Hey, another funny feature in form of pjass version git-31a4d73.
    Code (vJASS):

    function x takes nothing returns integer
        local integer a
        return a
    endfunction
     

    Code (Text):

    $ pjass test.j
    test.j:5: Variable a is uninitialized
    test.j failed with 1 error
    Parse failed: 1 error total
     
    Pjass now does a very simple check for uninitialized variables.
    Note that this check is the most basic possible and currently only checks locals.
    Something like the following compiles without errors:
    Code (vJASS):

    function y takes nothing returns integer
        local integer b
        if false then
            set b = 1
        endif
        return b
    endfunction
     


    I'd like people to test this a bit so that i can attach these newer versions to the OP.
    Another thing is that the uninitialized var check might have too many false positives (which i doubt) so that a warning would be better instead of an error.

    e:
    This is what i mean by false positive:
    Code (vJASS):

    function z takes nothing returns integer
        local integer c
        if false then
            set c = c
        endif
        return 3
    endfunction
     

    Code (Text):

    $ pjass test.j
    test.j:5: Variable c is uninitialized
    test.j failed with 1 error
    Parse failed: 1 error total
     
     

    Attached Files:

    Last edited: Feb 2, 2015
  14. edo494

    edo494

    Joined:
    Apr 16, 2012
    Messages:
    3,846
    Resources:
    5
    Spells:
    1
    JASS:
    4
    Resources:
    5
    The last example is technically malformed(runtime only) anyway, so I dont see problem throwing error in there.

    Nice feature btw
     
  15. LeP

    LeP

    Joined:
    Feb 13, 2008
    Messages:
    451
    Resources:
    0
    Resources:
    0
    Another funky update in the form of pjass git-0fab355.
    Up until now pjass would accept the following code
    Code (vJASS):

    function foo takes nothing returns integer
        if false then
            return 0
        elseif true then
        else
            return 2
        endif
    endfunction
     

    But now the following error will appear
    Code (Text):

    $ pjass test.j
    test.j:7: Missing return
    test.j failed with 1 error
    Parse failed: 1 error total
     
    I also urge people to test this version because i also fixed some memory violations.

    e: I also added two early exits to the name-suggestiong function which should speed it up some (dunno if it was a problem in the first place :| ).
     

    Attached Files:

  16. LeP

    LeP

    Joined:
    Feb 13, 2008
    Messages:
    451
    Resources:
    0
    Resources:
    0
    Since hashtables are used as pjass' only datastructure i took a jab at rewriting them. Just the normal continous block of memory and resizing when 2/3 filled.
    Then i also changed the hashfunction to murmur3_32. Not that pjass was slow to begin with but now pjass parses scripts in upto half the time.
     

    Attached Files:

  17. Gismo359

    Gismo359

    Joined:
    Jul 14, 2011
    Messages:
    773
    Resources:
    44
    Packs:
    4
    Maps:
    40
    Resources:
    44
    The missing return feature is cool but it seems to break TimerUtils(previous versions work fine) and probable some other libraries.
     
  18. LeP

    LeP

    Joined:
    Feb 13, 2008
    Messages:
    451
    Resources:
    0
    Resources:
    0
    Bug reports are always appriciated. But could you post the snippet you use?
    I just c'n'p'd this and it does work. So what kind of configuration do you use?
    Could you either reduce the script to just the error or post your war3map.j? pm would be ok too.
     
  19. Gismo359

    Gismo359

    Joined:
    Jul 14, 2011
    Messages:
    773
    Resources:
    44
    Packs:
    4
    Maps:
    40
    Resources:
    44
    I tried it using both Cohadar's and Vexorian's jasshelper, both via JNGP and outside. I also tried using a normal war3map.j(generated from jngp) and one that contains only the main function and timerutils(which should work).
    It says the error is here:
    Code (vJASS):

        function GetTimerData takes timer t returns integer
    //#         static if TimerUtils__USE_HASH_TABLE  then
                    // new blue
                    return LoadInteger(TimerUtils__ht, 0, GetHandleId(t))
                   
    //#         elseif (TimerUtils__USE_FLEXIBLE_OFFSET) then
    //#             // orange
    //#             static if  true  then
    //#                 if(GetHandleId(t)-TimerUtils__VOFFSET<0) then
    //#                     call BJDebugMsg("SetTimerData: Wrong handle id, only use SetTimerData on timers created by NewTimer")
    //#                 endif
    //#             endif
    //#             return TimerUtils__data[GetHandleId(t)-TimerUtils__VOFFSET]
    //#         else
    //#             // new red
    //#             static if  true  then
    //#                 if(GetHandleId(t)-TimerUtils__OFFSET<0) then
    //#                     call BJDebugMsg("SetTimerData: Wrong handle id, only use SetTimerData on timers created by NewTimer")
    //#                 endif
    //#             endif
    //#             return TimerUtils__data[GetHandleId(t)-TimerUtils__OFFSET]
    //#         endif        <- Missing return
        endfunction
     

    E: Ah, here is the problem - it thinks that the empty line(and comments) after the return is invalid.(dont really know how to say it in english)
    Code (vJASS):
    function foo takes nothing returns integer
        return 0 // <-Compiles correctly
    endfunction

    function foo takes nothing returns integer
        return 0
        // <-This does not
    endfunction
     
  20. LeP

    LeP

    Joined:
    Feb 13, 2008
    Messages:
    451
    Resources:
    0
    Resources:
    0
    Thanks for the report. I found some strange behaviour in pjass versions even prior to mine.

    For example the following code didn't work in pjass:
    Code (vJASS):

    function x takes nothing returns nothing
    endfunction

    function foo takes nothing returns integer
        return 1337
        call x()
    endfunction
     


    It *should* work now but the code which handles types and associated stuff is kinda hairy.
    I should probably rewrite it eventually but in the mean time please test it :)
     

    Attached Files: