On Dec 27, 2008, at 12:51 AM, Abdulaziz Ghuloum wrote:


On Dec 26, 2008, at 8:39 PM, kub wrote:

I asked for help because vim error format settings are somewhat
tricky and my hope was that somebody already has this done.

Parsing error messages and compiler output is tricky and no one
likes to do it.

"Tricky" is not the right word here.  "Fragile" is more like it.
I remember once I did a search-and-replace of square brackets
with parenthesis in psyntax and realized days later that the
syntax error messages were printed as #<foo (char nn of file)>
instead of  #<foo [char nn of file]>, and was thinking: "whose
error parser did I break now".


Script follows.  Let me know if you have any suggestions.

I probably should've used "guard" in that program like:

#!/usr/bin/env scheme-script

(import (ikarus))

(define (compile script-name)
  (guard (con
           [(source-position-condition? con)
            (print-condition con (current-output-port))
            (system
              (format "vim ~a -c \"goto ~a\""
                (source-position-file-name con)
                (source-position-character con)))])
     (load-r6rs-script script-name #f #f)))

(apply
  (case-lambda
    [(script script-name) (compile script-name)]
    [(script . args) (error #f "usage: ~a <script-name>" script)])
  (command-line))

#!eof

And BTW, does anybody have a good way of handling command-line
arguments, other than using apply and case-lambda like I'm
doing above?

Aziz,,,

Reply via email to