-
Notifications
You must be signed in to change notification settings - Fork 1
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
Tab/space parsing issue #14
Comments
I am quite confident that there's an issue in the preprocessor, especially when it comes to comments. I am guessing it's related. The preprocessor is quite greedy in its approach. |
nextToken :: PP (T.Text, Int)
nextToken = do
(ST t i ti) <- get
-- first split the input up in its leading whitespace/newline and the rest
let (fluff, t') = T.span (\c -> c == ' ' || c == '\n') t
-- then extract the next token and the rest of the input
let (token, t'') = T.span (\c -> c /= ' ' && c /= '\n') t'
-- update the internal column counter
updateColumn fluff
c <- gets current
-- emit the things we just cut off, to keep
-- the annotated code as close to the source as possible
tell fluff
-- modify the internal state to reflect the rest of the input
modify $ \(ST _ c i) -> ST t'' c i
-- get the column of the current token and return the subsequent pair
column <- gets current
return (token, column) Here it seems as if I am only considering spaces and newlines. If there's a tab in the commit you referenced, this is probably where the issue is. The good thing about the preprocessor is that it's quite short and simple, so changing it should not be too difficult, but a bad thing is that I've not documented it very well. @Abhiroop |
Aha! Perhaps that's the fix! Good that you documented it here. This is nothing very urgent; we can push this change later. |
This is not strictly a space/tab issue but this program:
issues the following error:
The |
As evidenced in this commit: d3b3a69
Extraneous tabs/spaces result in the following incomprehensible error:
Can we catch this and emit a more friendly error message?
The text was updated successfully, but these errors were encountered: