I'm trying to write a Flycheck checker definition based on Hy, using the API here. As part of that, I have to define a pattern for error matching. Now, Hy gives quite a large error spew, for example:
Traceback (most recent call last):
File "/usr/bin/hy", line 9, in <module>
load_entry_point('hy==0.10.1', 'console_scripts', 'hy')()
File "/usr/lib/python3.4/site-packages/hy/cmdline.py", line 305, in hy_main
sys.exit(cmdline_handler("hy", sys.argv))
File "/usr/lib/python3.4/site-packages/hy/cmdline.py", line 293, in cmdline_handler
return run_file(options.args[0])
File "/usr/lib/python3.4/site-packages/hy/cmdline.py", line 194, in run_file
import_file_to_module("__main__", filename)
File "/usr/lib/python3.4/site-packages/hy/importer.py", line 74, in import_file_to_module
eval(ast_compile(_ast, fpath, "exec"), mod.__dict__)
File "helloworld.hy", line 1, in <module>
(prin "Hello world")
NameError: name 'prin' is not defined
The only part of interest to the checker is the very last bit:
File "helloworld.hy", line 1, in <module>
(prin "Hello world")
NameError: name 'prin' is not defined
So I need to write a :error-patters
form that will match the following exactly:
- A tab character
- The string
File "
- The name of my file (Flycheck does this using
(file-name)
) - The string
", line
(with a terminating space) - The line number (Flycheck does this using
line
) - The string
, in <module>\n\t\t
(where\n\t\t
is a newline followed by two tabs) - Whatever follows until the next newline (including that newline)
- Whatever remains is the error message (which Flycheck matches with
(message)
)
So far, I have this:
:error-patterns ((error line-start "\tFile \"" (file-name) "\", line " line ", in <module>\n\t\t")) ;something more needs to go here
This gets me as far as step 6, but I'm not sure what to do for step 7, as I don't know rx
at all. Any and all help would be very much appreciated, both by me and the fledgling Hy community.