Mercurial > emacs
annotate lisp/cedet/semantic.el @ 104439:da5b2513c225
cedet/cedet.el (cedet-packages): Bump srecode version.
cedet/data-debug.el: Require `ring' for use of ring-length.
cedet/semantic.el (semantic-repeat-parse-whole-stream): Check
semantic-working-type before updating progress reporter.
cedet/semantic/adebug.el: Fix file header.
cedet/semantic/analyze.el: eval-when-compile semantic/find, for
semantic-find-tags-by-name. Declare semanticdb-strip-find-results and
semanticdb-find-tags-by-name.
cedet/semantic/chart.el: Require semantic/find, semantic/db-mode,
semantic/db-typecache, and semantic/scope.
cedet/semantic/complete.el: Declare
semantic-displayor-focus-abstract-child-p function (needed as the
semantic-displayor-focus-abstract class is defined only after used).
Move semantic-complete-inline-custom-type and
semantic-complete-inline-analyzer-displayor-class variable definitions
up, before they are used, to avoid compiler warning.
Require semantic/decorate, semantic/tag-file, eieio-opt, and
semantic/analyze/complete.
cedet/semantic/ctxt.el: Require semantic/find. Don't
eval-when-compile semantic/db
(semantic-get-local-variables): Use Emacs' built-in progress reporter
instead of working-status-forms.
cedet/semantic/db-debug.el: Require data-debug, semantic/db-mode, and
semantic/format.
cedet/semantic/db-ebrowse.el: Require semantic/db-mode, semantic/find,
semantic/sort, data-debug
(semanticdb-create-database): Require semantic/dep for
semantic-add-system-include.
(semanticdb-table-ebrowse, semanticdb-project-database-ebrowse): Move
class definitions near top of file, before they are used, to avoid
compiler warnings.
(semanticdb-ebrowse-add-tree-to-table): Use split-string.
author | Chong Yidong <cyd@stupidchicken.com> |
---|---|
date | Sun, 30 Aug 2009 21:16:39 +0000 |
parents | 05443eb58935 |
children | 217c6a8e8420 |
rev | line source |
---|---|
104409
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1 ;;; semantic.el --- Semantic buffer evaluator. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
2 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
3 ;;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
4 ;;; 2007, 2008, 2009 Free Software Foundation, Inc. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
5 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
6 ;; Author: Eric M. Ludlam <zappo@gnu.org> |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
7 ;; Keywords: syntax |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
8 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
9 ;; This file is part of GNU Emacs. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
10 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
11 ;; GNU Emacs is free software: you can redistribute it and/or modify |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
12 ;; it under the terms of the GNU General Public License as published by |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
13 ;; the Free Software Foundation, either version 3 of the License, or |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
14 ;; (at your option) any later version. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
15 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
16 ;; GNU Emacs is distributed in the hope that it will be useful, |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
19 ;; GNU General Public License for more details. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
20 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
21 ;; You should have received a copy of the GNU General Public License |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
22 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
23 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
24 ;;; Commentary: |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
25 ;; |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
26 ;; API for providing the semantic content of a buffer. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
27 ;; |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
28 ;; The semantic API provides an interface to a series of different parser |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
29 ;; implementations. Each parser outputs a parse tree in a similar format |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
30 ;; designed to handle typical functional and object oriented languages. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
31 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
32 (eval-and-compile |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
33 ;; Other package depend on this value at compile time via inversion. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
34 (defvar semantic-version "2.0pre7" |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
35 "Current version of Semantic.")) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
36 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
37 ;; (require 'working) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
38 (require 'assoc) |
104412
05443eb58935
cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
104409
diff
changeset
|
39 (require 'semantic/tag) |
05443eb58935
cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
104409
diff
changeset
|
40 (require 'semantic/lex) |
104409
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
41 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
42 (declare-function inversion-test "inversion") |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
43 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
44 (defun semantic-require-version (major minor &optional beta) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
45 "Non-nil if this version of semantic does not satisfy a specific version. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
46 Arguments can be: |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
47 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
48 (MAJOR MINOR &optional BETA) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
49 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
50 Values MAJOR and MINOR must be integers. BETA can be an integer, or |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
51 excluded if a released version is required. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
52 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
53 It is assumed that if the current version is newer than that specified, |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
54 everything passes. Exceptions occur when known incompatibilities are |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
55 introduced." |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
56 (require 'inversion) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
57 (inversion-test 'semantic |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
58 (concat major "." minor |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
59 (when beta (concat "beta" beta))))) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
60 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
61 (defgroup semantic nil |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
62 "Parser Generator and parser framework." |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
63 :group 'lisp) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
64 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
65 (defgroup semantic-faces nil |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
66 "Faces used for Semantic enabled tools." |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
67 :group 'semantic) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
68 |
104412
05443eb58935
cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
104409
diff
changeset
|
69 (require 'semantic/fw) |
104409
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
70 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
71 ;;; Code: |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
72 ;; |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
73 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
74 ;;; Variables and Configuration |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
75 ;; |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
76 (defvar semantic--parse-table nil |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
77 "Variable that defines how to parse top level items in a buffer. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
78 This variable is for internal use only, and its content depends on the |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
79 external parser used.") |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
80 (make-variable-buffer-local 'semantic--parse-table) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
81 (semantic-varalias-obsolete 'semantic-toplevel-bovine-table |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
82 'semantic--parse-table) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
83 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
84 (defvar semantic-symbol->name-assoc-list |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
85 '((type . "Types") |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
86 (variable . "Variables") |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
87 (function . "Functions") |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
88 (include . "Dependencies") |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
89 (package . "Provides")) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
90 "Association between symbols returned, and a string. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
91 The string is used to represent a group of objects of the given type. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
92 It is sometimes useful for a language to use a different string |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
93 in place of the default, even though that language will still |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
94 return a symbol. For example, Java return's includes, but the |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
95 string can be replaced with `Imports'.") |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
96 (make-variable-buffer-local 'semantic-symbol->name-assoc-list) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
97 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
98 (defvar semantic-symbol->name-assoc-list-for-type-parts nil |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
99 "Like `semantic-symbol->name-assoc-list' for type parts. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
100 Some tags that have children (see `semantic-tag-children-compatibility') |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
101 will want to define the names of classes of tags differently than at |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
102 the top level. For example, in C++, a Function may be called a |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
103 Method. In addition, there may be new types of tags that exist only |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
104 in classes, such as protection labels.") |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
105 (make-variable-buffer-local 'semantic-symbol->name-assoc-list-for-type-parts) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
106 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
107 (defvar semantic-case-fold nil |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
108 "Value for `case-fold-search' when parsing.") |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
109 (make-variable-buffer-local 'semantic-case-fold) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
110 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
111 (defvar semantic-expand-nonterminal nil |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
112 "Function to call for each nonterminal production. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
113 Return a list of non-terminals derived from the first argument, or nil |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
114 if it does not need to be expanded. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
115 Languages with compound definitions should use this function to expand |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
116 from one compound symbol into several. For example, in C the definition |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
117 int a, b; |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
118 is easily parsed into one tag. This function should take this |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
119 compound tag and turn it into two tags, one for A, and the other for B.") |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
120 (make-variable-buffer-local 'semantic-expand-nonterminal) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
121 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
122 (defvar semantic--buffer-cache nil |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
123 "A cache of the fully parsed buffer. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
124 If no significant changes have been made (based on the state) then |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
125 this is returned instead of re-parsing the buffer. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
126 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
127 DO NOT USE THIS VARIABLE IN PROGRAMS. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
128 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
129 If you need a tag list, use `semantic-fetch-tags'. If you need the |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
130 cached values for some reason, chances are you can, add a hook to |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
131 `semantic-after-toplevel-cache-change-hook'.") |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
132 (make-variable-buffer-local 'semantic--buffer-cache) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
133 (semantic-varalias-obsolete 'semantic-toplevel-bovine-cache |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
134 'semantic--buffer-cache) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
135 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
136 (defvar semantic-unmatched-syntax-cache nil |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
137 "A cached copy of unmatched syntax tokens.") |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
138 (make-variable-buffer-local 'semantic-unmatched-syntax-cache) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
139 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
140 (defvar semantic-unmatched-syntax-cache-check nil |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
141 "Non nil if the unmatched syntax cache is out of date. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
142 This is tracked with `semantic-change-function'.") |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
143 (make-variable-buffer-local 'semantic-unmatched-syntax-cache-check) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
144 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
145 (defvar semantic-edits-are-safe nil |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
146 "When non-nil, modifications do not require a reparse. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
147 This prevents tags from being marked dirty, and it prevents top level |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
148 edits from causing a cache check. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
149 Use this when writing programs that could cause a full reparse, but |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
150 will not change the tag structure, such as adding or updating |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
151 `top-level' comments.") |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
152 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
153 (defvar semantic-unmatched-syntax-hook nil |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
154 "Hooks run when semantic detects syntax not matched in a grammar. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
155 Each individual piece of syntax (such as a symbol or punctuation |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
156 character) is called with this hook when it doesn't match in the |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
157 grammar, and multiple unmatched syntax elements are not grouped |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
158 together. Each hook is called with one argument, which is a list of |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
159 syntax tokens created by the semantic lexer. Use the functions |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
160 `semantic-lex-token-start', `semantic-lex-token-end' and |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
161 `semantic-lex-token-text' to get information about these tokens. The |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
162 current buffer is the buffer these tokens are derived from.") |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
163 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
164 (defvar semantic--before-fetch-tags-hook nil |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
165 "Hooks run before a buffer is parses for tags. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
166 It is called before any request for tags is made via the function |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
167 `semantic-fetch-tags' by an application. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
168 If any hook returns a nil value, the cached value is returned |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
169 immediately, even if it is empty.") |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
170 (semantic-varalias-obsolete 'semantic-before-toplevel-bovination-hook |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
171 'semantic--before-fetch-tags-hook) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
172 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
173 (defvar semantic-after-toplevel-bovinate-hook nil |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
174 "Hooks run after a toplevel parse. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
175 It is not run if the toplevel parse command is called, and buffer does |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
176 not need to be fully reparsed. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
177 For language specific hooks, make sure you define this as a local hook. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
178 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
179 This hook should not be used any more. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
180 Use `semantic-after-toplevel-cache-change-hook' instead.") |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
181 (make-obsolete-variable 'semantic-after-toplevel-bovinate-hook nil) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
182 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
183 (defvar semantic-after-toplevel-cache-change-hook nil |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
184 "Hooks run after the buffer tag list has changed. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
185 This list will change when a buffer is reparsed, or when the tag list |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
186 in a buffer is cleared. It is *NOT* called if the current tag list is |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
187 partially reparsed. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
188 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
189 Hook functions must take one argument, which is the new list of tags |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
190 associated with this buffer. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
191 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
192 For language specific hooks, make sure you define this as a local hook.") |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
193 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
194 (defvar semantic-before-toplevel-cache-flush-hook nil |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
195 "Hooks run before the toplevel tag cache is flushed. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
196 For language specific hooks, make sure you define this as a local |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
197 hook. This hook is called before a corresponding |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
198 `semantic-after-toplevel-cache-change-hook' which is also called |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
199 during a flush when the cache is given a new value of nil.") |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
200 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
201 (defcustom semantic-dump-parse nil |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
202 "When non-nil, dump parsing information." |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
203 :group 'semantic |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
204 :type 'boolean) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
205 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
206 (defvar semantic-parser-name "LL" |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
207 "Optional name of the parser used to parse input stream.") |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
208 (make-variable-buffer-local 'semantic-parser-name) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
209 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
210 ;;; Parse tree state management API |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
211 ;; |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
212 (defvar semantic-parse-tree-state 'needs-rebuild |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
213 "State of the current parse tree.") |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
214 (make-variable-buffer-local 'semantic-parse-tree-state) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
215 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
216 (defmacro semantic-parse-tree-unparseable () |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
217 "Indicate that the current buffer is unparseable. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
218 It is also true that the parse tree will need either updating or |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
219 a rebuild. This state will be changed when the user edits the buffer." |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
220 `(setq semantic-parse-tree-state 'unparseable)) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
221 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
222 (defmacro semantic-parse-tree-unparseable-p () |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
223 "Return non-nil if the current buffer has been marked unparseable." |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
224 `(eq semantic-parse-tree-state 'unparseable)) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
225 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
226 (defmacro semantic-parse-tree-set-needs-update () |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
227 "Indicate that the current parse tree needs to be updated. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
228 The parse tree can be updated by `semantic-parse-changes'." |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
229 `(setq semantic-parse-tree-state 'needs-update)) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
230 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
231 (defmacro semantic-parse-tree-needs-update-p () |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
232 "Return non-nil if the current parse tree needs to be updated." |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
233 `(eq semantic-parse-tree-state 'needs-update)) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
234 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
235 (defmacro semantic-parse-tree-set-needs-rebuild () |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
236 "Indicate that the current parse tree needs to be rebuilt. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
237 The parse tree must be rebuilt by `semantic-parse-region'." |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
238 `(setq semantic-parse-tree-state 'needs-rebuild)) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
239 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
240 (defmacro semantic-parse-tree-needs-rebuild-p () |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
241 "Return non-nil if the current parse tree needs to be rebuilt." |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
242 `(eq semantic-parse-tree-state 'needs-rebuild)) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
243 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
244 (defmacro semantic-parse-tree-set-up-to-date () |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
245 "Indicate that the current parse tree is up to date." |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
246 `(setq semantic-parse-tree-state nil)) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
247 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
248 (defmacro semantic-parse-tree-up-to-date-p () |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
249 "Return non-nil if the current parse tree is up to date." |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
250 `(null semantic-parse-tree-state)) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
251 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
252 ;;; Interfacing with the system |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
253 ;; |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
254 (defcustom semantic-inhibit-functions nil |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
255 "List of functions to call with no arguments before Semantic is setup. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
256 If any of these functions returns non-nil, the current buffer is not |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
257 setup to use Semantic." |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
258 :group 'semantic |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
259 :type 'hook) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
260 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
261 (defvar semantic-init-hooks nil |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
262 "*Hooks run when a buffer is initialized with a parsing table.") |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
263 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
264 (defvar semantic-init-mode-hooks nil |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
265 "*Hooks run when a buffer of a particular mode is initialized.") |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
266 (make-variable-buffer-local 'semantic-init-mode-hooks) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
267 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
268 (defvar semantic-init-db-hooks nil |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
269 "Hooks run when a buffer is initialized with a parsing table for DBs. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
270 This hook is for database functions which intend to swap in a tag table. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
271 This guarantees that the DB will go before other modes that require |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
272 a parse of the buffer.") |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
273 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
274 (defvar semantic-new-buffer-fcn-was-run nil |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
275 "Non nil after `semantic-new-buffer-fcn' has been executed.") |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
276 (make-variable-buffer-local 'semantic-new-buffer-fcn-was-run) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
277 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
278 (defsubst semantic-active-p () |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
279 "Return non-nil if the current buffer was set up for parsing." |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
280 semantic-new-buffer-fcn-was-run) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
281 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
282 (defsubst semantic--umatched-syntax-needs-refresh-p () |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
283 "Return non-nil if the unmatched syntax cache needs a refresh. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
284 That is if it is dirty or if the current parse tree isn't up to date." |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
285 (or semantic-unmatched-syntax-cache-check |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
286 (not (semantic-parse-tree-up-to-date-p)))) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
287 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
288 (defun semantic-new-buffer-fcn () |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
289 "Setup the current buffer to use Semantic. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
290 If the major mode is ready for Semantic, and no |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
291 `semantic-inhibit-functions' disabled it, the current buffer is setup |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
292 to use Semantic, and `semantic-init-hook' is run." |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
293 ;; Do stuff if semantic was activated by a mode hook in this buffer, |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
294 ;; and not afterwards disabled. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
295 (when (and semantic--parse-table |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
296 (not (semantic-active-p)) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
297 (not (run-hook-with-args-until-success |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
298 'semantic-inhibit-functions))) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
299 ;; Make sure that if this buffer is cloned, our tags and overlays |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
300 ;; don't go along for the ride. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
301 (add-hook 'clone-indirect-buffer-hook 'semantic-clear-toplevel-cache |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
302 nil t) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
303 ;; Specify that this function has done it's work. At this point |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
304 ;; we can consider that semantic is active in this buffer. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
305 (setq semantic-new-buffer-fcn-was-run t) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
306 ;; Here are some buffer local variables we can initialize ourselves |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
307 ;; of a mode does not choose to do so. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
308 (semantic-lex-init) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
309 ;; Force this buffer to have its cache refreshed. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
310 (semantic-clear-toplevel-cache) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
311 ;; Call DB hooks before regular init hooks |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
312 (run-hooks 'semantic-init-db-hooks) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
313 ;; Set up semantic modes |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
314 (run-hooks 'semantic-init-hooks) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
315 ;; Set up major-mode specific semantic modes |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
316 (run-hooks 'semantic-init-mode-hooks) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
317 )) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
318 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
319 (add-hook 'mode-local-init-hook 'semantic-new-buffer-fcn) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
320 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
321 ;; Test the above hook. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
322 ;;(add-hook 'semantic-init-hooks (lambda () (message "init for semantic"))) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
323 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
324 (defun semantic-fetch-tags-fast () |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
325 "For use in a hook. When only a partial reparse is needed, reparse." |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
326 (condition-case nil |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
327 (if (semantic-parse-tree-needs-update-p) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
328 (semantic-fetch-tags)) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
329 (error nil)) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
330 semantic--buffer-cache) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
331 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
332 (if (boundp 'eval-defun-hooks) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
333 (add-hook 'eval-defun-hooks 'semantic-fetch-tags-fast)) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
334 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
335 ;;; Parsing Commands |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
336 ;; |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
337 (eval-when-compile |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
338 (condition-case nil (require 'pp) (error nil))) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
339 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
340 (defvar semantic-edebug nil |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
341 "When non-nil, activate the interactive parsing debugger. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
342 Do not set this yourself. Call `semantic-debug'.") |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
343 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
344 (defun semantic-elapsed-time (start end) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
345 "Copied from elp.el. Was elp-elapsed-time. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
346 Argument START and END bound the time being calculated." |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
347 (+ (* (- (car end) (car start)) 65536.0) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
348 (- (car (cdr end)) (car (cdr start))) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
349 (/ (- (car (cdr (cdr end))) (car (cdr (cdr start)))) 1000000.0))) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
350 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
351 (defun bovinate (&optional clear) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
352 "Parse the current buffer. Show output in a temp buffer. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
353 Optional argument CLEAR will clear the cache before parsing. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
354 If CLEAR is negative, it will do a full reparse, and also not display |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
355 the output buffer." |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
356 (interactive "P") |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
357 (if clear (semantic-clear-toplevel-cache)) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
358 (if (eq clear '-) (setq clear -1)) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
359 (let* ((start (current-time)) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
360 (out (semantic-fetch-tags)) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
361 (end (current-time))) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
362 (message "Retrieving tags took %.2f seconds." |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
363 (semantic-elapsed-time start end)) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
364 (when (or (null clear) (not (listp clear))) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
365 (pop-to-buffer "*Parser Output*") |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
366 (require 'pp) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
367 (erase-buffer) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
368 (insert (pp-to-string out)) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
369 (goto-char (point-min))))) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
370 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
371 ;;; Functions of the parser plug-in API |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
372 ;; |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
373 ;; Overload these functions to create new types of parsers. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
374 ;; |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
375 (define-overloadable-function semantic-parse-stream (stream nonterminal) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
376 "Parse STREAM, starting at the first NONTERMINAL rule. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
377 For bovine and wisent based parsers, STREAM is from the output of |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
378 `semantic-lex', and NONTERMINAL is a rule in the apropriate language |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
379 specific rules file. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
380 The default parser table used for bovine or wisent based parsers is |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
381 `semantic--parse-table'. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
382 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
383 Must return a list: (STREAM TAGS) where STREAM is the unused elements |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
384 from STREAM, and TAGS is the list of semantic tags found, usually only |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
385 one tag is returned with the exception of compound statements") |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
386 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
387 (define-overloadable-function semantic-parse-changes () |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
388 "Reparse changes in the current buffer. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
389 The list of changes are tracked as a series of overlays in the buffer. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
390 When overloading this function, use `semantic-changes-in-region' to |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
391 analyze.") |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
392 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
393 (define-overloadable-function semantic-parse-region |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
394 (start end &optional nonterminal depth returnonerror) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
395 "Parse the area between START and END, and return any tags found. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
396 If END needs to be extended due to a lexical token being too large, it |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
397 will be silently ignored. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
398 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
399 Optional arguments: |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
400 NONTERMINAL is the rule to start parsing at. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
401 DEPTH specifies the lexical depth to decend for parser that use |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
402 lexical analysis as their first step. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
403 RETURNONERROR specifies that parsing should stop on the first |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
404 unmatched syntax encountered. When nil, parsing skips the syntax, |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
405 adding it to the unmatched syntax cache. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
406 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
407 Must return a list of semantic tags wich have been cooked |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
408 \(repositioned properly) but which DO NOT HAVE OVERLAYS associated |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
409 with them. When overloading this function, use `semantic--tag-expand' |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
410 to cook raw tags.") |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
411 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
412 (defun semantic-parse-region-default |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
413 (start end &optional nonterminal depth returnonerror) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
414 "Parse the area between START and END, and return any tags found. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
415 If END needs to be extended due to a lexical token being too large, it |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
416 will be silently ignored. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
417 Optional arguments: |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
418 NONTERMINAL is the rule to start parsing at if it is known. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
419 DEPTH specifies the lexical depth to scan. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
420 RETURNONERROR specifies that parsing should end when encountering |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
421 unterminated syntax." |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
422 (when (or (null semantic--parse-table) (eq semantic--parse-table t)) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
423 ;; If there is no table, or it was set to t, then we are here by |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
424 ;; some other mistake. Do not throw an error deep in the parser. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
425 (error "No support found to parse buffer %S" (buffer-name))) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
426 (save-restriction |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
427 (widen) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
428 (when (or (< end start) (> end (point-max))) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
429 (error "Invalid parse region bounds %S, %S" start end)) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
430 (nreverse |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
431 (semantic-repeat-parse-whole-stream |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
432 (or (cdr (assq start semantic-lex-block-streams)) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
433 (semantic-lex start end depth)) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
434 nonterminal returnonerror)))) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
435 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
436 ;;; Parsing functions |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
437 ;; |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
438 (defun semantic-set-unmatched-syntax-cache (unmatched-syntax) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
439 "Set the unmatched syntax cache. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
440 Argument UNMATCHED-SYNTAX is the syntax to set into the cache." |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
441 ;; This function is not actually called by the main parse loop. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
442 ;; This is intended for use by semanticdb. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
443 (setq semantic-unmatched-syntax-cache unmatched-syntax |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
444 semantic-unmatched-syntax-cache-check nil) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
445 ;; Refresh the display of unmatched syntax tokens if enabled |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
446 (run-hook-with-args 'semantic-unmatched-syntax-hook |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
447 semantic-unmatched-syntax-cache)) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
448 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
449 (defun semantic-clear-unmatched-syntax-cache () |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
450 "Clear the cache of unmatched syntax tokens." |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
451 (setq semantic-unmatched-syntax-cache nil |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
452 semantic-unmatched-syntax-cache-check t)) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
453 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
454 (defun semantic-unmatched-syntax-tokens () |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
455 "Return the list of unmatched syntax tokens." |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
456 ;; If the cache need refresh then do a full re-parse. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
457 (if (semantic--umatched-syntax-needs-refresh-p) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
458 ;; To avoid a recursive call, temporarily disable |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
459 ;; `semantic-unmatched-syntax-hook'. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
460 (let (semantic-unmatched-syntax-hook) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
461 (condition-case nil |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
462 (progn |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
463 (semantic-clear-toplevel-cache) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
464 (semantic-fetch-tags)) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
465 (quit |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
466 (message "semantic-unmatched-syntax-tokens:\ |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
467 parsing of buffer canceled")) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
468 ))) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
469 semantic-unmatched-syntax-cache) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
470 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
471 (defun semantic-clear-toplevel-cache () |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
472 "Clear the toplevel tag cache for the current buffer. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
473 Clearing the cache will force a complete reparse next time a tag list |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
474 is requested." |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
475 (interactive) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
476 (run-hooks 'semantic-before-toplevel-cache-flush-hook) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
477 (setq semantic--buffer-cache nil) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
478 (semantic-clear-unmatched-syntax-cache) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
479 (semantic-clear-parser-warnings) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
480 ;; Nuke all semantic overlays. This is faster than deleting based |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
481 ;; on our data structure. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
482 (let ((l (semantic-overlay-lists))) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
483 (mapc 'semantic-delete-overlay-maybe (car l)) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
484 (mapc 'semantic-delete-overlay-maybe (cdr l)) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
485 ) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
486 (semantic-parse-tree-set-needs-rebuild) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
487 ;; Remove this hook which tracks if a buffer is up to date or not. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
488 (remove-hook 'after-change-functions 'semantic-change-function t) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
489 ;; Old model. Delete someday. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
490 ;;(run-hooks 'semantic-after-toplevel-bovinate-hook) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
491 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
492 (run-hook-with-args 'semantic-after-toplevel-cache-change-hook |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
493 semantic--buffer-cache) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
494 ) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
495 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
496 (defvar semantic-bovinate-nonterminal-check-obarray) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
497 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
498 (defun semantic--set-buffer-cache (tagtable) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
499 "Set the toplevel cache cache to TAGTABLE." |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
500 (setq semantic--buffer-cache tagtable |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
501 semantic-unmatched-syntax-cache-check nil |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
502 ;; This is specific to the bovine parser. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
503 semantic-bovinate-nonterminal-check-obarray nil) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
504 (semantic-parse-tree-set-up-to-date) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
505 (semantic-make-local-hook 'after-change-functions) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
506 (add-hook 'after-change-functions 'semantic-change-function nil t) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
507 (run-hook-with-args 'semantic-after-toplevel-cache-change-hook |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
508 semantic--buffer-cache) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
509 ;; Refresh the display of unmatched syntax tokens if enabled |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
510 (run-hook-with-args 'semantic-unmatched-syntax-hook |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
511 semantic-unmatched-syntax-cache) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
512 ;; Old Semantic 1.3 hook API. Maybe useful forever? |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
513 (run-hooks 'semantic-after-toplevel-bovinate-hook) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
514 ) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
515 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
516 (defvar semantic-working-type 'percent |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
517 "*The type of working message to use when parsing. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
518 'percent means we are doing a linear parse through the buffer. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
519 'dynamic means we are reparsing specific tags.") |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
520 (semantic-varalias-obsolete 'semantic-bovination-working-type |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
521 'semantic-working-type) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
522 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
523 (defvar semantic-minimum-working-buffer-size (* 1024 5) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
524 "*The minimum size of a buffer before working messages are displayed. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
525 Buffers smaller than will parse silently. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
526 Bufferse larger than this will display the working progress bar.") |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
527 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
528 (defsubst semantic-parser-working-message (&optional arg) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
529 "Return the message string displayed while parsing. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
530 If optional argument ARG is non-nil it is appended to the message |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
531 string." |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
532 (if semantic-parser-name |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
533 (format "%s/%s" semantic-parser-name (or arg "")) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
534 (format "%s" (or arg "")))) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
535 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
536 ;;; Application Parser Entry Points |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
537 ;; |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
538 ;; The best way to call the parser from programs is via |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
539 ;; `semantic-fetch-tags'. This, in turn, uses other internal |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
540 ;; API functions which plug-in parsers can take advantage of. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
541 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
542 (defun semantic-fetch-tags () |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
543 "Fetch semantic tags from the current buffer. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
544 If the buffer cache is up to date, return that. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
545 If the buffer cache is out of date, attempt an incremental reparse. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
546 If the buffer has not been parsed before, or if the incremental reparse |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
547 fails, then parse the entire buffer. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
548 If a lexcial error had been previously discovered and the buffer |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
549 was marked unparseable, then do nothing, and return the cache." |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
550 (and |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
551 ;; Is this a semantic enabled buffer? |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
552 (semantic-active-p) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
553 ;; Application hooks say the buffer is safe for parsing |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
554 (run-hook-with-args-until-failure |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
555 'semantic-before-toplevel-bovination-hook) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
556 (run-hook-with-args-until-failure |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
557 'semantic--before-fetch-tags-hook) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
558 ;; If the buffer was previously marked unparseable, |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
559 ;; then don't waste our time. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
560 (not (semantic-parse-tree-unparseable-p)) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
561 ;; The parse tree actually needs to be refreshed |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
562 (not (semantic-parse-tree-up-to-date-p)) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
563 ;; So do it! |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
564 (let* ((gc-cons-threshold (max gc-cons-threshold 10000000)) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
565 (semantic-lex-block-streams nil) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
566 (res nil)) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
567 (garbage-collect) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
568 (cond |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
569 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
570 ;;;; Try the incremental parser to do a fast update. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
571 ((semantic-parse-tree-needs-update-p) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
572 (setq res (semantic-parse-changes)) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
573 (if (semantic-parse-tree-needs-rebuild-p) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
574 ;; If the partial reparse fails, jump to a full reparse. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
575 (semantic-fetch-tags) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
576 ;; Clear the cache of unmatched syntax tokens |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
577 ;; |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
578 ;; NOTE TO SELF: |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
579 ;; |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
580 ;; Move this into the incremental parser. This is a bug. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
581 ;; |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
582 (semantic-clear-unmatched-syntax-cache) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
583 (run-hook-with-args ;; Let hooks know the updated tags |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
584 'semantic-after-partial-cache-change-hook res)) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
585 ) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
586 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
587 ;;;; Parse the whole system. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
588 ((semantic-parse-tree-needs-rebuild-p) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
589 ;; Use Emacs' built-in progress-reporter |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
590 (let ((semantic--progress-reporter |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
591 (and (>= (point-max) semantic-minimum-working-buffer-size) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
592 (eq semantic-working-type 'percent) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
593 (make-progress-reporter |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
594 (semantic-parser-working-message (buffer-name)) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
595 0 100)))) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
596 (setq res (semantic-parse-region (point-min) (point-max))) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
597 (progress-reporter-done semantic--progress-reporter)) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
598 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
599 ;; Clear the caches when we see there were no errors. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
600 ;; But preserve the unmatched syntax cache and warnings! |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
601 (let (semantic-unmatched-syntax-cache |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
602 semantic-unmatched-syntax-cache-check |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
603 semantic-parser-warnings) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
604 (semantic-clear-toplevel-cache)) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
605 ;; Set up the new overlays |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
606 (semantic--tag-link-list-to-buffer res) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
607 ;; Set up the cache with the new results |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
608 (semantic--set-buffer-cache res) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
609 )))) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
610 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
611 ;; Always return the current parse tree. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
612 semantic--buffer-cache) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
613 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
614 (defun semantic-refresh-tags-safe () |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
615 "Refreshes the current buffer's tags safely. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
616 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
617 Return non-nil if the refresh was successful. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
618 Return nil if there is some sort of syntax error preventing a reparse. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
619 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
620 Does nothing if the current buffer doesn't need reparsing." |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
621 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
622 ;; These checks actually occur in `semantic-fetch-tags', but if we |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
623 ;; do them here, then all the bovination hooks are not run, and |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
624 ;; we save lots of time. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
625 (cond |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
626 ;; If the buffer was previously marked unparseable, |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
627 ;; then don't waste our time. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
628 ((semantic-parse-tree-unparseable-p) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
629 nil) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
630 ;; The parse tree is already ok. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
631 ((semantic-parse-tree-up-to-date-p) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
632 t) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
633 (t |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
634 (let* ((inhibit-quit nil) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
635 (lexically-safe t) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
636 ) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
637 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
638 (unwind-protect |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
639 ;; Perform the parsing. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
640 (progn |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
641 (when (semantic-lex-catch-errors safe-refresh |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
642 (save-excursion (semantic-fetch-tags)) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
643 nil) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
644 ;; If we are here, it is because the lexical step failed, |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
645 ;; proably due to unterminated lists or something like that. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
646 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
647 ;; We do nothing, and just wait for the next idle timer |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
648 ;; to go off. In the meantime, remember this, and make sure |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
649 ;; no other idle services can get executed. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
650 (setq lexically-safe nil)) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
651 ) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
652 ) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
653 ;; Return if we are lexically safe |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
654 lexically-safe)))) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
655 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
656 (defun semantic-bovinate-toplevel (&optional ignored) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
657 "Backward Compatibility Function." |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
658 (semantic-fetch-tags)) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
659 (make-obsolete 'semantic-bovinate-toplevel 'semantic-fetch-tags) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
660 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
661 ;; Another approach is to let Emacs call the parser on idle time, when |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
662 ;; needed, use `semantic-fetch-available-tags' to only retrieve |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
663 ;; available tags, and setup the `semantic-after-*-hook' hooks to |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
664 ;; synchronize with new tags when they become available. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
665 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
666 (defsubst semantic-fetch-available-tags () |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
667 "Fetch available semantic tags from the current buffer. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
668 That is, return tags currently in the cache without parsing the |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
669 current buffer. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
670 Parse operations happen asynchronously when needed on Emacs idle time. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
671 Use the `semantic-after-toplevel-cache-change-hook' and |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
672 `semantic-after-partial-cache-change-hook' hooks to synchronize with |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
673 new tags when they become available." |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
674 semantic--buffer-cache) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
675 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
676 ;;; Iterative parser helper function |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
677 ;; |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
678 ;; Iterative parsers are better than rule-based iterative functions |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
679 ;; in that they can handle obscure errors more cleanly. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
680 ;; |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
681 ;; `semantic-repeat-parse-whole-stream' abstracts this action for |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
682 ;; other parser centric routines. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
683 ;; |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
684 (defun semantic-repeat-parse-whole-stream |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
685 (stream nonterm &optional returnonerror) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
686 "Iteratively parse the entire stream STREAM starting with NONTERM. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
687 Optional argument RETURNONERROR indicates that the parser should exit |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
688 with the current results on a parse error. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
689 This function returns semantic tags without overlays." |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
690 (let ((result nil) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
691 (case-fold-search semantic-case-fold) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
692 nontermsym tag) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
693 (while stream |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
694 (setq nontermsym (semantic-parse-stream stream nonterm) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
695 tag (car (cdr nontermsym))) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
696 (if (not nontermsym) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
697 (error "Parse error @ %d" (car (cdr (car stream))))) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
698 (if (eq (car nontermsym) stream) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
699 (error "Parser error: Infinite loop?")) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
700 (if tag |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
701 (if (car tag) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
702 (setq tag (mapcar |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
703 #'(lambda (tag) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
704 ;; Set the 'reparse-symbol property to |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
705 ;; NONTERM unless it was already setup |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
706 ;; by a tag expander |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
707 (or (semantic--tag-get-property |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
708 tag 'reparse-symbol) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
709 (semantic--tag-put-property |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
710 tag 'reparse-symbol nonterm)) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
711 tag) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
712 (semantic--tag-expand tag)) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
713 result (append tag result)) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
714 ;; No error in this case, a purposeful nil means don't |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
715 ;; store anything. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
716 ) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
717 (if returnonerror |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
718 (setq stream nil) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
719 ;; The current item in the stream didn't match, so add it to |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
720 ;; the list of syntax items which didn't match. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
721 (setq semantic-unmatched-syntax-cache |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
722 (cons (car stream) semantic-unmatched-syntax-cache)) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
723 )) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
724 ;; Designated to ignore. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
725 (setq stream (car nontermsym)) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
726 (if stream |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
727 ;; Use Emacs' built-in progress reporter: |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
728 (and (boundp 'semantic--progress-reporter) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
729 semantic--progress-reporter |
104439
da5b2513c225
cedet/cedet.el (cedet-packages): Bump srecode version.
Chong Yidong <cyd@stupidchicken.com>
parents:
104412
diff
changeset
|
730 (eq semantic-working-type 'percent) |
104409
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
731 (progress-reporter-update |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
732 semantic--progress-reporter |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
733 (/ (* 100 (semantic-lex-token-start (car stream))) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
734 (point-max)))))) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
735 result)) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
736 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
737 ;;; Parsing Warnings: |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
738 ;; |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
739 ;; Parsing a buffer may result in non-critical things that we should |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
740 ;; alert the user to without interrupting the normal flow. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
741 ;; |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
742 ;; Any parser can use this API to provide a list of warnings during a |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
743 ;; parse which a user may want to investigate. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
744 (defvar semantic-parser-warnings nil |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
745 "A list of parser warnings since the last full reparse.") |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
746 (make-variable-buffer-local 'semantic-parser-warnings) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
747 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
748 (defun semantic-clear-parser-warnings () |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
749 "Clear the current list of parser warnings for this buffer." |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
750 (setq semantic-parser-warnings nil)) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
751 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
752 (defun semantic-push-parser-warning (warning start end) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
753 "Add a parser WARNING that covers text from START to END." |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
754 (setq semantic-parser-warnings |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
755 (cons (cons warning (cons start end)) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
756 semantic-parser-warnings))) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
757 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
758 (defun semantic-dump-parser-warnings () |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
759 "Dump any parser warnings." |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
760 (interactive) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
761 (if semantic-parser-warnings |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
762 (let ((pw semantic-parser-warnings)) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
763 (pop-to-buffer "*Parser Warnings*") |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
764 (require 'pp) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
765 (erase-buffer) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
766 (insert (pp-to-string pw)) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
767 (goto-char (point-min))) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
768 (message "No parser warnings."))) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
769 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
770 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
771 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
772 ;;; Compatibility: |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
773 ;; |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
774 ;; Semantic 1.x parser action helper functions, used by some parsers. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
775 ;; Please move away from these functions, and try using semantic 2.x |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
776 ;; interfaces instead. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
777 ;; |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
778 (defsubst semantic-bovinate-region-until-error |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
779 (start end nonterm &optional depth) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
780 "NOTE: Use `semantic-parse-region' instead. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
781 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
782 Bovinate between START and END starting with NONTERM. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
783 Optional DEPTH specifies how many levels of parenthesis to enter. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
784 This command will parse until an error is encountered, and return |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
785 the list of everything found until that moment. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
786 This is meant for finding variable definitions at the beginning of |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
787 code blocks in methods. If `bovine-inner-scope' can also support |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
788 commands, use `semantic-bovinate-from-nonterminal-full'." |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
789 (semantic-parse-region start end nonterm depth t)) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
790 (make-obsolete 'semantic-bovinate-region-until-error |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
791 'semantic-parse-region) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
792 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
793 (defsubst semantic-bovinate-from-nonterminal |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
794 (start end nonterm &optional depth length) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
795 "Bovinate from within a nonterminal lambda from START to END. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
796 Argument NONTERM is the nonterminal symbol to start with. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
797 Optional argument DEPTH is the depth of lists to dive into. When used |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
798 in a `lambda' of a MATCH-LIST, there is no need to include a START and |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
799 END part. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
800 Optional argument LENGTH specifies we are only interested in LENGTH |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
801 tokens." |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
802 (car-safe (cdr (semantic-parse-stream |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
803 (semantic-lex start end (or depth 1) length) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
804 nonterm)))) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
805 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
806 (defsubst semantic-bovinate-from-nonterminal-full |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
807 (start end nonterm &optional depth) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
808 "NOTE: Use `semantic-parse-region' instead. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
809 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
810 Bovinate from within a nonterminal lambda from START to END. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
811 Iterates until all the space between START and END is exhausted. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
812 Argument NONTERM is the nonterminal symbol to start with. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
813 If NONTERM is nil, use `bovine-block-toplevel'. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
814 Optional argument DEPTH is the depth of lists to dive into. |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
815 When used in a `lambda' of a MATCH-LIST, there is no need to include |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
816 a START and END part." |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
817 (semantic-parse-region start end nonterm (or depth 1))) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
818 (make-obsolete 'semantic-bovinate-from-nonterminal-full |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
819 'semantic-parse-region) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
820 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
821 (provide 'semantic) |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
822 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
823 ;;; semantic.el ends here |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
824 |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
825 ;; Semantic-util is a part of the semantic API. Include it last |
560b69982442
semantic.el, semantic-tag.el, semantic-lex.el, semantic-fw.el: Initial
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
826 ;; because it depends on semantic. |
104412
05443eb58935
cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
104409
diff
changeset
|
827 (require 'semantic/util) |