emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r114926: * cedet/semantic/lex.el (semantic-lex-start


From: Johan Bockgard
Subject: [Emacs-diffs] trunk r114926: * cedet/semantic/lex.el (semantic-lex-start-block)
Date: Sun, 03 Nov 2013 21:51:30 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 114926
revision-id: address@hidden
parent: address@hidden
committer: Johan Bockgård <address@hidden>
branch nick: trunk
timestamp: Sun 2013-11-03 22:51:25 +0100
message:
  * cedet/semantic/lex.el (semantic-lex-start-block)
  (semantic-lex-end-block): Move after definition of
  semantic-lex-token macro.
modified:
  lisp/cedet/ChangeLog           changelog-20100919015713-3rbr456yray5m84f-1
  lisp/cedet/semantic/lex.el     lex.el-20091113204419-o5vbwnq5f7feedwu-11288
=== modified file 'lisp/cedet/ChangeLog'
--- a/lisp/cedet/ChangeLog      2013-10-31 01:50:24 +0000
+++ b/lisp/cedet/ChangeLog      2013-11-03 21:51:25 +0000
@@ -1,3 +1,9 @@
+2013-11-03  Johan Bockgård  <address@hidden>
+
+       * semantic/lex.el (semantic-lex-start-block)
+       (semantic-lex-end-block): Move after definition of
+       semantic-lex-token macro.
+
 2013-10-28  Barry O'Reilly  <address@hidden>
 
        * semantic/idle.el (semantic-idle-symbol-highlight)

=== modified file 'lisp/cedet/semantic/lex.el'
--- a/lisp/cedet/semantic/lex.el        2013-06-01 18:01:45 +0000
+++ b/lisp/cedet/semantic/lex.el        2013-11-03 21:51:25 +0000
@@ -831,63 +831,6 @@
        ;; Return the token stream
        (nreverse semantic-lex-token-stream))))
 
-;;; Collapsed block tokens delimited by any tokens.
-;;
-(defun semantic-lex-start-block (syntax)
-  "Mark the last read token as the beginning of a SYNTAX block."
-  (if (or (not semantic-lex-maximum-depth)
-          (< semantic-lex-current-depth semantic-lex-maximum-depth))
-      (setq semantic-lex-current-depth (1+ semantic-lex-current-depth))
-    (push (list syntax (car semantic-lex-token-stream))
-          semantic-lex-block-stack)))
-
-(defun semantic-lex-end-block (syntax)
-  "Process the end of a previously marked SYNTAX block.
-That is, collapse the tokens inside that block, including the
-beginning and end of block tokens, into a high level block token of
-class SYNTAX.
-The token at beginning of block is the one marked by a previous call
-to `semantic-lex-start-block'.  The current token is the end of block.
-The collapsed tokens are saved in `semantic-lex-block-streams'."
-  (if (null semantic-lex-block-stack)
-      (setq semantic-lex-current-depth (1- semantic-lex-current-depth))
-    (let* ((stream semantic-lex-token-stream)
-           (blk (pop semantic-lex-block-stack))
-           (bstream (cdr blk))
-           (first (car bstream))
-           (last (pop stream)) ;; The current token mark the EOBLK
-           tok)
-      (if (not (eq (car blk) syntax))
-          ;; SYNTAX doesn't match the syntax of the current block in
-          ;; the stack. So we encountered the end of the SYNTAX block
-          ;; before the end of the current one in the stack which is
-          ;; signaled unterminated.
-          (semantic-lex-unterminated-syntax-detected (car blk))
-        ;; Move tokens found inside the block from the main stream
-        ;; into a separate block stream.
-        (while (and stream (not (eq (setq tok (pop stream)) first)))
-          (push tok bstream))
-        ;; The token marked as beginning of block was not encountered.
-        ;; This should not happen!
-        (or (eq tok first)
-            (error "Token %S not found at beginning of block `%s'"
-                   first syntax))
-        ;; Save the block stream for future reuse, to avoid to redo
-        ;; the lexical analysis of the block content!
-        ;; Anchor the block stream with its start position, so we can
-        ;; use: (cdr (assq start semantic-lex-block-streams)) to
-        ;; quickly retrieve the lexical stream associated to a block.
-        (setcar blk (semantic-lex-token-start first))
-        (setcdr blk (nreverse bstream))
-        (push blk semantic-lex-block-streams)
-        ;; In the main stream, replace the tokens inside the block by
-        ;; a high level block token of class SYNTAX.
-        (setq semantic-lex-token-stream stream)
-        (semantic-lex-push-token
-         (semantic-lex-token
-          syntax (car blk) (semantic-lex-token-end last)))
-        ))))
-
 ;;; Lexical token API
 ;;
 ;; Functions for accessing parts of a token.  Use these functions
