;;; lil-mode.el --- major mode for editing lil. -*- coding: utf-8; lexical-binding: t; -*- ;; Copyright (c) 2022, by eli_oat ;; Author: eli_oat ;; Version: 0.0.1 ;; Created: 08 Dec 2022 ;; Keywords: languages ;; This file is not part of GNU Emacs. ;;; License: ;; You can redistribute this program and/or modify it under the terms of the MIT license. ;;; Commentary: ;; a major mode for writing lil, lil is a programming language by John Earnest. ;; Learn more about lil, . ;;; Code: (add-to-list 'auto-mode-alist '("\\.lil\\'" . lil-mode)) (defconst lil-mode-syntax-table (let ((table (make-syntax-table))) (modify-syntax-entry ?\" "\"" table) ; " is a string delimiter (modify-syntax-entry ?/ ". 12" table) ; # starts a comment (modify-syntax-entry ?\n ">" table) ; \n ends a comment table)) ;; (defconst lil-keywords ;; '("if" "else" "end" "while" "each" "send" "do" "select" "extract" "update" "insert" "into" "from" "where" "by" "orderby" "asc" "desc" "with" "local" "floor" "cos" "sin" "tan" "exp" "ln" "sqrt" "count" "sum" "min" "max" "raze" "first" "last" "range" "list" "table" "rows" "cols" "mag" "unit" "heading" "split" "fuse" "cat" "dict" "take" "drop" "in" "at" "join" "cross" "parse" "format" "typeof" "unless" "flip" "limit" "on")) ;; (defvar lil-font-lock-keywords ;; (list ;; ;; highlight all the reserved commands. ;; `(,(concat "\\_<" (regexp-opt lil-keywords) "\\_>") . font-lock-keyword-face)) ;; "Additional expressions to highlight in `lil-mode'.") ;; (defvar lilt-buffer-name "*lilt*") ;; (defvar lilt-cli-arguments '()) ;; (defun lilt-run () ;; (interactive) ;; (let* ((lilt-program "/usr/local/bin/lilt") ;; (buffer (get-buffer-create lilt-buffer-name)) ;; (proc-alive (comint-check-proc buffer)) ;; (process (get-buffer-process buffer))) ;; (unless proc-alive ;; (with-current-buffer buffer ;; (apply 'make-comint-in-buffer "lilt" buffer ;; lilt-program nil lilt-cli-arguments) ;; (lil-mode))) ;; (when buffer ;; (pop-to-buffer buffer)))) ;; (defun lilt--initialize () ;; (setq comint-process-echoes t)) (define-derived-mode lil-mode prog-mode "lil mode" :syntax-table lil-mode-syntax-table ; (set (make-local-variable 'font-lock-defaults) '(lil-font-lock-keywords t)) (font-lock-fontify-buffer)) (provide 'lil-mode) ;;; lil-mode.el ends here