From c97f7cfe7137da1f91b4db94a00ce71a96adec62 Mon Sep 17 00:00:00 2001 From: Ludovic Court`es Date: Fri, 24 Aug 2007 17:36:29 +0000 Subject: Slightly improved AST classes and methods. * src/guile/skribilo/ast.scm: For all simple getters, use GOOPS's `:getter' rather than define functions that call `slot-ref'. git-archimport-id: lcourtes@laas.fr--2006-libre/skribilo--devo--1.2--patch-93 --- src/guile/skribilo/ast.scm | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/guile/skribilo/ast.scm b/src/guile/skribilo/ast.scm index 930ec60..3ed33c9 100644 --- a/src/guile/skribilo/ast.scm +++ b/src/guile/skribilo/ast.scm @@ -219,12 +219,11 @@ ;;; ;;; ====================================================================== (define-class () - (fmt :init-keyword :fmt) - (body :init-keyword :body)) + (fmt :init-keyword :fmt :getter command-fmt) + (body :init-keyword :body :getter command-body)) (define (command? obj) (is-a? obj )) -(define (command-fmt obj) (slot-ref obj 'fmt)) -(define (command-body obj) (slot-ref obj 'body)) + ;;; ====================================================================== ;;; @@ -232,10 +231,9 @@ ;;; ;;; ====================================================================== (define-class () - (proc :init-keyword :proc)) + (proc :init-keyword :proc :getter unresolved-proc)) (define (unresolved? obj) (is-a? obj )) -(define (unresolved-proc obj) (slot-ref obj 'proc)) ;;; ====================================================================== ;;; @@ -246,8 +244,7 @@ (ast :init-keyword :ast :init-value #f :getter handle-ast)) (define (handle? obj) (is-a? obj )) -(define (handle-ast obj) (slot-ref obj 'ast)) -(define (handle-body h) (slot-ref h 'body)) +(define (handle-body h) (slot-ref h 'body)) ;; FIXME: Looks suspicious! ;;; ====================================================================== ;;; @@ -281,13 +278,13 @@ ;;; ;;; ====================================================================== (define-class () - (combinator :init-keyword :combinator :init-value (lambda (e1 e2) e1)) - (engine :init-keyword :engine :init-value 'unspecified) + (combinator :init-keyword :combinator :init-value (lambda (e1 e2) e1) + :getter processor-combinator) + (engine :init-keyword :engine :init-value 'unspecified + :getter processor-engine) (procedure :init-keyword :procedure :init-value (lambda (n e) n))) (define (processor? obj) (is-a? obj )) -(define (processor-combinator obj) (slot-ref obj 'combinator)) -(define (processor-engine obj) (slot-ref obj 'engine)) @@ -437,10 +434,9 @@ ;;; ;;; ====================================================================== (define-class () - (env :init-keyword :env :init-value '())) + (env :init-keyword :env :init-value '() :getter container-env)) (define (container? obj) (is-a? obj )) -(define (container-env obj) (slot-ref obj 'env)) (define container-options markup-options) (define container-ident markup-ident) (define container-body node-body) @@ -461,8 +457,8 @@ (define (document? obj) (is-a? obj )) -(define (document-ident obj) (slot-ref obj 'ident)) -(define (document-body obj) (slot-ref obj 'body)) +(define document-ident container-ident) +(define document-body container-body) (define document-options markup-options) (define document-env container-env) -- cgit v1.2.3