@@ -1049,6 +992,63 @@
                 (semantic-lex-token-end   semlist)
                 depth))
 
+;;; Collapsed block tokens delimited by any tokens.
+;;
+(defun semantic-lex-start-block (syntax)
+  "Mark the last read token as the beginning of a SYNTAX block."
+  (if (or (not semantic-lex-maximum-depth)
+          (< semantic-lex-current-depth semantic-lex-maximum-depth))
+      (setq semantic-lex-current-depth (1+ semantic-lex-current-depth))
+    (push (list syntax (car semantic-lex-token-stream))
+          semantic-lex-block-stack)))
+
+(defun semantic-lex-end-block (syntax)
+  "Process the end of a previously marked SYNTAX block.
+That is, collapse the tokens inside that block, including the
+beginning and end of block tokens, into a high level block token of
+class SYNTAX.
+The token at beginning of block is the one marked by a previous call
+to `semantic-lex-start-block'.  The current token is the end of block.
+The collapsed tokens are saved in `semantic-lex-block-streams'."
+  (if (null semantic-lex-block-stack)
+      (setq semantic-lex-current-depth (1- semantic-lex-current-depth))
+    (let* ((stream semantic-lex-token-stream)
+           (blk (pop semantic-lex-block-stack))
+           (bstream (cdr blk))
+           (first (car bstream))
+           (last (pop stream)) ;; The current token mark the EOBLK
+           tok)
+      (if (not (eq (car blk) syntax))
+          ;; SYNTAX doesn't match the syntax of the current block in
+          ;; the stack. So we encountered the end of the SYNTAX block
+          ;; before the end of the current one in the stack which is
+          ;; signaled unterminated.
+          (semantic-lex-unterminated-syntax-detected (car blk))
+        ;; Move tokens found inside the block from the main stream
+        ;; into a separate block stream.
+        (while (and stream (not (eq (setq tok (pop stream)) first)))
+          (push tok bstream))
+        ;; The token marked as beginning of block was not encountered.
+        ;; This should not happen!
+        (or (eq tok first)
+            (error "Token %S not found at beginning of block `%s'"
+                   first syntax))
+        ;; Save the block stream for future reuse, to avoid to redo
+        ;; the lexical analysis of the block content!
+        ;; Anchor the block stream with its start position, so we can
+        ;; use: (cdr (assq start semantic-lex-block-streams)) to
+        ;; quickly retrieve the lexical stream associated to a block.
+        (setcar blk (semantic-lex-token-start first))
+        (setcdr blk (nreverse bstream))
+        (push blk semantic-lex-block-streams)
+        ;; In the main stream, replace the tokens inside the block by
+        ;; a high level block token of class SYNTAX.
+        (setq semantic-lex-token-stream stream)
+        (semantic-lex-push-token
+         (semantic-lex-token
+          syntax (car blk) (semantic-lex-token-end last)))
+        ))))
+
 ;;; Analyzer creation macros
 ;;
 ;; An individual analyzer is a condition and code that goes with it.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]