Function: semantic-lex-python-mode
semantic-lex-python-mode is a byte-compiled function defined in
python.el.gz.
Signature
(semantic-lex-python-mode START END &optional DEPTH LENGTH)
Documentation
Lexically analyze Python code in current buffer.
See the function semantic-lex for the meaning of the START, END,
DEPTH and LENGTH arguments.
This function calls wisent-python-lexer to actually perform the
lexical analysis, then emits the necessary Python DEDENT tokens from
what remains in the wisent-python-indent-stack.
Override semantic-lex in python-mode buffers.
Source Code
;; Defined in /usr/src/emacs/lisp/cedet/semantic/wisent/python.el.gz
;;; Overridden Semantic API.
;;
(define-mode-local-override semantic-lex python-mode
(start end &optional depth length)
"Lexically analyze Python code in current buffer.
See the function `semantic-lex' for the meaning of the START, END,
DEPTH and LENGTH arguments.
This function calls `wisent-python-lexer' to actually perform the
lexical analysis, then emits the necessary Python DEDENT tokens from
what remains in the `wisent-python-indent-stack'."
(let* ((wisent-python-indent-stack (list 0))
(stream (wisent-python-lexer start end depth length))
(semantic-lex-token-stream nil))
;; Emit DEDENT tokens if something remains in the INDENT stack.
(while (> (pop wisent-python-indent-stack) 0)
(semantic-lex-push-token (semantic-lex-token 'DEDENT end end)))
(nconc stream (nreverse semantic-lex-token-stream))))