From 0767b6a8c74b072269f74ad9ca74353a09b41356 Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Fri, 29 Jun 2001 05:18:19 +0000 Subject: [PATCH] * 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. --- v7/src/star-parser/buffer.scm | 4 ++-- v7/src/star-parser/parser.pkg | 24 +++++++++++++++++++----- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/v7/src/star-parser/buffer.scm b/v7/src/star-parser/buffer.scm index f78f78a38..0ecf0f903 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.2 2001/06/29 05:17:21 cph Exp $ +;;; $Id: buffer.scm,v 1.3 2001/06/29 05:18:19 cph Exp $ ;;; ;;; Copyright (c) 2001 Massachusetts Institute of Technology ;;; @@ -118,7 +118,7 @@ ((char-matcher (lambda (name test) `(BEGIN - (DEFINE (,(symbol-append 'MATCH-PARSER-BUFFER- name -NO-ADVANCE) + (DEFINE (,(symbol-append 'MATCH-PARSER-BUFFER- name '-NO-ADVANCE) BUFFER REFERENCE) (LET ((CHAR (PEEK-PARSER-BUFFER-CHAR BUFFER))) (AND CHAR diff --git a/v7/src/star-parser/parser.pkg b/v7/src/star-parser/parser.pkg index 06f5ef6e0..8e17fd59c 100644 --- a/v7/src/star-parser/parser.pkg +++ b/v7/src/star-parser/parser.pkg @@ -1,6 +1,6 @@ ;;; -*-Scheme-*- ;;; -;;; $Id: parser.pkg,v 1.2 2001/06/26 18:51:33 cph Exp $ +;;; $Id: parser.pkg,v 1.3 2001/06/29 05:17:24 cph Exp $ ;;; ;;; Copyright (c) 2001 Massachusetts Institute of Technology ;;; @@ -23,20 +23,24 @@ (global-definitions "$brun/runtime") -(define-package (runtime *parser) - (files "buffer" "synchk" "shared" "matcher" "parser") +(define-package (runtime *parser buffer) + (files "buffer") (parent ()) (export () - decrement-parser-buffer-pointer discard-parser-buffer-head! get-parser-buffer-pointer get-parser-buffer-tail input-port->parser-buffer match-parser-buffer-char match-parser-buffer-char-ci + match-parser-buffer-char-ci-no-advance match-parser-buffer-char-in-set + match-parser-buffer-char-in-set-no-advance + match-parser-buffer-char-no-advance match-parser-buffer-not-char match-parser-buffer-not-char-ci + match-parser-buffer-not-char-ci-no-advance + match-parser-buffer-not-char-no-advance match-parser-buffer-string match-parser-buffer-string-ci match-parser-buffer-string-ci-no-advance @@ -45,10 +49,20 @@ match-parser-buffer-substring-ci match-parser-buffer-substring-ci-no-advance match-parser-buffer-substring-no-advance + parser-buffer-line + parser-buffer-pointer-index + parser-buffer-pointer-line + parser-buffer-pointer? + parser-buffer-position-string parser-buffer? peek-parser-buffer-char read-parser-buffer-char set-parser-buffer-pointer! source->parser-buffer string->parser-buffer - substring->parser-buffer)) \ No newline at end of file + substring->parser-buffer)) + +(define-package (runtime *parser) + (files "synchk" "shared" "matcher" "parser") + (parent ()) + (export ())) \ No newline at end of file -- 2.25.1