Skip to content

Divy1211/xs-check

Repository files navigation

XS Check

A linter for AoE2:DE's flavour of XS.

Installation

You may download and use the prebuilt binaries from here

Or instead, if you have rust installed and prefer to build it from source, you can simply run:

cargo install --git https://github.com/Divy1211/xs-check

This is recommended, as it will automatically add the binary to your system's path variable.

Usage

Suppose you have an XS file like so:

test.xs

void test(float f = 0.0) {
    int cp = xsGetContextPlayer();
    xsChatData("cp: %d", cp);
}

void test(float f = 0.0) {
    int b = "Oops";
}

void main() {
    test(1);

    float c = 4 + 5.5;
}

Invoke the binary on the file:

xs-check ./test.xs 

And it will generate an output with all the errors it finds:

test.png

You may also tell it to ignore warnings (errors cannot be ignored) with a comma separated list:

xs-check file.xs --ignores warning1,warning2

The name used to ignore the warning is the same name that is printed in the first line of the warning. Ignoring the DiscardedFn warning may be useful at times

Cool Maths

Note: GitHub does not render all the latex correctly, read these docs here: https://divy1211.github.io/xs-check/

Topic Subtopic
Parsing XS Tokens
Parsing XS Keywords
Parsing XS Grammar
Static Analysis XS Type Checking
Dynamic Analysis XS Operational Semantics
Code Generation XS Maximal Munch