From 9da6d01e36b6cfa6e171dd4c778ab3687d766ed3 Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Wed, 12 Jan 2022 14:56:37 +0530 Subject: ccwl: Add conditions. We introduce the &ccwl-violation condition. In later commits, it will be used to indicate ccwl syntax violations and to print out useful compiler errors. * ccwl/conditions.scm: New file. --- ccwl/conditions.scm | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 ccwl/conditions.scm diff --git a/ccwl/conditions.scm b/ccwl/conditions.scm new file mode 100644 index 0000000..756b46b --- /dev/null +++ b/ccwl/conditions.scm @@ -0,0 +1,39 @@ +;;; ccwl --- Concise Common Workflow Language +;;; Copyright © 2022 Arun Isaac +;;; +;;; This file is part of ccwl. +;;; +;;; ccwl is free software: you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation, either version 3 of the License, or +;;; (at your option) any later version. +;;; +;;; ccwl is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with ccwl. If not, see . + +(define-module (ccwl conditions) + #:use-module (rnrs conditions) + #:use-module (srfi srfi-28) + #:export (ccwl-violation + ccwl-violation? + ccwl-violation-file + ccwl-violation-line + ccwl-violation-column)) + +(define-condition-type &ccwl-violation &violation + make-ccwl-violation ccwl-violation? + (file ccwl-violation-file) + (line ccwl-violation-line) + (column ccwl-violation-column)) + +(define (ccwl-violation x) + "Return &ccwl-violation condition for syntax X." + (let ((properties (syntax-source x))) + (make-ccwl-violation (assq-ref properties 'filename) + (assq-ref properties 'line) + (assq-ref properties 'column)))) -- cgit v1.2.3