emacs-devel
[Top][All Lists]
Advanced

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

Re: How does one set up a syntax table for (* and //?


From: Noam Postavsky
Subject: Re: How does one set up a syntax table for (* and //?
Date: Wed, 11 Jan 2017 20:19:52 -0500

On Wed, Jan 11, 2017 at 10:44 AM, Clément Pit--Claudel
<address@hidden> wrote:
>
> As far as I can tell from the docs, the following syntax table should 
> recognize // … line comments and nestable (* … *) comments properly:
>
>     (defvar example-syntax-table
>       (let ((table (make-syntax-table)))
>         (modify-syntax-entry ?*  ". 23" table)
>         (modify-syntax-entry ?/  ". 12c" table)
>         (modify-syntax-entry ?\n  "> c" table)
>         (modify-syntax-entry ?\( "()1n" table)
>         (modify-syntax-entry ?\) ")(4n" table)
>         table))
[...]
> In this example, the last line (“which incorrectly extends past the 
> newline?”), is considered to be a comment, because the sequence "(/" is 
> treated as a multiline comment opener.

You don't want "a" style comment chars combining with "c" style
comment chars. Unfortunately, Emacs doesn't implement that. I think
you'll have to implement these kind of comments with a
syntax-propertize-function.



reply via email to

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