Annwan
2 years ago
commit
9dbb63a8e2
1 changed files with 83 additions and 0 deletions
@ -0,0 +1,83 @@ |
|||
;;; worst-mode.el --- major mode for worst -*- lexical-binding: t -*- |
|||
|
|||
;; Author: Antoine "Annwan" Combet |
|||
;; Maintainer: Antoine "Annwan" Combet |
|||
;; Version: 0.1.0 |
|||
;; Homepage: TBD |
|||
|
|||
;; This file is not part of GNU Emacs |
|||
|
|||
;; Copyright (C) 2022 Antoine "Annwan" COMBET |
|||
|
|||
;; Permission is hereby granted, free of charge, to any person obtaining a copy |
|||
;; of this software and associated documentation files (the "Software"), to |
|||
;; deal in the Software without restriction, including without limitation the |
|||
;; rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
|||
;; sell copies of the Software, and to permit persons to whom the Software is |
|||
;; furnished to do so, subject to the following conditions: |
|||
;; |
|||
;; The above copyright notice and this permission notice shall be included in |
|||
;; all copies or substantial portions of the Software. |
|||
;; |
|||
;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|||
;; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|||
;; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
|||
;; AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
|||
;; LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
|||
;;FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS |
|||
;; IN THE SOFTWARE. |
|||
|
|||
;;; Commentary: |
|||
|
|||
;; commentary |
|||
|
|||
;;; Code: |
|||
|
|||
(defvar worst--builtins |
|||
'(; Builtins |
|||
"define" "default-attributes" "definition-add" "all-definitions" |
|||
"definition-resolve" "dispatch" "dispatch-first" "stack-matches?" "quote" |
|||
"clone" "drop" "dig" "burry" "eval" "call" "uplevel" "upquote" "const" |
|||
"swap" "if" "while" "equal?" "not" "false?" "error?" "pause" "stack-empty" |
|||
"stack-dump" "value->string" "stack-get" "doc" "dcoumentation-attribute" |
|||
"value-doc" "open-file/read" "open-embedded-file/read" "interpreter-empty" |
|||
"interpreter-reset" "interpreter-stack-length" "interpreter-stack-push" |
|||
"interpreter-stack-pop" "interpreter-stack-get" |
|||
"interpreter-definition-add" "interpreter-definition-remove" |
|||
"interpreter-call" "interpreter-body-push" "interpreter-body-prepend" |
|||
"current-output-port" "current-error-port" "current-input-port" |
|||
"port-write-string" "port-flush" "can-read?" "port->string" |
|||
"buffered-port-read-line" "open-string-input-port" "list?" "list-empty" |
|||
"list-length" "list-reverse" "list-push" "list-pop" "list-append" "f64?" |
|||
"import" "export" "%exports" "i64?" "i64-add" "f64-add" "i64-sub" "f64-sub" |
|||
"i64-mul" "f64-mul" "i64-div" "f64-div" "i64-negate" "f64-negate" "i64-abs" |
|||
"f64-abs" "i64-complt" "f64-complt" "i64-comple" "f64-comple" "i64-compgt" |
|||
"f64-compgt" "i64-compge" "f64-compge" "command-line-arguments" |
|||
"get-environment-variable" "make-place" "place-get" "place-set" |
|||
"reader-empty" "reader-set-eof" "reader-write-string" "reader-next" |
|||
"read-port->list" "string?" "string-append" "whitespace?" "string->symbol" |
|||
; Standard lib definitions |
|||
"add" "sub" "mul" "div" "negate" "abs" "comple" "complt" "compge" "compgt" |
|||
"append" "->string" "print-value" "print" "read-line" "read-file" |
|||
"evaluate" "equals?" "==" "not" "max" "min" "updo" "iteri" "do-times" |
|||
"definition-exists" "definition-rename" "definition-copy-up" |
|||
"define-gensym" "stack-swap" "case")) |
|||
|
|||
(setq worst-font-lock-keywords |
|||
`((,worst--builtins . 'font-lock-builtin-face))) |
|||
|
|||
;;;###autoload |
|||
(define-generic-mode 'worst-mode |
|||
'(";") |
|||
worst--builtins |
|||
'(("#f\\|#t\\|[0-9+](\\.[0-9]+)\\|\".+?\"" . 'font-lock-constant-face) |
|||
("(\\|)\\|\\[\\|]\\|{\\|}" . 'font-lock-keyword-face) |
|||
("[^[:space:]]+" . 'font-lock-variable-name-face)) |
|||
'("\\.w$") |
|||
nil |
|||
"A mode for worst files") |
|||
|
|||
|
|||
(provide 'worst-mode) |
|||
|
|||
;;; worst-mode.el ends here |
Write
Preview
Loading…
Cancel
Save
Reference in new issue