/[emacs]/emacs/lisp/progmodes/antlr-mode.el
ViewVC logotype

Diff of /emacs/lisp/progmodes/antlr-mode.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.12 by rms, Mon Dec 31 20:35:03 2001 UTC revision 1.12.4.1 by miles, Fri Apr 4 06:20:31 2003 UTC
# Line 1  Line 1 
1  ;;; antlr-mode.el --- major mode for ANTLR grammar files  ;;; antlr-mode.el --- major mode for ANTLR grammar files
2    
3  ;; Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.  ;; Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
4  ;;  ;;
5  ;; Author: Christoph.Wedler@sap.com  ;; Author: Christoph.Wedler@sap.com
6  ;; Keywords: languages  ;; Keywords: languages
7  ;; Version: 2.1  ;; Version: (see `antlr-version' below)
8  ;; X-URL: http://www.fmi.uni-passau.de/~wedler/antlr-mode/  ;; X-URL: http://antlr-mode.sourceforge.net/
9    
10  ;; This file is part of GNU Emacs.  ;; This file is part of GNU Emacs.
11    
# Line 26  Line 26 
26    
27  ;;; Commentary:  ;;; Commentary:
28    
29  ;; This Emacs extension (major mode) provides various features for editing  ;; The Emacs package ANTLR-Mode provides: syntax highlighting for ANTLR grammar
30  ;; ANTLR grammar files.  ANTLR is a tool for LL(k)-based language recognition  ;; files, automatic indentation, menus containing rule/token definitions and
31  ;; and an excellent alternative to lex & yacc, see <http://www.ANTLR.org>.  ;; supported options and various other things like running ANTLR from within
32  ;; Some features depend on the value of ANTLR's "language" option (check the  ;; Emacs.
33  ;; modeline for "Antlr.Java" or "Antlr.C++").  
34    ;; For details, check <http://antlr-mode.sourceforge.net/> or, if you prefer
35  ;; This package provides the following features:  ;; the manual style, follow all commands mentioned in the documentation of
36  ;;  * Syntax highlighting for grammar symbols and the code in actions.  ;; `antlr-mode'.  ANTLR is a LL(k)-based recognition tool which generates
37  ;;  * Indentation (pretty-print) for the current line (TAB) and lines in the  ;; lexers, parsers and tree transformers in Java, C++ or Sather and can be
38  ;;    selected region (C-M-\).  Inserting an ANTLR syntax symbol (one of  ;; found at <http://www.antlr.org/>.
 ;;    ":;|&(){}") might also indent the current line.  
 ;;  * Menu "Index" and Speedbar tags with all class, token and rule  
 ;;    definitions.  Jump to corresponding position by selecting an entry.  
 ;;  * Commands to move to previous/next rule, beginning/end of rule body etc.  
 ;;  * Commands to hide/unhide actions.  
 ;;  * Support to insert/change file/grammar/rule/subrule options.  
 ;;  * Run ANTLR from within Emacs, create Makefile dependencies.  
   
 ;; SYNTAX HIGHLIGHTING comes in three phases.  First, comments and strings are  
 ;; highlighted.  Second, the grammar code is highlighted according to  
 ;; `antlr-font-lock-additional-keywords' (rule refs: dark blue, token refs:  
 ;; dark orange, definition: bold blue).  Third, actions, semantic predicates  
 ;; and arguments are highlighted according to the usual font-lock keywords of  
 ;; the major-mode corresponding to ANTLR's "language" option, see also  
 ;; `antlr-font-lock-maximum-decoration'.  We define special font-lock faces for  
 ;; the grammar code to allow you to distinguish ANTLR keywords from Java/C++  
 ;; keywords.  
   
 ;; INDENTATION.  This package supports ANTLR's (intended) indentation style  
 ;; which is based on a simple paren/brace/bracket depth-level calculation, see  
 ;; `antlr-indent-line'.  The indentation engine of cc-mode is only used inside  
 ;; block comments.  By default, this package defines a tab width of 4 to be  
 ;; consistent to both ANTLR's conventions (TABs usage) and the  
 ;; `c-indentation-style' "java" which sets `c-basic-offset' to 4, see  
 ;; `antlr-tab-offset-alist'.  You might want to set this variable to nil.  
   
 ;; OPTION SUPPORT.  This package provides special support to insert or change  
 ;; file, grammar, rule and subrule options via the menu or via the keyboard  
 ;; with completion.  For most options, you can also insert the value with  
 ;; completion (or select a value from a list by pressing `?').  You get a  
 ;; warning if an option is not supported by the version of ANTLR you are using  
 ;; (`antlr-tool-version' defaults to 2.7.1), or if the option shouldn't be  
 ;; inserted for other reasons.  This package knows the correct position where  
 ;; to insert the option and inserts "options {...}" if it is not already  
 ;; present.  For details, see the docstring of command \\[antlr-insert-option].  
   
 ;; MAKEFILE CREATION.  Command \\[antlr-show-makefile-rules] shows/inserts the  
 ;; dependencies for all grammar files in the current directory.  It considers  
 ;; ANTLR's "language" option, import/export vocabularies and grammar  
 ;; inheritance, and provides a value for the -glib option if necessary (which  
 ;; you have to edit if the super-grammar is not in the same directory).  
39    
40  ;; TODO/WISH-LIST.  Things which might be supported in future versions:  ;; Bug fixes, bug reports, improvements, and suggestions for the newest version
41    ;; are strongly appreciated.
42    
43    ;; To-do/Wish-list:
44    ;;
45  ;;  * Next Version [C-c C-w].  Produce HTML document with syntax highlighted  ;;  * Next Version [C-c C-w].  Produce HTML document with syntax highlighted
46  ;;    and hyper-links (using htmlize).  ;;    and hyper-links (using htmlize).
47  ;;  * Next Version [C-c C-u].  Insert/update special comments: each rule lists  ;;  * Next Version [C-c C-u].  Insert/update special comments: each rule lists
# Line 89  Line 51 
51  ;;  * Planned.  Further support for imenu, i.e., include entries for method  ;;  * Planned.  Further support for imenu, i.e., include entries for method
52  ;;    definitions at beginning of grammar class.  ;;    definitions at beginning of grammar class.
53  ;;  * Planned [C-c C-p].  Pack/unpack rule/subrule & options (one/multi-line).  ;;  * Planned [C-c C-p].  Pack/unpack rule/subrule & options (one/multi-line).
54    ;;
55  ;;  * Probably.  Show rules/dependencies for ANT like for Makefile (does ANT  ;;  * Probably.  Show rules/dependencies for ANT like for Makefile (does ANT
56  ;;    support vocabularies and grammar inheritance?), I have to look at  ;;    support vocabularies and grammar inheritance?), I have to look at
57  ;;    jde-ant.el: http://jakarta.apache.org/ant/manual/OptionalTasks/antlr.html  ;;    jde-ant.el: http://jakarta.apache.org/ant/manual/OptionalTasks/antlr.html
# Line 101  Line 63 
63  ;;    and action code and run special highlighting functions on these regions.  ;;    and action code and run special highlighting functions on these regions.
64  ;;    Problems: code size, this mode would depend on font-lock internals.  ;;    Problems: code size, this mode would depend on font-lock internals.
65    
 ;; Bug fixes, bug reports, improvements, and suggestions are strongly  
 ;; appreciated.  Please check the newest version first:  
 ;;   http://www.fmi.uni-passau.de/~wedler/antlr-mode/changes.html  
   
66  ;;; Installation:  ;;; Installation:
67    
68  ;; This file requires Emacs-20.3, XEmacs-20.4 or higher and package cc-mode.  ;; This file requires Emacs-20.3, XEmacs-20.4 or higher and package cc-mode.
# Line 116  Line 74 
74  ;;   (add-hook 'speedbar-load-hook  ; would be too late in antlr-mode.el  ;;   (add-hook 'speedbar-load-hook  ; would be too late in antlr-mode.el
75  ;;             (lambda () (speedbar-add-supported-extension ".g")))  ;;             (lambda () (speedbar-add-supported-extension ".g")))
76    
 ;; If you edit ANTLR's source files, you might also want to use  
 ;;   (autoload 'antlr-set-tabs "antlr-mode")  
 ;;   (add-hook 'java-mode-hook 'antlr-set-tabs)  
   
77  ;; I strongly recommend to use font-lock with a support mode like fast-lock,  ;; I strongly recommend to use font-lock with a support mode like fast-lock,
78  ;; lazy-lock or better jit-lock (Emacs-21.1+) / lazy-shot (XEmacs).  ;; lazy-lock or better jit-lock (Emacs-21.1+) / lazy-shot (XEmacs).
79    
# Line 128  Line 82 
82  ;;; Code:  ;;; Code:
83    
84  (provide 'antlr-mode)  (provide 'antlr-mode)
85  (eval-when-compile                      ; required and optional libraries  (require 'easymenu)
86    (require 'cc-mode)  
87    (defvar c-Java-access-key)            ; former cc-mode variable  ;; General Emacs/XEmacs-compatibility compile-time macros
88    (condition-case nil (require 'font-lock) (error nil))  (eval-when-compile
   (condition-case nil (require 'compile) (error nil))  
   (defvar outline-level) (defvar imenu-use-markers)  
   (defvar imenu-create-index-function))  
 (eval-when-compile                      ; Emacs: cl, easymenu, XEmacs vars  
89    (require 'cl)    (require 'cl)
90    (require 'easymenu)    (defmacro cond-emacs-xemacs (&rest args)
91    (defvar zmacs-region-stays))      (cond-emacs-xemacs-macfn
92  (eval-when-compile                      ; XEmacs: Emacs vars       args "`cond-emacs-xemacs' must return exactly one element"))
93    (defvar inhibit-point-motion-hooks) (defvar deactivate-mark))    (defun cond-emacs-xemacs-macfn (args &optional msg)
94        (if (atom args) args
95  (eval-and-compile                       ; XEmacs functions, simplified        (and (eq (car args) :@) (null msg) ; (:@ ...spliced...)
96    (if (featurep 'xemacs)             (setq args (cdr args)
97        (defalias 'antlr-scan-sexps 'scan-sexps)                   msg "(:@ ....) must return exactly one element"))
98      (defalias 'antlr-scan-sexps 'antlr-scan-sexps-internal))        (let ((ignore (if (string-match "XEmacs" emacs-version) :EMACS :XEMACS))
99    (if (featurep 'xemacs)              (mode :BOTH) code)
100        (defalias 'antlr-scan-lists 'scan-lists)          (while (consp args)
101      (defalias 'antlr-scan-lists 'antlr-scan-lists-internal))            (if (memq (car args) '(:EMACS :XEMACS :BOTH)) (setq mode (pop args)))
102    (if (fboundp 'default-directory)            (if (atom args)
103        (defalias 'antlr-default-directory 'default-directory)                (or args (error "Used selector %s without elements" mode))
104      (defun antlr-default-directory () default-directory))              (or (eq ignore mode)
105    (if (fboundp 'read-shell-command)                  (push (cond-emacs-xemacs-macfn (car args)) code))
106        (defalias 'antlr-read-shell-command 'read-shell-command)              (pop args)))
107      (defun antlr-read-shell-command (prompt &optional initial-input history)          (cond (msg (if (or args (cdr code)) (error msg) (car code)))
108        (read-from-minibuffer prompt initial-input nil nil                ((or (null args) (eq ignore mode)) (nreverse code))
109                              (or history 'shell-command-history))))                (t (nconc (nreverse code) args))))))
110    (if (fboundp 'with-displaying-help-buffer)    ;; Emacs/XEmacs-compatibility `defun': remove interactive "_" for Emacs, use
111        (defalias 'antlr-with-displaying-help-buffer 'with-displaying-help-buffer)    ;; existing functions when they are `fboundp', provide shortcuts if they are
112      (defun antlr-with-displaying-help-buffer (thunk &optional name)    ;; known to be defined in a specific Emacs branch (for short .elc)
113        (with-output-to-temp-buffer "*Help*"    (defmacro defunx (name arglist &rest definition)
114          (save-excursion (funcall thunk)))))      (let ((xemacsp (string-match "XEmacs" emacs-version)) reuses)
115    (if (and (fboundp 'buffer-syntactic-context)        (while (memq (car definition)
116             (fboundp 'buffer-syntactic-context-depth))                     '(:try :emacs-and-try :xemacs-and-try))
117        (progn          (if (eq (pop definition) (if xemacsp :xemacs-and-try :emacs-and-try))
118          (defalias 'antlr-invalidate-context-cache 'antlr-xemacs-bug-workaround)              (setq reuses (car definition)
119          (defalias 'antlr-syntactic-context 'antlr-fast-syntactic-context))                    definition nil)
120      (defalias 'antlr-invalidate-context-cache 'ignore)            (push (pop definition) reuses)))
121      (defalias 'antlr-syntactic-context 'antlr-slow-syntactic-context)))        (if (and reuses (symbolp reuses))
122              `(defalias ',name ',reuses)
123            (let* ((docstring (if (stringp (car definition)) (pop definition)))
124                   (spec (and (not xemacsp)
125                              (eq (car-safe (car definition)) 'interactive)
126                              (null (cddar definition))
127                              (cadar definition))))
128              (if (and (stringp spec)
129                       (not (string-equal spec ""))
130                       (eq (aref spec 0) ?_))
131                  (setq definition
132                        (cons (if (string-equal spec "_")
133                                  '(interactive)
134                                `(interactive ,(substring spec 1)))
135                              (cdr definition))))
136              (if (null reuses)
137                  `(defun ,name ,arglist ,docstring
138                     ,@(cond-emacs-xemacs-macfn definition))
139                ;; no dynamic docstring in this case
140                `(eval-and-compile          ; no warnings in Emacs
141                   (defalias ',name
142                     (cond ,@(mapcar (lambda (func) `((fboundp ',func) ',func))
143                                     (nreverse reuses))
144                           (t ,(if definition
145                                   `(lambda ,arglist ,docstring
146                                      ,@(cond-emacs-xemacs-macfn definition))
147                                 'ignore))))))))))
148      (defmacro ignore-errors-x (&rest body)
149        (let ((specials '((scan-sexps . 4) (scan-lists . 5)))
150              spec nils)
151          (if (and (string-match "XEmacs" emacs-version)
152                   (null (cdr body)) (consp (car body))
153                   (setq spec (assq (caar body) specials))
154                   (>= (setq nils (- (cdr spec) (length (car body)))) 0))
155              `(,@(car body) ,@(make-list nils nil) t)
156            `(ignore-errors ,@body)))))
157    
158    ;; More compile-time-macros
159    (eval-when-compile
160      (defmacro save-buffer-state-x (&rest body) ; similar to EMACS/lazy-lock.el
161        (let ((modified (gensym "save-buffer-state-x-modified-")))
162          `(let ((,modified (buffer-modified-p)))
163             (unwind-protect
164                 (let ((buffer-undo-list t) (inhibit-read-only t)
165                       ,@(unless (string-match "XEmacs" emacs-version)
166                           '((inhibit-point-motion-hooks t) deactivate-mark))
167                       before-change-functions after-change-functions
168                       buffer-file-name buffer-file-truename)
169                   ,@body)
170               (and (not ,modified) (buffer-modified-p)
171                    (set-buffer-modified-p nil)))))))
172    (put 'save-buffer-state-x 'lisp-indent-function 0)
173    
174    ;; get rid of byte-compile warnings
175    (eval-when-compile                      ; required and optional libraries
176      (ignore-errors (require 'cc-mode))
177      (ignore-errors (require 'font-lock))
178      (ignore-errors (require 'compile))
179      (defvar outline-level) (defvar imenu-use-markers)
180      (defvar imenu-create-index-function)
181      (ignore-errors (defun c-init-language-vars)))
182    
183    
184  ;;;;##########################################################################  ;;;;##########################################################################
# Line 181  Line 190 
190    "Major mode for ANTLR grammar files."    "Major mode for ANTLR grammar files."
191    :group 'languages    :group 'languages
192    :link '(emacs-commentary-link "antlr-mode.el")    :link '(emacs-commentary-link "antlr-mode.el")
193    :link '(url-link "http://www.fmi.uni-passau.de/~wedler/antlr-mode/")    :link '(url-link "http://antlr-mode.sourceforge.net/")
194    :prefix "antlr-")    :prefix "antlr-")
195    
196  (defconst antlr-version "2.1"  (defconst antlr-version "2.2b"
197    "ANTLR major mode version number.")    "ANTLR major mode version number.
198    Check <http://antlr-mode.sourceforge.net/> for the newest.")
199    
200    
201  ;;;===========================================================================  ;;;===========================================================================
# Line 272  ANTLR's and Java's indentation styles. Line 282  ANTLR's and Java's indentation styles.
282    
283  (defcustom antlr-indent-style "java"  (defcustom antlr-indent-style "java"
284    "*If non-nil, cc-mode indentation style used for `antlr-mode'.    "*If non-nil, cc-mode indentation style used for `antlr-mode'.
285  See `c-set-style' for details."  See `c-set-style' and for details, where the most interesting part in
286    `c-style-alist' is the value of `c-basic-offset'."
287    :group 'antlr    :group 'antlr
288    :type '(choice (const nil) regexp))    :type '(choice (const nil) regexp))
289    
290  (defcustom antlr-indent-item-regexp  (defcustom antlr-indent-item-regexp
291    "[]}):;|&]\\|default[ \t]*:\\|case[ \t]+\\('\\\\?.'\\|[0-9]+\\|[A-Za-z_][A-Za-z_0-9]*\\)[ \t]*:" ; & is local ANTLR extension (SGML's and-connector)    "[]}):;|&]" ; & is local ANTLR extension (SGML's and-connector)
292    "Regexp matching lines which should be indented by one TAB less.    "Regexp matching lines which should be indented by one TAB less.
293  See `antlr-indent-line' and command \\[antlr-indent-command]."  See `antlr-indent-line' and command \\[antlr-indent-command]."
294    :group 'antlr    :group 'antlr
# Line 285  See `antlr-indent-line' and command \\[a Line 296  See `antlr-indent-line' and command \\[a
296    
297  (defcustom antlr-indent-at-bol-alist  (defcustom antlr-indent-at-bol-alist
298    ;; eval-when-compile not usable with defcustom...    ;; eval-when-compile not usable with defcustom...
299    '((c++-mode . "#\\(assert\\|cpu\\|define\\|endif\\|el\\(if\\|se\\)\\|i\\(dent\\|f\\(def\\|ndef\\)?\\|mport\\|nclude\\(_next\\)?\\)\\|line\\|machine\\|pragma\\|system\\|un\\(assert\\|def\\)\\|warning\\)\\>"))    '((java-mode . "\\(package\\|import\\)\\>")
300        (c++-mode . "#\\(assert\\|cpu\\|define\\|endif\\|el\\(if\\|se\\)\\|i\\(dent\\|f\\(def\\|ndef\\)?\\|mport\\|nclude\\(_next\\)?\\)\\|line\\|machine\\|pragma\\|system\\|un\\(assert\\|def\\)\\|warning\\)\\>"))
301    "Alist of regexps matching lines are indented at column 0.    "Alist of regexps matching lines are indented at column 0.
302  Each element in this list looks like (MODE . REGEXP) where MODE is a  Each element in this list looks like (MODE . REGEXP) where MODE is a
303  function and REGEXP is a regular expression.  function and REGEXP is a regular expression.
304    
305  If `antlr-language' equals to a MODE and the line starting at the first  If `antlr-language' equals to a MODE, the line starting at the first
306  non-whitespace is matched by the corresponding REGEXP, indent the line  non-whitespace is matched by the corresponding REGEXP, and the line is
307  at column 0 instead according to the normal rules of `antlr-indent-line'."  part of an header action, indent the line at column 0 instead according
308    to the normal rules of `antlr-indent-line'."
309    :group 'antlr    :group 'antlr
310    :type '(repeat (cons (function :tag "Major mode") regexp)))    :type '(repeat (cons (function :tag "Major mode") regexp)))
311    
312    ;; adopt indentation to cc-engine
313    (defvar antlr-disabling-cc-syntactic-symbols
314      '(statement-block-intro
315        defun-block-intro topmost-intro statement-case-intro member-init-intro
316        arglist-intro brace-list-intro knr-argdecl-intro inher-intro
317        objc-method-intro
318        block-close defun-close class-close brace-list-close arglist-close
319        inline-close extern-lang-close namespace-close))
320    
321    
322  ;;;===========================================================================  ;;;===========================================================================
323  ;;;  Options: customization  ;;;  Options: customization
# Line 647  DIRECTORY is the name of the current dir Line 669  DIRECTORY is the name of the current dir
669  ;;;  Menu  ;;;  Menu
670  ;;;===========================================================================  ;;;===========================================================================
671    
672  (defcustom antlr-imenu-name t  (defcustom antlr-imenu-name t ; (featurep 'xemacs) ; TODO: Emacs-21 bug?
673    "*Non-nil, if a \"Index\" menu should be added to the menubar.    "*Non-nil, if a \"Index\" menu should be added to the menubar.
674  If it is a string, it is used instead \"Index\".  Requires package  If it is a string, it is used instead \"Index\".  Requires package
675  imenu."  imenu."
# Line 687  imenu." Line 709  imenu."
709  (easy-menu-define antlr-mode-menu antlr-mode-map  (easy-menu-define antlr-mode-menu antlr-mode-map
710    "Major mode menu."    "Major mode menu."
711    `("Antlr"    `("Antlr"
712      ,@(if (and antlr-options-use-submenus      ,@(if (cond-emacs-xemacs
713                 (boundp 'emacs-major-version)             :EMACS (and antlr-options-use-submenus
714                 (or (featurep 'xemacs) (>= emacs-major-version 21)))                         (>= emacs-major-version 21))
715               :XEMACS antlr-options-use-submenus)
716            `(("Insert File Option"            `(("Insert File Option"
717               :filter ,(lambda (x) (antlr-options-menu-filter 1 x)))               :filter ,(lambda (x) (antlr-options-menu-filter 1 x)))
718              ("Insert Grammar Option"              ("Insert Grammar Option"
# Line 797  Do not change." Line 820  Do not change."
820    
821  (defvar antlr-font-lock-keyword-face 'antlr-font-lock-keyword-face)  (defvar antlr-font-lock-keyword-face 'antlr-font-lock-keyword-face)
822  (defface antlr-font-lock-keyword-face  (defface antlr-font-lock-keyword-face
823    '((((class color) (background light)) (:foreground "black" :weight bold)))    (cond-emacs-xemacs
824       '((((class color) (background light))
825          (:foreground "black" :EMACS :weight bold :XEMACS :bold t))))
826    "ANTLR keywords."    "ANTLR keywords."
827    :group 'antlr)    :group 'antlr)
828    
829  (defvar antlr-font-lock-syntax-face 'antlr-font-lock-keyword-face)  (defvar antlr-font-lock-syntax-face 'antlr-font-lock-keyword-face)
830  (defface antlr-font-lock-syntax-face  (defface antlr-font-lock-syntax-face
831    '((((class color) (background light)) (:foreground "black" :weight bold)))    (cond-emacs-xemacs
832       '((((class color) (background light))
833          (:foreground "black" :EMACS :weight bold :XEMACS :bold t))))
834    "ANTLR syntax symbols like :, |, (, ), ...."    "ANTLR syntax symbols like :, |, (, ), ...."
835    :group 'antlr)    :group 'antlr)
836    
837  (defvar antlr-font-lock-ruledef-face 'antlr-font-lock-ruledef-face)  (defvar antlr-font-lock-ruledef-face 'antlr-font-lock-ruledef-face)
838  (defface antlr-font-lock-ruledef-face  (defface antlr-font-lock-ruledef-face
839    '((((class color) (background light)) (:foreground "blue" :weight bold)))    (cond-emacs-xemacs
840       '((((class color) (background light))
841          (:foreground "blue" :EMACS :weight bold :XEMACS :bold t))))
842    "ANTLR rule references (definition)."    "ANTLR rule references (definition)."
843    :group 'antlr)    :group 'antlr)
844    
845  (defvar antlr-font-lock-tokendef-face 'antlr-font-lock-tokendef-face)  (defvar antlr-font-lock-tokendef-face 'antlr-font-lock-tokendef-face)
846  (defface antlr-font-lock-tokendef-face  (defface antlr-font-lock-tokendef-face
847    '((((class color) (background light)) (:foreground "blue" :weight bold)))    (cond-emacs-xemacs
848       '((((class color) (background light))
849          (:foreground "blue" :EMACS :weight bold :XEMACS :bold t))))
850    "ANTLR token references (definition)."    "ANTLR token references (definition)."
851    :group 'antlr)    :group 'antlr)
852    
# Line 833  Do not change." Line 864  Do not change."
864    
865  (defvar antlr-font-lock-literal-face 'antlr-font-lock-literal-face)  (defvar antlr-font-lock-literal-face 'antlr-font-lock-literal-face)
866  (defface antlr-font-lock-literal-face  (defface antlr-font-lock-literal-face
867    '((((class color) (background light)) (:foreground "brown4" :weight bold)))    (cond-emacs-xemacs
868       '((((class color) (background light))
869          (:foreground "brown4" :EMACS :weight bold :XEMACS :bold t))))
870    "ANTLR special literal tokens.    "ANTLR special literal tokens.
871  It is used to highlight strings matched by the first regexp group of  It is used to highlight strings matched by the first regexp group of
872  `antlr-font-lock-literal-regexp'."  `antlr-font-lock-literal-regexp'."
# Line 853  group.  The string matched by the first Line 886  group.  The string matched by the first
886    "Regexp matching class headers.")    "Regexp matching class headers.")
887    
888  (defvar antlr-font-lock-additional-keywords  (defvar antlr-font-lock-additional-keywords
889    `((antlr-invalidate-context-cache)    (cond-emacs-xemacs
890      ("\\$setType[ \t]*(\\([A-Za-z\300-\326\330-\337]\\sw*\\))"     `((antlr-invalidate-context-cache)
891       (1 antlr-font-lock-tokendef-face))       ("\\$setType[ \t]*(\\([A-Za-z\300-\326\330-\337]\\sw*\\))"
892      ("\\$\\sw+" (0 font-lock-keyword-face))        (1 antlr-font-lock-tokendef-face))
893      ;; the tokens are already fontified as string/docstrings:       ("\\$\\sw+" (0 font-lock-keyword-face))
894      (,(lambda (limit)       ;; the tokens are already fontified as string/docstrings:
895          (if antlr-font-lock-literal-regexp       (,(lambda (limit)
896              (antlr-re-search-forward antlr-font-lock-literal-regexp limit)))           (if antlr-font-lock-literal-regexp
897       (1 antlr-font-lock-literal-face t)               (antlr-re-search-forward antlr-font-lock-literal-regexp limit)))
898       ,@(and (featurep 'xemacs) '((0 nil)))) ; XEmacs bug workaround        (1 antlr-font-lock-literal-face t)
899      (,(lambda (limit)        :XEMACS (0 nil))                  ; XEmacs bug workaround
900          (antlr-re-search-forward antlr-class-header-regexp limit))       (,(lambda (limit)
901       (1 antlr-font-lock-keyword-face)           (antlr-re-search-forward antlr-class-header-regexp limit))
902       (2 antlr-font-lock-ruledef-face)        (1 antlr-font-lock-keyword-face)
903       (3 antlr-font-lock-keyword-face)        (2 antlr-font-lock-ruledef-face)
904       (4 (if (member (match-string 4) '("Lexer" "Parser" "TreeParser"))        (3 antlr-font-lock-keyword-face)
905              'antlr-font-lock-keyword-face        (4 (if (member (match-string 4) '("Lexer" "Parser" "TreeParser"))
906            'font-lock-type-face)))               'antlr-font-lock-keyword-face
907      (,(lambda (limit)             'font-lock-type-face)))
908          (antlr-re-search-forward       (,(lambda (limit)
909           "\\<\\(header\\|options\\|tokens\\|exception\\|catch\\|returns\\)\\>"           (antlr-re-search-forward
910           limit))            "\\<\\(header\\|options\\|tokens\\|exception\\|catch\\|returns\\)\\>"
911              limit))
912       (1 antlr-font-lock-keyword-face))       (1 antlr-font-lock-keyword-face))
913      (,(lambda (limit)       (,(lambda (limit)
914          (antlr-re-search-forward           (antlr-re-search-forward
915           "^\\(private\\|public\\|protected\\)\\>[ \t]*\\(\\(\\sw+[ \t]*\\(:\\)?\\)\\)?"            "^\\(private\\|public\\|protected\\)\\>[ \t]*\\(\\(\\sw+[ \t]*\\(:\\)?\\)\\)?"
916           limit))            limit))
917       (1 font-lock-type-face)            ; not XEmacs' java level-3 fruit salad       (1 font-lock-type-face)            ; not XEmacs' java level-3 fruit salad
918       (3 (if (antlr-upcase-p (char-after (match-beginning 3)))       (3 (if (antlr-upcase-p (char-after (match-beginning 3)))
919              'antlr-font-lock-tokendef-face              'antlr-font-lock-tokendef-face
920            'antlr-font-lock-ruledef-face) nil t)            'antlr-font-lock-ruledef-face) nil t)
921       (4 antlr-font-lock-syntax-face nil t))       (4 antlr-font-lock-syntax-face nil t))
922      (,(lambda (limit)       (,(lambda (limit)
923          (antlr-re-search-forward "^\\(\\sw+\\)[ \t]*\\(:\\)?" limit))           (antlr-re-search-forward "^\\(\\sw+\\)[ \t]*\\(:\\)?" limit))
924       (1 (if (antlr-upcase-p (char-after (match-beginning 0)))       (1 (if (antlr-upcase-p (char-after (match-beginning 0)))
925              'antlr-font-lock-tokendef-face              'antlr-font-lock-tokendef-face
926            'antlr-font-lock-ruledef-face) nil t)            'antlr-font-lock-ruledef-face) nil t)
927       (2 antlr-font-lock-syntax-face nil t))       (2 antlr-font-lock-syntax-face nil t))
928      (,(lambda (limit)       (,(lambda (limit)
929          ;; v:ruleref and v:"literal" is allowed...           ;; v:ruleref and v:"literal" is allowed...
930          (antlr-re-search-forward "\\(\\sw+\\)[ \t]*\\([=:]\\)?" limit))           (antlr-re-search-forward "\\(\\sw+\\)[ \t]*\\([=:]\\)?" limit))
931       (1 (if (match-beginning 2)       (1 (if (match-beginning 2)
932              (if (eq (char-after (match-beginning 2)) ?=)              (if (eq (char-after (match-beginning 2)) ?=)
933                  'antlr-font-lock-default-face                  'antlr-font-lock-default-face
# Line 902  group.  The string matched by the first Line 936  group.  The string matched by the first
936                'antlr-font-lock-tokenref-face                'antlr-font-lock-tokenref-face
937              'antlr-font-lock-ruleref-face)))              'antlr-font-lock-ruleref-face)))
938       (2 antlr-font-lock-default-face nil t))       (2 antlr-font-lock-default-face nil t))
939      (,(lambda (limit)       (,(lambda (limit)
940          (antlr-re-search-forward "[|&:;(]\\|)\\([*+?]\\|=>\\)?" limit))           (antlr-re-search-forward "[|&:;(~]\\|)\\([*+?]\\|=>\\)?" limit))
941       (0 'antlr-font-lock-syntax-face)))       (0 'antlr-font-lock-syntax-face))))
942    "Font-lock keywords for ANTLR's normal grammar code.    "Font-lock keywords for ANTLR's normal grammar code.
943  See `antlr-font-lock-keywords-alist' for the keywords of actions.")  See `antlr-font-lock-keywords-alist' for the keywords of actions.")
944    
# Line 939  not to confuse their context_cache.") Line 973  not to confuse their context_cache.")
973    "Abbreviation table used in `antlr-mode' buffers.")    "Abbreviation table used in `antlr-mode' buffers.")
974  (define-abbrev-table 'antlr-mode-abbrev-table ())  (define-abbrev-table 'antlr-mode-abbrev-table ())
975    
976    (defvar antlr-slow-cache-enabling-symbol 'loudly
977    ;; Emacs' font-lock changes buffer's tick counter, therefore this value should
978    ;; be a parameter of a font-lock function, but not any other variable of
979    ;; functions which call `antlr-slow-syntactic-context'.
980      "If value is a bound symbol, cache will be used even with text changes.
981    This is no user option.  Used for `antlr-slow-syntactic-context'.")
982    
983    (defvar antlr-slow-cache-diff-threshold 5000
984      "Maximum distance between `point' and cache position for cache use.
985    Used for `antlr-slow-syntactic-context'.")
986    
987    
988  ;;;;##########################################################################  ;;;;##########################################################################
# Line 948  not to confuse their context_cache.") Line 992  not to confuse their context_cache.")
992    
993    
994  ;;;===========================================================================  ;;;===========================================================================
995  ;;;  Syntax functions -- Emacs vs XEmacs dependent  ;;;  Syntax functions -- Emacs vs XEmacs dependent, part 1
996  ;;;===========================================================================  ;;;===========================================================================
997    
998  ;; From help.el (XEmacs-21.1), without `copy-syntax-table'  ;; From help.el (XEmacs-21.1), without `copy-syntax-table'
# Line 961  not to confuse their context_cache.") Line 1005  not to confuse their context_cache.")
1005  (put 'antlr-with-syntax-table 'lisp-indent-function 1)  (put 'antlr-with-syntax-table 'lisp-indent-function 1)
1006  (put 'antlr-with-syntax-table 'edebug-form-spec '(form body))  (put 'antlr-with-syntax-table 'edebug-form-spec '(form body))
1007    
1008  (defun antlr-scan-sexps-internal (from count &optional dummy no-error)  (defunx antlr-default-directory ()
1009  ;; checkdoc-params: (from count dummy)    :xemacs-and-try default-directory
1010    "Like `scan-sexps' but with additional arguments.    "Return `default-directory'."
1011  When optional arg NO-ERROR is non-nil, `antlr-scan-sexps-internal' will    default-directory)
 return nil instead of signaling an error."  
   (if no-error  
       (condition-case nil  
           (scan-sexps from count)  
         (error nil))  
     (scan-sexps from count)))  
   
 (defun antlr-scan-lists-internal (from count depth &optional dummy no-error)  
 ;; checkdoc-params: (from count depth dummy)  
   "Like `scan-lists' but with additional arguments.  
 When optional arg NO-ERROR is non-nil, `antlr-scan-lists-internal' will  
 return nil instead of signaling an error."  
   (if no-error  
       (condition-case nil  
           (scan-lists from count depth)  
         (error nil))  
     (scan-lists from count depth)))  
1012    
1013  (defun antlr-xemacs-bug-workaround (&rest dummies)  ;; Check Emacs-21.1 simple.el, `shell-command'.
1014    (defunx antlr-read-shell-command (prompt &optional initial-input history)
1015      :xemacs-and-try read-shell-command
1016      "Read a string from the minibuffer, using `shell-command-history'."
1017      (read-from-minibuffer prompt initial-input nil nil
1018                            (or history 'shell-command-history)))
1019    
1020    (defunx antlr-with-displaying-help-buffer (thunk &optional name)
1021      :xemacs-and-try with-displaying-help-buffer
1022      "Make a help buffer and call `thunk' there."
1023      (with-output-to-temp-buffer "*Help*"
1024        (save-excursion (funcall thunk))))
1025    
1026    
1027    ;;;===========================================================================
1028    ;;;  Context cache
1029    ;;;===========================================================================
1030    
1031    (defvar antlr-slow-context-cache nil "Internal.")
1032    
1033    ;;;(defvar antlr-statistics-full-neg 0)
1034    ;;;(defvar antlr-statistics-full-diff 0)
1035    ;;;(defvar antlr-statistics-full-other 0)
1036    ;;;(defvar antlr-statistics-cache 0)
1037    ;;;(defvar antlr-statistics-inval 0)
1038    
1039    (defunx antlr-invalidate-context-cache (&rest dummies)
1040  ;; checkdoc-params: (dummies)  ;; checkdoc-params: (dummies)
1041    "Invalidate context_cache for syntactical context information."    "Invalidate context cache for syntactical context information."
1042    ;; XEmacs bug workaround    :XEMACS                               ; XEmacs bug workaround
1043    (save-excursion    (save-excursion
1044      (set-buffer (get-buffer-create " ANTLR XEmacs bug workaround"))      (set-buffer (get-buffer-create " ANTLR XEmacs bug workaround"))
1045      (buffer-syntactic-context-depth))      (buffer-syntactic-context-depth)
1046    nil)      nil)
1047      :EMACS
1048    ;;;  (incf antlr-statistics-inval)
1049      (setq antlr-slow-context-cache nil))
1050    
1051  (defun antlr-fast-syntactic-context ()  (defunx antlr-syntactic-context ()
1052    "Return some syntactic context information.    "Return some syntactic context information.
1053  Return `string' if point is within a string, `block-comment' or  Return `string' if point is within a string, `block-comment' or
1054  `comment' is point is within a comment or the depth within all  `comment' is point is within a comment or the depth within all
1055  parenthesis-syntax delimiters at point otherwise.  parenthesis-syntax delimiters at point otherwise.
1056  WARNING: this may alter `match-data'."  WARNING: this may alter `match-data'."
1057    (or (buffer-syntactic-context) (buffer-syntactic-context-depth)))    :XEMACS
1058      (or (buffer-syntactic-context) (buffer-syntactic-context-depth))
1059  (defun antlr-slow-syntactic-context ()    :EMACS
1060    "Return some syntactic context information.    (let ((orig (point)) diff state
1061  Return `string' if point is within a string, `block-comment' or          ;; Arg, Emacs' (buffer-modified-tick) changes with font-lock.  Use
1062  `comment' is point is within a comment or the depth within all          ;; hack that `loudly' is bound during font-locking => cache use will
1063  parenthesis-syntax delimiters at point otherwise.          ;; increase from 7% to 99.99% during font-locking.
1064  WARNING: this may alter `match-data'."          (tick (or (boundp antlr-slow-cache-enabling-symbol)
1065    (let ((orig (point)))                    (buffer-modified-tick))))
1066      (beginning-of-defun)      (if (and (cdr antlr-slow-context-cache)
1067      (let ((state (parse-partial-sexp (point) orig)))               (>= (setq diff (- orig (cadr antlr-slow-context-cache))) 0)
1068        (goto-char orig)               (< diff antlr-slow-cache-diff-threshold)
1069        (cond ((nth 3 state) 'string)               (eq (current-buffer) (caar antlr-slow-context-cache))
1070              ((nth 4 state) 'comment)    ; block-comment? -- we don't care               (eq tick (cdar antlr-slow-context-cache)))
1071              (t (car state))))))          ;; (setq antlr-statistics-cache (1+ antlr-statistics-cache) ...)
1072            (setq state (parse-partial-sexp (cadr antlr-slow-context-cache) orig
1073                                            nil nil
1074                                            (cddr antlr-slow-context-cache)))
1075          (if (>= orig antlr-slow-cache-diff-threshold)
1076              (beginning-of-defun)
1077            (goto-char (point-min)))
1078    ;;;      (cond ((and diff (< diff 0)) (incf antlr-statistics-full-neg))
1079    ;;;         ((and diff (>= diff 3000)) (incf antlr-statistics-full-diff))
1080    ;;;         (t (incf antlr-statistics-full-other)))
1081          (setq state (parse-partial-sexp (point) orig)))
1082        (goto-char orig)
1083        (if antlr-slow-context-cache
1084            (setcdr antlr-slow-context-cache (cons orig state))
1085          (setq antlr-slow-context-cache
1086                (cons (cons (current-buffer) tick)
1087                      (cons orig state))))
1088        (cond ((nth 3 state) 'string)
1089              ((nth 4 state) 'comment)      ; block-comment? -- we don't care
1090              (t (car state)))))
1091    
1092    ;;;  (incf (aref antlr-statistics 2))
1093    ;;;  (unless (and (eq (current-buffer)
1094    ;;;                (caar antlr-slow-context-cache))
1095    ;;;            (eq (buffer-modified-tick)
1096    ;;;                (cdar antlr-slow-context-cache)))
1097    ;;;    (incf (aref antlr-statistics 1))
1098    ;;;    (setq antlr-slow-context-cache nil))
1099    ;;;  (let* ((orig (point))
1100    ;;;      (base (cadr antlr-slow-context-cache))
1101    ;;;      (curr (cddr antlr-slow-context-cache))
1102    ;;;      (state (cond ((eq orig (car curr)) (cdr curr))
1103    ;;;                   ((eq orig (car base)) (cdr base))))
1104    ;;;      diff diff2)
1105    ;;;    (unless state
1106    ;;;      (incf (aref antlr-statistics 3))
1107    ;;;      (when curr
1108    ;;;     (if (< (setq diff  (abs (- orig (car curr))))
1109    ;;;            (setq diff2 (abs (- orig (car base)))))
1110    ;;;         (setq state curr)
1111    ;;;       (setq state base
1112    ;;;             diff  diff2))
1113    ;;;     (if (or (>= (1+ diff) (point)) (>= diff 3000))
1114    ;;;         (setq state nil)))          ; start from bod/bob
1115    ;;;      (if state
1116    ;;;       (setq state
1117    ;;;             (parse-partial-sexp (car state) orig nil nil (cdr state)))
1118    ;;;     (if (>= orig 3000) (beginning-of-defun) (goto-char (point-min)))
1119    ;;;     (incf (aref antlr-statistics 4))
1120    ;;;     (setq cw (list orig (point) base curr))
1121    ;;;     (setq state (parse-partial-sexp (point) orig)))
1122    ;;;      (goto-char orig)
1123    ;;;      (if antlr-slow-context-cache
1124    ;;;       (setcdr (cdr antlr-slow-context-cache) (cons orig state))
1125    ;;;     (setq antlr-slow-context-cache
1126    ;;;           (cons (cons (current-buffer) (buffer-modified-tick))
1127    ;;;                 (cons (cons orig state) (cons orig state))))))
1128    ;;;    (cond ((nth 3 state) 'string)
1129    ;;;       ((nth 4 state) 'comment)      ; block-comment? -- we don't care
1130    ;;;       (t (car state)))))
1131    
1132    ;;;    (beginning-of-defun)
1133    ;;;    (let ((state (parse-partial-sexp (point) orig)))
1134    ;;;      (goto-char orig)
1135    ;;;      (cond ((nth 3 state) 'string)
1136    ;;;         ((nth 4 state) 'comment)    ; block-comment? -- we don't care
1137    ;;;         (t (car state))))))
1138    
1139    
1140  ;;;===========================================================================  ;;;===========================================================================
1141  ;;;  Misc functions  ;;;  Miscellaneous functions
1142  ;;;===========================================================================  ;;;===========================================================================
1143    
1144  (defun antlr-upcase-p (char)  (defun antlr-upcase-p (char)
# Line 1066  strings and actions/semantic predicates. Line 1188  strings and actions/semantic predicates.
1188  (defsubst antlr-skip-sexps (count)  (defsubst antlr-skip-sexps (count)
1189    "Skip the next COUNT balanced expressions and the comments after it.    "Skip the next COUNT balanced expressions and the comments after it.
1190  Return position before the comments after the last expression."  Return position before the comments after the last expression."
1191    (goto-char (or (antlr-scan-sexps (point) count nil t) (point-max)))    (goto-char (or (ignore-errors-x (scan-sexps (point) count)) (point-max)))
1192    (prog1 (point)    (prog1 (point)
1193      (c-forward-syntactic-ws)))      (c-forward-syntactic-ws)))
1194    
# Line 1104  See `antlr-font-lock-additional-keywords Line 1226  See `antlr-font-lock-additional-keywords
1226  IF TOKENREFS-ONLY is non-nil, just return alist with tokenref names."  IF TOKENREFS-ONLY is non-nil, just return alist with tokenref names."
1227    (let ((items nil)    (let ((items nil)
1228          (classes nil)          (classes nil)
1229          (semi (point-max)))          (continue t))
1230      ;; Using `imenu-progress-message' would require imenu for compilation --      ;; Using `imenu-progress-message' would require imenu for compilation, but
1231      ;; nobody is missing these messages...      ;; nobody is missing these messages.  The generic imenu function searches
1232        ;; backward, which is slower and more likely not to work during editing.
1233      (antlr-with-syntax-table antlr-action-syntax-table      (antlr-with-syntax-table antlr-action-syntax-table
1234        ;; We stick to the imenu standard and search backwards, although I don't        (antlr-invalidate-context-cache)
1235        ;; think this is right.  It is slower and more likely not to work during        (goto-char (point-min))
1236        ;; editing (you are more likely to add functions to the end of the file).        (antlr-skip-file-prelude t)
1237        (while semi        (while continue
         (goto-char semi)  
         (setq semi (antlr-search-backward ";"))  
         (if semi  
             (progn (forward-char) (antlr-skip-exception-part t))  
           (antlr-skip-file-prelude t))  
1238          (if (looking-at "{") (antlr-skip-sexps 1))          (if (looking-at "{") (antlr-skip-sexps 1))
1239          (if (looking-at antlr-class-header-regexp)          (if (looking-at antlr-class-header-regexp)
1240              (or tokenrefs-only              (or tokenrefs-only
# Line 1135  IF TOKENREFS-ONLY is non-nil, just retur Line 1253  IF TOKENREFS-ONLY is non-nil, just retur
1253                            (if imenu-use-markers                            (if imenu-use-markers
1254                                (copy-marker (match-beginning 0))                                (copy-marker (match-beginning 0))
1255                              (match-beginning 0)))                              (match-beginning 0)))
1256                      items))))))                      items))))
1257      (if classes (cons (cons "Classes" classes) items) items)))          (if (setq continue (antlr-search-forward ";"))
1258                (antlr-skip-exception-part t))))
1259        (if classes
1260            (cons (cons "Classes" (nreverse classes)) (nreverse items))
1261          (nreverse items))))
1262    
1263    
1264  ;;;===========================================================================  ;;;===========================================================================
# Line 1255  rule." Line 1377  rule."
1377      (antlr-with-syntax-table antlr-action-syntax-table      (antlr-with-syntax-table antlr-action-syntax-table
1378        (not (antlr-outside-rule-p)))))        (not (antlr-outside-rule-p)))))
1379    
1380  (defun antlr-end-of-rule (&optional arg)  (defunx antlr-end-of-rule (&optional arg)
1381    "Move forward to next end of rule.  Do it ARG [default: 1] many times.    "Move forward to next end of rule.  Do it ARG [default: 1] many times.
1382  A grammar class header and the file prelude are also considered as a  A grammar class header and the file prelude are also considered as a
1383  rule.  Negative argument ARG means move back to ARGth preceding end of  rule.  Negative argument ARG means move back to ARGth preceding end of
1384  rule.  If ARG is zero, run `antlr-end-of-body'."  rule.  If ARG is zero, run `antlr-end-of-body'."
1385    (interactive "p")    (interactive "_p")
1386    (if (zerop arg)    (if (zerop arg)
1387        (antlr-end-of-body)        (antlr-end-of-body)
1388      (antlr-with-syntax-table antlr-action-syntax-table      (antlr-with-syntax-table antlr-action-syntax-table
1389        (antlr-next-rule arg nil))        (antlr-next-rule arg nil))))
     (setq zmacs-region-stays t)))  
1390    
1391  (defun antlr-beginning-of-rule (&optional arg)  (defunx antlr-beginning-of-rule (&optional arg)
1392    "Move backward to preceding beginning of rule.  Do it ARG many times.    "Move backward to preceding beginning of rule.  Do it ARG many times.
1393  A grammar class header and the file prelude are also considered as a  A grammar class header and the file prelude are also considered as a
1394  rule.  Negative argument ARG means move forward to ARGth next beginning  rule.  Negative argument ARG means move forward to ARGth next beginning
1395  of rule.  If ARG is zero, run `antlr-beginning-of-body'."  of rule.  If ARG is zero, run `antlr-beginning-of-body'."
1396    (interactive "p")    (interactive "_p")
1397    (if (zerop arg)    (if (zerop arg)
1398        (antlr-beginning-of-body)        (antlr-beginning-of-body)
1399      (antlr-with-syntax-table antlr-action-syntax-table      (antlr-with-syntax-table antlr-action-syntax-table
1400        (antlr-next-rule (- arg) t))        (antlr-next-rule (- arg) t))))
     (setq zmacs-region-stays t)))  
1401    
1402  (defun antlr-end-of-body (&optional msg)  (defunx antlr-end-of-body (&optional msg)
1403    "Move to position after the `;' of the current rule.    "Move to position after the `;' of the current rule.
1404  A grammar class header is also considered as a rule.  With optional  A grammar class header is also considered as a rule.  With optional
1405  prefix arg MSG, move to `:'."  prefix arg MSG, move to `:'."
1406    (interactive)    (interactive "_")
1407    (antlr-with-syntax-table antlr-action-syntax-table    (antlr-with-syntax-table antlr-action-syntax-table
1408      (let ((orig (point)))      (let ((orig (point)))
1409        (if (antlr-outside-rule-p)        (if (antlr-outside-rule-p)
# Line 1300  prefix arg MSG, move to `:'." Line 1420  prefix arg MSG, move to `:'."
1420                            (or (antlr-search-forward ":") (point-max))))                            (or (antlr-search-forward ":") (point-max))))
1421              (goto-char orig)              (goto-char orig)
1422              (error msg))              (error msg))
1423            (c-forward-syntactic-ws)))))            (c-forward-syntactic-ws))))))
   (setq zmacs-region-stays t))  
1424    
1425  (defun antlr-beginning-of-body ()  (defunx antlr-beginning-of-body ()
1426    "Move to the first element after the `:' of the current rule."    "Move to the first element after the `:' of the current rule."
1427    (interactive)    (interactive "_")
1428    (antlr-end-of-body "Class headers and the file prelude are without `:'"))    (antlr-end-of-body "Class headers and the file prelude are without `:'"))
1429    
1430    
# Line 1342  actions if ARG is 0 or negative.  See `a Line 1461  actions if ARG is 0 or negative.  See `a
1461    
1462  Display a message unless optional argument SILENT is non-nil."  Display a message unless optional argument SILENT is non-nil."
1463    (interactive "p")    (interactive "p")
1464    ;; from Emacs/lazy-lock: `save-buffer-state'    (save-buffer-state-x
   (let ((modified (buffer-modified-p))  
         (buffer-undo-list t) (inhibit-read-only t)  
         (inhibit-point-motion-hooks t) deactivate-mark ; Emacs only  
         before-change-functions after-change-functions  
         buffer-file-name buffer-file-truename)  
1465      (if (> arg 0)      (if (> arg 0)
1466          (let ((regexp (if (= arg 1) "[]}]" "}"))          (let ((regexp (if (= arg 1) "[]}]" "}"))
1467                (diff (and antlr-action-visibility                (diff (and antlr-action-visibility
# Line 1358  Display a message unless optional argume Line 1472  Display a message unless optional argume
1472              (antlr-with-syntax-table antlr-action-syntax-table              (antlr-with-syntax-table antlr-action-syntax-table
1473                (antlr-invalidate-context-cache)                (antlr-invalidate-context-cache)
1474                (while (antlr-re-search-forward regexp nil)                (while (antlr-re-search-forward regexp nil)
1475                  (let ((beg (antlr-scan-sexps (point) -1 nil t)))                  (let ((beg (ignore-errors-x (scan-sexps (point) -1))))
1476                    (when beg                    (when beg
1477                      (if diff            ; braces are visible                      (if diff            ; braces are visible
1478                          (if (> (point) (+ beg diff))                          (if (> (point) (+ beg diff))
# Line 1379  Display a message unless optional argume Line 1493  Display a message unless optional argume
1493        (remove-text-properties (point-min) (point-max)        (remove-text-properties (point-min) (point-max)
1494                                '(invisible nil intangible nil))                                '(invisible nil intangible nil))
1495        (or silent        (or silent
1496            (message "Unhide all actions (including arguments)...done")))            (message "Unhide all actions (including arguments)...done")))))
     (and (not modified) (buffer-modified-p)  
          (set-buffer-modified-p nil))))  
1497    
1498    
1499  ;;;===========================================================================  ;;;===========================================================================
# Line 1416  Inserting an option with this command wo Line 1528  Inserting an option with this command wo
1528      according to a newly inserted language option.      according to a newly inserted language option.
1529    
1530  The name of all options with a specification for their values are stored  The name of all options with a specification for their values are stored
1531  in `antlr-options-alist'.  The used specification also depends on the  in `antlr-options-alists'.  The used specification also depends on the
1532  value of `antlr-tool-version', i.e., step 4 will warn you if you use an  value of `antlr-tool-version', i.e., step 4 will warn you if you use an
1533  option that has been introduced in newer version of ANTLR, and step 5  option that has been introduced in newer version of ANTLR, and step 5
1534  will offer completion using version-correct values.  will offer completion using version-correct values.
# Line 1515  Use prefix argument ARG to return \(LEVE Line 1627  Use prefix argument ARG to return \(LEVE
1627                        :active active))                        :active active))
1628              (sort (mapcar 'car (elt antlr-options-alists (1- level)))              (sort (mapcar 'car (elt antlr-options-alists (1- level)))
1629                    'string-lessp))))                    'string-lessp))))
1630        
1631    
1632  ;;;===========================================================================  ;;;===========================================================================
1633  ;;;  Insert option: determine section-kind  ;;;  Insert option: determine section-kind
# Line 1553  like \(AREA \. PLACE), see `antlr-option Line 1665  like \(AREA \. PLACE), see `antlr-option
1665                (cond ((null pos) 'error)                (cond ((null pos) 'error)
1666                      ((looking-at "options[ \t\n]*{")                      ((looking-at "options[ \t\n]*{")
1667                       (goto-char (match-end 0))                       (goto-char (match-end 0))
1668                       (setq pos (antlr-scan-lists (point) 1 1 nil t))                       (setq pos (ignore-errors-x (scan-lists (point) 1 1)))
1669                       (antlr-option-location orig min0 max0                       (antlr-option-location orig min0 max0
1670                                              (point)                                              (point)
1671                                              (if pos (1- pos) (point-max))                                              (if pos (1- pos) (point-max))
# Line 1636  a visible start position and (MAX-AREA . Line 1748  a visible start position and (MAX-AREA .
1748  where the beginning is preferred if WITHP is nil and the end if WITHP is  where the beginning is preferred if WITHP is nil and the end if WITHP is
1749  non-nil."  non-nil."
1750    (cons (and withp (cons min-area max-area))    (cons (and withp (cons min-area max-area))
1751          (cond ((and (<= min-area orig) (<= orig max-area))          (cond ((and (<= min-area orig) (<= orig max-area)
1752                 ;; point in options area                      (save-excursion
1753                          (goto-char orig)
1754                          (not (memq (antlr-syntactic-context)
1755                                     '(comment block-comment)))))
1756                   ;; point in options area and not in comment
1757                 (list orig))                 (list orig))
1758                ((and (null withp) (<= min-vis min-area) (<= min-area max-vis))                ((and (null withp) (<= min-vis min-area) (<= min-area max-vis))
1759                 ;; use start of options area (only if not `withp')                 ;; use start of options area (only if not `withp')
# Line 1788  For OLD, see `antlr-insert-option-do'." Line 1904  For OLD, see `antlr-insert-option-do'."
1904      ;; stuff (no =, {, } or /) at point is not followed by ";"      ;; stuff (no =, {, } or /) at point is not followed by ";"
1905      (insert ";")      (insert ";")
1906      (backward-char)))      (backward-char)))
1907            
1908  (defun antlr-insert-option-space (area old)  (defun antlr-insert-option-space (area old)
1909    "Find appropriate place to insert option, insert newlines/spaces.    "Find appropriate place to insert option, insert newlines/spaces.
1910  For AREA and OLD, see `antlr-insert-option-do'."  For AREA and OLD, see `antlr-insert-option-do'."
# Line 1808  For AREA and OLD, see `antlr-insert-opti Line 1924  For AREA and OLD, see `antlr-insert-opti
1924                   (setq orig (point))                   (setq orig (point))
1925                 (goto-char orig)))                 (goto-char orig)))
1926          (skip-chars-forward " \t")          (skip-chars-forward " \t")
1927            
1928          (if (looking-at "$\\|//")          (if (looking-at "$\\|//")
1929              ;; just comment after point => skip (+ lines w/ same col comment)              ;; just comment after point => skip (+ lines w/ same col comment)
1930              (let ((same (if (> (match-end 0) (match-beginning 0))              (let ((same (if (> (match-end 0) (match-beginning 0))
# Line 1873  table is the resulting alist of TABLE-X Line 1989  table is the resulting alist of TABLE-X
1989  TABLE can also be a function evaluation to an alist.  TABLE can also be a function evaluation to an alist.
1990    
1991  Used inside `antlr-options-alists'."  Used inside `antlr-options-alists'."
1992    (let* ((table0 (and (or table table-x)    (let* ((completion-ignore-case t)     ; dynamic
1993             (table0 (and (or table table-x)
1994                        (append table-x                        (append table-x
1995                                (if (functionp table) (funcall table) table))))                                (if (functionp table) (funcall table) table))))
1996           (input (if table0           (input (if table0
# Line 1924  Ask user \(\"y or n\"), if a C++ only op Line 2041  Ask user \(\"y or n\"), if a C++ only op
2041    
2042  Called in PHASE `before-input', see `antlr-options-alists'."  Called in PHASE `before-input', see `antlr-options-alists'."
2043    (and (eq phase 'before-input)    (and (eq phase 'before-input)
2044           (not (eq antlr-language 'c++-mode))
2045         (not (y-or-n-p (format "Insert C++ %s option? " option)))         (not (y-or-n-p (format "Insert C++ %s option? " option)))
2046         (error "Didn't insert C++ %s option with language %s"         (error "Didn't insert C++ %s option with language %s"
2047                option (cadr (assq antlr-language antlr-language-alist)))))                option (cadr (assq antlr-language antlr-language-alist)))))
# Line 1949  Each SUPER is a super-grammar class wher Line 2067  Each SUPER is a super-grammar class wher
2067  its export vocabulary is used as an import vocabulary."  its export vocabulary is used as an import vocabulary."
2068    (unless buffer-file-name    (unless buffer-file-name
2069      (error "Grammar buffer does not visit a file"))      (error "Grammar buffer does not visit a file"))
2070    (let (classes exportVocabs importVocabs superclasses default-vocab)    (let (classes export-vocabs import-vocabs superclasses default-vocab)
2071      (antlr-with-syntax-table antlr-action-syntax-table      (antlr-with-syntax-table antlr-action-syntax-table
2072        (goto-char (point-min))        (goto-char (point-min))
2073        (while (antlr-re-search-forward antlr-class-header-regexp nil)        (while (antlr-re-search-forward antlr-class-header-regexp nil)
# Line 1988  its export vocabulary is used as an impo Line 2106  its export vocabulary is used as an impo
2106            (push (cons class evocab) classes)            (push (cons class evocab) classes)
2107            ;; default export vocab is export vocab of first grammar in file:            ;; default export vocab is export vocab of first grammar in file:
2108            (or default-vocab (setq default-vocab evocab))            (or default-vocab (setq default-vocab evocab))
2109            (or (member evocab exportVocabs) (push evocab exportVocabs))            (or (member evocab export-vocabs) (push evocab export-vocabs))
2110            (or (null ivocab)            (or (null ivocab)
2111                (member ivocab importVocabs) (push ivocab importVocabs)))))                (member ivocab import-vocabs) (push ivocab import-vocabs)))))
2112      (if classes      (if classes
2113          (list* (file-name-nondirectory buffer-file-name)          (list* (file-name-nondirectory buffer-file-name)
2114                 (cons (nreverse classes) (nreverse superclasses))                 (cons (nreverse classes) (nreverse superclasses))
2115                 (cons (nreverse exportVocabs) (nreverse importVocabs))                 (cons (nreverse export-vocabs) (nreverse import-vocabs))
2116                 antlr-language))))                 antlr-language))))
2117    
2118  (defun antlr-directory-dependencies (dirname)  (defun antlr-directory-dependencies (dirname)
# Line 2088  necessary. Line 2206  necessary.
2206  Save all buffers first unless optional value SAVED is non-nil.  When  Save all buffers first unless optional value SAVED is non-nil.  When
2207  called interactively, the buffers are always saved, see also variable  called interactively, the buffers are always saved, see also variable
2208  `antlr-ask-about-save'."  `antlr-ask-about-save'."
2209    (interactive    (interactive (antlr-run-tool-interactive))
    ;; code in `interactive' is not compiled: do not use cl macros (`cdadr')  
    (let* ((supers (cdr (cadr (save-excursion  
                                (save-restriction  
                                  (widen)  
                                  (antlr-file-dependencies))))))  
           (glibs ""))  
      (when supers  
        (save-some-buffers (not antlr-ask-about-save) nil)  
        (setq glibs (car (antlr-superclasses-glibs  
                          supers  
                          (car (antlr-directory-dependencies  
                                (antlr-default-directory)))))))  
      (list (antlr-read-shell-command "Run Antlr on current file with: "  
                                      (concat antlr-tool-command glibs " "))  
            buffer-file-name  
            supers)))  
2210    (or saved (save-some-buffers (not antlr-ask-about-save)))    (or saved (save-some-buffers (not antlr-ask-about-save)))
2211    (let ((default-directory (file-name-directory file)))    (let ((default-directory (file-name-directory file)))
2212      (require 'compile)                  ; only `compile' autoload      (require 'compile)                  ; only `compile' autoload
2213      (compile-internal (concat command " " (file-name-nondirectory file))      (compile-internal (concat command " " (file-name-nondirectory file))
2214                        "No more errors" "Antlr-Run")))                        "No more errors" "Antlr-Run")))
2215    
2216    (defun antlr-run-tool-interactive ()
2217      ;; code in `interactive' is not compiled
2218      "Interactive specification for `antlr-run-tool'.
2219    Use prefix argument ARG to return \(COMMAND FILE SAVED)."
2220      (let* ((supers (cdadr (save-excursion
2221                              (save-restriction
2222                                (widen)
2223                                (antlr-file-dependencies)))))
2224             (glibs ""))
2225        (when supers
2226          (save-some-buffers (not antlr-ask-about-save) nil)
2227          (setq glibs (car (antlr-superclasses-glibs
2228                            supers
2229                            (car (antlr-directory-dependencies
2230                                  (antlr-default-directory)))))))
2231        (list (antlr-read-shell-command "Run Antlr on current file with: "
2232                                        (concat antlr-tool-command glibs " "))
2233              buffer-file-name
2234              supers)))
2235    
2236    
2237  ;;;===========================================================================  ;;;===========================================================================
2238  ;;;  Makefile creation  ;;;  Makefile creation
# Line 2230  multiplied by: Line 2352  multiplied by:
2352  Lines inside block comments are indented by `c-indent-line' according to  Lines inside block comments are indented by `c-indent-line' according to
2353  `antlr-indent-comment'.  `antlr-indent-comment'.
2354    
2355  If `antlr-language' equals to a key in `antlr-indent-at-bol-alist' and  Lines in actions except top-level actions in a header part or an option
2356  the line starting at the first non-whitespace is matched by the  area are indented by `c-indent-line'.
2357  corresponding value, indent the line at column 0.  
2358    Lines in header actions are indented at column 0 if `antlr-language'
2359    equals to a key in `antlr-indent-at-bol-alist' and the line starting at
2360    the first non-whitespace is matched by the corresponding value.
2361    
2362  For the initialization of `c-basic-offset', see `antlr-indent-style' and,  For the initialization of `c-basic-offset', see `antlr-indent-style' and,
2363  to a lesser extent, `antlr-tab-offset-alist'."  to a lesser extent, `antlr-tab-offset-alist'."
2364    (save-restriction    (save-restriction
2365      (let ((orig (point))      (let ((orig (point))
2366            (min0 (point-min))            (min0 (point-min))
2367            bol boi indent syntax)            bol boi indent syntax cc-syntax)
2368        (widen)        (widen)
2369        (beginning-of-line)        (beginning-of-line)
2370        (setq bol (point))        (setq bol (point))
# Line 2253  to a lesser extent, `antlr-tab-offset-al Line 2378  to a lesser extent, `antlr-tab-offset-al
2378          (setq syntax (antlr-syntactic-context))          (setq syntax (antlr-syntactic-context))
2379          (cond ((symbolp syntax)          (cond ((symbolp syntax)
2380                 (setq indent nil))       ; block-comments, strings, (comments)                 (setq indent nil))       ; block-comments, strings, (comments)
               ((and (assq antlr-language antlr-indent-at-bol-alist)  
                     (looking-at (cdr (assq antlr-language  
                                            antlr-indent-at-bol-alist))))  
                (setq syntax 'bol)  
                (setq indent 0))         ; indentation at 0  
2381                ((progn                ((progn
2382                   (antlr-next-rule -1 t)                   (antlr-next-rule -1 t)
2383                   (if (antlr-search-forward ":") (< boi (1- (point))) t))                   (if (antlr-search-forward ":") (< boi (1- (point))) t))
# Line 2268  to a lesser extent, `antlr-tab-offset-al Line 2388  to a lesser extent, `antlr-tab-offset-al
2388                 (forward-char)                 (forward-char)
2389                 (antlr-skip-exception-part nil)                 (antlr-skip-exception-part nil)
2390                 (setq indent (if (> (point) boi) 1 0))))) ; in exception part?                 (setq indent (if (> (point) boi) 1 0))))) ; in exception part?
2391        ;; compute the corresponding indentation and indent --------------------        ;; check whether to use indentation engine of cc-mode ------------------
2392          (antlr-invalidate-context-cache)
2393          (goto-char boi)
2394          (when (and indent (> syntax 0))
2395            (cond ((> syntax 1)             ; block in action => use cc-mode
2396                   (setq indent nil))
2397                  ((and (= indent 0)
2398                        (assq antlr-language antlr-indent-at-bol-alist)
2399                        (looking-at (cdr (assq antlr-language
2400                                               antlr-indent-at-bol-alist))))
2401                   (setq syntax 'bol))
2402                  ((setq cc-syntax (c-guess-basic-syntax))
2403                   (let ((cc cc-syntax) symbol)
2404                     (while (setq symbol (pop cc))
2405                       (when (cdr symbol)
2406                         (or (memq (car symbol)
2407                                   antlr-disabling-cc-syntactic-symbols)
2408                             (setq indent nil))
2409                         (setq cc nil)))))))
2410    ;;;             ((= indent 1)           ; exception part => use cc-mode
2411    ;;;              (setq indent nil))
2412    ;;;             ((save-restriction      ; not in option part => cc-mode
2413    ;;;                (goto-char (scan-lists (point) -1 1))
2414    ;;;                (skip-chars-backward " \t\n")
2415    ;;;                (narrow-to-region (point-min) (point))
2416    ;;;                (not (re-search-backward "\\<options\\'" nil t)))
2417    ;;;              (setq indent nil)))))
2418            ;; compute the corresponding indentation and indent --------------------
2419        (if (null indent)        (if (null indent)
2420            ;; Use the indentation engine of cc-mode for block comments.  Using            ;; Use the indentation engine of cc-mode
           ;; it-mode for actions is not easy, especially if the actions come  
           ;; early in the rule body.  
2421            (progn            (progn
2422              (goto-char orig)              (goto-char orig)
2423              (and (eq antlr-indent-comment t)              (if (or (numberp syntax)
2424                   (not (eq syntax 'string))                      (if (eq syntax 'string) nil (eq antlr-indent-comment t)))
2425                   (c-indent-line)))                  (c-indent-line cc-syntax)))
2426          ;; do it ourselves          ;; do it ourselves
2427          (goto-char boi)          (goto-char boi)
2428          (unless (symbolp syntax)                ; direct indentation          (unless (symbolp syntax)                ; direct indentation
2429            (antlr-invalidate-context-cache)            ;;(antlr-invalidate-context-cache)
2430            (incf indent (antlr-syntactic-context))            (incf indent (antlr-syntactic-context))
2431            (and (> indent 0) (looking-at antlr-indent-item-regexp) (decf indent))            (and (> indent 0) (looking-at antlr-indent-item-regexp) (decf indent))
2432            (setq indent (* indent c-basic-offset)))            (setq indent (* indent c-basic-offset)))
# Line 2382  ANTLR's syntax and influences the auto i Line 2527  ANTLR's syntax and influences the auto i
2527          comment-line-break-function 'c-comment-line-break-function          comment-line-break-function 'c-comment-line-break-function
2528          adaptive-fill-regexp nil          adaptive-fill-regexp nil
2529          adaptive-fill-mode nil)          adaptive-fill-mode nil)
2530      (c-set-style (or antlr-indent-style "gnu"))
2531      (and (boundp 'c-current-comment-prefix) (boundp 'c-comment-prefix-regexp)
2532           (setq c-current-comment-prefix
2533                 (if (listp c-comment-prefix-regexp)
2534                     (cdr-safe (or (assoc major-mode c-comment-prefix-regexp)
2535                                   (assoc 'other c-comment-prefix-regexp)))
2536                   c-comment-prefix-regexp)))
2537    ;; we have to do something special for c-offsets-alist so that the    ;; we have to do something special for c-offsets-alist so that the
2538    ;; buffer local value has its own alist structure.    ;; buffer local value has its own alist structure.
2539    (setq c-offsets-alist (copy-alist c-offsets-alist))    (setq c-offsets-alist (copy-alist c-offsets-alist))
# Line 2403  the default language." Line 2555  the default language."
2555                      (match-string 1)))                      (match-string 1)))
2556          (seq antlr-language-alist)          (seq antlr-language-alist)
2557          r)          r)
2558      ;; Like (find-VALUE antlr-language-alist :key 'cddr :test 'member)      ;; Like (find VALUE antlr-language-alist :key 'cddr :test 'member)
2559      (while seq      (while seq
2560        (setq r (pop seq))        (setq r (pop seq))
2561        (if (member value (cddr r))        (if (member value (cddr r))
# Line 2417  the default language." Line 2569  the default language."
2569    "Major mode for editing ANTLR grammar files.    "Major mode for editing ANTLR grammar files.
2570  \\{antlr-mode-map}"  \\{antlr-mode-map}"
2571    (interactive)    (interactive)
2572    (c-initialize-cc-mode)                ; for java syntax table    (c-initialize-cc-mode)                ; required when depending on cc-mode
2573    (kill-all-local-variables)    (kill-all-local-variables)
2574    ;; ANTLR specific ----------------------------------------------------------    ;; ANTLR specific ----------------------------------------------------------
2575    (setq major-mode 'antlr-mode    (setq major-mode 'antlr-mode
# Line 2448  the default language." Line 2600  the default language."
2600    (antlr-c-common-init)    (antlr-c-common-init)
2601    (setq indent-line-function 'antlr-indent-line    (setq indent-line-function 'antlr-indent-line
2602          indent-region-function nil)     ; too lazy          indent-region-function nil)     ; too lazy
2603      (setq c-buffer-is-cc-mode antlr-language)
2604      (if (fboundp 'c-init-language-vars)
2605          (c-init-language-vars)            ; cc-mode >= v5.29
2606        (let ((settings                     ; (cdr '(setq...)) will be optimized
2607               (if (eq antlr-language 'c++-mode)
2608                   (cdr '(setq              ;' from `c++-mode' v5.20, v5.28
2609                          c-keywords (c-identifier-re c-C++-keywords)
2610                          c-conditional-key c-C++-conditional-key
2611                          c-comment-start-regexp c-C++-comment-start-regexp
2612                          c-class-key c-C++-class-key
2613                          c-extra-toplevel-key c-C++-extra-toplevel-key
2614                          c-access-key c-C++-access-key
2615                          c-recognize-knr-p nil
2616                          c-bitfield-key c-C-bitfield-key ; v5.28
2617                          ))
2618                 (cdr '(setq                ; from `java-mode' v5.20, v5.28
2619                        c-keywords (c-identifier-re c-Java-keywords)
2620                        c-conditional-key c-Java-conditional-key
2621                        c-comment-start-regexp c-Java-comment-start-regexp
2622                        c-class-key c-Java-class-key
2623                        c-method-key nil
2624                        c-baseclass-key nil
2625                        c-recognize-knr-p nil
2626                        c-access-key c-Java-access-key ; v5.20
2627                        c-inexpr-class-key c-Java-inexpr-class-key ; v5.28
2628                        )))))
2629          (while settings
2630            (when (boundp (car settings))
2631              (ignore-errors
2632                (set (car settings) (eval (cadr settings)))))
2633            (setq settings (cddr settings)))))
2634    (setq comment-start "// "    (setq comment-start "// "
2635          comment-end "")          comment-end "")
   (c-set-style "java")  
   (if (eq antlr-language 'c++-mode)  
       (setq c-conditional-key c-C++-conditional-key  
             c-comment-start-regexp c-C++-comment-start-regexp  
             c-class-key c-C++-class-key  
             c-extra-toplevel-key c-C++-extra-toplevel-key  
             c-access-key c-C++-access-key  
             c-recognize-knr-p nil)  
     (setq c-conditional-key c-Java-conditional-key  
           c-comment-start-regexp c-Java-comment-start-regexp  
           c-class-key c-Java-class-key  
           c-method-key nil  
           c-baseclass-key nil  
           c-recognize-knr-p nil  
           c-access-key (and (boundp 'c-Java-access-key) c-Java-access-key))  
     (and (boundp 'c-inexpr-class-key) (boundp 'c-Java-inexpr-class-key)  
          (setq c-inexpr-class-key c-Java-inexpr-class-key)))  
2636    ;; various -----------------------------------------------------------------    ;; various -----------------------------------------------------------------
2637    (make-local-variable 'font-lock-defaults)    (make-local-variable 'font-lock-defaults)
2638    (setq font-lock-defaults antlr-font-lock-defaults)    (setq font-lock-defaults antlr-font-lock-defaults)
# Line 2502  Used in `antlr-mode'.  Also a useful fun Line 2668  Used in `antlr-mode'.  Also a useful fun
2668                       indent-tabs-mode (cadddr elem)                       indent-tabs-mode (cadddr elem)
2669                       alist nil))))))                       alist nil))))))
2670    
2671  ; LocalWords:  antlr ANother ANTLR's Cpp Lexer TreeParser esp refs VALUEs ea ee  ;;; Local IspellPersDict: .ispell_antlr
 ; LocalWords:  Java's Nomencl ruledef tokendef ruleref tokenref setType ader ev  
 ; LocalWords:  ivate syntab lexer treeparser lic rotected rivate bor boi AFAIK  
 ; LocalWords:  slist knr inexpr unhide jit GENS SEP GEN sTokenTypes hpp cpp DEP  
 ; LocalWords:  VOCAB EVOCAB Antlr's TokenTypes exportVocab incl excl SUPERS gen  
 ; LocalWords:  VOCABS IVOCAB exportVocabs importVocabs superclasses vocab kens  
 ; LocalWords:  sclass evocab ivocab importVocab deps glibs supers sep dep lang  
 ; LocalWords:  htmlize subrule jde Sather sather eiffel SGML's XYYZZ namespace  
 ; LocalWords:  mangleLiteralPrefix namespaceStd namespaceAntlr genHashLines AST  
 ; LocalWords:  testLiterals defaultErrorHandler codeGenMakeSwitchThreshold XXX  
 ; LocalWords:  codeGenBitsetTestThreshold bitset analyzerDebug codeGenDebug boc  
 ; LocalWords:  buildAST ASTLabelType charVocabulary caseSensitive autoTokenDef  
 ; LocalWords:  caseSensitiveLiterals classHeaderSuffix keywordsMeltTo NAMEs LL  
 ; LocalWords:  warnWhenFollowAmbig generateAmbigWarnings ARGs tokenrefs withp  
 ; LocalWords:  outsidep existsp JOR sert endif se ndef mport nclude pragma LE  
 ; LocalWords:  TION ASE RSION OMPT ava serting VEL mparison AMMAR  
   
2672  ;;; antlr-mode.el ends here  ;;; antlr-mode.el ends here

Legend:
Removed from v.1.12  
changed lines
  Added in v.1.12.4.1

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26