Anonymous avatar Anonymous committed c3f6af5

2002-08-12 Steve Youngs <youngs@xemacs.org>;

* Sync to upstream version 1.4 [complete this time].

* package-info.in (provides): Update.

* semantic-load.el: Revert my previous patch.

* Makefile (ELCS): Update.
(EXTRA_SOURCES): Add INSTALL NEWS Project.ede and the .bnf files.
(all): Build autoloads first.

* NEWS: New.

* semantic-cb.el: New.

* semantic-chart.el: New.

* semantic-example.el: New.

* semantic-skel.el: New.

* skeleton.bnf: New.

Comments (0)

Files changed (14)

+2002-08-12  Steve Youngs  <youngs@xemacs.org>
+
+	* Sync to upstream version 1.4 [complete this time].
+
+	* package-info.in (provides): Update.
+
+	* semantic-load.el: Revert my previous patch.
+
+	* Makefile (ELCS): Update.
+	(EXTRA_SOURCES): Add INSTALL NEWS Project.ede and the .bnf files.
+	(all): Build autoloads first.
+
+	* NEWS: New.
+
+	* semantic-cb.el: New.
+
+	* semantic-chart.el: New.
+
+	* semantic-example.el: New.
+
+	* semantic-skel.el: New.
+
+	* skeleton.bnf: New.
+
 2002-08-12  Rendhalver [Peter Brown]  <rendhalver@xemacs.org>
 
 	* Makefile (VERSION): XEmacs package 1.13 released.
 
 1) Copy source files somewhere.
 
+1.1) Optional: Install EIEIO CLOS library package from:
+	http://cedet.sourceforge.net/eieio.shtml
+
+1.2) Optional: Install the Speedbar package from:
+	http://cedet.sourceforge.net/speedbar.shtml
+     Note: Some parts of semantic may not load with the version
+	   of speedbar included in current versions of Emacs
+
 2) Byte compile semantic (optional, but recommended)
 
-   a) run "make"
-   b) If that fails, byte compile the files individually from Emacs or XEmacs.
+   a) Edit Makefile, and change LOADPATH to include the path to
+	 EIEIO and Speedbar.
+   b) run "make"
+
+   -OR-
+
+   a) run: make "LOADPATH=<path to eieio> <path to speedbar>"
+
+   If byte compilation fails fails:
+    a) Follow step 3:
+    b) byte compile the files individually and interactivly from
+	Emacs or XEmacs.
 
 3) Install load hooks into your .emacs file.
 
