Skip to content

ensure we do at least what these simple lexc/twol/xfst modes do #3

@unhammer

Description

@unhammer
;; lexc
;; ;;;;

; lexc-mode-el -- Major mode for editing LEXC files

; Author: W.P. McNeill <billmcn@u.washington.edu>
; Created: 7 November 2004
; Keywords: LEXC major-mode

; This was based on an emacs mode authoring tutorial located here:
; http://two-wugs.net/emacs/mode-tutorial.html



; Hook for overriding the functions defined in this file
(defvar lexc-mode-hook nil)

; Associate .lexc extension with this mode.
(add-to-list 'auto-mode-alist '("\\.lexc\\'" . lexc-mode))
(add-to-list 'auto-mode-alist '("\\-lex.txt\\'" . lexc-mode))
(add-to-list 'auto-mode-alist '("\\-morph.txt\\'" . lexc-mode))

; Keywords for syntax highlighting
(defconst lexc-font-lock-keywords
  (list
   '("\\<\\(Multichar_Symbols\\)\\>" . font-lock-keyword-face)
   '("\\<\\(LEXICON\\)\\>" . font-lock-function-name-face))
  "Highlighting expressions for LEXC mode.")

; Define syntactic constituents
(defvar lexc-mode-syntax-table
  (let ((lexc-mode-syntax-table (make-syntax-table)))
    ; The ! character is the comment delimiter
    (modify-syntax-entry ?!  "<" lexc-mode-syntax-table)
    (modify-syntax-entry ?\n ">" lexc-mode-syntax-table)
    lexc-mode-syntax-table)
  "Syntax table for lexc-mode")

; Entry function called by emacs  
(defun lexc-mode ()
  (interactive)
  (kill-all-local-variables)
  ; Define syntactic constituents
  (set-syntax-table lexc-mode-syntax-table)
  ; Set up font-lock
  (set (make-local-variable 'font-lock-defaults) '(lexc-font-lock-keywords))
  ; Register our indentation function
  (setq major-mode 'lexc-mode)
  (setq mode-name "LEXC")
  (run-hooks 'lexc-mode-hook))

; Expose this mode to the emacs environment
(provide 'lexc-mode)




;; xfst
;; ;;;;



; xfst-mode-el -- Major mode for editing XFST files

; Author: W.P. McNeill <billmcn@u.washington.edu>
; Created: 7 November 2004
; Keywords: XFST major-mode

; This was based on an emacs mode authoring tutorial located here:
; http://two-wugs.net/emacs/mode-tutorial.html



; Hook for overriding the functions defined in this file
(defvar xfst-mode-hook nil)

; Associate .xfst extension with this mode.
(add-to-list 'auto-mode-alist '("\\.xfst\\'" . xfst-mode))
(add-to-list 'auto-mode-alist '("\\.-xfst.txt\\'" . xfst-mode))

; Keywords for syntax highlighting
(defconst xfst-font-lock-keywords
  (list
   '("\\<\\(define\\|read\\|save\\|clear\\|regex\\|stack\\)\\>" . font-lock-keyword-face)
   '() )
  "Highlighting expressions for XFST mode.")

; Define syntactic constituents
(defvar xfst-mode-syntax-table
  (let ((xfst-mode-syntax-table (make-syntax-table)))
    ; The ! character is the comment delimiter
    (modify-syntax-entry ?!  "<" xfst-mode-syntax-table)
    (modify-syntax-entry ?\n ">" xfst-mode-syntax-table)
    xfst-mode-syntax-table)
  "Syntax table for xfst-mode")

; Entry function called by emacs  
(defun xfst-mode ()
  (interactive)
  (kill-all-local-variables)
  ; Define syntactic constituents
  (set-syntax-table xfst-mode-syntax-table)
  ; Set up font-lock
  (set (make-local-variable 'font-lock-defaults) '(xfst-font-lock-keywords))
  ; Register our indentation function
  (setq major-mode 'xfst-mode)
  (setq mode-name "XFST")
  (run-hooks 'xfst-mode-hook))

; Expose this mode to the emacs environment
(provide 'xfst-mode)










;; twolc
;; ;;;;;

; Hook for overriding the functions defined in this file
(defvar twol-mode-hook nil)

; Associate .rle extension with this mode.
(add-to-list 'auto-mode-alist '("\\.twolc\\'" . twol-mode))
(add-to-list 'auto-mode-alist '("\\.twol\\'" . twol-mode))
(add-to-list 'auto-mode-alist '("\\twol*.txt\\'" . twol-mode))

; Keywords for syntax highlighting
(defconst twol-font-lock-keywords
  (list
   '("\\<\\(Alphabet\\|Sets\\|Definitions\\|Rules)\\>" . font-lock-keyword-face)
   '("\\<\\(in\\|matching\\|KEEPIF\\|ELSE\\|ENDKEEP)\\>" . font-lock-function-name-face) )
  "Highlighting expressions for TWOL mode.")

; Define syntactic constituents
(defvar twol-mode-syntax-table
  (let ((twol-mode-syntax-table (make-syntax-table)))
    ; The ! character is the comment delimiter
    (modify-syntax-entry ?!  "<" twol-mode-syntax-table)
    (modify-syntax-entry ?\n ">" twol-mode-syntax-table)
    twol-mode-syntax-table)
  "Syntax table for twol-mode")

; Entry function called by emacs  
(defun twol-mode ()
  (interactive)
  (kill-all-local-variables)
  ; Define syntactic constituents
  (set-syntax-table twol-mode-syntax-table)
  ; Set up font-lock
  (set (make-local-variable 'font-lock-defaults) '(twol-font-lock-keywords))
  ; Register our indentation function
  (setq major-mode 'twol-mode)
  (setq mode-name "TWOL")
  (run-hooks 'twol-mode-hook))

; Expose this mode to the emacs environment
(provide 'twol-mode)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions