Variable: semantic-lex-punctuation-type

semantic-lex-punctuation-type is a variable defined in lex.el.gz.

Value

Large value
((and
  (looking-at "\\(\\s.\\|\\s$\\|\\s'\\)+")
  (let*
      ((key
	(match-string 0))
       (pos
	(match-beginning 0))
       (end
	(match-end 0))
       (len
	(- end pos))
       (lst
	(semantic-lex-type-value "punctuation" t))
       (def
	(car lst))
       (lst
	(cdr lst))
       (elt nil))
    (if lst
	(while
	    (and
	     (> len 0)
	     (not
	      (setq elt
		    (rassoc key lst))))
	  (setq len
		(1- len)
		key
		(substring key 0 len))))
    (if elt
	(semantic-lex-push-token
	 (semantic-lex-token
	  (car elt)
	  pos
	  (+ pos len)))
      (if def
	  (semantic-lex-push-token
	   (semantic-lex-token def pos end)))))))

Documentation

Detect and create a punctuation type token.

Recognized punctuation is defined in the current table of lexical types, as the value of the punctuation token type.

Source Code

;; Defined in /usr/src/emacs/lisp/cedet/semantic/lex.el.gz
(define-lex-analyzer semantic-lex-punctuation-type
  "Detect and create a punctuation type token.
Recognized punctuation is defined in the current table of lexical
types, as the value of the `punctuation' token type."
  (and (looking-at "\\(\\s.\\|\\s$\\|\\s'\\)+")
       (let* ((key (match-string 0))
              (pos (match-beginning 0))
              (end (match-end 0))
              (len (- end pos))
              (lst (semantic-lex-type-value "punctuation" t))
              (def (car lst)) ;; default lexical symbol or nil
              (lst (cdr lst)) ;; alist of (LEX-SYM . PUNCT-STRING)
              (elt nil))
         (if lst
             ;; Starting with the longest one, search if the
             ;; punctuation string is defined for this language.
             (while (and (> len 0) (not (setq elt (rassoc key lst))))
               (setq len (1- len)
                     key (substring key 0 len))))
         (if elt ;; Return the punctuation token found
             (semantic-lex-push-token
	      (semantic-lex-token (car elt) pos (+ pos len)))
           (if def ;; Return a default generic token
               (semantic-lex-push-token
		(semantic-lex-token def pos end))
             ;; Nothing match
             )))))