* bug#13585: pascal-mode doesn't recognize all free-pascal comments
@ 2013-01-29 13:09 vrt277
2013-01-31 1:02 ` Stefan Monnier
0 siblings, 1 reply; 2+ messages in thread
From: vrt277 @ 2013-01-29 13:09 UTC (permalink / raw)
To: 13585
Hi Emacs developers,
pascal-mode from pascal.el doesn't recognize c-style (aka delphi style)
one-line comments.
==example
// I'm a comment
==example
One-line comments is widely used in delphi/freepascal code. Examples can
be found in freepascal compiler sources (for example
https://github.com/graemeg/freepascal/blob/master/compiler/nflw.pas#L848).
(Most ugly thing is that apostrophe symbol inside comment will be
recognized
as start of string and source code below will be highlighted as
string).
Information about freepascal comments can be found here:
http://www.freepascal.org/docs-html/ref/refse2.html
Nowday freepascal is one of most widely used pascal compilers (after
Delphi). Although delphi-mode doesn't have
described problem I thiks if there is separate pascal-mode it should work
good. So problem should be fixed.
Thanks,
Vasiliy K.
In GNU Emacs 24.1.1 (i686-pc-linux-gnu, GTK+ Version 2.24.12)
of 2012-09-23 on panlong, modified by Debian
Windowing system distributor `The X.Org Foundation', version 11.0.11300000
Configured using:
`configure '--build' 'i686-linux-gnu' '--build' 'i686-linux-gnu'
'--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib'
'--localstatedir=/var/lib' '--infodir=/usr/share/info'
'--mandir=/usr/share/man' '--with-pop=yes'
'--enable-locallisppath=/etc/emacs24:/etc/emacs:/usr/local/share/emacs/24.1/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.1/site-lisp:/usr/share/emacs/site-lisp'
'--with-crt-dir=/usr/lib/i386-linux-gnu' '--with-x=yes'
'--with-x-toolkit=gtk' '--with-toolkit-scroll-bars'
'build_alias=i686-linux-gnu' 'CFLAGS=-g -O2 -fstack-protector
--param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wall -O2'
'CPPFLAGS=-D_FORTIFY_SOURCE=2''
Important settings:
value of $LC_ALL: nil
value of $LC_COLLATE: nil
value of $LC_CTYPE: nil
value of $LC_MESSAGES: nil
value of $LC_MONETARY: nil
value of $LC_NUMERIC: nil
value of $LC_TIME: nil
value of $LANG: en_US.UTF-8
value of $XMODIFIERS: nil
locale-coding-system: utf-8-unix
default enable-multibyte-characters: t
Major mode: Fundamental
Minor modes in effect:
tooltip-mode: t
mouse-wheel-mode: t
tool-bar-mode: t
menu-bar-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
blink-cursor-mode: t
auto-composition-mode: t
auto-encryption-mode: t
auto-compression-mode: t
line-number-mode: t
transient-mark-mode: t
Recent input:
M-x s e n d - e m a <tab> <backspace> <backspace> <backspace>
<M-backspace> r e p o r <tab> <return>
Recent messages:
Loading 00debian-vars...done
Loading /etc/emacs/site-start.d/50autoconf.el (source)...done
Loading /etc/emacs/site-start.d/50dictionaries-common.el (source)...
Loading debian-ispell...
Loading /var/cache/dictionaries-common/emacsen-ispell-default.el
(source)...done
Loading debian-ispell...done
Loading /var/cache/dictionaries-common/emacsen-ispell-dicts.el
(source)...done
Loading /etc/emacs/site-start.d/50dictionaries-common.el (source)...done
For information about GNU Emacs and the GNU system, type C-h C-a.
Load-path shadows:
/usr/share/emacs/24.1/site-lisp/debian-startup hides
/usr/share/emacs/site-lisp/debian-startup
/usr/share/emacs24/site-lisp/dictionaries-common/flyspell hides
/usr/share/emacs/24.1/lisp/textmodes/flyspell
/usr/share/emacs24/site-lisp/dictionaries-common/ispell hides
/usr/share/emacs/24.1/lisp/textmodes/ispell
Features:
(shadow sort gnus-util mail-extr emacsbug message format-spec rfc822 mml
easymenu mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader sendmail regexp-opt rfc2047 rfc2045
ietf-drums mm-util mail-prsvr mail-utils time-date tooltip ediff-hook
vc-hooks lisp-float-type mwheel x-win x-dnd tool-bar dnd fontset image
fringe lisp-mode register page menu-bar rfn-eshadow timer select
scroll-bar mouse jit-lock font-lock syntax facemenu font-core frame cham
georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese hebrew greek romanian slovak czech european ethiopic
indian cyrillic chinese case-table epa-hook jka-cmpr-hook help simple
abbrev minibuffer loaddefs button faces cus-face files text-properties
overlay sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote make-network-process dbusbind
dynamic-setting system-font-setting font-render-setting move-toolbar gtk
x-toolkit x multi-tty emacs)
^ permalink raw reply [flat|nested] 2+ messages in thread
* bug#13585: pascal-mode doesn't recognize all free-pascal comments
2013-01-29 13:09 bug#13585: pascal-mode doesn't recognize all free-pascal comments vrt277
@ 2013-01-31 1:02 ` Stefan Monnier
0 siblings, 0 replies; 2+ messages in thread
From: Stefan Monnier @ 2013-01-31 1:02 UTC (permalink / raw)
To: vrt277; +Cc: 13585
> Nowday freepascal is one of most widely used pascal compilers (after
> Delphi). Although delphi-mode doesn't have described problem I thiks
> if there is separate pascal-mode it should work good. So problem
> should be fixed.
Indeed, I even extended the syntax-table facility so as to be able to
properly support the many different comment styles in Pascal.
I installed the patch below, which should do what you asked for.
I hope someone can try and merge delphi.el and pascal.el. It can be
done step by step, e.g. by first making delphi.el a derived mode of
pascal.el and then moving delphi.el code to pascal.el bit by bit.
Stefan
=== modified file 'lisp/progmodes/pascal.el'
--- lisp/progmodes/pascal.el 2013-01-01 09:11:05 +0000
+++ lisp/progmodes/pascal.el 2013-01-31 00:56:19 +0000
@@ -138,6 +138,9 @@
;; find about the syntax of Pascal's comments said that (* ... } is
;; a valid comment, just as { ... *) or (* ... *) or { ... }.
(modify-syntax-entry ?* ". 23" st)
+ ;; Allow //...\n comments as accepted by Free Pascal.
+ (modify-syntax-entry ?/ ". 12c" st)
+ (modify-syntax-entry ?\n "> c" st)
(modify-syntax-entry ?{ "<" st)
(modify-syntax-entry ?} ">" st)
(modify-syntax-entry ?+ "." st)
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-01-31 1:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-29 13:09 bug#13585: pascal-mode doesn't recognize all free-pascal comments vrt277
2013-01-31 1:02 ` Stefan Monnier
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).