Function: semantic-lex-c-namespace-begin-nested-macro

semantic-lex-c-namespace-begin-nested-macro is a byte-compiled function defined in c.el.gz.

Signature

(semantic-lex-c-namespace-begin-nested-macro)

Documentation

Handle G++'s namespace macros which the pre-processor can't handle.

Source Code

;; Defined in /usr/src/emacs/lisp/cedet/semantic/bovine/c.el.gz
(define-lex-regex-analyzer semantic-lex-c-namespace-begin-nested-macro
  "Handle G++'s namespace macros which the pre-processor can't handle."
  "\\(_GLIBCXX_BEGIN_NESTED_NAMESPACE\\)(\\s-*\\(\\(?:\\w\\|\\s_\\)+\\)\\s-*,\\s-*\\(\\(?:\\w\\|\\s_\\)+\\)\\s-*)"
  (goto-char (match-end 0))
  (let* ((nsend (match-end 1))
	 (sym-start (match-beginning 2))
	 (sym-end (match-end 2))
	 (ms (buffer-substring-no-properties sym-start sym-end))
	 (sym2-start (match-beginning 3))
	 (sym2-end (match-end 3))
	 (ms2 (buffer-substring-no-properties sym2-start sym2-end)))
    ;; Push the namespace keyword.
    (semantic-lex-push-token
     (semantic-lex-token 'NAMESPACE (match-beginning 0) nsend "namespace"))
    ;; Push the name.
    (semantic-lex-push-token
     (semantic-lex-token 'symbol sym-start sym-end ms))

    (goto-char (match-end 0))
    (let ((start (point))
	  (end 0))
      ;; If we can't find a matching end, then create the fake list.
      (when (re-search-forward "_GLIBCXX_END_NESTED_NAMESPACE" nil t)
	(setq end (point))
	(if semantic-lex-c-nested-namespace-ignore-second
	    ;; The same as _GLIBCXX_BEGIN_NAMESPACE
	    (semantic-lex-push-token
	     (semantic-lex-token 'semantic-list start end
				 (list 'prefix-fake)))
	  ;; Do both the top and second level namespace
	  (semantic-lex-push-token
	   (semantic-lex-token 'semantic-list start end
			       ;; We'll depend on a quick hack
			       (list 'prefix-fake-plus
				     (semantic-lex-token 'NAMESPACE
							 sym-end sym2-start
							 "namespace")
				     (semantic-lex-token 'symbol
							 sym2-start sym2-end
							 ms2)
				     (semantic-lex-token 'semantic-list start end
							 (list 'prefix-fake)))
			       )))
	)))
  (setq semantic-lex-end-point (point)))