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
preparse behaviour #17778
Comments
comment:1
What exactly is the issue, I don't understand the description... |
comment:2
The issue is that when calling preparse, if the first line is a comment (IDK why it would start with a
would not get preparsed. Given the description, the preparser works on the assumption that the input is a specific self-contained line, but it seems to have the functionality to handle multi-line input. I think we should either see if there is a line break and then preparse the rest after the comment line or very explicitly state the assumption. |
This comment has been minimized.
This comment has been minimized.
Reviewer: Jeroen Demeyer |
comment:4
Not a bug.
|
Commit: |
Changed reviewer from Jeroen Demeyer to none |
Author: Travis Scrimshaw |
comment:6
I feel like this needs to a be little bit more explicitly documented. New commits:
|
Branch: public/17778 |
comment:7
Actually, I'm not sure that is true. How are block comments with I type in
which gets fed to the interpreter, which results in
which then gets sent to the preparser as a complete unit (a single string) and becomes
Unless I am misunderstanding something? |
comment:8
Okay, so it does things a little differently than I thought. The interpreter decides whether or not it needs to preparse a line. So the interpreter keeps track of whether you're in a comment or not. If it has a line break with a Although I can break the preparser by doing
So there is an issue with bad user input, but I'm not sure what to do about that. |
comment:9
Solved by #31043. If you agree, remove the branch, move your name |
Reviewer: Travis Scrimshaw |
Changed branch from public/17778 to none |
Changed author from Travis Scrimshaw to none |
Changed commit from |
comment:10
I agree this is fixed. It would be nice to do something about the error in comment:8, but I think that is expecting too much. |
I noticed that apparently
preparse
treats a (multiline) string as comment, if the first non-whitespace character is a#
:I wonder why, because it is not unusual for a block of code to start with a comment. I cannot see where comments in later lines are treated, so I have no idea how to fix this.
The issue is that when calling preparse, if the first line is a comment (IDK why it would start with a
!
...) then it does not preparse anything further. Specifically, if there is a multiline statement that you want to preparse, but the first line is a comment, it doesn't do anything. For example:would not get preparsed. Given the description, the preparser works on the assumption that the input is a specific self-contained line, but it seems to have the functionality to handle multi-line input. I think we should either see if there is a line break and then preparse the rest after the comment line or very explicitly state the assumption.
Component: user interface
Keywords: preparser
Reviewer: Travis Scrimshaw
Issue created by migration from https://trac.sagemath.org/ticket/17778
The text was updated successfully, but these errors were encountered: