Q: Dual-style comments in PL/SQL mode?

From: Peter Mroz <pmroz_at_domaincorp.com>
Date: 1996/10/14
Message-ID: <32623D49.7BD5_at_domaincorp.com>#1/1


I'm having trouble getting dual style comments to work in PL/SQL mode. PL/SQL gives Oracle procedural extensions to SQL. The language seems to be based on Ada, and the PL/SQL mode I got via the net is based on Ada-mode.

Comments in PL/SQL can come in two flavors:

  1. C-style comments:

        /* This is a comment */

        FUNCTION foobar(a IN INTEGER, b OUT INTEGER); /* Function foobar */

	/* This is a multi-line
	   comment */

2. Everything after two dashes (--) up to the end of a line

        FUNCTION foobar(a IN INTEGER, b OUT INTEGER); -- Function foobar

  • This function foos your bar nicely

I read the Lisp manual, and it appears that dual-style comments only work when the first character is the same! That's why it works for C++ mode for /* */ and // comments.

Here's a snippet from the syntax table definition:

  ;; a single hyphen is punctuation, but a double hyphen starts a comment
(modify-syntax-entry ?- ". 56" pls-mode-syntax-table)

  ;; and \f and \n end a comment
(modify-syntax-entry ?\f "> b" pls-mode-syntax-table)
(modify-syntax-entry ?\n "> b" pls-mode-syntax-table)

(if t ;; PLS has C-style comments

      (progn
	(cond
	 ((pls-xemacs)
	  ;; XEmacs (formerly Lucid) has the best implementation
	  (modify-syntax-entry ?/  ". 14" pls-mode-syntax-table)
	  (modify-syntax-entry ?*  ". 23"   pls-mode-syntax-table))
	 (t
	  ;; FSF Emacs 19 does things differently, but we can work with it
	  (modify-syntax-entry ?/  ". 124b" pls-mode-syntax-table)
	  (modify-syntax-entry ?*  ". 23"   pls-mode-syntax-table)
	  ))))


Any suggestions?

Thanks in advance!

-- 
Peter Mroz				Domain Solutions Corporation
Tel: 610-892-7540			1023 East Baltimore Pike, Suite 205
Fax: 610-892-7616			Media, PA 19063
Received on Mon Oct 14 1996 - 00:00:00 CEST

Original text of this message