-(add-to-list 'load-path "~/semantic-#.#") ; so Emacs can find semantic
-					; change to actual install area.
+(add-to-list 'load-path "/path/to/semantic")
+(setq semantic-load-turn-everything-on t)
+(require 'semantic-load)
 
-(require 'semantic-c) ; for C code integration
-(require 'semantic-el) ; for Emacs Lisp code integration
-(require 'semantic-make) ; for Makefile integration
-(require 'semantic-imenu) ; if you use imenu or wich-function
-(add-hook 'speedbar-load-hook (lambda () (require 'semantic-sb)))
-			; for speedbar integration
-(autoload 'semantic-bnf-mode "semantic-bnf" "Mode for Bovine Normal Form." t)
-(add-to-list 'auto-mode-alist '("\\.bnf$" . semantic-bnf-mode))
-			; for editing .bnf parser files.
-(autoload 'semantic-minor-mode "semantic-mode" "Mode managing semantic parsing." t)
-			; for semantic-minor-mode
 
+4) If turning everything on is too much:
+
+   Remove the first line setting the variable that turns everything on.
+   Investigate the file `semantic-load.el', and include those pieces
+   you want to use.
+
+5) To send bug reports, or participate in discussions about semantic,
+   use the mailing list cedet-semantic@@sourceforge.net via the URL:
+
+   http://lists.sourceforge.net/lists/listinfo/cedet-semantic
+
 CATEGORY = standard
 
 ELCS = document-vars.elc document.elc semantic-analyze.elc semantic-bnf.elc \
-	semantic-c.elc semantic-ctxt.elc semantic-el.elc semantic-ia-sb.elc \
-	semantic-ia.elc semantic-imenu.elc semantic-java.elc \
-	semantic-load.elc semantic-make.elc semantic-sb.elc semantic-scm.elc \
-	semantic-texi.elc semantic-util-modes.elc semantic-util.elc \
-	semantic.elc semanticdb.elc senator-isearch.elc senator.elc \
-	sformat.elc working.elc
+	semantic-c.elc semantic-cb.elc semantic-chart.elc semantic-ctxt.elc \
+	semantic-el.elc semantic-example.elc semantic-ia-sb.elc semantic-ia.elc \
+	semantic-imenu.elc semantic-java.elc semantic-load.elc semantic-make.elc \
+	semantic-sb.elc semantic-scm.elc semantic-skel.elc semantic-texi.elc \
+	semantic-util-modes.elc semantic-util.elc semantic.elc semanticdb.elc \
+	senator-isearch.elc senator.elc sformat.elc working.elc
 
-EXTRA_SOURCES = semantic-util.el
+EXTRA_SOURCES = INSTALL NEWS Project.ede $(wildcard *.bnf)
 
 INFO_FILES = $(PACKAGE).info*
 HTML_FILES = $(PACKAGE)*.html
 
 GENERATED += custom-load.elc
 
-all:: $(ELCS) auto-autoloads.elc custom-load.elc $(PACKAGE).info
+all:: auto-autoloads.elc $(ELCS) custom-load.elc $(PACKAGE).info
 
 srckit: srckit-std
 
+* Changes for Semantic 1.4
+
+** New Non-recursive parser by David Ponce <david@dponce.com>
+
+** Changed contents of some nonterminals to make them language agnostic
+
+*** Variables no longer contain an explicit constant flag.
+
+*** Modifiers field for variable, function, and types is now an association
+    list.
+
+** Semantic Context Analysis library
+
+*** Analyzizes via type information the local context
+
+*** Provides smart completion information
+
+*** Speedbar mode for using analysis information.
+
+** Semantic Class Browser structure generator
+
+*** Generates objects representing a browsable class structure
+    which links parents and subclasses and externally defined
+    methods into an easilly navigated (programatically) structure.
+
+*** Speedbar interface to browser structure (simple)
+
+** User Visible Features
+
+*** semantic-load.el simplifies installation.
+
+*** Added partial reparseing of buffers where only token contents have changed.
+
+*** Added `semantic-show-dirty-mode'.
+
+*** Added `semantic-show-unmatched-syntax-mode'
+
+*** Added `semantic-auto-reparse-mode'
+
+*** Added new tool, `semanticdb'.
+    Semanticdb caches token lists between sessions with a specific file.
+
+*** Added semantic-texi for parsing texinfo files.
+
+**** Commands for creating @deffn sections from source
+
+**** Commands for updating an entire document with the source.
+
+*** Added semantic-scm for parsing Scheme (guile) scripts
+
+*** semantic-el now has a much faster Emacs Lisp parser.
+    It uses the built in Emacs read command.
+
+*** semantic-c updates
+
+**** Handles most of C++, including templates
+
+**** Faster type parsing
+
+**** Faster function/variable parsing
+
+**** Summary text for keywords for eldoc
+
+*** Added Senator (Semantic Navigator) by David Ponce <david@dponce.com>
+
+**** Provides a minor mode keymap and menu.
+
+**** Search and Isearch in token names.
+
+**** Jump to functions by name
+
+**** Token Completion, and completion menu.
+
+**** eldoc support for languages supported by semantic.
+
+**** hippie expand try function for token names.
+
+*** Added Java.bnf by David Ponce <david@dponce.com>
+
+**** java.bnf from JDE by Paul Kinnucan and David Ponce
+
+**** semantic-java.el derived from JDE.
+
+**** eldoc support in bnf modes.
+
+*** semantic-imenu can now tags for all files that had been loaded in
+    emacs in a directory if semanticdb is active
+
+*** Imenu and speedbar group externally defined methods together.
+
+** bnf-mode: Language Author Features
+
+*** Parsing with `semantic-toplevel-bovinate-override' is better supported.
+
+*** Fixed BNF indentation engine to handle Optional Lambda Expressions
+   in a much cleaner way.
+
+*** Keyword table for a language can be generated using %token specifiers
+    and queried using `semantic-flex-map-keywords'.
+
+*** Source level debugging in the .bnf file
+
+*** skeleton.bnf as a good starting point for new languages.
+
+Local variables:
+mode: outline
+paragraph-separate: "[ 	
+end:
-;; Object ede-proj-project
+;; Object semantic
 ;; EDE project file.
-(ede-proj-project "ede-proj-project"
+(ede-proj-project "semantic"
   :name "semantic"
-  :version "1.3.3"
+  :version "1.4"
   :file "Project.ede"
   :targets (list 
-   (ede-proj-target-elisp "(semantic-bnf.el semantic.el semantic-util.el)"
+   (ede-proj-target-makefile-miscelaneous "example"
+    :name "example"
+    :path ""
+    :source '("semantic-skel.el" "skeleton.bnf" "semantic-example.el")
+    )
+   (ede-proj-target-elisp "nil"
+    :name "init"
+    :path ""
+    :source '("semantic-load.el")
+    :partofall 'nil
+    )
+   (ede-proj-target-elisp "semantic"
     :name "semantic"
     :path ""
-    :source '("semantic-bnf.el" "semantic.el" "semantic-util.el")
+    :source '("semantic.el" "semantic-util.el" "semantic-bnf.el" "semantic-ctxt.el")
     :versionsource '("semantic.el")
     )
+   (ede-proj-target-elisp "Languages"
+    :name "Languages"
+    :path ""
+    :source '("semantic-c.el" "semantic-el.el" "semantic-java.el" "semantic-make.el" "semantic-scm.el" "semantic-texi.el")
+    )
    (ede-proj-target-elisp "tools"
     :name "tools"
     :path ""
-    :source '("document.el" "document-vars.el" "sformat.el" "semantic-make.el" "semantic-c.el" "semantic-imenu.el" "semantic-el.el" "semantic-sb.el" "working.el" "semantic-mode.el")
+    :source '("semantic-imenu.el" "semantic-sb.el" "working.el" "semanticdb.el" "document.el" "document-vars.el" "sformat.el" "semantic-chart.el" "semantic-util-modes.el" "semantic-analyze.el" "semantic-ia.el" "semantic-cb.el" "semantic-ia-sb.el")
+    :aux-packages '("eieio" "speedbar")
+    )
+   (ede-proj-target-elisp "senator"
+    :name "senator"
+    :path ""
+    :source '("senator.el")
     )
    (ede-proj-target-aux "misc"
     :name "misc"
     :path ""
-    :source '("INSTALL")
+    :source '("INSTALL" "NEWS" "ChangeLog")
     )
    (ede-proj-target-makefile-info "info"
     :name "info"
    (ede-proj-target-aux "aux"
     :name "aux"
     :path ""
-    :source '("c.bnf" "make.bnf")
+    :source '("c.bnf" "make.bnf" "java.bnf" "scheme.bnf")
     )
    )
+  :web-site-url "http://cedet.sourceforge.net/semantic.shtml"
+  :web-site-directory "~/cedet/www"
+  :web-site-file "semantic.shtml"
+  :ftp-upload-site "/ftp@upload.sourceforge.net:/incoming"
   :configuration-variables 'nil
   )
    filename FILENAME
    md5sum MD5SUM
    size SIZE
-   provides (document-vars document semantic-analyze semantic-bnf semantic-c semantic-ctxt semantic-el semantic-ia-sb semantic-ia semantic-imenu semantic-java semantic-load semantic-make semantic-sb semantic-scm semantic-texi semantic-util-modes semantic-util semantic semanticdb senator-isearch senator sformat working)
+   provides (document-vars document semantic-analyze semantic-bnf semantic-c semantic-cb semantic-chart semantic-ctxt semantic-el semantic-example semantic-ia-sb semantic-ia semantic-imenu semantic-java semantic-load semantic-make semantic-sb semantic-scm semantic-skel semantic-texi semantic-util-modes semantic-util semantic semanticdb senator-isearch senator sformat working)
    requires (REQUIRES)
    type regular
 ))
+;;; semantic-cb.el --- Manage and maintain a Class Browser database
+
+;;; Copyright (C) 2002 Eric M. Ludlam
+
+;; Author: Eric M. Ludlam <zappo@gnu.org>
+;; Keywords: syntax
+;; X-RCS: $Id$
+
+;; This file is not part of GNU Emacs.
+
+;; Semantic-sb is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 2, or (at your option)
+;; any later version.
+
+;; This software is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs; see the file COPYING.  If not, write to the
+;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+;; Boston, MA 02111-1307, USA.
+
+;;; Commentary:
+;;
+;; Files in an OO language don't always properly represent the structure
+;; of classes available.  This Class Browser analyzer can create
+;; and maintain a database where types and tokens are linked together
+;; so that the program structure can be programatically navigated
+;; or displayed.
+;;
+;; By having the classes created inherit from `eieio-speedbar-*',
+;; speedbar support for full class browsing is garnered for
+;; nearly no effort.
+
+(require 'semantic)
+(require 'eieio-speedbar)
+(require 'eieio-base)
+
+;;; Code:
+(defclass semantic-cb-project ()
+  ((types :initarg :types
+	  :type list
+	  :documentation
+	  "List of top level types in this project.")
+   )
+  "The root of a project's tag system.
+The project will consist of top-level types, classes, namespaces,
+or whatever is used in that language as a representaton.")
+
+(defclass semantic-cb-token (eieio-named eieio-speedbar)
+  ((buttontype :initform statictag)
+   (buttonface :initform speedbar-tag-face)
+   (token :initarg :token
+	  :type semantic-token
+	  :documentation
+	  "Semantic token which represents a type.")
+   (table :initarg :table
+	  :type semanticdb-table
+	  :documentation
+	  "This is the database table that `token' was found in.
+Be sure to use this field when loading a token's file into memory.")
+   (container :initarg :container
+	      :type (or null semantic-cb-token)
+	      :documentation
+	      "This is the CB object containing this token.
+CB Containers are usually types with attributes of methods.")
+   )
+  "A single semantic token.
+Tokens represented in the Class Browser database may not be loaded
+in memory, so this forms the structure needed to access them.")
+
+(defclass semantic-cb-type (semantic-cb-token)
+  ((buttontype :initform expandtag)
+   (buttonface :initform speedbar-tag-face)
+   (parents :type list
+	     :initform nil
+	     :documentation
+	     "The full parents this type was derived from.
+These are also `semantic-cb-type' objects.
+This excludes Java interfaces.")
+   (subclasses :type list
+	       :initform nil
+	       :documentation
+	       "A list of types which inherit from this object.
+These are also `semantic-cb-type' objects.")
+   (children :type list
+	     :initform nil
+	     :documentation
+	     "List of CB token children, both embedded and external.
+Embedded children are defined within the scope of this types declaration.
+External children are defined within some other scope, and are labeled
+as children of this type.
+Children are of type `semantic-cb-token'.")
+   )
+  "One type object for a given project.
+Because some connections are derived, or take a while to find,
+details which are derivable will be cached in the fields
+of a type object.
+In addition, type objects will contain the actual tokens created by
+semantic, external methods and such will be cached in this object, not
+in the semantic token itself.")
+
+(defvar semantic-cb-incomplete-types nil
+  "During construction, the list of types that need work.
+Types are created without CB objects for parent or interfaces.
+We need to go back later and fill them in from this list.")
+
+(defvar semantic-cb-incomplete-scoped-types nil
+  "During construction, the list of contained types that need work.
+Types are created without CB objects for parent or interfaces.
+We need to go back later and fill them in from this list.")
+
+(defun semantic-cb-add-incomplete-type (cbtoken)
+  "Add CBTOKEN to the list of incomplete types."
+  (add-to-list (if (oref cbtoken :container)
+		   'semantic-cb-incomplete-scoped-types
+		 'semantic-cb-incomplete-types)
+	       cbtoken))
+
+(defvar semantic-cb-current-project nil
+  "The current project's class structure.")
+
+(defun semantic-cb-new-class-browser ()
+  "Create an object representing this project's organization.
+The object returned is of type `semantic-cb-project', which contains
+the slot `:types', a list of all top-level types.  Each element is a
+class of type `semantic-cb-token', or `semantic-cb-type'."
+  (let ((alldbtype (semanticdb-find-nonterminal-by-token
+		    'type
+		    nil			;current project
+		    nil			;only top level types
+		    nil			;no include files outside this project
+		    nil			;same mode
+		    nil))		;do not load unloaded files.
+	;; Scope these variables during construction.
+	(semantic-cb-incomplete-types nil)
+	(semantic-cb-incomplete-scoped-types nil)
+	)
+    ;; Loop over all discovered types, and construct them.
+    (while alldbtype
+      (let ((alltype (cdr (car alldbtype)))
+	    (db (car (car alldbtype))))
+	(while alltype
+	  ;; This adds all new types into a special list.
+	  (semantic-cb-convert-type (car alltype) db nil)
+	  (setq alltype (cdr alltype))))
+      (setq alldbtype (cdr alldbtype)))
+    ;; Cycle over all incomplete subtypes, finding parents
+    ;; The incomplete type lists are in two batches.  The first we
+    ;; will deal with are for unscoped classes at the top level.
+    ;; The second is for types defined in other types, so that
+    ;; they are scoped locally.  This excludes them from our search
+    ;; lists.
+    (let ((typesearchlist semantic-cb-incomplete-types)
+	  (list1 semantic-cb-incomplete-types)
+	  (list2 semantic-cb-incomplete-scoped-types)
+	  (top-level nil))
+      (while list1
+	(semantic-cb-complete-type (car list1) typesearchlist)
+	;; If there is no parent from our project, then
+	;; it must be a top-level object.
+	(when (not (oref (car list1) parents))
+	  (setq top-level (cons (car list1) top-level)))
+	(setq list1 (cdr list1)))
+      (while list2
+	(semantic-cb-complete-type (car list2) typesearchlist)
+	(setq list2 (cdr list2)))
+      ;; Create the new cache.
+      (setq semantic-cb-current-project
+	    (semantic-cb-project
+	     "Project"
+	     :types (nreverse top-level)
+	     )))
+    ;; Return it
+    semantic-cb-current-project))
+
+(defun semantic-cb-complete-type (cbtoken possibleparents)
+  "Complete CBTOKEN, an object which needs to be completed.
+POSSIBLEPARENTS is the list of types which are eligible
+to be parents of CBTOKEN."
+  (let* ((pl (semantic-token-type-parent (oref cbtoken token)))
+	 (parents (car pl))
+	 (interface (cdr pl))
+	 )
+    (if (semantic-token-p pl)
+	(setq parents (list pl)
+	      interface nil))
+    (if (or (not (listp parents))
+	    (semantic-token-p parents))
+	(setq parents (list parents)))
+    (while parents
+      (semantic-cb-find-parent cbtoken (car parents) possibleparents)
+      (setq parents (cdr parents)))
+    (if (or (not (listp interface))
+	    (semantic-token-p interface))
+	(setq interface (list interface)))
+    (while interface
+      (semantic-cb-find-parent cbtoken (car interface) possibleparents)
+      (setq interface (cdr interface)))
+    ))
+
+(defun semantic-cb-find-parent (cbt parentobj possibleparents)
+  "For CBT, find the CB object represented by PARENTOBJECT.
+PARENTOBJ will be in POSSIBLEPARENTS, or determined to be nil.
+If a valid CB object is found, link CBT to the found object."
+  (let* ((pstr (cond ((stringp parentobj)
+		      parentobj)
+		     ((semantic-token-p parentobj)
+		      (semantic-token-name parentobj))
+		     (t (error "Unknown parent object type"))))
+	 (po (object-assoc pstr :object-name possibleparents))
+	 )
+    (when po
+      ;; List parent as the
+      (object-add-to-list cbt 'parents po t)
+      ;; List cbt as inheriting from parent
+      (object-add-to-list po 'subclasses cbt t)
+      )))
+
+(defun semantic-cb-convert-type (token db parentobj)
+  "Convert the semantic TOKEN to a type object.
+DB is the semantic database that TOKEN is derived from.
+PARENTOBJ is the CB object which is the parent of TOKEN"
+  (let* ((chil (cons
+		;; This makes a mock DB list
+		(cons db (semantic-token-type-parts token))
+		;; External children in DB form.
+		(semantic-nonterminal-external-member-children-db
+		 token t)))
+	 ;; This is a created CB object which will represent
+	 ;; this type.
+	 (tobj (semantic-cb-type
+		(semantic-token-name token) ; name
+		 :token token		; The token
+		 :table db		; database table we came from
+		 :container parentobj	; parent container
+		 )))
+    ;; We now have a token in TOBJ.  Conver the child list
+    ;; we just got into a form suitable for a tobj child list.
+    (setq chil (semantic-cb-convert-children chil tobj))
+    (oset tobj children chil)
+    ;; Add ourselves to the list of incomplete types.
+    (semantic-cb-add-incomplete-type tobj)
+    ;; Return it.
+    tobj))
+
+(defun semantic-cb-convert-children (childlist parentobj)
+  "Convert CHILDLIST from semantic format to cb objects.
+CHILDLIST is in semanticdb search format, such that each
+element of the list starts with a database table object.
+PARENTOBJ is the CB token which hosts CHILDLIST."
+  (let ((newlist nil))
+    (while childlist
+      (let ((sublist (cdr (car childlist)))
+	    (db (car (car childlist))))
+	(while sublist
+	  (if (semantic-token-with-position-p (car sublist))
+	      (let ((newtok
+		     (cond
+		      ((eq (semantic-token-token (car sublist))
+			   'type)
+		       (semantic-cb-convert-type (car sublist) db parentobj))
+		      (t
+		       (semantic-cb-token
+			(semantic-token-name (car sublist))
+			:token (car sublist)
+			:table db
+			:container parentobj)))))
+		;; We have a new object representing the token.
+		;; add it to the new list.
+		(setq newlist (cons newtok newlist))))
+	  (setq sublist (cdr sublist))))
+      (setq childlist (cdr childlist)))
+    (nreverse newlist)))
+
+;;; Methods
+;;
+(defmethod initialize-instance :AFTER ((this semantic-cb-token) &rest fields)
+  "After initializing THIS, keep overlay properties up to date."
+  (let* ((tok (oref this token))
+	 (ol (semantic-token-overlay tok)))
+    ;; Ignore tokens that are in the database.
+    (when (semantic-overlay-p ol)
+      ;; Apply our object onto this overlay for fast
+      ;; reference.
+      (semantic-overlay-put ol 'semantic-cb this))))
+
+
+;;; Speedbar specific methods
+;;
+(defmethod eieio-speedbar-object-children ((object semantic-cb-type))
+  "Return children for OBJECT."
+  (oref object subclasses))
+
+;(defmethod eieio-speedbar-object-children ((object semantic-cb-token))
+;  "Return children of this type."
+;  (oref object children))
+
+(defmethod eieio-speedbar-description ((object semantic-cb-token))
+  "Descriptive text for OBJECT."
+  (semantic-summarize-nonterminal (oref object token)))
+
+(defmethod eieio-speedbar-derive-line-path ((object semantic-cb-token))
+  "Get the path to OBJECT's instantiation."
+  (oref (oref object table) file))
+
+(defmethod eieio-speedbar-handle-click ((object semantic-cb-token))
+  "When clicking on a token OBJECT, jump to its definition."
+  (let ((token (oref object token)))
+    (speedbar-find-file-in-frame
+     (semanticdb-full-filename (oref object table)))
+    (save-excursion (speedbar-stealthy-updates))
+    (semantic-find-nonterminal token) ;; only positioned objects here.
+    (speedbar-maybee-jump-to-attached-frame)
+    (run-hooks 'speedbar-visiting-tag-hook)))
+	
+
+
+;;; Speedbar initialization
+;;
+(defvar semantic-cb-speedbar-key-map
+  eieio-speedbar-key-map
+  "Extra keybindings used when speedbar displays our class tree.")
+
+(defun semantic-cb-make-map ()
+  "Create a keymap and return it."
+  nil)
+
+(defvar semantic-cb-speedbar-menu
+  eieio-speedbar-menu
+  "Menu additions used in speedbar when displaying a callback hierarchy.")
+
+(defun semantic-cb-speedbar-buttons (dir)
+  "Return the list of object children to display at the toplevel in speedbar.
+Argument DIR is the directory speedbar is asking about."
+  (speedbar-with-attached-buffer (semantic-cb-new-class-browser))
+  (oref semantic-cb-current-project types))
+
+;;;###autoload
+(defun semantic-cb-speedbar-mode ()
+  "Bring speedbar up, and put it into Class Browser mode.
+This will use the Class Browser logic applied to the current Semantic
+project database to build the available relations.  The structure of
+the class hierarchy can then be navigated using traditional speedbar
+interactions."
+  (interactive)
+  (speedbar-frame-mode 1)
+  (speedbar-change-initial-expansion-list "Class Browser")
+  (speedbar-get-focus))
+
+(eieio-speedbar-create 'semantic-cb-make-map
+		       'semantic-cb-speedbar-key-map
+		       'semantic-cb-speedbar-menu
+		       "Class Browser"
+		       'semantic-cb-speedbar-buttons)
+
+(provide 'semantic-cb)
+
+;;; semantic-cb.el ends here

semantic-chart.el

+;;; semantic-util.el --- Utilities for use with semantic token streams
+
+;;; Copyright (C) 1999, 2000, 2001 Eric M. Ludlam
+
+;; Author: Eric M. Ludlam <zappo@gnu.org>
+;; Keywords: chart
+;; X-RCS: $Id$
+
+;; This file is not part of GNU Emacs.
+
+;; Semantic is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 2, or (at your option)
+;; any later version.
+
+;; This software is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs; see the file COPYING.  If not, write to the
+;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+;; Boston, MA 02111-1307, USA.
+
+;;; Commentary:
+;;
+;; A set of simple functions for charting details about a file based on
+;; the output of the semantic parser.
+;;
+
+(require 'semantic)
+(require 'chart)
+
+;;; Code:
+
+;;;###autoload
+(defun semantic-chart-nonterminals-by-token (&optional buffer-or-stream)
+  "Create a bar chart representing the number of nonterminals for a token.
+Each bar represents how many toplevel nonterminal in BUFFER-OR-STREAM
+exist with a given token type.  See `semantic-symbol->name-assoc-list'
+for tokens which will be charted."
+  (interactive)
+  (let* ((stream (cond ((not buffer-or-stream)
+			(semantic-bovinate-toplevel t))
+		       ((bufferp buffer-or-stream)
+			(save-excursion
+			  (set-buffer buffer-or-stream)
+			  (semantic-bovinate-toplevel t)))
+		       (t buffer-or-stream)))
+	 (names (mapcar 'cdr semantic-symbol->name-assoc-list))
+	 (nums (mapcar
+		(lambda (symname)
+		  (length
+		   (semantic-find-nonterminal-by-token
+		    (car symname)
+		    stream
+		    t nil)))
+		  semantic-symbol->name-assoc-list)))
+    (chart-bar-quickie 'vertical
+		       "Semantic Toplevel Token Volume"
+		       names "Token Type"
+		       nums "Volume")
+    ))
+
+;;;###autoload
+(defun semantic-chart-database-size (&optional buffer-or-stream)
+  "Create a bar chart representing the size of each file in semanticdb.
+Each bar represents how many toplevel nonterminals in BUFFER-OR-STREAM
+exist in each database entry."
+  (interactive)
+  (if (or (not (fboundp 'semanticdb-minor-mode-p))
+	  (not (semanticdb-minor-mode-p)))
+      (error "Semanticdb is not enabled"))
+  (let* ((stream (cond ((not buffer-or-stream)
+			(semantic-bovinate-toplevel t))
+		       ((bufferp buffer-or-stream)
+			(save-excursion
+			  (set-buffer buffer-or-stream)
+			  (semantic-bovinate-toplevel t)))
+		       (t buffer-or-stream)))
+	 (db semanticdb-current-database)
+	 (names (mapcar 'car (object-assoc-list 'file (oref db tables))))
+	 (numnuts (mapcar (lambda (a)
+			    (prog1
+				(cons (length (car a))
+				      (car names))
+			      (setq names (cdr names))))
+			  (object-assoc-list 'tokens (oref db tables))))
+	 (nums nil)
+	 (fh (/ (- (frame-height) 7) 4)))
+    (setq numnuts (sort numnuts (lambda (a b) (> (car a) (car b)))))
+    (setq names (mapcar 'cdr numnuts)
+	  nums (mapcar 'car numnuts))
+    (if (> (length names) fh)
+	(progn
+	  (setcdr (nthcdr fh names) nil)
+	  (setcdr (nthcdr fh nums) nil)))
+    (chart-bar-quickie 'horizontal
+		       "Semantic DB Toplevel Token Volume"
+		       names "File"
+		       nums "Volume")
+    ))
+
+(defun semantic-chart-token-complexity (tok)
+  "Calculate the `complexity' of token TOK."
+  (count-lines
+   (semantic-token-end tok)
+   (semantic-token-start tok)))
+
+;;;###autoload
+(defun semantic-chart-nonterminal-complexity-token
+  (&optional symbol buffer-or-stream)
+  "Create a bar chart representing the complexity of some tokens.
+Complexity is calculated for tokens with a token of SYMBOL.  Each bar
+represents the complexity of some nonterminal in BUFFER-OR-STREAM.
+Only the most complex items are charted."
+  (interactive)
+  (let* ((sym (if (not symbol) 'function))
+	 (stream
+	  (semantic-find-nonterminal-by-token
+	   sym
+	   (cond ((not buffer-or-stream)
+		  (semantic-bovinate-toplevel t))
+		 ((bufferp buffer-or-stream)
+		  (save-excursion
+		    (set-buffer buffer-or-stream)
+		    (semantic-bovinate-toplevel t)))
+		 (t buffer-or-stream))
+	   'positiononly nil))
+	 (name (cond ((semantic-token-with-position-p (car stream))
+		      (buffer-name (semantic-token-buffer (car stream))))
+		     (t "")))
+	 (cplx (mapcar (lambda (tok)
+			 (cons tok (semantic-chart-token-complexity tok)))
+		       stream))
+	 (namelabel (cdr (assoc 'function semantic-symbol->name-assoc-list)))
+	 (names nil)
+	 (nums nil))
+    (setq cplx (sort cplx (lambda (a b) (> (cdr a) (cdr b)))))
+    (while (and cplx (<= (length names) (/ (- (frame-height) 7) 4)))
+      (setq names (cons (semantic-token-name (car (car cplx)))
+			names)
+	    nums (cons (cdr (car cplx)) nums)
+	    cplx (cdr cplx)))
+;; ;;     (setq names (mapcar (lambda (str)
+;; ;; 			  (substring str (- (length str) 10)))
+;; ;; 			names))
+    (chart-bar-quickie 'horizontal
+		       (format "Function Complexity in %s" name)
+		       names namelabel
+		       nums "Complexity (Lines of code)")
+    ))
+
+(provide 'semantic-chart)
+
+;;; semantic-chart.el ends here

semantic-example.el

+;;; semanto-example.el --- Examples using the semantic API
+
+;;; Copyright (C) 2002 Eric M. Ludlam
+
+;; Author: Eric M. Ludlam <zappo@gnu.org>
+;; Keywords: syntax
+;; X-RCS: $Id$
+
+;; This file is not part of GNU Emacs.
+
+;; Semantic is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 2, or (at your option)
+;; any later version.
+
+;; This software is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs; see the file COPYING.  If not, write to the
+;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+;; Boston, MA 02111-1307, USA.
+
+;;; Commentary:
+;;
+;; Simplified example programs that use the semantic API.
+
+(defun se-jump (name)
+  "Jump to the token with NAME.
+Shows how to:
+ * Interactivly finding a token name from a stream.
+ * Getting symbols under point.
+ * Getting the main token list
+ * Finding a token by name.
+ * Highlighting a token"
+  (interactive
+   (list
+    ;; Helpful way of interactivly querying for a token name.
+    (semantic-read-symbol
+     "Jump to: "
+     ;; The default can be the text under the cursor.
+     ;; It returns a list such that:
+     ;;  this.that.th
+     ;; is
+     ;; ( "this" "that" "th" )
+     (car (reverse (semantic-ctxt-current-symbol)))
+     ;; The stream is from this buffer
+     (semantic-bovinate-toplevel t)
+     ;; We don't need a filter.
+     nil )))
+  (let (tok pos)
+    ;; Search for the token
+    (setq tok (semantic-find-nonterminal-by-name
+	       name
+	       ;; Get the stream.  May be a buffer too.
+	       (semantic-bovinate-toplevel t)
+	       ;; Look inside structures
+	       t
+	       ;; Don't search include files. Perhaps a later
+	       ;; revision?
+	       nil))
+    (if tok
+	(progn
+	  ;; Get the position of the token.
+	  (setq pos (semantic-token-start tok))
+	  ;; Jump.
+	  ;; Because we only searched this buffer, we can assume the token is
+	  ;; also in this buffer.
+	  (goto-char pos)
+	  ;; Fancy stuff: Hightlight the token we jumped to.
+	  ;; This will automatically unhighlight the token later.
+	  (semantic-momentary-highlight-token tok)
+	  )
+      (error "No tag %s found" name)
+      )))
+
+(defcustom se-summary-function 'semantic-uml-prototype-nonterminal
+  "*Function to use when showing info about a token for Examples.
+Shows how to:
+  * Create a customization variable."
+  :group 'semantic
+  :type semantic-token->text-custom-list)
+
+(defun se-show (name)
+  "Show important information about some token with NAME.
+Shows how to:
+ * Create a variable with `semantic-token->text-functions'.
+ * Create the colorized text."
+  (interactive (list (semantic-read-symbol "Symbol: ")))
+  (let ((tok (semantic-find-nonterminal-by-name name (current-buffer) t))
+	parent
+	msg)
+    (if tok
+	(save-excursion
+	  ;; Token text functions can take a PARENT argument.  To find this
+	  ;; really quickly, jump to TOK, then use the overlay mechanism to
+	  ;; Find it.
+	  (goto-char (semantic-token-start tok))
+	  (setq parent (semantic-current-nonterminal-parent))
+	  ;; Create a message
+	  (setq msg (funcall se-summary-function tok parent t))
+	  ;; Display it
+	  (message msg)))))
+
+(defun se-db-apropos-show (name)
+  "Show information about several tokens matching NAME using semanticdb.
+Shows how to:
+  * Query the database.
+  * Decode the databases' output."
+  (interactive
+   (list (read-string "Symbol: "
+		      ;; Current symbol is the default
+		      (car (reverse (semantic-ctxt-current-symbol))))))
+  (let ((tok (semanticdb-find-nonterminal-by-name-regexp
+	      name
+	      ;; The current list of active databases for this file.
+	      ;; This is the same as passing `nil'
+	      (semanticdb-current-database-list)
+	      t   ;; Search inside types
+	      nil ;; Do not search include files
+	      nil ;; Only files of the same mode
+	      t   ;; When a token is found, make sure it is
+	          ;; an active buffer.
+	      )))
+    ;; Each entry in the database is a list
+    ;; starting with the database a token was found in,
+    ;; followed by the tokens found.
+    (message
+     (mapconcat
+      ;; Outer lambda: Decode the database search format.
+      (lambda (db-list)
+	(mapconcat
+	 ;; Inner lambda: Convert found tokens into text.
+	 (lambda (tok)
+	   (funcall se-summary-function
+		    tok
+		    nil
+		    t))
+	 ;; The first element is the database.  The second is a token.
+	 (cdr db-list)
+	 "\n"))
+      tok
+      "\n"))
+    ))
+
+
+(provide 'semantic-example)
+
+;;; semantic-example.el ends here
 ;;; Some speedbar major modes
 (eval-after-load "speedbar"
   '(progn
+     (require 'semantic-cb)
      (require 'semantic-ia-sb)))
 
 
+;;; semantic-skel.el --- Semantic details for skel
+
+;;; Copyright (C) 2001 Eric M. Ludlam
+
+;; Author: Eric M. Ludlam <zappo@gnu.org>
+;; X-RCS: $Id$
+
+;; This file is not part of GNU Emacs.
+
+;; This is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 2, or (at your option)
+;; any later version.
+
+;; This software is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs; see the file COPYING.  If not, write to the
+;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+;; Boston, MA 02111-1307, USA.
+
+;;; Commentary:
+;;
+
+;;; History:
+;; 
+
+(require 'semantic)
+(require 'backquote)
+
+;; Depending on what elements you include specialized support for
+(eval-when-compile
+  (require 'semantic-ctxt)
+  (require 'semantic-imenu)
+  (require 'document)
+  (require 'senator))
+
+;;; Code:
+(defvar semantic-toplevel-skeleton-bovine-table
+  nil
+  "Skeleton language specification.")
+
+(defvar semantic-flex-skeleton-extensions
+  '(
+    ;;Exmple of Cs' ifdef removal mechanism
+    ;;("^#\\(if\\(def\\)?\\|else\\|endif\\)" . semantic-flex-c-if)
+    )
+  "Extensions to the flexer for C.")
+
+;; You do not need to use this function unless you have compound
+;; definitions.  For example, in C, the following is expanded:
+;;  int x, y;
+(defun semantic-expand-skeleton-nonterminal (nonterm)
+  "Expand NONTERM into a list of equivalent nonterminals, or nil."
+  nil)
+
+(defvar semantic-skeleton-keyword-table
+  nil
+  "Some keywords used in skeleton.")
+
+
+;;; Override methods & Variables
+;;
+
+;; Add methods to the override table here.  See
+;; `semantic-install-function-overrides' for more details.
+
+
+;;; Setup function
+;;
+;;;###autoload
+(defun semantic-default-skel-setup ()
+  "Set up a buffer for semantic parsing of the skeleton language."
+;; Use this after defining override functions.
+;;  (semantic-install-function-overrides
+;;   '(
+;;     ))
+  )
+
+;; Loading this file will install the parser.  Add this line
+;; to a .emacs file, or other setup file along with an autoload
+;; for the setup function to dynamically install the parser
+;; when a file of that type is read into Emacs.
+(add-hook 'skeleton-mode-hook 'semantic-default-skeleton-setup)
+
+(provide 'semantic-skel)
+
+;;; semantic-skel.el ends here
 @end defun
 
 @defun semantic-token-type-parent-superclass token
-Retrieve the parent superclasses of the type @var{TOKEN}.
+Retrieve the parent super classes of type type @var{TOKEN}.
 @end defun
 
 @defun semantic-token-type-parent-implement token
-Retrieve the parent interfaces of the type @var{TOKEN}.
+Retrieve the parent interfaces of type type @var{TOKEN}.
 @end defun
 
 @defun semantic-token-type-modifiers token

senator-isearch.el

 ;;; senator-isearch.el --- SEmantic NAvigaTOR isearch support
 
-;; Copyright (C) 2000 by David Ponce
+;; Copyright (C) 2000, 2001 by David Ponce
 
 ;; Author: David Ponce <david@dponce.com>
 ;; Maintainer: David Ponce <david@dponce.com>
 ;; 
 ;; This library improves isearch (and ishl) to allow overriding of the
 ;; basic search functions used by `isearch-search' and
-;; `isearch-lazy-highlight-search' (or `ishl-search').
+;; `isearch-lazy-highlight-search' (GNU Emacs before 21.0.95),
+;; `isearch-lazy-highlight-update' (GNU Emacs since 21.0.95) or
+;; `ishl-search' (GNU Emacs 20).
 ;;
 ;; This feature is needed by the SEmantic NAvigaTOR library to extend
 ;; isearch with an incremental semantic search mode. When isearch is
 ;;; Change Log:
 
 ;; $Log$
-;; Revision 1.1  2001/08/16 03:29:22  andyp
-;; Update to JDE 2.2.7.1
+;; Revision 1.4  2001/01/24 21:27:46  zappo
+;; *** empty log message ***
 ;;
 ;; Revision 1.3  2001/01/03 15:41:11  david_ponce
 ;; Improved isearch lazy highlighting support.
 ;; Emacs 20.  Not currently implemented for XEmacs (it seems that ishl
 ;; does not work).
 (cond
- (;; GNU Emacs 21 lazy highlighting
-  (fboundp 'isearch-lazy-highlight-search)
+ (;; GNU Emacs 21.0 lazy highlighting
+  (boundp 'isearch-lazy-highlight)
 
-  (defadvice isearch-lazy-highlight-search (around senator activate)
-    "Search ahead for the next or previous match, for lazy highlighting.
+  (if (fboundp 'isearch-lazy-highlight-search)
+      
+      ;; GNU Emacs before 21.0.95
+      (defadvice isearch-lazy-highlight-search (around senator activate)
+        "Search ahead for the next or previous match, for lazy highlighting.
 Attempt to do the search exactly the way the pending isearch would."
-    (let ((case-fold-search isearch-case-fold-search))
-      (setq ad-return-value
-            (funcall (if isearch-search-handler-provider
-                         (funcall isearch-search-handler-provider)
-                       (isearch-default-search-handler))
-                     isearch-string
-                     (if isearch-forward
-                         (if isearch-lazy-highlight-wrapped
-                             isearch-lazy-highlight-start
-                           nil)
-                       (if isearch-lazy-highlight-wrapped
-                           isearch-lazy-highlight-end
-                         nil))
-                     t))))
+        (let ((case-fold-search isearch-case-fold-search))
+          (setq ad-return-value
+                (funcall (if isearch-search-handler-provider
+                             (funcall isearch-search-handler-provider)
+                           (isearch-default-search-handler))
+                         isearch-string
+                         (if isearch-forward
+                             (if isearch-lazy-highlight-wrapped
+                                 isearch-lazy-highlight-start
+                               nil)
+                           (if isearch-lazy-highlight-wrapped
+                               isearch-lazy-highlight-end
+                             nil))
+                         t))))
+  
+    ;; GNU Emacs since 21.0.95
+    (defadvice isearch-lazy-highlight-update (around senator activate)
+      "Update highlighting of possible other matches for isearch."
+      (unless (and (eq isearch-lazy-highlight-window (selected-window))
+                   (equal isearch-lazy-highlight-start (window-start)))
+
+        ;; The search string or the visible window has changed.
+
+        (setq isearch-lazy-highlight-window (selected-window)
+              isearch-lazy-highlight-start (window-start)
+              isearch-lazy-highlight-end (window-end nil t)
+              isearch-lazy-highlight-last-string isearch-string)
+
+       ;; If the string is the same, the old overlays are still usable
+        ;; if they are still visible in the window.
+        (isearch-lazy-highlight-remove-overlays (window-start)
+                                                (window-end nil t))
+
+        (when (or (null isearch-lazy-highlight-max)
+                  (< (length isearch-lazy-highlight-overlays)
+                     isearch-lazy-highlight-max))
+          (save-excursion
+            (save-match-data
+              (let (found)
+                (goto-char isearch-lazy-highlight-start)
+                (while (let ((case-fold-search isearch-case-fold-search)
+                             (isearch-forward t))
+                         (funcall (if isearch-search-handler-provider
+                                      (funcall isearch-search-handler-provider)
+                                    (isearch-default-search-handler))
+                                  isearch-string
+                                  isearch-lazy-highlight-end
+                                  t))
+                  ;; Found the next match.
+                  (let ((ov (make-overlay (match-beginning 0)
+                                          (match-end 0))))
+               ;; If OV overlaps the current isearch overlay, suppress
+                 ;; its face property; otherwise, we sometimes get odd
+                    ;; looking face combinations.
+                    (unless (memq isearch-overlay
+                                  (overlays-at (match-beginning 0)))
+                      (overlay-put ov 'face isearch-lazy-highlight-face))
+
+                    (overlay-put ov 'priority 0)
+                    ;; Don't highlight on any other windows.
+                    (overlay-put ov 'window isearch-lazy-highlight-window)
+
+                    (push ov isearch-lazy-highlight-overlays)))))))))
+
+    )
         
   ;; Provide this function used by senator
   (defun senator-lazy-highlight-update ()
+# Skeleton for creating BNF files.
+#
+# Copyright (C) 2001 Eric M. Ludlam
+#
+# Author: 
+# X-RCS: $Id$
+#
+# .bnf is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This software is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Emacs; see the file COPYING.  If not, write to the
+# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+#
+
+
+# Replace occurance of "skeleton" with the name of your language.
+
+# Replace start, and scopestart names with something apropriate for
+# your language.
+
+%start         starting_rule
+%scopestart    start_scope_rule
+%outputfile    semantic-skel.el
+%parsetable    semantic-toplevel-skeleton-bovine-table
+%keywordtable  semantic-skeleton-keyword-table
+%languagemode  skeleton-mode
+%setupfunction semantic-default-skeleton-setup
+
+# Commented out lines below are generally considered optional
+# See the Emacs Doc for the symbols used below
+%(setq semantic-symbol->name-assoc-list '( (variable . "Variables")
+					   (type     . "Types")
+					   (function . "Functions")
+					   (include  . "Includes")
+					   (package  . "Exports"))
+       #semantic-expand-nonterminal 'semantic-expand-skeleton-nonterminal
+       #semantic-flex-extensions semantic-flex-skeleton-extensions
+       #semantic-dependency-include-path semantic-default-skeleton-path
+       imenu-create-index-function 'semantic-create-imenu-index
+       semantic-type-relation-separator-character '(".")
+       semantic-command-separation-character ";"
+       document-comment-start "/*"
+       document-comment-line-prefix " *"
+       document-comment-end " */"
+       ;; Semantic navigation inside 'type children
+       senator-step-at-token-ids '(function variable)
+       )%
+
+# Make common keywords into tokens returned by the lexer.
+# This improves accuracy, makes this file more readable.
+# Use SOMETHING in your rules as a terminal
+%token SOMETHING "something"
+# Adding a summary help's `eldoc' mode display useful information
+# in your language.
+%put SOMETHING summary "Describe something"
+
+# Turn common punctuation elements into tokens.
+# This does not effect lexical analysis or accuracy,
+# but does make your file more readable.
+%token PERIOD punctuation "."
+
+starting_rule : something
+	      ;
+
+start_scope_rule : something_else
+		 ;
+
+
+something : SOMETHING
+	  ;
+
+# Examples from c.bnf:
+
+opt-expression : expression
+	       | EMPTY ( nil )
+	       ;
+
+# This expression parses over expressions, but doesn't return
+# anything
+expression : number
+	     ( )
+	   | symbol
+	     ( )
+	   | string
+	     ( )
+           | semantic-list
+	     ( )
+	   | punctuation "[-+*/%^|&]" expression
+	   # ( nil )
+	   ;
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.