Re: Commented by default
Christian Himpe <[email protected]>
| Newsgroups | gmane.lisp.scheme.chicken |
|---|---|
| Message-ID | <[email protected]> |
> On 27. Apr 2024, at 20:02, [email protected] wrote: > >> Dear All, >> >> is it somehow possible (ie via macros) to have a line in a scheme source code file being a comment line by default and only when a certain symbol or group of symbols is starting a line it is an uncommented / evaluated line? Basically, the reverse of a normal source file where I need to introduce a comment line. I would imagine a header line setting up this "comment"-mode, and below this every line becomes a comment unless explicitly uncommented. > > You could use "set-read-syntax!" or "set-sharp-read-syntax!" to define a sequence > that either treats the line as a comment or reads and returns it as an expression. > Dropping means to skip subsequent lines prefixed with the chosen sequence or > returning the first expression that follows. Since an expression may straddle multiple > prefixed lines, you may have to dynamically bind a flag that ignores the sequence > in nested reads. This may need a bit of fiddling, but that is probably the approach > I would try. > > > felix > Dear felix, This looks like a very good starting point. Thank you for pointing me in the right direction. Cheers Christian