Cope with no reported error when formatting error messages. default tip
authorTony Garnock-Jones <tonygarnockjones@gmail.com>
Mon, 04 Jul 2011 10:59:25 -0400
changeset 37 c28094727b3d
parent 36 ae93c5bd6657
Cope with no reported error when formatting error messages.
ometa.scm
--- a/ometa.scm	Mon Jul 04 10:21:32 2011 -0400
+++ b/ometa.scm	Mon Jul 04 10:59:25 2011 -0400
@@ -782,18 +782,20 @@
   (emit (map serialize-production ast)))
 
 (define (format-ometa-error err)
-  (let ((s (open-output-string)))
-    (display "Parse error at position " s)
-    (write (car err) s)
-    (newline s)
-    (display "Error messages:" s)
-    (newline s)
-    (for-each (lambda (msg)
-		(display " - " s)
-		(write msg s)
-		(newline s))
-	      (cdr err))
-    (get-output-string s)))
+  (if err
+      (let ((s (open-output-string)))
+	(display "Parse error at position " s)
+	(write (car err) s)
+	(newline s)
+	(display "Error messages:" s)
+	(newline s)
+	(for-each (lambda (msg)
+		    (display " - " s)
+		    (write msg s)
+		    (newline s))
+		  (cdr err))
+	(get-output-string s))
+      "No error"))
 
 (define (report-ometa-error err)
   (display (format-ometa-error err))