File: antlr-mode.el.html
The Emacs package ANTLR-Mode provides: syntax highlighting for ANTLR grammar files, automatic indentation, menus containing rule/token definitions and supported options and various other things like running ANTLR from within Emacs. It works for ANTLR v2, v3 and v4.
For details, check <https://antlr-mode.sourceforge.net/> or, if you prefer
the manual style, follow all commands mentioned in the documentation of
antlr-mode. ANTLR is a LL(k)-based recognition tool which generates
lexers, parsers and tree transformers in Java, C++ or other languages and
can be found at <https://www.antlr.org/>.
Topics for 3.2 or later:
* Special support for indent-region: faster and better for Python ELP
profiling in a class init action shows half the time is spent in
antlr-next-rule, the other half in c-guess-basic-syntax.
Do not define a indent command, just a function to be put into
indent-line/region-function.
* In v4, highlight lexer commands after "->"
* Test: in antlr-imenu-create-index-function, can we use
(or antlr-skip-line-regexp antlr-grammar-header-regexp)
* Use native menu bindings instead easymenu (and use :help)
* Support v4 rule element options
* Define minor mode for antlr-hide-actions functionality.
* [C-c C-u]. *Help* for current rule / all rules: used-By list (at least
for single-file grammars)
* [C-c C-j]. Jump to generated coding.
Eventually:
* Support for one of the multi-mode imenu extensions mentioned in
https://www.emacswiki.org/emacs-test/ImenuMode - if necessary
* [C-c C-w]. Produce HTML document with syntax highlighted and
hyper-links. With htmfontify: invisible actions did not really work
(only w/o spaces?, default invisible would be better anyway) - we need to
set <a> tags afterwards ourselves... Firefox does not understand
encoding via XML declaration - use HTML meta tag.
* Support for outline-minor-mode.
The following topics and suggestions are unlikely to be implemented:
* Some constructs of languages (in actions) which are highly un-C-ish might
bring Emacs (and ANTLR!) out of sync: e.g. regexp literals in Perl,
character and percent literals in Ruby.
* Faster syntax highlighting: sectionize the buffer into Antlr and action
code and run special highlighting functions on these regions. UNLIKELY
due to: code size, this mode would depend on font-lock internals.
* Set the syntax-table of the inner mode before calling the indentation
engine of the inner mode (possible? - BUT: actions should still end at
the same place!). Probably not worth the effort.
Bug fixes, bug reports, improvements, and suggestions for the newest version are strongly appreciated.
Defined variables (134)
antlr-action-font-lock-keywords | Font Lock keywords used for the actions in the grammar. |
antlr-action-mode | Major-mode for code in actions of the grammar. |
antlr-action-names | Valid ANTLR action names. |
antlr-action-scope-names | Valid ANTLR action scope names. |
antlr-action-visibility | Visibility of actions when command ‘antlr-hide-actions’ is used. |
antlr-ask-about-save | If not nil, M-x antlr-run-tool asks which buffers to save. |
antlr-base-offset-alist | Influence the rule indentation of ‘antlr-indent-line’. |
antlr-c-action-font-lock-keywords | Value for ‘antlr-action-font-lock-keywords’ when using language ‘antlr-c’. |
antlr-c-action-mode | Value for ‘antlr-action-mode’ when using language ‘antlr-c’. |
antlr-c-init-cc-mode | Value for ‘antlr-init-cc-mode’ when using language ‘antlr-c’. |
antlr-c-language-mode-name | Value for ‘antlr-language-mode-name’ when using language ‘antlr-c’. |
antlr-compilation-error-regexp-alist | If non-nil, used instead ‘compilation-error-regexp-alist’‘. |
antlr-compilation-mode | Mode used for compile output of M-x antlr-run-tool. |
antlr-cpp-action-font-lock-keywords | Value for ‘antlr-action-font-lock-keywords’ when using language ‘antlr-cpp’. |
antlr-cpp-action-mode | Value for ‘antlr-action-mode’ when using language ‘antlr-cpp’. |
antlr-cpp-init-cc-mode | Value for ‘antlr-init-cc-mode’ when using language ‘antlr-cpp’. |
antlr-cpp-language-mode-name | Value for ‘antlr-language-mode-name’ when using language ‘antlr-cpp’. |
antlr-delayed-mode-hook | Hook run after entering Antlr mode or a derived mode. |
antlr-delphi-action-font-lock-keywords | Value for ‘antlr-action-font-lock-keywords’ when using language ‘antlr-delphi’. |
antlr-delphi-action-mode | Value for ‘antlr-action-mode’ when using language ‘antlr-delphi’. |
antlr-delphi-indent-action-line | Value for ‘antlr-indent-action-line’ when using language ‘antlr-delphi’. |
antlr-delphi-init-submode | Value for ‘antlr-init-submode’ when using language ‘antlr-delphi’. |
antlr-delphi-language-mode-name | Value for ‘antlr-language-mode-name’ when using language ‘antlr-delphi’. |
antlr-disabling-cc-syntactic-symbols | CC Mode syntactic context symbols adopting the indentation by CC Mode. |
antlr-do-syntax-propertize | Whether M-x antlr-mode runs ‘syntax-propertize’ on the complete buffer. |
antlr-end-of-defun-is-next | Non-nil, if rule movement commands normally jump to beginning of rule. |
antlr-file-formats-alist | Language dependent formats which specify generated files. |
antlr-font-lock-additional-keywords | Early font-lock keywords for ANTLR’s normal grammar code. |
antlr-font-lock-attribute-regexp | Regexp matching attributes within actions with special syntax highlighting. |
antlr-font-lock-defaults | Font-lock defaults used for ANTLR syntax highlighting. |
antlr-font-lock-late-keywords | Late font-lock keywords for ANTLR’s normal grammar code. |
antlr-font-lock-literal-regexp | Regexp matching literals with special syntax highlighting, or nil. |
antlr-font-lock-maximum-decoration | The maximum decoration level for fontifying actions. |
antlr-font-lock-negation-regexp | Regexp whose first regexp group matches negation. |
antlr-font-lock-symbol-regexp | Regexp matching symbol declarations in the grammar, or nil. |
antlr-font-lock-syntax-spec | Specification for highlighting syntax symbols for AST creation: !, ^, ->. |
antlr-grammar-file | Grammar file processed in *compilation* buffer. |
antlr-grammar-header-regexp | Regexp matching class headers. |
antlr-help-rules-intro | Introduction to use with M-x antlr-show-makefile-rules. |
antlr-help-unknown-file-text | String indicating the existence of unknown files in the Makefile. |
antlr-imenu-name | Non-nil, if a "Index" menu should be added to the menubar. |
antlr-indent-action-line | Function which indents the current line in actions. |
antlr-indent-at-bol-alist | Alist of regexps matching lines are indented at column 0. |
antlr-indent-comment | Non-nil, if the indentation should touch lines in block comments. |
antlr-indent-item-regexp | Regexp matching lines which should be indented by one TAB less. |
antlr-indent-style | If non-nil, cc-mode indentation style used for ‘antlr-mode’. |
antlr-init-cc-mode | Major-mode used to initialize the language variables of CC Mode. |
antlr-init-submode | Function used to initialize the action language. |
antlr-java-action-font-lock-keywords | Value for ‘antlr-action-font-lock-keywords’ when using language ‘antlr-java’. |
antlr-java-action-mode | Value for ‘antlr-action-mode’ when using language ‘antlr-java’. |
antlr-java-action-names | Valid ANTLR action names in Java. |
antlr-java-init-cc-mode | Value for ‘antlr-init-cc-mode’ when using language ‘antlr-java’. |
antlr-java-language-mode-name | Value for ‘antlr-language-mode-name’ when using language ‘antlr-java’. |
antlr-js-action-font-lock-keywords | Value for ‘antlr-action-font-lock-keywords’ when using language ‘antlr-js’. |
antlr-js-action-mode | Value for ‘antlr-action-mode’ when using language ‘antlr-js’. |
antlr-js-indent-action-line | Value for ‘antlr-indent-action-line’ when using language ‘antlr-js’. |
antlr-js-init-submode | Value for ‘antlr-init-submode’ when using language ‘antlr-js’. |
antlr-js-language-mode-name | Value for ‘antlr-language-mode-name’ when using language ‘antlr-js’. |
antlr-language | Major mode corresponding to ANTLR’s "language" option. |
antlr-language-alist | List of ANTLR’s supported languages. Variable is UNUSED. |
antlr-language-limit-n-regexp | Used to set a reasonable value for ‘antlr-language’. |
antlr-language-list | Alist of supported action languages. |
antlr-language-mode-name | The second part of the mode name used in the mode line. |
antlr-language-variables | List of variables which have a language-dependent value. |
antlr-makefile-specification | Variable to specify the appearance of the generated makefile rules. |
antlr-mode-abbrev-table | Abbreviation table used in ‘antlr-mode’ buffers. |
antlr-mode-hook | Hook called by ‘antlr-mode’. |
antlr-mode-map | Keymap used in ‘antlr-mode’ buffers. |
antlr-mode-menu | Major mode menu. |
antlr-mode-syntax-table | Syntax table used in ‘antlr-mode’ buffers. |
antlr-no-action-keywords | Empty font-lock keywords for actions. |
antlr-obj-init-cc-mode | Value for ‘antlr-init-cc-mode’ when using language ‘antlr-objc’. |
antlr-objc-action-font-lock-keywords | Value for ‘antlr-action-font-lock-keywords’ when using language ‘antlr-objc’. |
antlr-objc-action-mode | Value for ‘antlr-action-mode’ when using language ‘antlr-objc’. |
antlr-objc-language-mode-name | Value for ‘antlr-language-mode-name’ when using language ‘antlr-objc’. |
antlr-options-alists | Definitions for Antlr’s options of all four different kinds. |
antlr-options-assign-string | String containing ‘=’ to use between option name and value. |
antlr-options-auto-colon | Non-nil, if ‘:’ is inserted with a rule or subrule options section. |
antlr-options-headings | Headings for the four different option kinds. |
antlr-options-push-mark | Non-nil, if inserting an option should set & push mark. |
antlr-options-style | Obsolete user option. |
antlr-options-use-submenus | Non-nil, if the major mode menu should include option submenus. |
antlr-python-action-font-lock-keywords | Value for ‘antlr-action-font-lock-keywords’ when using language ‘antlr-python’. |
antlr-python-action-mode | Value for ‘antlr-action-mode’ when using language ‘antlr-python’. |
antlr-python-indent-action-line | Value for ‘antlr-indent-action-line’ when using language ‘antlr-python’. |
antlr-python-init-submode | Value for ‘antlr-init-submode’ when using language ‘antlr-python’. |
antlr-python-language-mode-name | Value for ‘antlr-language-mode-name’ when using language ‘antlr-python’. |
antlr-ruby-action-font-lock-keywords | Value for ‘antlr-action-font-lock-keywords’ when using language ‘antlr-ruby’. |
antlr-ruby-action-mode | Value for ‘antlr-action-mode’ when using language ‘antlr-ruby’. |
antlr-ruby-indent-action-line | Value for ‘antlr-indent-action-line’ when using language ‘antlr-ruby’. |
antlr-ruby-init-submode | Value for ‘antlr-init-submode’ when using language ‘antlr-ruby’. |
antlr-ruby-language-mode-name | Value for ‘antlr-language-mode-name’ when using language ‘antlr-ruby’. |
antlr-rule-body-start-op | Single-character string which starts the rule body. |
antlr-rule-postlude-skip-alist | Alist of keywords after the ’;’ which still belong to the grammar rule. |
antlr-rule-postlude-skip-alist--const | Constant for ‘antlr-rule-postlude-skip-alist’. |
antlr-rule-postlude-skip-regexp | Regexp matching things after ’;’ which still belong to the grammar rule. |
antlr-ruleref-assign-regexp | Regexp matching rule references or their optional labels. |
antlr-run-tool-on-buffer-file | Non-nil, if M-x antlr-run-tool runs on the file for the current buffer. |
antlr-skip-line-regexp | Regexp matching special declarations after the grammar header. |
antlr-special-file-formats | Language independent formats which specify generated files. |
antlr-syntax-propertize | Specification used to apply \+‘syntax-table’ text properties. |
antlr-tab-offset-alist | Alist to determine whether to use ANTLR’s convention for TABs. |
antlr-token-identifier-p | Function for syntax highlighting to distinguish token refs from rule refs. |
antlr-tool-command | Command used in M-x antlr-run-tool to run the Antlr tool. |
antlr-tool-mode-name | The first part of the mode name used in the mode line. |
antlr-tool-path | Extra settings for environment variables $PATH and $LD_LIBRARY_PATH. |
antlr-tool-version | The version symbol of the Antlr tool. DO NOT CUSTOMIZE. |
antlr-tool-version-variables | List of variables which have a tool-dependent value. |
antlr-unknown-file-formats | Formats which specify the names of unknown files. |
antlr-v2-grammar-header-regexp | Value for ‘antlr-grammar-header-regexp’ when using ANTLR v2. |
antlr-v2-language-list | Value for ‘antlr-language-list’ when using ANTLR v2. |
antlr-v2-options-alists | Value for ‘antlr-options-alist’ when using ANTLR v2. |
antlr-v2-ruleref-assign-regexp | Value for ‘antlr-ruleref-assign-regexp’ when using ANTLR v2. |
antlr-v2-syntax-propertize | Value for ‘antlr-syntax-propertize’ when using ANTLR v2. |
antlr-v2-tool-command | Command used in M-x antlr-run-tool to run the Antlr tool. |
antlr-v2-tool-mode-name | Value for ‘antlr-tool-mode-name’ when using ANTLR v2. |
antlr-v3-font-lock-symbol-regexp | Value for ‘antlr-font-lock-symbol-regexp’ when using ANTLR v3. |
antlr-v3-language-list | Value for ‘antlr-language-list’ when using ANTLR v3. |
antlr-v3-options-alists | Value for ‘antlr-options-alists’ when using ANTLR v3. |
antlr-v3-skip-line-regexp | Value for ‘antlr-skip-line-regexp’ when using ANTLR v3. |
antlr-v3-syntax-propertize | Value for ‘antlr-syntax-propertize’ when using ANTLR v3. |
antlr-v3-tool-command | Command used in M-x antlr-run-tool to run the Antlr tool. |
antlr-v3-tool-mode-name | Value for ‘antlr-tool-mode-name’ when using ANTLR v3. |
antlr-v4-compilation-error-regexp-alist | Value for ‘antlr-compilation-error-regexp-alist’ when using ANTLR v4. |
antlr-v4-font-lock-symbol-regexp | Value for ‘antlr-font-lock-symbol-regexp’ when using ANTLR v4. |
antlr-v4-language-list | Value for ‘antlr-language-list’ when using ANTLR v4. |
antlr-v4-mode-hook | Hook run after entering ‘antlr-v4-mode’. |
antlr-v4-mode-map | Keymap for ‘antlr-v4-mode’. |
antlr-v4-options-alists | Value for ‘antlr-options-alists’ when using ANTLR v4. |
antlr-v4-skip-line-regexp | Value for ‘antlr-skip-line-regexp’ when using ANTLR v4. |
antlr-v4-syntax-propertize | Value for ‘antlr-syntax-propertize’ when using ANTLR v4. |
antlr-v4-tool-command | Command used in M-x antlr-run-tool to run the Antlr tool. |
antlr-v4-tool-mode-name | Value for ‘antlr-tool-mode-name’ when using ANTLR v4. |
antlr-version | ANTLR major mode version number. |
Defined functions (74)
Defined faces (11)
antlr-action | ANTLR action names: @ActionName, @ActionScope::ActionName. |
antlr-attribute | ANTLR references to attributes within actions. |
antlr-default | Face to prevent strings from language dependent highlighting. Do not change. |
antlr-keyword | ANTLR keywords. |
antlr-literal | ANTLR special literal tokens. It is used to highlight strings matched by the first regexp group of ‘antlr-font-lock-literal-regexp’. |
antlr-ruledef | ANTLR parser and treeparser rule symbols (definition). |
antlr-ruleref | ANTLR parser and treeparser rule symbols (usage). |
antlr-symbol | ANTLR symbols (definition and usage) for things other than rules. Used for grammars, v3 scopes and v4 modes. |
antlr-syntax | ANTLR syntax symbols for AST creation: !, ^, ->. |
antlr-tokendef | ANTLR scanner rule symbols (definition). |
antlr-tokenref | ANTLR scanner rule symbols (usage). |