Author: hhubner Date: 2007-11-29 08:18:49 -0500 (Thu, 29 Nov 2007) New Revision: 2294
Modified: branches/trunk-reorg/thirdparty/emacs/javascript.el Log: Updated version from http://joost.zeekat.nl/wp-content/javascript.el
Modified: branches/trunk-reorg/thirdparty/emacs/javascript.el =================================================================== --- branches/trunk-reorg/thirdparty/emacs/javascript.el 2007-11-29 11:57:01 UTC (rev 2293) +++ branches/trunk-reorg/thirdparty/emacs/javascript.el 2007-11-29 13:18:49 UTC (rev 2294) @@ -1,5 +1,14 @@ ;;; javascript.el --- Major mode for editing JavaScript source text
+;; This version contains a few font-lock fixes for quoted strings +;; and regular expressions by Joost Diepenmaat joost@zeekat.nl +;; Joost's version - 2007-11-29 + +;; Currently known issues: +;; +;; /* .. */ style comments inside quoted strings are shown as comments +;; instead of quoted strings. Fixing this may get complicated. + ;; Copyright (C) 2006 Karl Landström
;; Author: Karl Landström kland@comhem.se @@ -8,9 +17,6 @@ ;; Date: 2006-12-26 ;; Keywords: languages, oop
-;; This version contains a few font-lock fixes for quoted strings -;; and regular expressions by Joost Diepenmaat joost@zeekat.nl - ;; This file is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation; either version 2, or (at your option) @@ -117,6 +123,14 @@ (modify-syntax-entry ?' "." table) (modify-syntax-entry ?" "." table)
+ ;; partially disable comment detection. Our manual string detection + ;; won't work if there are automatically detected comments inside the + ;; string. + ;; + ;; note that we keep auto-detection of /* .. */ style comments since + ;; they are multi-line and can't easily be detected otherwise. + (modify-syntax-entry ?/ ". 14" table) + ;; The syntax class of underscore should really be `symbol' ("_") ;; but that makes matching of tokens much more complex as e.g. ;; "\<xyz\>" matches part of e.g. "_xyz" and "xyz_abc". Defines @@ -297,8 +311,10 @@
;; detect "autoquoted" object properties... clases with "switch { ... default: }" ;; may not be worth the trouble - (list "\(^[ \t]*\|[,{][ \t]*\)\(\w+\):" 2 font-lock-string-face)) + (list "\(^[ \t]*\|[,{][ \t]*\)\(\w+\):" 2 font-lock-string-face)
+ ;; find single-line comments + (list "\(//.*\)" 1 font-lock-comment-face)) "Level one font lock.")
(defconst js-font-lock-keywords-2