Skip to content
lepPublic

About

The famous jass syntax checker.

Topics

Resources

Stars

39 stars

Watchers

4 watching

Forks

Repository files navigation

pjass

A lightweight and fast Jass2 parser for bison/yacc

Original by Rudi Cilibrasi

And improved by many others

This repo now maintained by lep

Usage

To use this program, list the files you would like to parse in order. If you would like to parse from standard input (the keyboard), then use - as an argument. If you supply no arguments to pjass, it will parse the console standard input by default.

To test this program:

$ pjass common.j common.ai Blizzard.j

Installation for JNGP

If you are using pjass via JNGP replace the pjass.exe in JNGP/jasshelper/ with the updated one.

Installation for bundled JassHelper for Patches 1.31+

Blizzard ships their own pjass signed by them so you can't just replace the .exe-file. But you can still use the new pjass by using jasshelper.conf like this:

[jasscompiler]
"pjass-fresh.exe"
"$COMMONJ $BLIZZARDJ $WAR3MAPJ"

pjass-fresh.exe is of course the newly downloaded pjass executable (just put it next to the original pjass.exe).

Command line arguments

pjass provides a bunch of command line flags to customize and turn on specific checks. pjass provides a special system to easily enable and disable features for specific files. Say you want to enable the "returnbug" but only for Blizzard.j, here is how you would do that:

$ pjass common.j +rb Blizzard.j -rb war3map.j

So any +-flag enables the flag until the next --flag. If you want to have flag on for all your files just put before any file arguments.

$ pjass +checkstringhash common.j Blizzard.j war3map.j

You can also (de)activate the flags on a per function base directly in your .j-file like this:

//# +rb 
function H2I takes handle h returns integer
    return h
    return 0
endfunction

Here is a table of all currently supported flags. All of these options are off by default.

Flag Description
rb When enabled pjass allows the old returnbug usage.
filter When enabled pjass checks for functions in Filter or Condition to return boolean.
shadow When enabled this checks if a local variable name is same as a previously defined global variable name.
checkglobalsinit When enabled pjass checks for potentially usage of uninitialized global variables.
checkstringhash When enabled pjass checks for calls to StringHash and reports when two different strings hash to the same integer.
noruntimeerror When enabled pjass ignores all runtime errors. Runtime errors are wrong usage of specific natives for example.
nosemanticerror When enabled pjass ignores all semantic errors. This is/was used to be able to check the memhack scripts.
nosyntaxerror When enabled pjass ignores all syntax errors.
nomodulooperator When enabled pjass reports any usage of the modulo (%) operator.
checklongnames When enabled pjass checks if any name is longer than 3958 characters.
checknumberliterals When enabled pjass checks if any number literal overflows.
checkstringlength When enabled pjass reports string literals over 1023 characters, which can crash Warcraft III when loading an engine saved game. Maps that do not use engine save/load can leave this check disabled.
oldpatch Enables +rb, +filter, +nomodulooperator and +checklongnames at once.

Checking file groups separately

The first --each saves the state left by the files before it. Each subsequent --each restores that state to start a new group:

$ pjass common.j Blizzard.j --each a1.j a2.j --each b1.j b2.j

common.j and Blizzard.j are parsed once. Files within a group are parsed in order as usual: a2.j can use functions, globals and types from a1.j, and b2.j can use those from b1.j. The b group cannot see declarations from the a group, and parser state from errors in one group is reset at the next --each. To check individual scripts separately, put --each before each one:

$ pjass common.j Blizzard.j --each war3map-1.j --each war3map-2.j

The exit status is nonzero if any file fails; the prelude and final totals are printed once. --each can't be combined with +checkstringhash (including source annotations), which collects its hashes across all files.

Building

This uses flex and bison (atleast version 3.0), so install them first. Then just run GNUMake (e.g. make or gmake).

You can also run make help to get a bunch of options but the other most important make-target is probably test which builds pjass and runs all supplied tests in tests/.

History

In this repo i tried to capture the whole history of pjass. For this i imported the cvs repo from sourceforge and went through the pjass-thread on wc3c. On top of that i added my own modifications. This probably isn't the real history as for one some attachments on wc3c were faulty but i guess it's as good as it can get.

Links

You can find news about this program and updates at http://hiveworkshop.com/threads/pjass-updates.258738/ and http://www.wc3c.net/showthread.php?t=75239 and http://jass.sourceforge.net

About

The famous jass syntax checker.

Topics

Resources

Stars

39 stars

Watchers

4 watching

Forks

Releases

Packages

Used by

Contributors

Languages