From: Chris Hanson Date: Fri, 29 Jun 2001 05:19:24 +0000 (+0000) Subject: * Track the line number of the current buffer position, so that error X-Git-Tag: 20090517-FFI~2690 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=99d7c6935fe5012025c8b93cf765d45752b0c080;p=mit-scheme.git * Track the line number of the current buffer position, so that error messages can refer to the line. Change representation of buffer pointers to include the line number. Add operation to generate a string that shows the line number and character number of either a given pointer or the current position. * Eliminate DECREMENT-PARSER-BUFFER-POINTER, which was unused and makes implementing the line number more difficult. * Add -NO-ADVANCE versions of procedures that match single characters. * Change terminology: the index of the current character in the buffer is called a "position". The word "pointer" is reserved to refer to pointer objects that are handed to the users, which themselves refer to positions. --- diff --git a/v7/src/star-parser/buffer.scm b/v7/src/star-parser/buffer.scm index 0ecf0f903..1a9ee5899 100644 --- a/v7/src/star-parser/buffer.scm +++ b/v7/src/star-parser/buffer.scm @@ -1,6 +1,6 @@ ;;; -*-Scheme-*- ;;; -;;; $Id: buffer.scm,v 1.3 2001/06/29 05:18:19 cph Exp $ +;;; $Id: buffer.scm,v 1.4 2001/06/29 05:19:24 cph Exp $ ;;; ;;; Copyright (c) 2001 Massachusetts Institute of Technology ;;; @@ -104,15 +104,15 @@ (error:wrong-type-argument p "parser-buffer pointer" 'POINTER->INDEX))) (define (parser-buffer-position-string object) - (let ((position - (if (parser-buffer-position? object) + (let ((pointer + (if (parser-buffer-pointer? object) object (get-parser-buffer-pointer object)))) (string-append "line " - (number->string (+ (parser-buffer-pointer-line object) 1)) + (number->string (+ (parser-buffer-pointer-line pointer) 1)) ", char " - (number->string (+ (parser-buffer-pointer-index object) 1))))) + (number->string (+ (parser-buffer-pointer-index pointer) 1))))) (let-syntax ((char-matcher