Mercurial > emacs
annotate lisp/cedet/semantic/bovine.el @ 110769:ca7895148434
Fix rnewspost.el comment typo.
author | Glenn Morris <rgm@gnu.org> |
---|---|
date | Mon, 04 Oct 2010 21:14:08 -0700 |
parents | 1d1d5d9bd884 |
children | 376148b31b5e |
rev | line source |
---|---|
104453
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1 ;;; semantic/bovine.el --- LL Parser/Analyzer core. |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
2 |
106815 | 3 ;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2006, 2007, 2009, 2010 |
105285 | 4 ;; Free Software Foundation, Inc. |
104453
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
5 |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
6 ;; Author: Eric M. Ludlam <eric@siege-engine.com> |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
7 |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
8 ;; This file is part of GNU Emacs. |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
9 |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
10 ;; GNU Emacs is free software: you can redistribute it and/or modify |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
11 ;; it under the terms of the GNU General Public License as published by |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
12 ;; the Free Software Foundation, either version 3 of the License, or |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
13 ;; (at your option) any later version. |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
14 |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
15 ;; GNU Emacs is distributed in the hope that it will be useful, |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
18 ;; GNU General Public License for more details. |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
19 |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
20 ;; You should have received a copy of the GNU General Public License |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
21 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
22 |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
23 ;;; Commentary: |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
24 ;; |
105335 | 25 ;; Semantic 1.x uses an LL parser named the "bovinator". This parser |
104453
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
26 ;; had several conveniences in it which made for parsing tags out of |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
27 ;; languages with list characters easy. This parser lives on as one |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
28 ;; of many available parsers for semantic the tool. |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
29 ;; |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
30 ;; This parser should be used when the language is simple, such as |
105335 | 31 ;; makefiles or other data-declarative languages. |
104453
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
32 |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
33 ;;; Code: |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
34 (require 'semantic) |
105260
bbd7017a25d9
CEDET (development tools) package merged.
Chong Yidong <cyd@stupidchicken.com>
parents:
104453
diff
changeset
|
35 |
bbd7017a25d9
CEDET (development tools) package merged.
Chong Yidong <cyd@stupidchicken.com>
parents:
104453
diff
changeset
|
36 (declare-function semantic-create-bovine-debug-error-frame |
bbd7017a25d9
CEDET (development tools) package merged.
Chong Yidong <cyd@stupidchicken.com>
parents:
104453
diff
changeset
|
37 "semantic/bovine/debug") |
bbd7017a25d9
CEDET (development tools) package merged.
Chong Yidong <cyd@stupidchicken.com>
parents:
104453
diff
changeset
|
38 (declare-function semantic-bovine-debug-create-frame |
bbd7017a25d9
CEDET (development tools) package merged.
Chong Yidong <cyd@stupidchicken.com>
parents:
104453
diff
changeset
|
39 "semantic/bovine/debug") |
bbd7017a25d9
CEDET (development tools) package merged.
Chong Yidong <cyd@stupidchicken.com>
parents:
104453
diff
changeset
|
40 (declare-function semantic-debug-break "semantic/debug") |
104453
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
41 |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
42 ;;; Variables |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
43 ;; |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
44 (defvar semantic-bovinate-nonterminal-check-obarray nil |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
45 "Obarray of streams already parsed for nonterminal symbols. |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
46 Use this to detect infinite recursion during a parse.") |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
47 (make-variable-buffer-local 'semantic-bovinate-nonterminal-check-obarray) |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
48 |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
49 |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
50 |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
51 ;; These are functions that can be called from within a bovine table. |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
52 ;; Most of these have code auto-generated from other construct in the |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
53 ;; bovine input grammar. |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
54 (defmacro semantic-lambda (&rest return-val) |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
55 "Create a lambda expression to return a list including RETURN-VAL. |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
56 The return list is a lambda expression to be used in a bovine table." |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
57 `(lambda (vals start end) |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
58 (append ,@return-val (list start end)))) |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
59 |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
60 ;;; Semantic Bovination |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
61 ;; |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
62 ;; Take a semantic token stream, and convert it using the bovinator. |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
63 ;; The bovinator takes a state table, and converts the token stream |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
64 ;; into a new semantic stream defined by the bovination table. |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
65 ;; |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
66 (defsubst semantic-bovinate-symbol-nonterminal-p (sym table) |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
67 "Return non-nil if SYM is in TABLE, indicating it is NONTERMINAL." |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
68 ;; sym is always a sym, so assq should be ok. |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
69 (if (assq sym table) t nil)) |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
70 |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
71 (defmacro semantic-bovinate-nonterminal-db-nt () |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
72 "Return the current nonterminal symbol. |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
73 Part of the grammar source debugger. Depends on the existing |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
74 environment of `semantic-bovinate-stream'." |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
75 `(if nt-stack |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
76 (car (aref (car nt-stack) 2)) |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
77 nonterminal)) |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
78 |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
79 (defun semantic-bovinate-nonterminal-check (stream nonterminal) |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
80 "Check if STREAM not already parsed for NONTERMINAL. |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
81 If so abort because an infinite recursive parse is suspected." |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
82 (or (vectorp semantic-bovinate-nonterminal-check-obarray) |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
83 (setq semantic-bovinate-nonterminal-check-obarray |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
84 (make-vector 13 nil))) |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
85 (let* ((nt (symbol-name nonterminal)) |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
86 (vs (symbol-value |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
87 (intern-soft |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
88 nt semantic-bovinate-nonterminal-check-obarray)))) |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
89 (if (memq stream vs) |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
90 ;; Always enter debugger to see the backtrace |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
91 (let ((debug-on-signal t) |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
92 (debug-on-error t)) |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
93 (setq semantic-bovinate-nonterminal-check-obarray nil) |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
94 (error "Infinite recursive parse suspected on %s" nt)) |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
95 (set (intern nt semantic-bovinate-nonterminal-check-obarray) |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
96 (cons stream vs))))) |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
97 |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
98 ;;;###autoload |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
99 (defun semantic-bovinate-stream (stream &optional nonterminal) |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
100 "Bovinate STREAM, starting at the first NONTERMINAL rule. |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
101 Use `bovine-toplevel' if NONTERMINAL is not provided. |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
102 This is the core routine for converting a stream into a table. |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
103 Return the list (STREAM SEMANTIC-STREAM) where STREAM are those |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
104 elements of STREAM that have not been used. SEMANTIC-STREAM is the |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
105 list of semantic tokens found." |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
106 (if (not nonterminal) |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
107 (setq nonterminal 'bovine-toplevel)) |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
108 |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
109 ;; Try to detect infinite recursive parse when doing a full reparse. |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
110 (or semantic--buffer-cache |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
111 (semantic-bovinate-nonterminal-check stream nonterminal)) |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
112 |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
113 (let* ((table semantic--parse-table) |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
114 (matchlist (cdr (assq nonterminal table))) |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
115 (starting-stream stream) |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
116 (nt-loop t) ;non-terminal loop condition |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
117 nt-popup ;non-nil if return from nt recursion |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
118 nt-stack ;non-terminal recursion stack |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
119 s ;Temp Stream Tracker |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
120 lse ;Local Semantic Element |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
121 lte ;Local matchlist element |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
122 tev ;Matchlist entry values from buffer |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
123 val ;Value found in buffer. |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
124 cvl ;collected values list. |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
125 out ;Output |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
126 end ;End of match |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
127 result |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
128 ) |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
129 (condition-case debug-condition |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
130 (while nt-loop |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
131 (catch 'push-non-terminal |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
132 (setq nt-popup nil |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
133 end (semantic-lex-token-end (car stream))) |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
134 (while (or nt-loop nt-popup) |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
135 (setq nt-loop nil |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
136 out nil) |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
137 (while (or nt-popup matchlist) |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
138 (if nt-popup |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
139 ;; End of a non-terminal recursion |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
140 (setq nt-popup nil) |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
141 ;; New matching process |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
142 (setq s stream ;init s from stream. |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
143 cvl nil ;re-init the collected value list. |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
144 lte (car matchlist) ;Get the local matchlist entry. |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
145 ) |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
146 (if (or (byte-code-function-p (car lte)) |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
147 (listp (car lte))) |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
148 ;; In this case, we have an EMPTY match! Make |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
149 ;; stuff up. |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
150 (setq cvl (list nil)))) |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
151 |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
152 (while (and lte |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
153 (not (byte-code-function-p (car lte))) |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
154 (not (listp (car lte)))) |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
155 |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
156 ;; GRAMMAR SOURCE DEBUGGING! |
105260
bbd7017a25d9
CEDET (development tools) package merged.
Chong Yidong <cyd@stupidchicken.com>
parents:
104453
diff
changeset
|
157 (if (and (boundp 'semantic-debug-enabled) |
bbd7017a25d9
CEDET (development tools) package merged.
Chong Yidong <cyd@stupidchicken.com>
parents:
104453
diff
changeset
|
158 semantic-debug-enabled) |
104453
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
159 (let* ((db-nt (semantic-bovinate-nonterminal-db-nt)) |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
160 (db-ml (cdr (assq db-nt table))) |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
161 (db-mlen (length db-ml)) |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
162 (db-midx (- db-mlen (length matchlist))) |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
163 (db-tlen (length (nth db-midx db-ml))) |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
164 (db-tidx (- db-tlen (length lte))) |
105260
bbd7017a25d9
CEDET (development tools) package merged.
Chong Yidong <cyd@stupidchicken.com>
parents:
104453
diff
changeset
|
165 (frame (progn |
bbd7017a25d9
CEDET (development tools) package merged.
Chong Yidong <cyd@stupidchicken.com>
parents:
104453
diff
changeset
|
166 (require 'semantic/bovine/debug) |
bbd7017a25d9
CEDET (development tools) package merged.
Chong Yidong <cyd@stupidchicken.com>
parents:
104453
diff
changeset
|
167 (semantic-bovine-debug-create-frame |
bbd7017a25d9
CEDET (development tools) package merged.
Chong Yidong <cyd@stupidchicken.com>
parents:
104453
diff
changeset
|
168 db-nt db-midx db-tidx cvl (car s)))) |
104453
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
169 (cmd (semantic-debug-break frame)) |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
170 ) |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
171 (cond ((eq 'fail cmd) (setq lte '(trash 0 . 0))) |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
172 ((eq 'quit cmd) (signal 'quit "Abort")) |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
173 ((eq 'abort cmd) (error "Abort")) |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
174 ;; support more commands here. |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
175 |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
176 ))) |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
177 ;; END GRAMMAR SOURCE DEBUGGING! |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
178 |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
179 (cond |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
180 ;; We have a nonterminal symbol. Recurse inline. |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
181 ((setq nt-loop (assq (car lte) table)) |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
182 |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
183 (setq |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
184 ;; push state into the nt-stack |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
185 nt-stack (cons (vector matchlist cvl lte stream end |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
186 ) |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
187 nt-stack) |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
188 ;; new non-terminal matchlist |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
189 matchlist (cdr nt-loop) |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
190 ;; new non-terminal stream |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
191 stream s) |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
192 |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
193 (throw 'push-non-terminal t) |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
194 |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
195 ) |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
196 ;; Default case |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
197 (t |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
198 (setq lse (car s) ;Get the local stream element |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
199 s (cdr s)) ;update stream. |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
200 ;; Do the compare |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
201 (if (eq (car lte) (semantic-lex-token-class lse)) ;syntactic match |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
202 (let ((valdot (semantic-lex-token-bounds lse))) |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
203 (setq val (semantic-lex-token-text lse)) |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
204 (setq lte (cdr lte)) |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
205 (if (stringp (car lte)) |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
206 (progn |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
207 (setq tev (car lte) |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
208 lte (cdr lte)) |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
209 (if (string-match tev val) |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
210 (setq cvl (cons |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
211 (if (memq (semantic-lex-token-class lse) |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
212 '(comment semantic-list)) |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
213 valdot val) |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
214 cvl)) ;append this value |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
215 (setq lte nil cvl nil))) ;clear the entry (exit) |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
216 (setq cvl (cons |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
217 (if (memq (semantic-lex-token-class lse) |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
218 '(comment semantic-list)) |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
219 valdot val) cvl))) ;append unchecked value. |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
220 (setq end (semantic-lex-token-end lse)) |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
221 ) |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
222 (setq lte nil cvl nil)) ;No more matches, exit |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
223 ))) |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
224 (if (not cvl) ;lte=nil; there was no match. |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
225 (setq matchlist (cdr matchlist)) ;Move to next matchlist entry |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
226 (let ((start (semantic-lex-token-start (car stream)))) |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
227 (setq out (cond |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
228 ((car lte) |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
229 (funcall (car lte) ;call matchlist fn on values |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
230 (nreverse cvl) start end)) |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
231 ((and (= (length cvl) 1) |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
232 (listp (car cvl)) |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
233 (not (numberp (car (car cvl))))) |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
234 (append (car cvl) (list start end))) |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
235 (t |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
236 ;;(append (nreverse cvl) (list start end)))) |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
237 ;; MAYBE THE FOLLOWING NEEDS LESS CONS |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
238 ;; CELLS THAN THE ABOVE? |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
239 (nreverse (cons end (cons start cvl))))) |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
240 matchlist nil) ;;generate exit condition |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
241 (if (not end) |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
242 (setq out nil))) |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
243 ;; Nothin? |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
244 )) |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
245 (setq result |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
246 (if (eq s starting-stream) |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
247 (list (cdr s) nil) |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
248 (list s out))) |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
249 (if nt-stack |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
250 ;; pop previous state from the nt-stack |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
251 (let ((state (car nt-stack))) |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
252 |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
253 (setq nt-popup t |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
254 ;; pop actual parser state |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
255 matchlist (aref state 0) |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
256 cvl (aref state 1) |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
257 lte (aref state 2) |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
258 stream (aref state 3) |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
259 end (aref state 4) |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
260 ;; update the stack |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
261 nt-stack (cdr nt-stack)) |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
262 |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
263 (if out |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
264 (let ((len (length out)) |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
265 (strip (nreverse (cdr (cdr (reverse out)))))) |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
266 (setq end (nth (1- len) out) ;reset end to the end of exp |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
267 cvl (cons strip cvl) ;prepend value of exp |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
268 lte (cdr lte)) ;update the local table entry |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
269 ) |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
270 ;; No value means that we need to terminate this |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
271 ;; match. |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
272 (setq lte nil cvl nil)) ;No match, exit |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
273 ))))) |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
274 (error |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
275 ;; On error just move forward the stream of lexical tokens |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
276 (setq result (list (cdr starting-stream) nil)) |
105260
bbd7017a25d9
CEDET (development tools) package merged.
Chong Yidong <cyd@stupidchicken.com>
parents:
104453
diff
changeset
|
277 (when (and (boundp 'semantic-debug-enabled) |
bbd7017a25d9
CEDET (development tools) package merged.
Chong Yidong <cyd@stupidchicken.com>
parents:
104453
diff
changeset
|
278 semantic-debug-enabled) |
bbd7017a25d9
CEDET (development tools) package merged.
Chong Yidong <cyd@stupidchicken.com>
parents:
104453
diff
changeset
|
279 (require 'semantic/bovine/debug) |
bbd7017a25d9
CEDET (development tools) package merged.
Chong Yidong <cyd@stupidchicken.com>
parents:
104453
diff
changeset
|
280 (let ((frame (semantic-create-bovine-debug-error-frame |
bbd7017a25d9
CEDET (development tools) package merged.
Chong Yidong <cyd@stupidchicken.com>
parents:
104453
diff
changeset
|
281 debug-condition))) |
bbd7017a25d9
CEDET (development tools) package merged.
Chong Yidong <cyd@stupidchicken.com>
parents:
104453
diff
changeset
|
282 (semantic-debug-break frame))))) |
104453
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
283 result)) |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
284 |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
285 ;; Make it the default parser |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
286 ;;;###autoload |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
287 (defalias 'semantic-parse-stream-default 'semantic-bovinate-stream) |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
288 |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
289 (provide 'semantic/bovine) |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
290 |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
291 ;; Local variables: |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
292 ;; generated-autoload-file: "loaddefs.el" |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
293 ;; generated-autoload-load-name: "semantic/bovine" |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
294 ;; End: |
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
295 |
105377 | 296 ;; arch-tag: 1e820899-2a26-499a-b0c0-57301365a6b0 |
104453
a19d1a45b823
lisp/cedet/semantic/bovine.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
297 ;;; semantic/bovine.el ends here |