mit-scheme-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[MIT-Scheme-devel] Parsing the file attributes line.


From: Joe Marshall
Subject: [MIT-Scheme-devel] Parsing the file attributes line.
Date: Sun, 28 Mar 2010 13:06:44 -0700

I've just added support for parsing the `file attributes line' in
scheme source files.
The file attributes line is the line at the top of the file that looks
like this:
 -*- Mode: Scheme -*-

In order for the line to be parsed, it must be the first or second
line in the file,
and it must be within a comment.  If it is within a ';' comment, it may not
span more than one line.  If it is within a multiline comment '#| |#',
it may span
more than one line, but must start on the first or second line, and it must
not be within a nested multiline comment.

The parser is fairly robust, and will attempt to recover gracefully if it gets
confused by ill-formed file attributes lines.  You may on occasion see
warnings about ill-formed file attributes lines.  You can disable the parsing
altogether by setting *parser-enable-file-attributes-parsing?* to #F.

Most attributes are ignored.  There are three attributes that are not.
 If the mode
attribute is present and it is not `Scheme', a warning is issued.  The file will
be parsed as a scheme file anyway.

If the keyword-style attribute is present, it should have the value "prefix"
or "suffix".  This will direct the parser to override the default keyword style
for the duration of the file.  If the value is prefix, then symbols
prefixed with
colon will be read as keywords.  If the value is suffix, then symbols with a
colon suffix will be read as keywords.

You can override the default case sensitivity on a file-by-file basis
by specifying the
sTuDly-case attribute to be True.  Be sure to get the case absolutely
correct because it is important.  You can disable case sensitivity by
specifying the attribute to be false.  Case is ignored if you are disabling it.

Here are some examples:

;;; -*- mode:scheme; keyword-style:prefix -*-

;;; -*- Mode: Scheme; sTuDly-case: True; keyword-style:suffix -*-

;;; Hey Emacs, this is -*-Scheme-*- mode.

#|  -*-mode:scheme;studly-case:false-*-
|#

-- 
~jrm




reply via email to

[Prev in Thread] Current Thread [Next in Thread]