From Martin Maechler <maechler@stat.math.ethz.ch>  Thu Jun 20 11:13:33 2002
From: Martin Maechler <maechler@stat.math.ethz.ch> (Martin Maechler)
Date: Thu, 20 Jun 2002 12:13:33 +0200
Subject: a version of source() which keeps comments ?
Message-ID: <15633.43725.738497.292166@gargle.gargle.HOWL>

I'd like to have this to be used in, e.g.,
demo() and example().

Currently, source() parse()s the entire file and then evaluates
expression by expression. ``Of course'',  parse() already loses
the comments.

An (much slower) alternative might be to the readLine() the
file, echo what we read, 
and try to parse() ``the current chunk''.
when parse() fails (when the current expression is incomplete),
we silently read the next line, etc, until the expression is complete and hence
parse() succeeds, then we eval() and print().

What do people think?

Would there be volunteers to write this?
[I think it should finalize as an optional argument to source(), 
 but for experimentation it might be easier to try with a
 function  sourceLinewise(.)
].

Martin Maechler <maechler@stat.math.ethz.ch>	http://stat.ethz.ch/~maechler/
Seminar fuer Statistik, ETH-Zentrum  LEO C16	Leonhardstr. 27
ETH (Federal Inst. Technology)	8092 Zurich	SWITZERLAND
phone: x-41-1-632-3408		fax: ...-1228			<><
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


a version of source() which keeps comments ?
Martin Maechler