terralang / terra-mode Goto Github PK
View Code? Open in Web Editor NEWEmacs major mode for Terra
Emacs major mode for Terra
A new implementation of rx.el
was released in Emacs 27.1, removing the rx-form
function altogether. Terra-mode still depends on this function, however, resulting in the mode crashing on load. According to the commit, it was changed shortly after the release of Emacs 26.3, on 2019-09-25. The error message now being thrown is as follows:
Debugger entered--Lisp error: (void-function rx-form)
(rx-form `(seq symbol-start ,form symbol-end) rx-parent)
terra--rx-symbol((symbol (regexp "[[:alpha:]_]+[[:alnum:]_]*")))
rx--translate-compat-form((terra--rx-symbol 1 nil) (symbol (regexp "[[:alpha:]_]+[[:alnum:]_]*")))
rx--translate-form((symbol (regexp "[[:alpha:]_]+[[:alnum:]_]*")))
rx--translate((symbol (regexp "[[:alpha:]_]+[[:alnum:]_]*")))
rx-to-string((symbol (regexp "[[:alpha:]_]+[[:alnum:]_]*")) nogroup)
(let ((rx-constituents terra-rx-constituents)) (rx-to-string form no-group))
terra-rx-to-string((symbol (regexp "[[:alpha:]_]+[[:alnum:]_]*")) nogroup)
(setcdr form (terra-rx-to-string (cadr form-definition) 'nogroup))
(progn (setcdr form (terra-rx-to-string (cadr form-definition) 'nogroup)))
(if (and (listp form-definition) (eq ':rx (car form-definition))) (progn (setcdr form (terra-rx-to-string (cadr form-definition) 'nogroup))))
(when (and (listp form-definition) (eq ':rx (car form-definition))) (setcdr form (terra-rx-to-string (cadr form-definition) 'nogroup)))
(let ((name (car form)) (form-definition (cdr form))) (when (and (listp form-definition) (eq ':rx (car form-definition))) (setcdr form (terra-rx-to-string (cadr form-definition) 'nogroup))) (push form terra-rx-constituents))
terra--new-rx-form((terra-name :rx (symbol (regexp "[[:alpha:]_]+[[:alnum:]_]*"))))
mapc(terra--new-rx-form ((symbol terra--rx-symbol 1 nil) (ws . "[ \11]*") (ws+ . "[ \11]+") (terra-name :rx (symbol (regexp "[[:alpha:]_]+[[:alnum:]_]*"))) (terra-funcname :rx (seq terra-name (* ws "." ws terra-name) (opt ws ":" ws terra-name))) (terra-funcheader :rx (seq (or (seq (symbol "function" "struct" "terra") ws (group-n 1 terra-funcname)) (seq (group-n 1 terra-funcname) ws "=" ws (symbol "function" "struct" "terra"))))) (terra-number :rx (seq (or (seq (+ digit) (opt ".") (* digit)) (seq (* digit) (opt ".") (+ digit))) (opt (regexp "[eE][+-]?[0-9]+")))) (terra-assignment-op :rx (seq "=" (or buffer-end (not (any "="))))) (terra-token :rx (or "+" "-" "*" "/" "%" "^" "#" "==" "~=" "<=" ">=" "<" ">" "=" ";" ":" "," "." ".." "..." "`" "@")) (terra-keyword :rx (symbol "and" "break" "do" "else" "elseif" "end" "for" "function" "goto" "if" "in" "local" "not" "or" "repeat" "return" "then" "until" "while" "defer" "escape" "emit" "import" "quote" "struct" "terra" "var"))))
(progn (defvar terra-rx-constituents) (defvar rx-parent) (defun terra-rx-to-string (form &optional no-group) "Terra-specific replacement for `rx-to-string'.\n\nSe..." (let ((rx-constituents terra-rx-constituents)) (rx-to-string form no-group))) (defmacro terra-rx (&rest regexps) "Terra-specific replacement for `rx'.\n\nSee `rx' doc..." (cond ((null regexps) (error "No regexp")) ((cdr regexps) (terra-rx-to-string `(and ,@regexps) t)) (t (terra-rx-to-string (car regexps) t)))) (defun terra--new-rx-form (form) "Add FORM definition to `terra-rx' macro.\n\nFORM is ..." (let ((name (car form)) (form-definition (cdr form))) (when (and (listp form-definition) (eq ':rx (car form-definition))) (setcdr form (terra-rx-to-string (cadr form-definition) 'nogroup))) (push form terra-rx-constituents))) (defun terra--rx-symbol (form) (setq form (cdr form)) (setq form (if (eq 1 (length form)) (car form) (append '(or) form))) (rx-form `(seq symbol-start ,form symbol-end) rx-parent)) (setq terra-rx-constituents (copy-sequence rx-constituents)) (unless (assq 'group-n rx-constituents) (defun terra--rx-group-n (form) (concat (format "\\(?%d:" (nth 1 form)) (rx-form `(seq ,@...) ':) "\\)")) (push '(group-n terra--rx-group-n 1 nil) terra-rx-constituents)) (mapc #'terra--new-rx-form `((symbol terra--rx-symbol 1 nil) (ws . "[ \11]*") (ws+ . "[ \11]+") (terra-name :rx (symbol (regexp "[[:alpha:]_]+[[:alnum:]_]*"))) (terra-funcname :rx (seq terra-name (* ws "." ws terra-name) (opt ws ":" ws terra-name))) (terra-funcheader :rx (seq (or (seq ... ws ...) (seq ... ws "=" ws ...)))) (terra-number :rx (seq (or (seq ... ... ...) (seq ... ... ...)) (opt (regexp "[eE][+-]?[0-9]+")))) (terra-assignment-op :rx (seq "=" (or buffer-end (not ...)))) (terra-token :rx (or "+" "-" "*" "/" "%" "^" "#" "==" "~=" "<=" ">=" "<" ">" "=" ";" ":" "," "." ".." "..." "`" "@")) (terra-keyword :rx (symbol "and" "break" "do" "else" "elseif" "end" "for" "function" "goto" "if" "in" "local" "not" "or" "repeat" "return" "then" "until" "while" "defer" "escape" "emit" "import" "quote" "struct" "terra" "var")))))
eval((progn (defvar terra-rx-constituents) (defvar rx-parent) (defun terra-rx-to-string (form &optional no-group) "Terra-specific replacement for `rx-to-string'.\n\nSe..." (let ((rx-constituents terra-rx-constituents)) (rx-to-string form no-group))) (defmacro terra-rx (&rest regexps) "Terra-specific replacement for `rx'.\n\nSee `rx' doc..." (cond ((null regexps) (error "No regexp")) ((cdr regexps) (terra-rx-to-string `(and ...) t)) (t (terra-rx-to-string (car regexps) t)))) (defun terra--new-rx-form (form) "Add FORM definition to `terra-rx' macro.\n\nFORM is ..." (let ((name (car form)) (form-definition (cdr form))) (when (and (listp form-definition) (eq ':rx (car form-definition))) (setcdr form (terra-rx-to-string (cadr form-definition) 'nogroup))) (push form terra-rx-constituents))) (defun terra--rx-symbol (form) (setq form (cdr form)) (setq form (if (eq 1 (length form)) (car form) (append '(or) form))) (rx-form `(seq symbol-start ,form symbol-end) rx-parent)) (setq terra-rx-constituents (copy-sequence rx-constituents)) (unless (assq 'group-n rx-constituents) (defun terra--rx-group-n (form) (concat (format "\\(?%d:" (nth 1 form)) (rx-form `(seq ...) ':) "\\)")) (push '(group-n terra--rx-group-n 1 nil) terra-rx-constituents)) (mapc #'terra--new-rx-form `((symbol terra--rx-symbol 1 nil) (ws . "[ \11]*") (ws+ . "[ \11]+") (terra-name :rx (symbol (regexp "[[:alpha:]_]+[[:alnum:]_]*"))) (terra-funcname :rx (seq terra-name (* ws "." ws terra-name) (opt ws ":" ws terra-name))) (terra-funcheader :rx (seq (or ... ...))) (terra-number :rx (seq (or ... ...) (opt ...))) (terra-assignment-op :rx (seq "=" (or buffer-end ...))) (terra-token :rx (or "+" "-" "*" "/" "%" "^" "#" "==" "~=" "<=" ">=" "<" ">" "=" ";" ":" "," "." ".." "..." "`" "@")) (terra-keyword :rx (symbol "and" "break" "do" "else" "elseif" "end" "for" "function" "goto" "if" "in" "local" "not" "or" "repeat" "return" "then" "until" "while" "defer" "escape" "emit" "import" "quote" "struct" "terra" "var"))))) nil)
#f(compiled-function (&rest body) "Like `progn', but evaluates the body at compile time and at\nload time. In interpreted code, this is entirely equivalent to\n`progn', except that the value of the expression may be (but is\nnot necessarily) computed at load time if eager macro expansion\nis enabled." #<bytecode 0x1fdfc4090ad3>)((defvar terra-rx-constituents) (defvar rx-parent) (defun terra-rx-to-string (form &optional no-group) "Terra-specific replacement for `rx-to-string'.\n\nSe..." (let ((rx-constituents terra-rx-constituents)) (rx-to-string form no-group))) (defmacro terra-rx (&rest regexps) "Terra-specific replacement for `rx'.\n\nSee `rx' doc..." (cond ((null regexps) (error "No regexp")) ((cdr regexps) (terra-rx-to-string `(and ,@regexps) t)) (t (terra-rx-to-string (car regexps) t)))) (defun terra--new-rx-form (form) "Add FORM definition to `terra-rx' macro.\n\nFORM is ..." (let ((name (car form)) (form-definition (cdr form))) (when (and (listp form-definition) (eq ':rx (car form-definition))) (setcdr form (terra-rx-to-string (cadr form-definition) 'nogroup))) (push form terra-rx-constituents))) (defun terra--rx-symbol (form) (setq form (cdr form)) (setq form (if (eq 1 (length form)) (car form) (append '(or) form))) (rx-form `(seq symbol-start ,form symbol-end) rx-parent)) (setq terra-rx-constituents (copy-sequence rx-constituents)) (unless (assq 'group-n rx-constituents) (defun terra--rx-group-n (form) (concat (format "\\(?%d:" (nth 1 form)) (rx-form `(seq ,@...) ':) "\\)")) (push '(group-n terra--rx-group-n 1 nil) terra-rx-constituents)) (mapc #'terra--new-rx-form `((symbol terra--rx-symbol 1 nil) (ws . "[ \11]*") (ws+ . "[ \11]+") (terra-name :rx (symbol (regexp "[[:alpha:]_]+[[:alnum:]_]*"))) (terra-funcname :rx (seq terra-name (* ws "." ws terra-name) (opt ws ":" ws terra-name))) (terra-funcheader :rx (seq (or (seq ... ws ...) (seq ... ws "=" ws ...)))) (terra-number :rx (seq (or (seq ... ... ...) (seq ... ... ...)) (opt (regexp "[eE][+-]?[0-9]+")))) (terra-assignment-op :rx (seq "=" (or buffer-end (not ...)))) (terra-token :rx (or "+" "-" "*" "/" "%" "^" "#" "==" "~=" "<=" ">=" "<" ">" "=" ";" ":" "," "." ".." "..." "`" "@")) (terra-keyword :rx (symbol "and" "break" "do" "else" "elseif" "end" "for" "function" "goto" "if" "in" "local" "not" "or" "repeat" "return" "then" "until" "while" "defer" "escape" "emit" "import" "quote" "struct" "terra" "var")))))
(eval-and-compile (defvar terra-rx-constituents) (defvar rx-parent) (defun terra-rx-to-string (form &optional no-group) "Terra-specific replacement for `rx-to-string'.\n\nSe..." (let ((rx-constituents terra-rx-constituents)) (rx-to-string form no-group))) (defmacro terra-rx (&rest regexps) "Terra-specific replacement for `rx'.\n\nSee `rx' doc..." (cond ((null regexps) (error "No regexp")) ((cdr regexps) (terra-rx-to-string `(and ,@regexps) t)) (t (terra-rx-to-string (car regexps) t)))) (defun terra--new-rx-form (form) "Add FORM definition to `terra-rx' macro.\n\nFORM is ..." (let ((name (car form)) (form-definition (cdr form))) (when (and (listp form-definition) (eq ':rx (car form-definition))) (setcdr form (terra-rx-to-string (cadr form-definition) 'nogroup))) (push form terra-rx-constituents))) (defun terra--rx-symbol (form) (setq form (cdr form)) (setq form (if (eq 1 (length form)) (car form) (append '(or) form))) (rx-form `(seq symbol-start ,form symbol-end) rx-parent)) (setq terra-rx-constituents (copy-sequence rx-constituents)) (unless (assq 'group-n rx-constituents) (defun terra--rx-group-n (form) (concat (format "\\(?%d:" (nth 1 form)) (rx-form `(seq ,@...) ':) "\\)")) (push '(group-n terra--rx-group-n 1 nil) terra-rx-constituents)) (mapc #'terra--new-rx-form `((symbol terra--rx-symbol 1 nil) (ws . "[ \11]*") (ws+ . "[ \11]+") (terra-name :rx (symbol (regexp "[[:alpha:]_]+[[:alnum:]_]*"))) (terra-funcname :rx (seq terra-name (* ws "." ws terra-name) (opt ws ":" ws terra-name))) (terra-funcheader :rx (seq (or (seq ... ws ...) (seq ... ws "=" ws ...)))) (terra-number :rx (seq (or (seq ... ... ...) (seq ... ... ...)) (opt (regexp "[eE][+-]?[0-9]+")))) (terra-assignment-op :rx (seq "=" (or buffer-end (not ...)))) (terra-token :rx (or "+" "-" "*" "/" "%" "^" "#" "==" "~=" "<=" ">=" "<" ">" "=" ";" ":" "," "." ".." "..." "`" "@")) (terra-keyword :rx (symbol "and" "break" "do" "else" "elseif" "end" "for" "function" "goto" "if" "in" "local" "not" "or" "repeat" "return" "then" "until" "while" "defer" "escape" "emit" "import" "quote" "struct" "terra" "var")))))
eval-buffer(#<buffer *load*> nil "/home/seylerius/.emacs.d/.local/straight/build/ter..." nil t) ; Reading at buffer position 8058
load-with-code-conversion("/home/seylerius/.emacs.d/.local/straight/build/ter..." "/home/seylerius/.emacs.d/.local/straight/build/ter..." nil t)
terra-mode()
(Error shortened somewhat)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.