Function: antlr-syntax-propertize-template-literals

antlr-syntax-propertize-template-literals is a byte-compiled function defined in antlr-mode.el.gz.

Signature

(antlr-syntax-propertize-template-literals START END)

Documentation

Function used to properly highlight ANTLR v3 template literals.

This function is as value for syntax-propertize-function and makes sure that templates like <<...>> outside actions, strings or comments are considered literals.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/antlr-mode.el.gz
(defun antlr-syntax-propertize-template-literals (start end)
  ;; checkdoc-params: (start end)
  "Function used to properly highlight ANTLR v3 template literals.
This function is as value for `syntax-propertize-function' and makes
sure that templates like <<...>> outside actions, strings or comments
are considered literals."
  (goto-char start)
  (while (search-forward "<<" end t)
    (let ((context (antlr-syntactic-context)))
      (if context
          (when (numberp context)
            (goto-char (min (or (ignore-errors (scan-lists (point) 1 context))
                                end)
                            end)))
        (let ((pos (- (point) 2)))
          ;; put the text property on the inner "<>", since multi-line is set
          ;; to be ok with `c-multiline-string-start-char'
          (put-text-property (1+ pos) (point) 'syntax-table
                             (eval-when-compile
                               (string-to-syntax "|")))
          (when (search-forward ">>" end 'move)
            (put-text-property (- (point) 2) (1- (point)) 'syntax-table
                               (eval-when-compile
                                 (string-to-syntax "|"))))
          (put-text-property pos (point) 'syntax-multiline t))))))