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

Special error message for pre- or postfix operators immediately next to other operators #345

Open
byorgey opened this issue Mar 10, 2022 · 3 comments
Labels
C-Moderate Effort Should take a moderate amount of time to address. S-Nice to have Minor importance U-Error Reporting U-Parsing Z-Feature Request

Comments

@byorgey
Copy link
Member

byorgey commented Mar 10, 2022

Disco> Disco> 1/-1
1:2:
  |
1 | 1/-1
  |  ^
unexpected '/'
expecting digit, end of input, expression, operator, or type annotation
Disco> 1/ -1
-1

Can we fix this? /- is not a valid operator so it would be nice if the parser could figure this out.

@byorgey byorgey added C-Low Hanging Fruit Shouldn't take too much time; ideal issues for new contributors. U-Parsing S-Nice to have Minor importance Z-Bug labels Mar 10, 2022
@byorgey byorgey changed the title Spaces required before negative sign? Special error message for operator before negative sign Mar 11, 2022
@byorgey
Copy link
Member Author

byorgey commented Mar 11, 2022

Ah, well, if we implement #136, then /- could be a valid operator... I think we shouldn't fix this. But I'm leaving this ticket open and repurposing it to see if we can generate a special error message when this situation occurs.

@byorgey
Copy link
Member Author

byorgey commented May 3, 2022

Note a similar kind of thing can happen with postfix operators right next to other operators:

Disco> 10! * 11!/5!
1:9:
  |
1 | 10! * 11!/5!
  |         ^
unexpected '!'
expecting digit, end of input, expression, operator, or type annotation

@byorgey byorgey changed the title Special error message for operator before negative sign Special error message for pre- or postfix operators immediately next to other operators May 3, 2022
@byorgey
Copy link
Member Author

byorgey commented Oct 7, 2023

#101 could conceivably help with this.

@byorgey byorgey added C-Moderate Effort Should take a moderate amount of time to address. Z-Feature Request U-Error Reporting and removed C-Low Hanging Fruit Shouldn't take too much time; ideal issues for new contributors. Z-Bug labels Aug 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-Moderate Effort Should take a moderate amount of time to address. S-Nice to have Minor importance U-Error Reporting U-Parsing Z-Feature Request
Projects
None yet
Development

No branches or pull requests

1 participant