From: Ulrich Becker
Subject: Analysing lisp-sourcecode
Date: 
Message-ID: <5o3ajh$40b@faui40f.informatik.uni-erlangen.de>
Hi,

I'm currently developing a system that generates CLOS-code-skeletons
from class-diagrams of an object-oriented design. Thereby I ran across
the following problem:

If the design changes, I have to generate a new version of the
code-skeleton. Code that was manually inserted in the meantime should
be extracted and included in the new version of the skeleton. The most
trivial solution to this problem would be to use #'read to collect
all expressions, but this way I loose all comments and whitespace.

The ideal solution would be to have

1. all forms from the sourcefile as they are returned from read
   (since having them as lists would make their analysis very simple)

2. a mapping from these forms and their elements to absolute
   positions in the file (so that I can figure out, for example, that 
   a certain form starts at position 234 and ends at position 345. 
   Using #'read and #'file-position, i just get the end-position of
   the last expression read)  

Any hints and ideas how such a mapping could be extracted from a
source-file?

Thanks in advance,

Ulrich