Skip to content

Disallow leading spaces in error regexp in interactive mode. #636

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

Closed

Conversation

ikirill
Copy link
Contributor

@ikirill ikirill commented May 8, 2015

Disallow leading spaces in error regexp in interactive mode.

Disallow leading spaces in error regexp in interactive mode.
@ikirill ikirill force-pushed the pr-interactive-next-error-regexp branch from 05b9857 to 6a9f506 Compare May 9, 2015 05:39
@gracjan gracjan changed the title Fix #635 Disallow leading spaces in error regexp in interactive mode. May 9, 2015
@gracjan
Copy link
Contributor

gracjan commented May 9, 2015

Fixes #635.

Note that we should really have a test suite with examples of texts that should and should not be matched.

@ikirill
Copy link
Contributor Author

ikirill commented May 9, 2015

The old regexp was really bad, but the new one of yours isn't that much better either.

haskell-compilation-error-regexp-alist and haskell-process-parse-error seem to do the actual work of parsing the error message. I just meant to fix the thing that I thought was immediately wrong with it.

What about this? It matches the filename greedily. Also, I don't think filenames are really restriced to alnum characters, even though module names might be.

(rx line-start
    (group
     (+ (not (any control))))
    ?:
    (group
     (+ (any digit))
     ?:
     (+ (any digit))
     (? ?-
        (+ (any digit))))
    ?:
    )
"^\\([^[:cntrl:]]+\\):\\([[:digit:]]+:[[:digit:]]+\\(?:-[[:digit:]]+\\)?\\):"

@gracjan
Copy link
Contributor

gracjan commented May 9, 2015

Does GHC do some quoting/escaping should a file name contain unfriendly character like on of `:'"/?

@gracjan
Copy link
Contributor

gracjan commented May 9, 2015

Can you please create some ert tests for this function? I feel uneasy accepting this commit without any tests whatsoever.

Please create a new file tests/interactive-haskell-mode-tests.el, copy paste a test from one of the other files in tests and add some lines that you want matches and some other that you want to not match.

@ikirill
Copy link
Contributor Author

ikirill commented May 13, 2015

Does GHC do some quoting/escaping should a file name contain unfriendly character like on of `:'"/?

Filenames (base names and dir names) are very unlikely to contain special characters like :/, especially when those can be directory separators. On the other hand, quotes are not a problem:

test"`'.hs:2:8-9: Couldn't match expected type ‘IO ()’ with actual type ‘()’ …

When the colon comes from a C:\... path on windows, it should be handled by the greediness of the + in the regexp.

@gracjan
Copy link
Contributor

gracjan commented Jul 23, 2015

@ikirill: Can we have some ert tests for this? It is a very useful functionality, but we must have tests before we merge.

@gracjan
Copy link
Contributor

gracjan commented Sep 28, 2015

@ikirill: What's up with this one? Have we achieved consensus here?

Do we have tests?

@gracjan
Copy link
Contributor

gracjan commented Nov 20, 2015

@ikirill ?

@gracjan
Copy link
Contributor

gracjan commented Jan 12, 2016

@bergey: Daniel, if you had time to take this one over it would be beyond great. We need tests.

@bergey
Copy link
Contributor

bergey commented Jan 13, 2016

OK, I'll add tests for this.

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.

3 participants