; XEmacs mode for Vera
; $Id: vera-mode.el,v 1.1 2000/03/04 18:35:48 earl Exp $

(put 'vera-mode 'font-lock-defaults
     '((vera-font-lock-keywords
	vera-font-lock-keywords
	vera-font-lock-keywords
	vera-font-lock-keywords)
       nil nil ((?_ . "w") (?~ . "w")) beginning-of-defun))

(require 'cc-mode)

(defun vera-mode ()
  "Major mode for editing Vera code.

To see what version of CC Mode you are running, enter `\\[c-version]'.

The hook variable `vera-mode-hook' is run with no args, if that
variable is bound and has a non-nil value.  Also the hook
`c-mode-common-hook' is run first.

Key bindings:
\\{c++-mode-map}"
  (interactive)
  (c-initialize-cc-mode)
  (kill-all-local-variables)
  (set-syntax-table vera-mode-syntax-table)
  (setq major-mode 'vera-mode
	mode-name "Vera")
  (use-local-map c++-mode-map)
  (c-common-init)
  (setq comment-start "// "
	comment-end ""
	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
	imenu-generic-expression cc-imenu-c++-generic-expression
	imenu-case-fold-search nil
	)
  (run-hooks 'c-mode-common-hook)
  (run-hooks 'c++-mode-hook)
  (c-update-modeline))

(defvar vera-font-lock-keywords
  '("\\<\\(all\\|CLOCK\\|any\\|assoc_index\\|assoc_size\\|async\\|bad_brans\\|bad_state\\|begin\\|big_endian\\|bind\\|bind_var\\|bit\\|bit_normal\\|bit_reverse\\|break\\|breakpoint\\|case\\|casex\\|casez\\|class\\|constraint\\|continue\\|coverage\\|coverage_block\\|coverage_def\\|coverage_depth\\|coverage_goal\\|coverage_option\\|coverage_val\\|default\\|depth\\|dist\\|else\\|end\\|enum\\|event\\|exhaustive\\|export\\|extends\\|extern\\|for\\|fork\\|function\\|if\\|illegal_self_transition\\|illegal_state\\|illegal_transition\\|in\\|inout\\|input\\|integer\\|interface\\|invisible\\|join\\|little_endian\\|local\\|m_bad_state\\|m_bad_trans\\|m_state\\|m_trans\\|negedge\\|new\\|newcov\\|non_rand\\|none\\|not\\|null\\|or\\|ordered\\|output\\|packed\\|port\\|posedge\\|prod\\|prodget\\|prodset\\|program\\|protected\\|public\\|rand\\|randc\\|randcase\\|randseq\\|repeat\\|req\\|return\\|shadow\\|soft\\|state\\|static\\|string\\|string\\|super\\|task\\|terminate\\|this\\|trans\\|typedef!
!
\\|unpacked\\|var\\|vca\\|vector\\|verilog_node\\|verilog_task\\|vhdl_node\\|vhdl_task\\|virtual\\|visible\\|void\\|while\\|with\\)\\>"
    )
  "Vera keywords for font-lock")

(defvar vera-mode-syntax-table nil
  "Syntax table used in vera-mode buffers.")
(if vera-mode-syntax-table
    ()
  (setq vera-mode-syntax-table (make-syntax-table))
  (c-populate-syntax-table vera-mode-syntax-table)
  (modify-syntax-entry ?\' "." vera-mode-syntax-table)
  ;; TBD: does it make sense for colon to be symbol class in vera?
  ;; I'm not so sure, since c-label-key is busted on lines like:
  ;; Foo::bar( i );
  ;; maybe c-label-key should be fixed instead of commenting this out,
  ;; but it also bothers me that this only seems appropriate for vera
  ;; and not C.
  ;;(modify-syntax-entry ?: "_" vera-mode-syntax-table)
  )

(provide 'vera)

