jainpranav1 / Nand2Tetris-HDL-Visualizer

Repository for Nand2Tetris HDL Visualizer extension
2 stars 0 forks source link

Doesn't handle whitespace #3

Closed mightyhorst closed 2 years ago

mightyhorst commented 2 years ago

If I leave a space between the equals sign it will throw an error.

e.g. Working (but a different error)

CHIP Or {
    IN a, b;
    OUT out;

    PARTS:
    Nand (a=nota, b=notb, out=out);
    Not (in=a, out=nota);
    Not (in=b, out=notb);
}

Will run (but throw a system error see issue #2 )

However the parts syntax will throw a different error if there are spaces between the equals sign. e.g. a = nota

SyntaxError

This code will throw a regex error

SyntaxError: Expected "false", "true", or [a-z,A-Z] but " " found.
CHIP Or {
    IN a, b;
    OUT out;

    PARTS:
    Nand (a = nota, b=notb, out=out);
    Not (in=a, out=nota);
    Not (in=b, out=notb);
}

Note the a = nota

jainpranav1 commented 2 years ago

Thanks for letting me know! That looks like an issue with the parser I am using (https://www.npmjs.com/package/hdl-parser). I can look into a fix for this as well.

jainpranav1 commented 2 years ago

The issue has been fixed with the parser. In the next update of the visualizer, I will use the updated parser which should resolve this issue.

jainpranav1 commented 2 years ago

This issue should now be fixed with version 0.0.5. This was possible because the hdl parser was updated.

jainpranav1 commented 2 years ago

If the issue is resolved for you, I will close this issue.