Mercurial > emacs
annotate lisp/cedet/semantic/grammar.el @ 109981:55e2c5cbf29c
fontset.c (reorder_font_vector): Prefer a font-spec specifying :otf.
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Wed, 25 Aug 2010 15:10:09 +0900 |
parents | e0514072acb0 |
children | a5ad4f188e19 |
rev | line source |
---|---|
104524
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1 ;;; semantic/grammar.el --- Major mode framework for Semantic grammars |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
2 |
106815 | 3 ;; Copyright (C) 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010 |
105340 | 4 ;; Free Software Foundation, Inc. |
104524
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
5 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
6 ;; Author: David Ponce <david@dponce.com> |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
7 ;; Maintainer: David Ponce <david@dponce.com> |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
8 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
9 ;; This file is part of GNU Emacs. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
10 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
11 ;; GNU Emacs is free software: you can redistribute it and/or modify |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
12 ;; it under the terms of the GNU General Public License as published by |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
13 ;; the Free Software Foundation, either version 3 of the License, or |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
14 ;; (at your option) any later version. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
15 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
16 ;; GNU Emacs is distributed in the hope that it will be useful, |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
19 ;; GNU General Public License for more details. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
20 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
21 ;; You should have received a copy of the GNU General Public License |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
22 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
23 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
24 ;;; Commentary: |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
25 ;; |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
26 ;; Major mode framework for editing Semantic's input grammar files. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
27 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
28 ;;; History: |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
29 ;; |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
30 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
31 ;;; Code: |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
32 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
33 (require 'semantic) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
34 (require 'semantic/ctxt) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
35 (require 'semantic/format) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
36 (require 'semantic/grammar-wy) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
37 (require 'semantic/idle) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
38 (declare-function semantic-momentary-highlight-tag "semantic/decorate") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
39 (declare-function semantic-analyze-context "semantic/analyze") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
40 (declare-function semantic-analyze-tags-of-class-list |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
41 "semantic/analyze/complete") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
42 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
43 (eval-when-compile |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
44 (require 'eldoc) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
45 (require 'semantic/edit) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
46 (require 'semantic/find)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
47 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
48 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
49 ;;;; |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
50 ;;;; Set up lexer |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
51 ;;;; |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
52 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
53 (defconst semantic-grammar-lex-c-char-re "'\\s\\?.'" |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
54 "Regexp matching C-like character literals.") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
55 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
56 ;; Most of the analyzers are auto-generated from the grammar, but the |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
57 ;; following which need special handling code. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
58 ;; |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
59 (define-lex-regex-analyzer semantic-grammar-lex-prologue |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
60 "Detect and create a prologue token." |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
61 "\\<%{" |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
62 ;; Zing to the end of this brace block. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
63 (semantic-lex-push-token |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
64 (semantic-lex-token |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
65 'PROLOGUE (point) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
66 (save-excursion |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
67 (semantic-lex-unterminated-syntax-protection 'PROLOGUE |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
68 (forward-char) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
69 (forward-sexp 1) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
70 (point)))))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
71 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
72 (defsubst semantic-grammar-epilogue-start () |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
73 "Return the start position of the grammar epilogue." |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
74 (save-excursion |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
75 (goto-char (point-min)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
76 (if (re-search-forward "^\\s-*\\<%%\\>\\s-*$" nil t 2) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
77 (match-beginning 0) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
78 (1+ (point-max))))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
79 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
80 (define-lex-regex-analyzer semantic-grammar-lex-epilogue |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
81 "Detect and create an epilogue or percent-percent token." |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
82 "\\<%%\\>" |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
83 (let ((start (match-beginning 0)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
84 (end (match-end 0)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
85 (class 'PERCENT_PERCENT)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
86 (when (>= start (semantic-grammar-epilogue-start)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
87 (setq class 'EPILOGUE |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
88 end (point-max))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
89 (semantic-lex-push-token |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
90 (semantic-lex-token class start end)))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
91 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
92 (define-lex semantic-grammar-lexer |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
93 "Lexical analyzer that handles Semantic grammar buffers. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
94 It ignores whitespaces, newlines and comments." |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
95 semantic-lex-ignore-newline |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
96 semantic-lex-ignore-whitespace |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
97 ;; Must detect prologue/epilogue before other symbols/keywords! |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
98 semantic-grammar-lex-prologue |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
99 semantic-grammar-lex-epilogue |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
100 semantic-grammar-wy--<keyword>-keyword-analyzer |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
101 semantic-grammar-wy--<symbol>-regexp-analyzer |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
102 semantic-grammar-wy--<char>-regexp-analyzer |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
103 semantic-grammar-wy--<string>-sexp-analyzer |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
104 ;; Must detect comments after strings because `comment-start-skip' |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
105 ;; regexp match semicolons inside strings! |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
106 semantic-lex-ignore-comments |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
107 ;; Must detect prefixed list before punctuation because prefix chars |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
108 ;; are also punctuations! |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
109 semantic-grammar-wy--<qlist>-sexp-analyzer |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
110 ;; Must detect punctuations after comments because the semicolon can |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
111 ;; be a punctuation or a comment start! |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
112 semantic-grammar-wy--<punctuation>-string-analyzer |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
113 semantic-grammar-wy--<block>-block-analyzer |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
114 semantic-grammar-wy--<sexp>-sexp-analyzer) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
115 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
116 ;;; Test the lexer |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
117 ;; |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
118 (defun semantic-grammar-lex-buffer () |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
119 "Run `semantic-grammar-lex' on current buffer." |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
120 (interactive) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
121 (semantic-lex-init) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
122 (setq semantic-lex-analyzer 'semantic-grammar-lexer) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
123 (let ((token-stream |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
124 (semantic-lex (point-min) (point-max)))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
125 (with-current-buffer (get-buffer-create "*semantic-grammar-lex*") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
126 (erase-buffer) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
127 (pp token-stream (current-buffer)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
128 (goto-char (point-min)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
129 (pop-to-buffer (current-buffer))))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
130 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
131 ;;;; |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
132 ;;;; Semantic action expansion |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
133 ;;;; |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
134 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
135 (defun semantic-grammar-ASSOC (&rest args) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
136 "Return expansion of built-in ASSOC expression. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
137 ARGS are ASSOC's key value list." |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
138 (let ((key t)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
139 `(semantic-tag-make-assoc-list |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
140 ,@(mapcar #'(lambda (i) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
141 (prog1 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
142 (if key |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
143 (list 'quote i) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
144 i) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
145 (setq key (not key)))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
146 args)))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
147 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
148 (defsubst semantic-grammar-quote-p (sym) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
149 "Return non-nil if SYM is bound to the `quote' function." |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
150 (condition-case nil |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
151 (eq (indirect-function sym) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
152 (indirect-function 'quote)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
153 (error nil))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
154 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
155 (defsubst semantic-grammar-backquote-p (sym) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
156 "Return non-nil if SYM is bound to the `backquote' function." |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
157 (condition-case nil |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
158 (eq (indirect-function sym) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
159 (indirect-function 'backquote)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
160 (error nil))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
161 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
162 ;;;; |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
163 ;;;; API to access grammar tags |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
164 ;;;; |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
165 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
166 (define-mode-local-override semantic-tag-components |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
167 semantic-grammar-mode (tag) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
168 "Return the children of tag TAG." |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
169 (semantic-tag-get-attribute tag :children)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
170 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
171 (defun semantic-grammar-first-tag-name (class) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
172 "Return the name of the first tag of class CLASS found. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
173 Warn if other tags of class CLASS exist." |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
174 (let* ((tags (semantic-find-tags-by-class |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
175 class (current-buffer)))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
176 (if tags |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
177 (prog1 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
178 (semantic-tag-name (car tags)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
179 (if (cdr tags) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
180 (message "*** Ignore all but first declared %s" |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
181 class)))))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
182 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
183 (defun semantic-grammar-tag-symbols (class) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
184 "Return the list of symbols defined in tags of class CLASS. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
185 That is tag names plus names defined in tag attribute `:rest'." |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
186 (let* ((tags (semantic-find-tags-by-class |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
187 class (current-buffer)))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
188 (apply 'append |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
189 (mapcar |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
190 #'(lambda (tag) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
191 (mapcar |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
192 'intern |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
193 (cons (semantic-tag-name tag) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
194 (semantic-tag-get-attribute tag :rest)))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
195 tags)))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
196 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
197 (defsubst semantic-grammar-item-text (item) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
198 "Return the readable string form of ITEM." |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
199 (if (string-match semantic-grammar-lex-c-char-re item) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
200 (concat "?" (substring item 1 -1)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
201 item)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
202 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
203 (defsubst semantic-grammar-item-value (item) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
204 "Return symbol or character value of ITEM string." |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
205 (if (string-match semantic-grammar-lex-c-char-re item) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
206 (let ((c (read (concat "?" (substring item 1 -1))))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
207 (if (featurep 'xemacs) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
208 ;; Handle characters as integers in XEmacs like in GNU Emacs. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
209 (char-int c) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
210 c)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
211 (intern item))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
212 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
213 (defun semantic-grammar-prologue () |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
214 "Return grammar prologue code as a string value." |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
215 (let ((tag (semantic-find-first-tag-by-name |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
216 "prologue" |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
217 (semantic-find-tags-by-class 'code (current-buffer))))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
218 (if tag |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
219 (save-excursion |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
220 (concat |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
221 (buffer-substring |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
222 (progn |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
223 (goto-char (semantic-tag-start tag)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
224 (skip-chars-forward "%{\r\n\t ") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
225 (point)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
226 (progn |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
227 (goto-char (semantic-tag-end tag)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
228 (skip-chars-backward "\r\n\t %}") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
229 (point))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
230 "\n")) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
231 ""))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
232 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
233 (defun semantic-grammar-epilogue () |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
234 "Return grammar epilogue code as a string value." |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
235 (let ((tag (semantic-find-first-tag-by-name |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
236 "epilogue" |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
237 (semantic-find-tags-by-class 'code (current-buffer))))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
238 (if tag |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
239 (save-excursion |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
240 (concat |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
241 (buffer-substring |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
242 (progn |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
243 (goto-char (semantic-tag-start tag)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
244 (skip-chars-forward "%\r\n\t ") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
245 (point)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
246 (progn |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
247 (goto-char (semantic-tag-end tag)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
248 (skip-chars-backward "\r\n\t") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
249 ;; If a grammar footer is found, skip it. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
250 (re-search-backward "^;;;\\s-+\\S-+\\s-+ends here" |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
251 (save-excursion |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
252 (beginning-of-line) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
253 (point)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
254 t) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
255 (skip-chars-backward "\r\n\t") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
256 (point))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
257 "\n")) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
258 ""))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
259 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
260 (defsubst semantic-grammar-buffer-file (&optional buffer) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
261 "Return name of file sans directory BUFFER is visiting. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
262 No argument or nil as argument means use the current buffer." |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
263 (file-name-nondirectory (buffer-file-name buffer))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
264 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
265 (defun semantic-grammar-package () |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
266 "Return the %package value as a string. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
267 If there is no %package statement in the grammar, return a default |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
268 package name derived from the grammar file name. For example, the |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
269 default package name for the grammar file foo.wy is foo-wy, and for |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
270 foo.by it is foo-by." |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
271 (or (semantic-grammar-first-tag-name 'package) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
272 (let* ((file (semantic-grammar-buffer-file)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
273 (ext (file-name-extension file)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
274 (i (string-match (format "\\([.]\\)%s\\'" ext) file))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
275 (concat (substring file 0 i) "-" ext)))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
276 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
277 (defsubst semantic-grammar-languagemode () |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
278 "Return the %languagemode value as a list of symbols or nil." |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
279 (semantic-grammar-tag-symbols 'languagemode)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
280 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
281 (defsubst semantic-grammar-start () |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
282 "Return the %start value as a list of symbols or nil." |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
283 (semantic-grammar-tag-symbols 'start)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
284 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
285 (defsubst semantic-grammar-scopestart () |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
286 "Return the %scopestart value as a symbol or nil." |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
287 (intern (or (semantic-grammar-first-tag-name 'scopestart) "nil"))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
288 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
289 (defsubst semantic-grammar-quotemode () |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
290 "Return the %quotemode value as a symbol or nil." |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
291 (intern (or (semantic-grammar-first-tag-name 'quotemode) "nil"))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
292 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
293 (defsubst semantic-grammar-keywords () |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
294 "Return the language keywords. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
295 That is an alist of (VALUE . TOKEN) where VALUE is the string value of |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
296 the keyword and TOKEN is the terminal symbol identifying the keyword." |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
297 (mapcar |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
298 #'(lambda (key) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
299 (cons (semantic-tag-get-attribute key :value) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
300 (intern (semantic-tag-name key)))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
301 (semantic-find-tags-by-class 'keyword (current-buffer)))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
302 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
303 (defun semantic-grammar-keyword-properties (keywords) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
304 "Return the list of KEYWORDS properties." |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
305 (let ((puts (semantic-find-tags-by-class |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
306 'put (current-buffer))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
307 put keys key plist assoc pkey pval props) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
308 (while puts |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
309 (setq put (car puts) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
310 puts (cdr puts) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
311 keys (mapcar |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
312 'intern |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
313 (cons (semantic-tag-name put) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
314 (semantic-tag-get-attribute put :rest)))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
315 (while keys |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
316 (setq key (car keys) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
317 keys (cdr keys) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
318 assoc (rassq key keywords)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
319 (if (null assoc) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
320 nil ;;(message "*** %%put to undefined keyword %s ignored" key) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
321 (setq key (car assoc) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
322 plist (semantic-tag-get-attribute put :value)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
323 (while plist |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
324 (setq pkey (intern (caar plist)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
325 pval (read (cdar plist)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
326 props (cons (list key pkey pval) props) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
327 plist (cdr plist)))))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
328 props)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
329 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
330 (defun semantic-grammar-tokens () |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
331 "Return defined lexical tokens. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
332 That is an alist (TYPE . DEFS) where type is a %token <type> symbol |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
333 and DEFS is an alist of (TOKEN . VALUE). TOKEN is the terminal symbol |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
334 identifying the token and VALUE is the string value of the token or |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
335 nil." |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
336 (let (tags alist assoc tag type term names value) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
337 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
338 ;; Check for <type> in %left, %right & %nonassoc declarations |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
339 (setq tags (semantic-find-tags-by-class |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
340 'assoc (current-buffer))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
341 (while tags |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
342 (setq tag (car tags) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
343 tags (cdr tags)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
344 (when (setq type (semantic-tag-type tag)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
345 (setq names (semantic-tag-get-attribute tag :value) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
346 assoc (assoc type alist)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
347 (or assoc (setq assoc (list type) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
348 alist (cons assoc alist))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
349 (while names |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
350 (setq term (car names) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
351 names (cdr names)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
352 (or (string-match semantic-grammar-lex-c-char-re term) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
353 (setcdr assoc (cons (list (intern term)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
354 (cdr assoc))))))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
355 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
356 ;; Then process %token declarations so they can override any |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
357 ;; previous specifications |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
358 (setq tags (semantic-find-tags-by-class |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
359 'token (current-buffer))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
360 (while tags |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
361 (setq tag (car tags) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
362 tags (cdr tags)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
363 (setq names (cons (semantic-tag-name tag) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
364 (semantic-tag-get-attribute tag :rest)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
365 type (or (semantic-tag-type tag) "<no-type>") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
366 value (semantic-tag-get-attribute tag :value) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
367 assoc (assoc type alist)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
368 (or assoc (setq assoc (list type) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
369 alist (cons assoc alist))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
370 (while names |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
371 (setq term (intern (car names)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
372 names (cdr names)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
373 (setcdr assoc (cons (cons term value) (cdr assoc))))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
374 alist)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
375 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
376 (defun semantic-grammar-token-%type-properties (&optional props) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
377 "Return properties set by %type statements. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
378 This declare a new type if necessary. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
379 If optional argument PROPS is non-nil, it is an existing list of |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
380 properties where to add new properties." |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
381 (let (type) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
382 (dolist (tag (semantic-find-tags-by-class 'type (current-buffer))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
383 (setq type (semantic-tag-name tag)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
384 ;; Indicate to auto-generate the analyzer for this type |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
385 (push (list type :declared t) props) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
386 (dolist (e (semantic-tag-get-attribute tag :value)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
387 (push (list type (intern (car e)) (read (or (cdr e) "nil"))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
388 props))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
389 props)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
390 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
391 (defun semantic-grammar-token-%put-properties (tokens) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
392 "For types found in TOKENS, return properties set by %put statements." |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
393 (let (found props) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
394 (dolist (put (semantic-find-tags-by-class 'put (current-buffer))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
395 (dolist (type (cons (semantic-tag-name put) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
396 (semantic-tag-get-attribute put :rest))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
397 (setq found (assoc type tokens)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
398 (if (null found) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
399 nil ;; %put <type> ignored, no token defined |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
400 (setq type (car found)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
401 (dolist (e (semantic-tag-get-attribute put :value)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
402 (push (list type (intern (car e)) (read (or (cdr e) "nil"))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
403 props))))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
404 props)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
405 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
406 (defsubst semantic-grammar-token-properties (tokens) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
407 "Return properties of declared types. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
408 Types are explicitly declared by %type statements. Types found in |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
409 TOKENS are those declared implicitly by %token statements. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
410 Properties can be set by %put and %type statements. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
411 Properties set by %type statements take precedence over those set by |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
412 %put statements." |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
413 (let ((props (semantic-grammar-token-%put-properties tokens))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
414 (semantic-grammar-token-%type-properties props))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
415 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
416 (defun semantic-grammar-use-macros () |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
417 "Return macro definitions from %use-macros statements. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
418 Also load the specified macro libraries." |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
419 (let (lib defs) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
420 (dolist (tag (semantic-find-tags-by-class 'macro (current-buffer))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
421 (setq lib (intern (semantic-tag-type tag))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
422 (condition-case nil |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
423 ;;(load lib) ;; Be sure to use the latest macro library. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
424 (require lib) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
425 (error nil)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
426 (dolist (mac (semantic-tag-get-attribute tag :value)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
427 (push (cons (intern mac) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
428 (intern (format "%s-%s" lib mac))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
429 defs))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
430 (nreverse defs))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
431 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
432 (defvar semantic-grammar-macros nil |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
433 "List of associations (MACRO-NAME . EXPANDER).") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
434 (make-variable-buffer-local 'semantic-grammar-macros) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
435 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
436 (defun semantic-grammar-macros () |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
437 "Build and return the alist of defined macros." |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
438 (append |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
439 ;; Definitions found in tags. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
440 (semantic-grammar-use-macros) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
441 ;; Other pre-installed definitions. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
442 semantic-grammar-macros)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
443 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
444 ;;;; |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
445 ;;;; Overloaded functions that build parser data. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
446 ;;;; |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
447 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
448 ;;; Keyword table builder |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
449 ;; |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
450 (defun semantic-grammar-keywordtable-builder-default () |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
451 "Return the default value of the keyword table." |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
452 (let ((keywords (semantic-grammar-keywords))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
453 `(semantic-lex-make-keyword-table |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
454 ',keywords |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
455 ',(semantic-grammar-keyword-properties keywords)))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
456 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
457 (define-overloadable-function semantic-grammar-keywordtable-builder () |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
458 "Return the keyword table table value.") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
459 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
460 ;;; Token table builder |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
461 ;; |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
462 (defun semantic-grammar-tokentable-builder-default () |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
463 "Return the default value of the table of lexical tokens." |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
464 (let ((tokens (semantic-grammar-tokens))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
465 `(semantic-lex-make-type-table |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
466 ',tokens |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
467 ',(semantic-grammar-token-properties tokens)))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
468 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
469 (define-overloadable-function semantic-grammar-tokentable-builder () |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
470 "Return the value of the table of lexical tokens.") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
471 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
472 ;;; Parser table builder |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
473 ;; |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
474 (defun semantic-grammar-parsetable-builder-default () |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
475 "Return the default value of the parse table." |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
476 (error "`semantic-grammar-parsetable-builder' not defined")) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
477 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
478 (define-overloadable-function semantic-grammar-parsetable-builder () |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
479 "Return the parser table value.") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
480 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
481 ;;; Parser setup code builder |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
482 ;; |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
483 (defun semantic-grammar-setupcode-builder-default () |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
484 "Return the default value of the setup code form." |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
485 (error "`semantic-grammar-setupcode-builder' not defined")) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
486 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
487 (define-overloadable-function semantic-grammar-setupcode-builder () |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
488 "Return the parser setup code form.") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
489 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
490 ;;;; |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
491 ;;;; Lisp code generation |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
492 ;;;; |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
493 (defvar semantic--grammar-input-buffer nil) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
494 (defvar semantic--grammar-output-buffer nil) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
495 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
496 (defsubst semantic-grammar-keywordtable () |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
497 "Return the variable name of the keyword table." |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
498 (concat (file-name-sans-extension |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
499 (semantic-grammar-buffer-file |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
500 semantic--grammar-output-buffer)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
501 "--keyword-table")) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
502 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
503 (defsubst semantic-grammar-tokentable () |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
504 "Return the variable name of the token table." |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
505 (concat (file-name-sans-extension |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
506 (semantic-grammar-buffer-file |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
507 semantic--grammar-output-buffer)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
508 "--token-table")) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
509 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
510 (defsubst semantic-grammar-parsetable () |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
511 "Return the variable name of the parse table." |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
512 (concat (file-name-sans-extension |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
513 (semantic-grammar-buffer-file |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
514 semantic--grammar-output-buffer)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
515 "--parse-table")) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
516 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
517 (defsubst semantic-grammar-setupfunction () |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
518 "Return the name of the parser setup function." |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
519 (concat (file-name-sans-extension |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
520 (semantic-grammar-buffer-file |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
521 semantic--grammar-output-buffer)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
522 "--install-parser")) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
523 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
524 (defmacro semantic-grammar-as-string (object) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
525 "Return OBJECT as a string value." |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
526 `(if (stringp ,object) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
527 ,object |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
528 ;;(require 'pp) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
529 (pp-to-string ,object))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
530 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
531 (defun semantic-grammar-insert-defconst (name value docstring) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
532 "Insert declaration of constant NAME with VALUE and DOCSTRING." |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
533 (let ((start (point))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
534 (insert (format "(defconst %s\n%s%S)\n\n" name value docstring)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
535 (save-excursion |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
536 (goto-char start) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
537 (indent-sexp)))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
538 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
539 (defun semantic-grammar-insert-defun (name body docstring) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
540 "Insert declaration of function NAME with BODY and DOCSTRING." |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
541 (let ((start (point))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
542 (insert (format "(defun %s ()\n%S\n%s)\n\n" name docstring body)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
543 (save-excursion |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
544 (goto-char start) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
545 (indent-sexp)))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
546 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
547 (defun semantic-grammar-insert-define (define) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
548 "Insert the declaration specified by DEFINE expression. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
549 Typically a DEFINE expression should look like this: |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
550 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
551 \(define-thing name docstring expression1 ...)" |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
552 ;;(require 'pp) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
553 (let ((start (point))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
554 (insert (format "(%S %S" (car define) (nth 1 define))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
555 (dolist (item (nthcdr 2 define)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
556 (insert "\n") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
557 (delete-blank-lines) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
558 (pp item (current-buffer))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
559 (insert ")\n\n") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
560 (save-excursion |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
561 (goto-char start) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
562 (indent-sexp)))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
563 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
564 (defconst semantic-grammar-header-template |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
565 '("\ |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
566 ;;; " file " --- Generated parser support file |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
567 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
568 " copy " |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
569 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
570 ;; Author: " user-full-name " <" user-mail-address "> |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
571 ;; Created: " date " |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
572 ;; Keywords: syntax |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
573 ;; X-RCS: " vcid " |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
574 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
575 ;; This file is not part of GNU Emacs. |
107340
e0514072acb0
Update some cedet template copyrights to GPLv3+.
Glenn Morris <rgm@gnu.org>
parents:
106815
diff
changeset
|
576 |
104524
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
577 ;; This program is free software; you can redistribute it and/or |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
578 ;; modify it under the terms of the GNU General Public License as |
107340
e0514072acb0
Update some cedet template copyrights to GPLv3+.
Glenn Morris <rgm@gnu.org>
parents:
106815
diff
changeset
|
579 ;; published by the Free Software Foundation, either version 3 of |
e0514072acb0
Update some cedet template copyrights to GPLv3+.
Glenn Morris <rgm@gnu.org>
parents:
106815
diff
changeset
|
580 ;; the License, or (at your option) any later version. |
e0514072acb0
Update some cedet template copyrights to GPLv3+.
Glenn Morris <rgm@gnu.org>
parents:
106815
diff
changeset
|
581 |
104524
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
582 ;; This software is distributed in the hope that it will be useful, |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
583 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
584 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
585 ;; General Public License for more details. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
586 ;; |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
587 ;; You should have received a copy of the GNU General Public License |
107340
e0514072acb0
Update some cedet template copyrights to GPLv3+.
Glenn Morris <rgm@gnu.org>
parents:
106815
diff
changeset
|
588 ;; along with this program. If not, see <http://www.gnu.org/licenses/>. |
104524
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
589 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
590 ;;; Commentary: |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
591 ;; |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
592 ;; PLEASE DO NOT MANUALLY EDIT THIS FILE! It is automatically |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
593 ;; generated from the grammar file " gram ". |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
594 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
595 ;;; History: |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
596 ;; |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
597 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
598 ;;; Code: |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
599 ") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
600 "Generated header template. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
601 The symbols in the template are local variables in |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
602 `semantic-grammar-header'") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
603 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
604 (defconst semantic-grammar-footer-template |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
605 '("\ |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
606 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
607 \(provide '" libr ") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
608 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
609 ;;; " file " ends here |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
610 ") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
611 "Generated footer template. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
612 The symbols in the list are local variables in |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
613 `semantic-grammar-footer'.") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
614 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
615 (defun semantic-grammar-copyright-line () |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
616 "Return the grammar copyright line, or nil if not found." |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
617 (save-excursion |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
618 (goto-char (point-min)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
619 (when (re-search-forward "^;;+[ \t]+Copyright (C) .*$" |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
620 ;; Search only in the four top lines |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
621 (save-excursion (forward-line 4) (point)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
622 t) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
623 (match-string 0)))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
624 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
625 (defun semantic-grammar-header () |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
626 "Return text of a generated standard header." |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
627 (let ((file (semantic-grammar-buffer-file |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
628 semantic--grammar-output-buffer)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
629 (gram (semantic-grammar-buffer-file)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
630 (date (format-time-string "%Y-%m-%d %T%z")) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
631 (vcid (concat "$" "Id" "$")) ;; Avoid expansion |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
632 ;; Try to get the copyright from the input grammar, or |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
633 ;; generate a new one if not found. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
634 (copy (or (semantic-grammar-copyright-line) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
635 (concat (format-time-string ";; Copyright (C) %Y ") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
636 user-full-name))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
637 (out "")) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
638 (dolist (S semantic-grammar-header-template) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
639 (cond ((stringp S) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
640 (setq out (concat out S))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
641 ((symbolp S) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
642 (setq out (concat out (symbol-value S)))))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
643 out)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
644 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
645 (defun semantic-grammar-footer () |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
646 "Return text of a generated standard footer." |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
647 (let* ((file (semantic-grammar-buffer-file |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
648 semantic--grammar-output-buffer)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
649 (libr (file-name-sans-extension file)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
650 (out "")) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
651 (dolist (S semantic-grammar-footer-template) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
652 (cond ((stringp S) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
653 (setq out (concat out S))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
654 ((symbolp S) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
655 (setq out (concat out (symbol-value S)))))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
656 out)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
657 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
658 (defun semantic-grammar-token-data () |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
659 "Return the string value of the table of lexical tokens." |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
660 (semantic-grammar-as-string |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
661 (semantic-grammar-tokentable-builder))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
662 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
663 (defun semantic-grammar-keyword-data () |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
664 "Return the string value of the table of keywords." |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
665 (semantic-grammar-as-string |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
666 (semantic-grammar-keywordtable-builder))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
667 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
668 (defun semantic-grammar-parser-data () |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
669 "Return the parser table as a string value." |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
670 (semantic-grammar-as-string |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
671 (semantic-grammar-parsetable-builder))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
672 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
673 (defun semantic-grammar-setup-data () |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
674 "Return the parser setup code form as a string value." |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
675 (semantic-grammar-as-string |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
676 (semantic-grammar-setupcode-builder))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
677 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
678 ;;; Generation of lexical analyzers. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
679 ;; |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
680 (defvar semantic-grammar--lex-block-specs) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
681 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
682 (defsubst semantic-grammar--lex-delim-spec (block-spec) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
683 "Return delimiters specification from BLOCK-SPEC." |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
684 (condition-case nil |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
685 (let* ((standard-input (cdr block-spec)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
686 (delim-spec (read))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
687 (if (and (consp delim-spec) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
688 (car delim-spec) (symbolp (car delim-spec)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
689 (cadr delim-spec) (symbolp (cadr delim-spec))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
690 delim-spec |
105650
0412ef1b2214
(semantic-grammar--lex-delim-spec): All errors should have messages.
Glenn Morris <rgm@gnu.org>
parents:
105377
diff
changeset
|
691 (error "Invalid delimiter"))) |
104524
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
692 (error |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
693 (error "Invalid delimiters specification %s in block token %s" |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
694 (cdr block-spec) (car block-spec))))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
695 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
696 (defun semantic-grammar--lex-block-specs () |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
697 "Compute lexical block specifications for the current buffer. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
698 Block definitions are read from the current table of lexical types." |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
699 (cond |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
700 ;; Block specifications have been parsed and are invalid. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
701 ((eq semantic-grammar--lex-block-specs 'error) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
702 nil |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
703 ) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
704 ;; Parse block specifications. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
705 ((null semantic-grammar--lex-block-specs) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
706 (condition-case err |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
707 (let* ((blocks (cdr (semantic-lex-type-value "block" t))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
708 (open-delims (cdr (semantic-lex-type-value "open-paren" t))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
709 (close-delims (cdr (semantic-lex-type-value "close-paren" t))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
710 olist clist block-spec delim-spec open-spec close-spec) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
711 (dolist (block-spec blocks) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
712 (setq delim-spec (semantic-grammar--lex-delim-spec block-spec) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
713 open-spec (assq (car delim-spec) open-delims) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
714 close-spec (assq (cadr delim-spec) close-delims)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
715 (or open-spec |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
716 (error "Missing open-paren token %s required by block %s" |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
717 (car delim-spec) (car block-spec))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
718 (or close-spec |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
719 (error "Missing close-paren token %s required by block %s" |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
720 (cdr delim-spec) (car block-spec))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
721 ;; build alist ((OPEN-DELIM OPEN-SYM BLOCK-SYM) ...) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
722 (push (list (cdr open-spec) (car open-spec) (car block-spec)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
723 olist) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
724 ;; build alist ((CLOSE-DELIM CLOSE-SYM) ...) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
725 (push (list (cdr close-spec) (car close-spec)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
726 clist)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
727 (setq semantic-grammar--lex-block-specs (cons olist clist))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
728 (error |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
729 (setq semantic-grammar--lex-block-specs 'error) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
730 (message "%s" (error-message-string err)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
731 nil)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
732 ) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
733 ;; Block specifications already parsed. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
734 (t |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
735 semantic-grammar--lex-block-specs))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
736 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
737 (defsubst semantic-grammar-quoted-form (exp) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
738 "Return a quoted form of EXP if it isn't a self evaluating form." |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
739 (if (and (not (null exp)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
740 (or (listp exp) (symbolp exp))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
741 (list 'quote exp) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
742 exp)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
743 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
744 (defun semantic-grammar-insert-defanalyzer (type) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
745 "Insert declaration of the lexical analyzer defined with TYPE." |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
746 (let* ((type-name (symbol-name type)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
747 (type-value (symbol-value type)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
748 (syntax (get type 'syntax)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
749 (declared (get type :declared)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
750 spec mtype prefix name doc) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
751 ;; Generate an analyzer if the corresponding type has been |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
752 ;; explicitly declared in a %type statement, and if at least the |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
753 ;; syntax property has been provided. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
754 (when (and declared syntax) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
755 (setq prefix (file-name-sans-extension |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
756 (semantic-grammar-buffer-file |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
757 semantic--grammar-output-buffer)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
758 mtype (or (get type 'matchdatatype) 'regexp) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
759 name (intern (format "%s--<%s>-%s-analyzer" prefix type mtype)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
760 doc (format "%s analyzer for <%s> tokens." mtype type)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
761 (cond |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
762 ;; Regexp match analyzer |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
763 ((eq mtype 'regexp) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
764 (semantic-grammar-insert-define |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
765 `(define-lex-regex-type-analyzer ,name |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
766 ,doc ,syntax |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
767 ,(semantic-grammar-quoted-form (cdr type-value)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
768 ',(or (car type-value) (intern type-name)))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
769 ) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
770 ;; String compare analyzer |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
771 ((eq mtype 'string) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
772 (semantic-grammar-insert-define |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
773 `(define-lex-string-type-analyzer ,name |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
774 ,doc ,syntax |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
775 ,(semantic-grammar-quoted-form (cdr type-value)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
776 ',(or (car type-value) (intern type-name)))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
777 ) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
778 ;; Block analyzer |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
779 ((and (eq mtype 'block) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
780 (setq spec (semantic-grammar--lex-block-specs))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
781 (semantic-grammar-insert-define |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
782 `(define-lex-block-type-analyzer ,name |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
783 ,doc ,syntax |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
784 ,(semantic-grammar-quoted-form spec))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
785 ) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
786 ;; Sexp analyzer |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
787 ((eq mtype 'sexp) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
788 (semantic-grammar-insert-define |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
789 `(define-lex-sexp-type-analyzer ,name |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
790 ,doc ,syntax |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
791 ',(or (car type-value) (intern type-name)))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
792 ) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
793 ;; keyword analyzer |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
794 ((eq mtype 'keyword) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
795 (semantic-grammar-insert-define |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
796 `(define-lex-keyword-type-analyzer ,name |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
797 ,doc ,syntax)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
798 ) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
799 )) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
800 )) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
801 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
802 (defun semantic-grammar-insert-defanalyzers () |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
803 "Insert declarations of lexical analyzers." |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
804 (let (tokens props) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
805 (with-current-buffer semantic--grammar-input-buffer |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
806 (setq tokens (semantic-grammar-tokens) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
807 props (semantic-grammar-token-properties tokens))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
808 (insert "(require 'semantic-lex)\n\n") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
809 (let ((semantic-lex-types-obarray |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
810 (semantic-lex-make-type-table tokens props)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
811 semantic-grammar--lex-block-specs) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
812 (mapatoms 'semantic-grammar-insert-defanalyzer |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
813 semantic-lex-types-obarray)))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
814 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
815 ;;; Generation of the grammar support file. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
816 ;; |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
817 (defcustom semantic-grammar-file-regexp "\\.[wb]y$" |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
818 "Regexp which matches grammar source files." |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
819 :group 'semantic |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
820 :type 'regexp) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
821 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
822 (defsubst semantic-grammar-noninteractive () |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
823 "Return non-nil if running without interactive terminal." |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
824 (if (featurep 'xemacs) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
825 (noninteractive) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
826 noninteractive)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
827 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
828 (defun semantic-grammar-create-package (&optional force) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
829 "Create package Lisp code from grammar in current buffer. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
830 Does nothing if the Lisp code seems up to date. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
831 If optional argument FORCE is non-nil, unconditionally re-generate the |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
832 Lisp code." |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
833 (interactive "P") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
834 (setq force (or force current-prefix-arg)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
835 (semantic-fetch-tags) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
836 (let* ( |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
837 ;; Values of the following local variables are obtained from |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
838 ;; the grammar parsed tree in current buffer, that is before |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
839 ;; switching to the output file. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
840 (package (semantic-grammar-package)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
841 (output (concat package ".el")) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
842 (semantic--grammar-input-buffer (current-buffer)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
843 (semantic--grammar-output-buffer (find-file-noselect output)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
844 (header (semantic-grammar-header)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
845 (prologue (semantic-grammar-prologue)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
846 (epilogue (semantic-grammar-epilogue)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
847 (footer (semantic-grammar-footer)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
848 ) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
849 (if (and (not force) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
850 (not (buffer-modified-p)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
851 (file-newer-than-file-p |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
852 (buffer-file-name semantic--grammar-output-buffer) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
853 (buffer-file-name semantic--grammar-input-buffer))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
854 (message "Package `%s' is up to date." package) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
855 ;; Create the package |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
856 (set-buffer semantic--grammar-output-buffer) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
857 ;; Use Unix EOLs, so that the file is portable to all platforms. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
858 (setq buffer-file-coding-system 'raw-text-unix) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
859 (erase-buffer) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
860 (unless (eq major-mode 'emacs-lisp-mode) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
861 (emacs-lisp-mode)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
862 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
863 ;;;; Header + Prologue |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
864 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
865 (insert header |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
866 "\n;;; Prologue\n;;\n" |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
867 prologue |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
868 ) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
869 ;; Evaluate the prologue now, because it might provide definition |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
870 ;; of grammar macro expanders. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
871 (eval-region (point-min) (point)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
872 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
873 (save-excursion |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
874 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
875 ;;;; Declarations |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
876 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
877 (insert "\n;;; Declarations\n;;\n") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
878 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
879 ;; `eval-defun' is not necessary to reset `defconst' values. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
880 (semantic-grammar-insert-defconst |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
881 (semantic-grammar-keywordtable) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
882 (with-current-buffer semantic--grammar-input-buffer |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
883 (semantic-grammar-keyword-data)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
884 "Table of language keywords.") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
885 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
886 (semantic-grammar-insert-defconst |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
887 (semantic-grammar-tokentable) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
888 (with-current-buffer semantic--grammar-input-buffer |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
889 (semantic-grammar-token-data)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
890 "Table of lexical tokens.") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
891 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
892 (semantic-grammar-insert-defconst |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
893 (semantic-grammar-parsetable) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
894 (with-current-buffer semantic--grammar-input-buffer |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
895 (semantic-grammar-parser-data)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
896 "Parser table.") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
897 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
898 (semantic-grammar-insert-defun |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
899 (semantic-grammar-setupfunction) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
900 (with-current-buffer semantic--grammar-input-buffer |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
901 (semantic-grammar-setup-data)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
902 "Setup the Semantic Parser.") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
903 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
904 ;;;; Analyzers |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
905 (insert "\n;;; Analyzers\n;;\n") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
906 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
907 (semantic-grammar-insert-defanalyzers) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
908 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
909 ;;;; Epilogue & Footer |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
910 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
911 (insert "\n;;; Epilogue\n;;\n" |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
912 epilogue |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
913 footer |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
914 ) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
915 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
916 ) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
917 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
918 (save-buffer 16) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
919 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
920 ;; If running in batch mode, there is nothing more to do. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
921 ;; Save the generated file and quit. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
922 (if (semantic-grammar-noninteractive) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
923 (let ((version-control t) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
924 (delete-old-versions t) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
925 (make-backup-files t) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
926 (vc-make-backup-files t)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
927 (kill-buffer (current-buffer))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
928 ;; If running interactively, eval declarations and epilogue |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
929 ;; code, then pop to the buffer visiting the generated file. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
930 (eval-region (point) (point-max)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
931 (goto-char (point-min)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
932 (pop-to-buffer (current-buffer)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
933 ;; The generated code has been evaluated and updated into |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
934 ;; memory. Now find all buffers that match the major modes we |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
935 ;; have created this language for, and force them to call our |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
936 ;; setup function again, refreshing all semantic data, and |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
937 ;; enabling them to work with the new code just created. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
938 ;;;; FIXME? |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
939 ;; At this point, I don't know any user's defined setup code :-( |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
940 ;; At least, what I can do for now, is to run the generated |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
941 ;; parser-install function. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
942 (semantic-map-mode-buffers |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
943 (semantic-grammar-setupfunction) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
944 (semantic-grammar-languagemode))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
945 ) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
946 ;; Return the name of the generated package file. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
947 output)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
948 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
949 (defun semantic-grammar-recreate-package () |
105340 | 950 "Unconditionally create Lisp code from grammar in current buffer. |
104524
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
951 Like \\[universal-argument] \\[semantic-grammar-create-package]." |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
952 (interactive) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
953 (semantic-grammar-create-package t)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
954 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
955 (defun semantic-grammar-batch-build-one-package (file) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
956 "Build a Lisp package from the grammar in FILE. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
957 That is, generate Lisp code from FILE, and `byte-compile' it. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
958 Return non-nil if there were no errors, nil if errors." |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
959 ;; We need this require so that we can find `byte-compile-dest-file'. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
960 (require 'bytecomp) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
961 (unless (auto-save-file-name-p file) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
962 ;; Create the package |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
963 (let ((packagename |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
964 (condition-case err |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
965 (with-current-buffer (find-file-noselect file) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
966 (semantic-grammar-create-package)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
967 (error |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
968 (message "%s" (error-message-string err)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
969 nil)))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
970 (when packagename |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
971 ;; Only byte compile if out of date |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
972 (if (file-newer-than-file-p |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
973 packagename (byte-compile-dest-file packagename)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
974 (let (;; Some complex grammar table expressions need a few |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
975 ;; more resources than the default. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
976 (max-specpdl-size (max 3000 max-specpdl-size)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
977 (max-lisp-eval-depth (max 1000 max-lisp-eval-depth)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
978 ) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
979 ;; byte compile the resultant file |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
980 (byte-compile-file packagename)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
981 t))))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
982 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
983 (defun semantic-grammar-batch-build-packages () |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
984 "Build Lisp packages from grammar files on the command line. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
985 That is, run `semantic-grammar-batch-build-one-package' for each file. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
986 Each file is processed even if an error occurred previously. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
987 Must be used from the command line, with `-batch'. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
988 For example, to process grammar files in current directory, invoke: |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
989 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
990 \"emacs -batch -f semantic-grammar-batch-build-packages .\". |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
991 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
992 See also the variable `semantic-grammar-file-regexp'." |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
993 (or (semantic-grammar-noninteractive) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
994 (error "\ |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
995 `semantic-grammar-batch-build-packages' must be used with -batch" |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
996 )) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
997 (let ((status 0) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
998 ;; Remove vc from find-file-hook. It causes bad stuff to |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
999 ;; happen in Emacs 20. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1000 (find-file-hook (delete 'vc-find-file-hook find-file-hook))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1001 (message "Compiling Grammars from: %s" (locate-library "semantic-grammar")) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1002 (dolist (arg command-line-args-left) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1003 (unless (and arg (file-exists-p arg)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1004 (error "Argument %s is not a valid file name" arg)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1005 (setq arg (expand-file-name arg)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1006 (if (file-directory-p arg) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1007 ;; Directory as argument |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1008 (dolist (src (condition-case nil |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1009 (directory-files |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1010 arg nil semantic-grammar-file-regexp) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1011 (error |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1012 (error "Unable to read directory files")))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1013 (or (semantic-grammar-batch-build-one-package |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1014 (expand-file-name src arg)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1015 (setq status 1))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1016 ;; Specific file argument |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1017 (or (semantic-grammar-batch-build-one-package arg) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1018 (setq status 1)))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1019 (kill-emacs status) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1020 )) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1021 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1022 ;;;; |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1023 ;;;; Macros highlighting |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1024 ;;;; |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1025 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1026 (defvar semantic--grammar-macros-regexp-1 nil) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1027 (make-variable-buffer-local 'semantic--grammar-macros-regexp-1) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1028 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1029 (defun semantic--grammar-macros-regexp-1 () |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1030 "Return font-lock keyword regexp for pre-installed macro names." |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1031 (and semantic-grammar-macros |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1032 (not semantic--grammar-macros-regexp-1) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1033 (condition-case nil |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1034 (setq semantic--grammar-macros-regexp-1 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1035 (concat "(\\s-*" |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1036 (regexp-opt |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1037 (mapcar #'(lambda (e) (symbol-name (car e))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1038 semantic-grammar-macros) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1039 t) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1040 "\\>")) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1041 (error nil))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1042 semantic--grammar-macros-regexp-1) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1043 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1044 (defconst semantic--grammar-macdecl-re |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1045 "\\<%use-macros\\>[ \t\r\n]+\\(\\sw\\|\\s_\\)+[ \t\r\n]+{" |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1046 "Regexp that matches a macro declaration statement.") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1047 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1048 (defvar semantic--grammar-macros-regexp-2 nil) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1049 (make-variable-buffer-local 'semantic--grammar-macros-regexp-2) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1050 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1051 (defun semantic--grammar-clear-macros-regexp-2 (&rest ignore) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1052 "Clear the cached regexp that match macros local in this grammar. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1053 IGNORE arguments. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1054 Added to `before-change-functions' hooks to be run before each text |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1055 change." |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1056 (setq semantic--grammar-macros-regexp-2 nil)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1057 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1058 (defun semantic--grammar-macros-regexp-2 () |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1059 "Return the regexp that match macros local in this grammar." |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1060 (unless semantic--grammar-macros-regexp-2 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1061 (let (macs) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1062 (save-excursion |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1063 (goto-char (point-min)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1064 (while (re-search-forward semantic--grammar-macdecl-re nil t) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1065 (condition-case nil |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1066 (setq macs (nconc macs |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1067 (split-string |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1068 (buffer-substring-no-properties |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1069 (point) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1070 (progn |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1071 (backward-char) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1072 (forward-list 1) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1073 (down-list -1) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1074 (point)))))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1075 (error nil))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1076 (when macs |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1077 (setq semantic--grammar-macros-regexp-2 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1078 (concat "(\\s-*" (regexp-opt macs t) "\\>")))))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1079 semantic--grammar-macros-regexp-2) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1080 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1081 (defun semantic--grammar-macros-matcher (end) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1082 "Search for a grammar macro name to highlight. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1083 END is the limit of the search." |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1084 (let ((regexp (semantic--grammar-macros-regexp-1))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1085 (or (and regexp (re-search-forward regexp end t)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1086 (and (setq regexp (semantic--grammar-macros-regexp-2)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1087 (re-search-forward regexp end t))))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1088 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1089 ;;;; |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1090 ;;;; Define major mode |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1091 ;;;; |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1092 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1093 (defvar semantic-grammar-syntax-table |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1094 (let ((table (make-syntax-table (standard-syntax-table)))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1095 (modify-syntax-entry ?\: "." table) ;; COLON |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1096 (modify-syntax-entry ?\> "." table) ;; GT |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1097 (modify-syntax-entry ?\< "." table) ;; LT |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1098 (modify-syntax-entry ?\| "." table) ;; OR |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1099 (modify-syntax-entry ?\; ". 12" table) ;; SEMI, Comment start ;; |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1100 (modify-syntax-entry ?\n ">" table) ;; Comment end |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1101 (modify-syntax-entry ?\" "\"" table) ;; String |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1102 (modify-syntax-entry ?\% "w" table) ;; Word |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1103 (modify-syntax-entry ?\- "_" table) ;; Symbol |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1104 (modify-syntax-entry ?\. "_" table) ;; Symbol |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1105 (modify-syntax-entry ?\\ "\\" table) ;; Quote |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1106 (modify-syntax-entry ?\` "'" table) ;; Prefix ` (backquote) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1107 (modify-syntax-entry ?\' "'" table) ;; Prefix ' (quote) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1108 (modify-syntax-entry ?\, "'" table) ;; Prefix , (comma) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1109 (modify-syntax-entry ?\# "'" table) ;; Prefix # (sharp) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1110 table) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1111 "Syntax table used in a Semantic grammar buffers.") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1112 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1113 (defvar semantic-grammar-mode-hook nil |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1114 "Hook run when starting Semantic grammar mode.") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1115 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1116 (defvar semantic-grammar-mode-keywords-1 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1117 `(("\\(\\<%%\\>\\|\\<%[{}]\\)" |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1118 0 font-lock-reference-face) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1119 ("\\(%\\)\\(\\(\\sw\\|\\s_\\)+\\)" |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1120 (1 font-lock-reference-face) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1121 (2 font-lock-keyword-face)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1122 ("\\<error\\>" |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1123 0 (unless (semantic-grammar-in-lisp-p) 'bold)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1124 ("^\\(\\(\\sw\\|\\s_\\)+\\)[ \n\r\t]*:" |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1125 1 font-lock-function-name-face) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1126 (semantic--grammar-macros-matcher |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1127 1 ,(if (boundp 'font-lock-builtin-face) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1128 'font-lock-builtin-face |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1129 'font-lock-preprocessor-face)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1130 ("\\$\\(\\sw\\|\\s_\\)*" |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1131 0 font-lock-variable-name-face) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1132 ("<\\(\\(\\sw\\|\\s_\\)+\\)>" |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1133 1 font-lock-type-face) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1134 (,semantic-grammar-lex-c-char-re |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1135 0 ,(if (boundp 'font-lock-constant-face) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1136 'font-lock-constant-face |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1137 'font-lock-string-face) t) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1138 ;; Must highlight :keyword here, because ':' is a punctuation in |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1139 ;; grammar mode! |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1140 ("[\r\n\t ]+:\\sw+\\>" |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1141 0 font-lock-builtin-face) |
105260
bbd7017a25d9
CEDET (development tools) package merged.
Chong Yidong <cyd@stupidchicken.com>
parents:
104524
diff
changeset
|
1142 ;; ;; Append the Semantic keywords |
bbd7017a25d9
CEDET (development tools) package merged.
Chong Yidong <cyd@stupidchicken.com>
parents:
104524
diff
changeset
|
1143 ;; ,@semantic-fw-font-lock-keywords |
104524
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1144 ) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1145 "Font Lock keywords used to highlight Semantic grammar buffers.") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1146 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1147 (defvar semantic-grammar-mode-keywords-2 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1148 (append semantic-grammar-mode-keywords-1 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1149 lisp-font-lock-keywords-1) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1150 "Font Lock keywords used to highlight Semantic grammar buffers.") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1151 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1152 (defvar semantic-grammar-mode-keywords-3 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1153 (append semantic-grammar-mode-keywords-1 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1154 lisp-font-lock-keywords-2) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1155 "Font Lock keywords used to highlight Semantic grammar buffers.") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1156 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1157 (defvar semantic-grammar-mode-keywords |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1158 semantic-grammar-mode-keywords-1 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1159 "Font Lock keywords used to highlight Semantic grammar buffers.") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1160 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1161 (defvar semantic-grammar-map |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1162 (let ((km (make-sparse-keymap))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1163 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1164 (define-key km "|" 'semantic-grammar-electric-punctuation) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1165 (define-key km ";" 'semantic-grammar-electric-punctuation) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1166 (define-key km "%" 'semantic-grammar-electric-punctuation) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1167 (define-key km "(" 'semantic-grammar-electric-punctuation) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1168 (define-key km ")" 'semantic-grammar-electric-punctuation) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1169 (define-key km ":" 'semantic-grammar-electric-punctuation) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1170 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1171 (define-key km "\t" 'semantic-grammar-indent) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1172 (define-key km "\M-\t" 'semantic-grammar-complete) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1173 (define-key km "\C-c\C-c" 'semantic-grammar-create-package) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1174 (define-key km "\C-cm" 'semantic-grammar-find-macro-expander) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1175 (define-key km "\C-cik" 'semantic-grammar-insert-keyword) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1176 ;; (define-key km "\C-cc" 'semantic-grammar-generate-and-load) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1177 ;; (define-key km "\C-cr" 'semantic-grammar-generate-one-rule) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1178 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1179 km) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1180 "Keymap used in `semantic-grammar-mode'.") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1181 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1182 (defvar semantic-grammar-menu |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1183 '("Grammar" |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1184 ["Indent Line" semantic-grammar-indent] |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1185 ["Complete Symbol" semantic-grammar-complete] |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1186 ["Find Macro" semantic-grammar-find-macro-expander] |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1187 "--" |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1188 ["Insert %keyword" semantic-grammar-insert-keyword] |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1189 "--" |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1190 ["Update Lisp Package" semantic-grammar-create-package] |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1191 ["Recreate Lisp Package" semantic-grammar-recreate-package] |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1192 ) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1193 "Common semantic grammar menu.") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1194 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1195 (defun semantic-grammar-setup-menu-emacs (symbol mode-menu) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1196 "Setup a GNU Emacs grammar menu in variable SYMBOL. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1197 MODE-MENU is an optional specific menu whose items are appended to the |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1198 common grammar menu." |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1199 (let ((items (make-symbol "items"))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1200 `(unless (boundp ',symbol) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1201 (easy-menu-define ,symbol (current-local-map) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1202 "Grammar Menu" semantic-grammar-menu) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1203 (let ((,items (cdr ,mode-menu))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1204 (when ,items |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1205 (easy-menu-add-item ,symbol nil "--") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1206 (while ,items |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1207 (easy-menu-add-item ,symbol nil (car ,items)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1208 (setq ,items (cdr ,items)))))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1209 )) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1210 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1211 (defun semantic-grammar-setup-menu-xemacs (symbol mode-menu) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1212 "Setup an XEmacs grammar menu in variable SYMBOL. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1213 MODE-MENU is an optional specific menu whose items are appended to the |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1214 common grammar menu." |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1215 (let ((items (make-symbol "items")) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1216 (path (make-symbol "path"))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1217 `(progn |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1218 (unless (boundp ',symbol) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1219 (easy-menu-define ,symbol nil |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1220 "Grammar Menu" (copy-sequence semantic-grammar-menu))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1221 (easy-menu-add ,symbol) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1222 (let ((,items (cdr ,mode-menu)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1223 (,path (list (car ,symbol)))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1224 (when ,items |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1225 (easy-menu-add-item nil ,path "--") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1226 (while ,items |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1227 (easy-menu-add-item nil ,path (car ,items)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1228 (setq ,items (cdr ,items)))))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1229 )) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1230 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1231 (defmacro semantic-grammar-setup-menu (&optional mode-menu) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1232 "Setup a mode local grammar menu. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1233 MODE-MENU is an optional specific menu whose items are appended to the |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1234 common grammar menu." |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1235 (let ((menu (intern (format "%s-menu" major-mode)))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1236 (if (featurep 'xemacs) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1237 (semantic-grammar-setup-menu-xemacs menu mode-menu) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1238 (semantic-grammar-setup-menu-emacs menu mode-menu)))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1239 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1240 (defsubst semantic-grammar-in-lisp-p () |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1241 "Return non-nil if point is in Lisp code." |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1242 (or (>= (point) (semantic-grammar-epilogue-start)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1243 (condition-case nil |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1244 (save-excursion |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1245 (up-list -1) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1246 t) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1247 (error nil)))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1248 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1249 (defun semantic-grammar-edits-new-change-hook-fcn (overlay) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1250 "Function set into `semantic-edits-new-change-hook'. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1251 Argument OVERLAY is the overlay created to mark the change. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1252 When OVERLAY marks a change in the scope of a nonterminal tag extend |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1253 the change bounds to encompass the whole nonterminal tag." |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1254 (let ((outer (car (semantic-find-tag-by-overlay-in-region |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1255 (semantic-edits-os overlay) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1256 (semantic-edits-oe overlay))))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1257 (if (semantic-tag-of-class-p outer 'nonterminal) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1258 (semantic-overlay-move overlay |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1259 (semantic-tag-start outer) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1260 (semantic-tag-end outer))))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1261 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1262 (defun semantic-grammar-mode () |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1263 "Initialize a buffer for editing Semantic grammars. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1264 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1265 \\{semantic-grammar-map}" |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1266 (interactive) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1267 (kill-all-local-variables) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1268 (setq major-mode 'semantic-grammar-mode |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1269 mode-name "Semantic Grammar Framework") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1270 (set (make-local-variable 'parse-sexp-ignore-comments) t) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1271 (set (make-local-variable 'comment-start) ";;") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1272 ;; Look within the line for a ; following an even number of backslashes |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1273 ;; after either a non-backslash or the line beginning. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1274 (set (make-local-variable 'comment-start-skip) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1275 "\\(\\(^\\|[^\\\\\n]\\)\\(\\\\\\\\\\)*\\);+ *") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1276 (set-syntax-table semantic-grammar-syntax-table) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1277 (use-local-map semantic-grammar-map) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1278 (set (make-local-variable 'indent-line-function) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1279 'semantic-grammar-indent) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1280 (set (make-local-variable 'fill-paragraph-function) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1281 'lisp-fill-paragraph) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1282 (set (make-local-variable 'font-lock-multiline) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1283 'undecided) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1284 (set (make-local-variable 'font-lock-defaults) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1285 '((semantic-grammar-mode-keywords |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1286 semantic-grammar-mode-keywords-1 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1287 semantic-grammar-mode-keywords-2 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1288 semantic-grammar-mode-keywords-3) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1289 nil ;; perform string/comment fontification |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1290 nil ;; keywords are case sensitive. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1291 ;; This puts _ & - as a word constituant, |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1292 ;; simplifying our keywords significantly |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1293 ((?_ . "w") (?- . "w")))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1294 ;; Setup Semantic to parse grammar |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1295 (semantic-grammar-wy--install-parser) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1296 (setq semantic-lex-comment-regex ";;" |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1297 semantic-lex-analyzer 'semantic-grammar-lexer |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1298 semantic-type-relation-separator-character '(":") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1299 semantic-symbol->name-assoc-list |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1300 '( |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1301 (code . "Setup Code") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1302 (keyword . "Keyword") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1303 (token . "Token") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1304 (nonterminal . "Nonterminal") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1305 (rule . "Rule") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1306 )) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1307 (set (make-local-variable 'semantic-format-face-alist) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1308 '( |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1309 (code . default) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1310 (keyword . font-lock-keyword-face) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1311 (token . font-lock-type-face) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1312 (nonterminal . font-lock-function-name-face) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1313 (rule . default) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1314 )) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1315 (set (make-local-variable 'semantic-stickyfunc-sticky-classes) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1316 '(nonterminal)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1317 ;; Before each change, clear the cached regexp used to highlight |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1318 ;; macros local in this grammar. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1319 (semantic-make-local-hook 'before-change-functions) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1320 (add-hook 'before-change-functions |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1321 'semantic--grammar-clear-macros-regexp-2 nil t) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1322 ;; Handle safe re-parse of grammar rules. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1323 (semantic-make-local-hook 'semantic-edits-new-change-hooks) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1324 (add-hook 'semantic-edits-new-change-hooks |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1325 'semantic-grammar-edits-new-change-hook-fcn |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1326 nil t) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1327 (semantic-run-mode-hooks 'semantic-grammar-mode-hook)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1328 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1329 ;;;; |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1330 ;;;; Useful commands |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1331 ;;;; |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1332 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1333 (defvar semantic-grammar-skip-quoted-syntax-table |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1334 (let ((st (copy-syntax-table semantic-grammar-syntax-table))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1335 (modify-syntax-entry ?\' "$" st) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1336 st) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1337 "Syntax table to skip a whole quoted expression in grammar code. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1338 Consider quote as a \"paired delimiter\", so `forward-sexp' will skip |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1339 whole quoted expression.") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1340 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1341 (defsubst semantic-grammar-backward-item () |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1342 "Move point to beginning of the previous grammar item." |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1343 (forward-comment (- (point-max))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1344 (if (zerop (skip-syntax-backward ".")) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1345 (if (eq (char-before) ?\') |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1346 (with-syntax-table |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1347 ;; Can't be Lisp code here! Temporarily consider quote |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1348 ;; as a "paired delimiter", so `forward-sexp' can skip |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1349 ;; the whole quoted expression. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1350 semantic-grammar-skip-quoted-syntax-table |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1351 (forward-sexp -1)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1352 (forward-sexp -1)))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1353 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1354 (defun semantic-grammar-anchored-indentation () |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1355 "Return indentation based on previous anchor character found." |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1356 (let (indent) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1357 (save-excursion |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1358 (while (not indent) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1359 (semantic-grammar-backward-item) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1360 (cond |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1361 ((bobp) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1362 (setq indent 0)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1363 ((looking-at ":\\(\\s-\\|$\\)") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1364 (setq indent (current-column)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1365 (forward-char) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1366 (skip-syntax-forward "-") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1367 (if (eolp) (setq indent 2)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1368 ) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1369 ((and (looking-at "[;%]") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1370 (not (looking-at "\\<%prec\\>"))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1371 (setq indent 0) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1372 )))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1373 indent)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1374 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1375 (defun semantic-grammar-do-grammar-indent () |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1376 "Indent a line of grammar. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1377 When called the point is not in Lisp code." |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1378 (let (indent n) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1379 (save-excursion |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1380 (beginning-of-line) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1381 (skip-syntax-forward "-") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1382 (setq indent (current-column)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1383 (cond |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1384 ((or (bobp) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1385 (looking-at "\\(\\w\\|\\s_\\)+\\s-*:") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1386 (and (looking-at "%") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1387 (not (looking-at "%prec\\>")))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1388 (setq n 0)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1389 ((looking-at ":") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1390 (setq n 2)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1391 ((and (looking-at ";;") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1392 (save-excursion (forward-comment (point-max)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1393 (looking-at ":"))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1394 (setq n 1)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1395 (t |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1396 (setq n (semantic-grammar-anchored-indentation)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1397 (unless (zerop n) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1398 (cond |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1399 ((looking-at ";;") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1400 (setq n (1- n))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1401 ((looking-at "[|;]") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1402 ) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1403 (t |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1404 (setq n (+ n 2))))))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1405 (when (/= n indent) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1406 (beginning-of-line) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1407 (delete-horizontal-space) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1408 (indent-to n))))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1409 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1410 (defvar semantic-grammar-brackets-as-parens-syntax-table |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1411 (let ((st (copy-syntax-table emacs-lisp-mode-syntax-table))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1412 (modify-syntax-entry ?\{ "(} " st) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1413 (modify-syntax-entry ?\} "){ " st) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1414 st) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1415 "Syntax table that consider brackets as parenthesis. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1416 So `lisp-indent-line' will work inside bracket blocks.") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1417 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1418 (defun semantic-grammar-do-lisp-indent () |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1419 "Maybe run the Emacs Lisp indenter on a line of code. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1420 Return nil if not in a Lisp expression." |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1421 (condition-case nil |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1422 (save-excursion |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1423 (beginning-of-line) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1424 (skip-chars-forward "\t ") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1425 (let ((first (point))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1426 (or (>= first (semantic-grammar-epilogue-start)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1427 (up-list -1)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1428 (condition-case nil |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1429 (while t |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1430 (up-list -1)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1431 (error nil)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1432 (beginning-of-line) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1433 (save-restriction |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1434 (narrow-to-region (point) first) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1435 (goto-char (point-max)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1436 (with-syntax-table |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1437 ;; Temporarily consider brackets as parenthesis so |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1438 ;; `lisp-indent-line' can indent Lisp code inside |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1439 ;; brackets. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1440 semantic-grammar-brackets-as-parens-syntax-table |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1441 (lisp-indent-line)))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1442 t) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1443 (error nil))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1444 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1445 (defun semantic-grammar-indent () |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1446 "Indent the current line. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1447 Use the Lisp or grammar indenter depending on point location." |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1448 (interactive) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1449 (let ((orig (point)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1450 first) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1451 (or (semantic-grammar-do-lisp-indent) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1452 (semantic-grammar-do-grammar-indent)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1453 (setq first (save-excursion |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1454 (beginning-of-line) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1455 (skip-chars-forward "\t ") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1456 (point))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1457 (if (or (< orig first) (/= orig (point))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1458 (goto-char first)))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1459 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1460 (defun semantic-grammar-electric-punctuation () |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1461 "Insert and reindent for the symbol just typed in." |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1462 (interactive) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1463 (self-insert-command 1) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1464 (save-excursion |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1465 (semantic-grammar-indent))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1466 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1467 (defun semantic-grammar-complete () |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1468 "Attempt to complete the symbol under point. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1469 Completion is position sensitive. If the cursor is in a match section of |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1470 a rule, then nonterminals symbols are scanned. If the cursor is in a Lisp |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1471 expression then Lisp symbols are completed." |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1472 (interactive) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1473 (if (semantic-grammar-in-lisp-p) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1474 ;; We are in lisp code. Do lisp completion. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1475 (lisp-complete-symbol) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1476 ;; We are not in lisp code. Do rule completion. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1477 (let* ((nonterms (semantic-find-tags-by-class 'nonterminal (current-buffer))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1478 (sym (car (semantic-ctxt-current-symbol))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1479 (ans (try-completion sym nonterms))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1480 (cond ((eq ans t) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1481 ;; All done |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1482 (message "Symbols is already complete")) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1483 ((and (stringp ans) (string= ans sym)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1484 ;; Max matchable. Show completions. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1485 (with-output-to-temp-buffer "*Completions*" |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1486 (display-completion-list (all-completions sym nonterms))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1487 ) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1488 ((stringp ans) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1489 ;; Expand the completions |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1490 (forward-sexp -1) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1491 (delete-region (point) (progn (forward-sexp 1) (point))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1492 (insert ans)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1493 (t (message "No Completions.")) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1494 )) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1495 )) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1496 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1497 (defun semantic-grammar-insert-keyword (name) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1498 "Insert a new %keyword declaration with NAME. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1499 Assumes it is typed in with the correct casing." |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1500 (interactive "sKeyword: ") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1501 (if (not (bolp)) (insert "\n")) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1502 (insert "%keyword " (upcase name) " \"" name "\" |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1503 %put " (upcase name) " summary |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1504 \"\"\n") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1505 (forward-char -2)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1506 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1507 ;;; Macro facilities |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1508 ;; |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1509 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1510 (defsubst semantic--grammar-macro-function-tag (name) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1511 "Search for a function tag for the grammar macro with name NAME. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1512 Return the tag found or nil if not found." |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1513 (car (semantic-find-tags-by-class |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1514 'function |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1515 (or (semantic-find-tags-by-name name (current-buffer)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1516 (and (featurep 'semanticdb) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1517 semanticdb-current-database |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1518 (cdar (semanticdb-find-tags-by-name name nil t))))))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1519 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1520 (defsubst semantic--grammar-macro-lib-part (def) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1521 "Return the library part of the grammar macro defined by DEF." |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1522 (let ((suf (format "-%s\\'" (regexp-quote (symbol-name (car def))))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1523 (fun (symbol-name (cdr def)))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1524 (substring fun 0 (string-match suf fun)))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1525 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1526 (defun semantic--grammar-macro-compl-elt (def &optional full) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1527 "Return a completion entry for the grammar macro defined by DEF. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1528 If optional argument FULL is non-nil qualify the macro name with the |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1529 library found in DEF." |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1530 (let ((mac (car def)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1531 (lib (semantic--grammar-macro-lib-part def))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1532 (cons (if full |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1533 (format "%s/%s" mac lib) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1534 (symbol-name mac)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1535 (list mac lib)))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1536 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1537 (defun semantic--grammar-macro-compl-dict () |
105340 | 1538 "Return a completion dictionary of macro definitions." |
104524
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1539 (let ((defs (semantic-grammar-macros)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1540 def dups dict) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1541 (while defs |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1542 (setq def (car defs) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1543 defs (cdr defs)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1544 (if (or (assoc (car def) defs) (assoc (car def) dups)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1545 (push def dups) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1546 (push (semantic--grammar-macro-compl-elt def) dict))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1547 (while dups |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1548 (setq def (car dups) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1549 dups (cdr dups)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1550 (push (semantic--grammar-macro-compl-elt def t) dict)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1551 dict)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1552 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1553 (defun semantic-grammar-find-macro-expander (macro-name library) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1554 "Visit the Emacs Lisp library where a grammar macro is implemented. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1555 MACRO-NAME is a symbol that identifies a grammar macro. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1556 LIBRARY is the name (sans extension) of the Emacs Lisp library where |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1557 to start searching the macro implementation. Lookup in included |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1558 libraries, if necessary. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1559 Find a function tag (in current tags table) whose name contains MACRO-NAME. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1560 Select the buffer containing the tag's definition, and move point there." |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1561 (interactive |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1562 (let* ((dic (semantic--grammar-macro-compl-dict)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1563 (def (assoc (completing-read "Macro: " dic nil 1) dic))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1564 (or (cdr def) '(nil nil)))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1565 (when (and macro-name library) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1566 (let* ((lib (format "%s.el" library)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1567 (buf (find-file-noselect (or (locate-library lib t) lib))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1568 (tag (with-current-buffer buf |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1569 (semantic--grammar-macro-function-tag |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1570 (format "%s-%s" library macro-name))))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1571 (if tag |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1572 (progn |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1573 (require 'semantic/decorate) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1574 (pop-to-buffer (semantic-tag-buffer tag)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1575 (goto-char (semantic-tag-start tag)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1576 (semantic-momentary-highlight-tag tag)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1577 (pop-to-buffer buf) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1578 (message "No expander found in library %s for macro %s" |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1579 library macro-name))))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1580 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1581 ;;; Additional help |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1582 ;; |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1583 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1584 (defvar semantic-grammar-syntax-help |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1585 `( |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1586 ;; Lexical Symbols |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1587 ("symbol" . "Syntax: A symbol of alpha numeric and symbol characters") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1588 ("number" . "Syntax: Numeric characters.") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1589 ("punctuation" . "Syntax: Punctuation character.") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1590 ("semantic-list" . "Syntax: A list delimited by any valid list characters") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1591 ("open-paren" . "Syntax: Open Parenthesis character") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1592 ("close-paren" . "Syntax: Close Parenthesis character") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1593 ("string" . "Syntax: String character delimited text") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1594 ("comment" . "Syntax: Comment character delimited text") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1595 ;; Special Macros |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1596 ("EMPTY" . "Syntax: Match empty text") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1597 ("ASSOC" . "Lambda Key: (ASSOC key1 value1 key2 value2 ...)") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1598 ("EXPAND" . "Lambda Key: (EXPAND <list id> <rule>)") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1599 ("EXPANDFULL" . "Lambda Key: (EXPANDFULL <list id> <rule>)") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1600 ;; Tag Generator Macros |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1601 ("TAG" . "Generic Tag Generation: (TAG <name> <tag-class> [ :key value ]*)") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1602 ("VARIABLE-TAG" . "(VARIABLE-TAG <name> <lang-type> <default-value> [ :key value ]*)") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1603 ("FUNCTION-TAG" . "(FUNCTION-TAG <name> <lang-type> <arg-list> [ :key value ]*)") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1604 ("TYPE-TAG" . "(TYPE-TAG <name> <lang-type> <part-list> <parents> [ :key value ]*)") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1605 ("INCLUDE-TAG" . "(INCLUDE-TAG <name> <system-flag> [ :key value ]*)") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1606 ("PACKAGE-TAG" . "(PACKAGE-TAG <name> <detail> [ :key value ]*)") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1607 ("CODE-TAG" . "(CODE-TAG <name> <detail> [ :key value ]*)") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1608 ("ALIAS-TAG" . "(ALIAS-TAG <name> <aliasclass> <definition> [:key value]*)") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1609 ;; Special value macros |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1610 ("$1" . "Match Value: Value from match list in slot 1") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1611 ("$2" . "Match Value: Value from match list in slot 2") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1612 ("$3" . "Match Value: Value from match list in slot 3") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1613 ("$4" . "Match Value: Value from match list in slot 4") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1614 ("$5" . "Match Value: Value from match list in slot 5") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1615 ("$6" . "Match Value: Value from match list in slot 6") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1616 ("$7" . "Match Value: Value from match list in slot 7") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1617 ("$8" . "Match Value: Value from match list in slot 8") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1618 ("$9" . "Match Value: Value from match list in slot 9") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1619 ;; Same, but with annoying , in front. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1620 (",$1" . "Match Value: Value from match list in slot 1") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1621 (",$2" . "Match Value: Value from match list in slot 2") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1622 (",$3" . "Match Value: Value from match list in slot 3") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1623 (",$4" . "Match Value: Value from match list in slot 4") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1624 (",$5" . "Match Value: Value from match list in slot 5") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1625 (",$6" . "Match Value: Value from match list in slot 6") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1626 (",$7" . "Match Value: Value from match list in slot 7") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1627 (",$8" . "Match Value: Value from match list in slot 8") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1628 (",$9" . "Match Value: Value from match list in slot 9") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1629 ) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1630 "Association of syntax elements, and the corresponding help.") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1631 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1632 (defun semantic-grammar-eldoc-get-macro-docstring (macro expander) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1633 "Return a one-line docstring for the given grammar MACRO. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1634 EXPANDER is the name of the function that expands MACRO." |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1635 (require 'eldoc) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1636 (if (and (eq expander (aref eldoc-last-data 0)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1637 (eq 'function (aref eldoc-last-data 2))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1638 (aref eldoc-last-data 1) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1639 (let ((doc (help-split-fundoc (documentation expander t) expander))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1640 (cond |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1641 (doc |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1642 (setq doc (car doc)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1643 (string-match "\\`[^ )]* ?" doc) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1644 (setq doc (concat "(" (substring doc (match-end 0))))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1645 (t |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1646 (setq doc (eldoc-function-argstring expander)))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1647 (when doc |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1648 (setq doc |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1649 (eldoc-docstring-format-sym-doc |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1650 macro (format "==> %s %s" expander doc) 'default)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1651 (eldoc-last-data-store expander doc 'function)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1652 doc))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1653 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1654 (define-mode-local-override semantic-idle-summary-current-symbol-info |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1655 semantic-grammar-mode () |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1656 "Display additional eldoc information about grammar syntax elements. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1657 Syntax element is the current symbol at point. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1658 If it is associated a help string in `semantic-grammar-syntax-help', |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1659 return that string. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1660 If it is a macro name, return a description of the associated expander |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1661 function parameter list. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1662 If it is a function name, return a description of this function |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1663 parameter list. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1664 It it is a variable name, return a brief (one-line) documentation |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1665 string for the variable. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1666 If a default description of the current context can be obtained, |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1667 return it. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1668 Otherwise return nil." |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1669 (require 'eldoc) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1670 (let* ((elt (car (semantic-ctxt-current-symbol))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1671 (val (and elt (cdr (assoc elt semantic-grammar-syntax-help))))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1672 (when (and (not val) elt (semantic-grammar-in-lisp-p)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1673 ;; Ensure to load macro definitions before doing `intern-soft'. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1674 (setq val (semantic-grammar-macros) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1675 elt (intern-soft elt) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1676 val (and elt (cdr (assq elt val)))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1677 (cond |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1678 ;; Grammar macro |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1679 ((and val (fboundp val)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1680 (setq val (semantic-grammar-eldoc-get-macro-docstring elt val))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1681 ;; Function |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1682 ((and elt (fboundp elt)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1683 (setq val (eldoc-get-fnsym-args-string elt))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1684 ;; Variable |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1685 ((and elt (boundp elt)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1686 (setq val (eldoc-get-var-docstring elt))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1687 (t nil))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1688 (or val (semantic-idle-summary-current-symbol-info-default)))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1689 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1690 (define-mode-local-override semantic-tag-boundary-p |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1691 semantic-grammar-mode (tag) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1692 "Return non-nil for tags that should have a boundary drawn. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1693 Only tags of type 'nonterminal will be so marked." |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1694 (let ((c (semantic-tag-class tag))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1695 (eq c 'nonterminal))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1696 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1697 (define-mode-local-override semantic-ctxt-current-function |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1698 semantic-grammar-mode (&optional point) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1699 "Determine the name of the current function at POINT." |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1700 (save-excursion |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1701 (and point (goto-char point)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1702 (when (semantic-grammar-in-lisp-p) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1703 (with-mode-local emacs-lisp-mode |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1704 (semantic-ctxt-current-function))))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1705 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1706 (define-mode-local-override semantic-ctxt-current-argument |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1707 semantic-grammar-mode (&optional point) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1708 "Determine the argument index of the called function at POINT." |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1709 (save-excursion |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1710 (and point (goto-char point)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1711 (when (semantic-grammar-in-lisp-p) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1712 (with-mode-local emacs-lisp-mode |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1713 (semantic-ctxt-current-argument))))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1714 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1715 (define-mode-local-override semantic-ctxt-current-assignment |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1716 semantic-grammar-mode (&optional point) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1717 "Determine the tag being assigned into at POINT." |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1718 (save-excursion |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1719 (and point (goto-char point)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1720 (when (semantic-grammar-in-lisp-p) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1721 (with-mode-local emacs-lisp-mode |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1722 (semantic-ctxt-current-assignment))))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1723 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1724 (define-mode-local-override semantic-ctxt-current-class-list |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1725 semantic-grammar-mode (&optional point) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1726 "Determine the class of tags that can be used at POINT." |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1727 (save-excursion |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1728 (and point (goto-char point)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1729 (if (semantic-grammar-in-lisp-p) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1730 (with-mode-local emacs-lisp-mode |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1731 (semantic-ctxt-current-class-list)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1732 '(nonterminal keyword)))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1733 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1734 (define-mode-local-override semantic-ctxt-current-mode |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1735 semantic-grammar-mode (&optional point) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1736 "Return the major mode active at POINT. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1737 POINT defaults to the value of point in current buffer. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1738 Return `emacs-lisp-mode' is POINT is within Lisp code, otherwise |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1739 return the current major mode." |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1740 (save-excursion |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1741 (and point (goto-char point)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1742 (if (semantic-grammar-in-lisp-p) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1743 'emacs-lisp-mode |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1744 (semantic-ctxt-current-mode-default)))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1745 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1746 (define-mode-local-override semantic-format-tag-abbreviate |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1747 semantic-grammar-mode (tag &optional parent color) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1748 "Return a string abbreviation of TAG. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1749 Optional PARENT is not used. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1750 Optional COLOR is used to flag if color is added to the text." |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1751 (let ((class (semantic-tag-class tag)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1752 (name (semantic-format-tag-name tag parent color))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1753 (cond |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1754 ((eq class 'nonterminal) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1755 (concat name ":")) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1756 ((eq class 'setting) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1757 "%settings%") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1758 ((memq class '(rule keyword)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1759 name) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1760 (t |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1761 (concat "%" (symbol-name class) " " name))))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1762 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1763 (define-mode-local-override semantic-format-tag-summarize |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1764 semantic-grammar-mode (tag &optional parent color) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1765 "Return a string summarizing TAG. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1766 Optional PARENT is not used. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1767 Optional argument COLOR determines if color is added to the text." |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1768 (let ((class (semantic-tag-class tag)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1769 (name (semantic-format-tag-name tag parent color)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1770 (label nil) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1771 (desc nil)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1772 (cond |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1773 ((eq class 'nonterminal) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1774 (setq label "Nonterminal: " |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1775 desc (format |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1776 " with %d match lists." |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1777 (length (semantic-tag-components tag))))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1778 ((eq class 'keyword) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1779 (setq label "Keyword: ") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1780 (let (summary) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1781 (semantic--find-tags-by-function |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1782 #'(lambda (put) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1783 (unless summary |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1784 (setq summary (cdr (assoc "summary" |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1785 (semantic-tag-get-attribute |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1786 put :value)))))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1787 ;; Get `put' tag with TAG name. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1788 (semantic-find-tags-by-name-regexp |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1789 (regexp-quote (semantic-tag-name tag)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1790 (semantic-find-tags-by-class 'put (current-buffer)))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1791 (setq desc (concat " = " |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1792 (semantic-tag-get-attribute tag :value) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1793 (if summary |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1794 (concat " - " (read summary)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1795 ""))))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1796 ((eq class 'token) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1797 (setq label "Token: ") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1798 (let ((val (semantic-tag-get-attribute tag :value)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1799 (names (semantic-tag-get-attribute tag :rest)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1800 (type (semantic-tag-type tag))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1801 (if names |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1802 (setq name (mapconcat 'identity (cons name names) " "))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1803 (setq desc (concat |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1804 (if type |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1805 (format " <%s>" type) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1806 "") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1807 (if val |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1808 (format "%s%S" val (if type " " "")) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1809 ""))))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1810 ((eq class 'assoc) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1811 (setq label "Assoc: ") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1812 (let ((val (semantic-tag-get-attribute tag :value)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1813 (type (semantic-tag-type tag))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1814 (setq desc (concat |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1815 (if type |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1816 (format " <%s>" type) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1817 "") |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1818 (if val |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1819 (concat " " (mapconcat 'identity val " ")) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1820 ""))))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1821 (t |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1822 (setq desc (semantic-format-tag-abbreviate tag parent color)))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1823 (if (and color label) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1824 (setq label (semantic--format-colorize-text label 'label))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1825 (if (and color label desc) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1826 (setq desc (semantic--format-colorize-text desc 'comment))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1827 (if label |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1828 (concat label name desc) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1829 ;; Just a description is the abbreviated version |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1830 desc))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1831 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1832 ;;; Semantic Analysis |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1833 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1834 (define-mode-local-override semantic-analyze-current-context |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1835 semantic-grammar-mode (point) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1836 "Provide a semantic analysis object describing a context in a grammar." |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1837 (require 'semantic/analyze) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1838 (if (semantic-grammar-in-lisp-p) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1839 (with-mode-local emacs-lisp-mode |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1840 (semantic-analyze-current-context point)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1841 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1842 (let* ((context-return nil) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1843 (prefixandbounds (semantic-ctxt-current-symbol-and-bounds)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1844 (prefix (car prefixandbounds)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1845 (bounds (nth 2 prefixandbounds)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1846 (prefixsym nil) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1847 (prefixclass (semantic-ctxt-current-class-list)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1848 ) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1849 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1850 ;; Do context for rules when in a match list. |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1851 (setq prefixsym |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1852 (semantic-find-first-tag-by-name |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1853 (car prefix) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1854 (current-buffer))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1855 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1856 (setq context-return |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1857 (semantic-analyze-context |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1858 "context-for-semantic-grammar" |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1859 :buffer (current-buffer) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1860 :scope nil |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1861 :bounds bounds |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1862 :prefix (if prefixsym |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1863 (list prefixsym) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1864 prefix) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1865 :prefixtypes nil |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1866 :prefixclass prefixclass |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1867 )) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1868 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1869 context-return))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1870 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1871 (define-mode-local-override semantic-analyze-possible-completions |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1872 semantic-grammar-mode (context) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1873 "Return a list of possible completions based on CONTEXT." |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1874 (require 'semantic/analyze/complete) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1875 (if (semantic-grammar-in-lisp-p) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1876 (with-mode-local emacs-lisp-mode |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1877 (semantic-analyze-possible-completions context)) |
105799
3fe6da4a95a9
* cedet/srecode/srt-mode.el (semantic-analyze-possible-completions):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105650
diff
changeset
|
1878 (with-current-buffer (oref context buffer) |
104524
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1879 (let* ((prefix (car (oref context :prefix))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1880 (completetext (cond ((semantic-tag-p prefix) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1881 (semantic-tag-name prefix)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1882 ((stringp prefix) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1883 prefix) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1884 ((stringp (car prefix)) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1885 (car prefix)))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1886 (tags (semantic-find-tags-for-completion completetext |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1887 (current-buffer)))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1888 (semantic-analyze-tags-of-class-list |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1889 tags (oref context prefixclass))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1890 ))) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1891 |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1892 (provide 'semantic/grammar) |
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1893 |
105377 | 1894 ;; arch-tag: 12ffc9d5-557d-49af-a5fd-a66a006ddb3e |
104524
fbd55cc47b77
* cedet/ede/system.el (ede-upload-html-documentation)
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1895 ;;; semantic/grammar.el ends here |