aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--vcl-mode.el107
1 files changed, 61 insertions, 46 deletions
diff --git a/vcl-mode.el b/vcl-mode.el
index c6ea5e1..b3e8a26 100644
--- a/vcl-mode.el
+++ b/vcl-mode.el
@@ -40,26 +40,10 @@
(defvar vcl-mode-syntax-table
(let ((st (make-syntax-table)))
- (modify-syntax-entry ?\n "> b" st)
- (modify-syntax-entry ?\r "> " st)
- (modify-syntax-entry ?\f "> " st)
-; (modify-syntax-entry ?\# "<" st)
- (modify-syntax-entry ?/ ". 124b" st)
- (modify-syntax-entry ?* ". 23" st)
- (modify-syntax-entry ?+ "." st)
- (modify-syntax-entry ?- "." st)
- (modify-syntax-entry ?~ "." st)
- (modify-syntax-entry ?= "." st)
- (modify-syntax-entry ?% "." st)
- (modify-syntax-entry ?< "." st)
- (modify-syntax-entry ?> "." st)
- (modify-syntax-entry ?& "." st)
- (modify-syntax-entry ?| "." st)
- (modify-syntax-entry ?_ "_" st)
(modify-syntax-entry ?\' "." st)
- (modify-syntax-entry ?\" "." st)
- (modify-syntax-entry ?{ "." st)
- (modify-syntax-entry ?} "." st)
+ ;; (modify-syntax-entry ?\" "." st)
+ ;; (modify-syntax-entry ?{ "." st)
+ ;; (modify-syntax-entry ?} "." st)
st)
"Syntax table in use in VCL Mode buffers.")
@@ -322,44 +306,75 @@
(put-text-property (point) (+ (point) 1)
'syntax-table (string-to-syntax ">")))))))
-(defconst vcl-syntax-propertize-function
- (syntax-propertize-rules
- ("\\({\\)\""
- (1 "|"))
- ("\\({\\)[^\"]"
- (1 "(}"))
- ("\"\\(}\\)"
- (1 "|"))
- ("\\(^\\|[^\"]\\)\\(}\\)"
- (2 "){"))
- ("\\(\"\\)[^}]"
- (1 (let ((syntax (save-match-data (syntax-ppss))))
- (string-to-syntax
- (cond ((nth 4 syntax)
- ".")
- ((eq (nth 3 syntax) t)
- (backward-char)
- ".")
- (t
- (backward-char)
- "\""))))))
- ("\\(#\\)"
- (1 (ignore (vcl-sharp-comment-syntax))))
- ))
+(cond
+ ((and (>= emacs-major-version 24) (>= emacs-minor-version 1))
+ (defconst vcl-syntax-propertize-function
+ (syntax-propertize-rules
+ ("\\({\\)\""
+ (1 "|"))
+ ("\\({\\)[^\"]"
+ (1 "(}"))
+ ("\"\\(}\\)"
+ (1 "|"))
+ ("\\(^\\|[^\"]\\)\\(}\\)"
+ (2 "){"))
+ ("\\(\"\\)[^}]"
+ (1 (let ((syntax (save-match-data (syntax-ppss))))
+ (string-to-syntax
+ (cond ((nth 4 syntax)
+ ".")
+ ((eq (nth 3 syntax) t)
+ (backward-char)
+ ".")
+ (t
+ (backward-char)
+ "\""))))))
+ ("\\(#\\)"
+ (1 (ignore (vcl-sharp-comment-syntax)))) )))
+ (t
+ (defconst vcl-font-lock-syntactic-keywords
+ '(("\\({\\)\""
+ 1 "|")
+ ("\\({\\)[^\"]"
+ 1 "(}")
+ ("\"\\(}\\)"
+ 1 "|")
+ ("\\(^\\|[^\"]\\)\\(}\\)"
+ 2 "){")
+ ("\\(\"\\)[^}]"
+ 1 (let ((syntax (save-match-data (syntax-ppss))))
+ (string-to-syntax
+ (cond ((nth 4 syntax)
+ ".")
+ ((eq (nth 3 syntax) t)
+ (backward-char)
+ ".")
+ (t
+ (backward-char)
+ "\"")))))
+ ("\\(#\\)"
+ (1 (ignore (vcl-sharp-comment-syntax)))) ))) )
;;;###autoload
(add-to-list 'auto-mode-alist (cons (purecopy "\\.vcl\\'") 'vcl-mode))
;;;###autoload
-(define-derived-mode vcl-mode prog-mode "VCL"
+(define-derived-mode vcl-mode c-mode "VCL"
"Major mode for editing VCL code.
Key bindings:
\\{vcl-mode-map}"
- (set (make-local-variable 'syntax-propertize-function)
- vcl-syntax-propertize-function)
+ (cond
+ ((and (>= emacs-major-version 24) (>= emacs-minor-version 1))
+ (set (make-local-variable 'syntax-propertize-function)
+ vcl-syntax-propertize-function))
+ (t
+ (set (make-local-variable 'font-lock-syntactic-keywords)
+ vcl-font-lock-syntactic-keywords)))
+
(set (make-local-variable 'parse-sexp-lookup-properties) t)
+ (set (make-local-variable 'parse-sexp-ignore-comments) t)
(set (make-local-variable 'comment-start) "# ")
(c-initialize-cc-mode t)

Return to:

Send suggestions and report system problems to the System administrator.