[Top][All Lists]

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

syntax table entries for comments

From: Arjan Bos
Subject: syntax table entries for comments
Date: Mon, 08 Sep 2003 07:39:08 +0200
User-agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.4) Gecko/20030624

Hi all,

First of, many thanks to those who answered my question about info for major-mode writers. The mode tutorial on emacs wiki was most enlightning. In fact it was so helpful, that I decided to completely rewrite the major-mode for NetRexx. When it's done I'll post it in gnu.emacs.sources.

But before that can happen, I'll need some clues. NetRexx is a programming language that contains two types of comments. The first is for large blocks and is the familiar /* */ construction. This I can do by looking at the examples. The second one is a single-line comment that consists of two hyphens, like:
  -- this is a comment.

Based on the major mode tutorial I did put the following code in:

(defvar nrx-mode-syntax-table nil
  "Syntax table in use in NRX-mode buffers.")

(defun nrx-create-syntax-table ()
  (if nrx-mode-syntax-table
    (setq nrx-mode-syntax-table (make-syntax-table))
    (modify-syntax-entry ?. "." nrx-mode-syntax-table)
    (modify-syntax-entry ?- ". 12b" nrx-mode-syntax-table)
    (modify-syntax-entry ?/ ". 14" nrx-mode-syntax-table)
    (modify-syntax-entry ?* ". 23" nrx-mode-syntax-table)
    (modify-syntax-entry ?\n "> b" nrx-mode-syntax-table)
    (modify-syntax-entry ?\' "\"" nrx-mode-syntax-table))

  (set-syntax-table nrx-mode-syntax-table))

This works but also renders the combination -* and *- as comment start and end, which is wrong. Could anyone please tell me what I'm missing?



reply via email to

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