From 620c89651ae54f8f35c3d0926f8c2c36c3fdd174 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Mon, 19 Oct 2009 22:38:34 +0200 Subject: Add support for R6RS/SRFI-30 nested block comments. Suggested by Andreas Rottmann . * libguile/read.c (flush_ws, scm_read_sharp): Add support for R6RS/SRFI-30 block comments. (scm_read_r6rs_block_comment): New function. * test-suite/tests/reader.test (exception:unterminated-block-comment): Adjust to match both block comment styles. ("reading")["R6RS/SRFI-30 block comment", "R6RS/SRFI-30 nested block comment", "R6RS/SRFI-30 block comment syntax overridden"]: New tests. ("exceptions")["R6RS/SRFI-30 unterminated nested block comment"]: New test. * doc/ref/api-evaluation.texi (Block Comments): Mention SRFI-30/R6RS block comments. * doc/ref/srfi-modules.texi (SRFI-30): New node. --- doc/ref/api-evaluation.texi | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'doc/ref/api-evaluation.texi') diff --git a/doc/ref/api-evaluation.texi b/doc/ref/api-evaluation.texi index 8abd9f9cf..e50a51546 100644 --- a/doc/ref/api-evaluation.texi +++ b/doc/ref/api-evaluation.texi @@ -230,6 +230,21 @@ Thus a Guile script often starts like this. More details on Guile scripting can be found in the scripting section (@pxref{Guile Scripting}). +@cindex R6RS block comments +@cindex SRFI-30 block comments +Similarly, Guile (starting from version 2.0) supports nested block +comments as specified by R6RS and +@url{http://srfi.schemers.org/srfi-30/srfi-30.html, SRFI-30}: + +@lisp +(+ #| this is a #| nested |# block comment |# 2) +@result{} 3 +@end lisp + +For backward compatibility, this syntax can be overridden with +@code{read-hash-extend} (@pxref{Reader Extensions, +@code{read-hash-extend}}). + There is one special case where the contents of a comment can actually affect the interpretation of code. When a character encoding declaration, such as @code{coding: utf-8} appears in one of the first -- cgit v1.2.3