template.el 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. ;;; srecode/template.el --- SRecoder template language parser support.
  2. ;; Copyright (C) 2005, 2007-2012 Free Software Foundation, Inc.
  3. ;; This file is part of GNU Emacs.
  4. ;; GNU Emacs is free software: you can redistribute it and/or modify
  5. ;; it under the terms of the GNU General Public License as published by
  6. ;; the Free Software Foundation, either version 3 of the License, or
  7. ;; (at your option) any later version.
  8. ;; GNU Emacs is distributed in the hope that it will be useful,
  9. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. ;; GNU General Public License for more details.
  12. ;; You should have received a copy of the GNU General Public License
  13. ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
  14. ;;; Commentary:
  15. ;;
  16. ;; Parser setup for the semantic recoder template parser.
  17. ;;; Code:
  18. (require 'semantic)
  19. (require 'semantic/ctxt)
  20. (require 'semantic/wisent)
  21. (require 'srecode/srt-wy)
  22. (define-mode-local-override semantic-tag-components
  23. srecode-template-mode (tag)
  24. "Return sectiondictionary tags."
  25. (when (semantic-tag-of-class-p tag 'function)
  26. (let ((dicts (semantic-tag-get-attribute tag :dictionaries))
  27. (ans nil))
  28. (while dicts
  29. (setq ans (append ans (cdr (car dicts))))
  30. (setq dicts (cdr dicts)))
  31. ans)
  32. ))
  33. ;; In semantic-imenu.el, not part of Emacs.
  34. (defvar semantic-imenu-summary-function)
  35. ;;;###autoload
  36. (defun srecode-template-setup-parser ()
  37. "Setup buffer for parse."
  38. (srecode-template-wy--install-parser)
  39. (setq
  40. ;; Lexical Analysis
  41. semantic-lex-analyzer 'wisent-srecode-template-lexer
  42. ;; Parsing
  43. ;; Environment
  44. semantic-imenu-summary-function 'semantic-format-tag-name
  45. imenu-create-index-function 'semantic-create-imenu-index
  46. semantic-command-separation-character "\n"
  47. semantic-lex-comment-regex ";;"
  48. ;; Speedbar
  49. semantic-symbol->name-assoc-list
  50. '((function . "Template")
  51. (variable . "Variable")
  52. )
  53. ;; Navigation
  54. senator-step-at-tag-classes '(function variable)
  55. ))
  56. (provide 'srecode/template)
  57. ;; Local variables:
  58. ;; generated-autoload-file: "loaddefs.el"
  59. ;; generated-autoload-load-name: "srecode/template"
  60. ;; End:
  61. ;;; srecode/template.el ends here