Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

18c Fix: Logical operators #49

Merged
merged 4 commits into from
May 5, 2022
Merged

18c Fix: Logical operators #49

merged 4 commits into from
May 5, 2022

Conversation

ngjunsiang
Copy link
Contributor

Oops, one bug that slipped testing!

Test code:

PROCEDURE TestBool(Succeeded : BOOLEAN)
    IF Succeeded = TRUE AND NOT (-1 = -1)
      THEN
        OUTPUT "Yay!"
      ELSE
        OUTPUT "Awww!"
    ENDIF
ENDPROCEDURE

CALL TestBool(TRUE)

This doesn't work, because ...
https://github.com/nyjc-computing/pseudo/blob/660d9fd53224954cf78282b4d79d06271ef7f4dc/parser.py#L88-L95

Our unary() parser is too generous, parsing an entire expression, which gives us -(1 = -1) instead of ((-1) = (-1)).

Simple fix: parse with value() instead of expression():
e4bdb4a

@ngjunsiang
Copy link
Contributor Author

Another minor issue: errors involving names display a Name Expr instead of a token. That's because we didn't insert the correct token. Fix: [4420dc6]

And with that, we also wrap up two issues: #5 and #7.

@ngjunsiang ngjunsiang merged commit 4e1ea55 into main May 5, 2022
@ngjunsiang ngjunsiang deleted the boolean branch May 5, 2022 07:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant