46 lines
1.2 KiB
Plaintext
46 lines
1.2 KiB
Plaintext
;; Test expression for syntax highlight
|
|
(ignore (let print 1234 0x1234 "a string" empty-string "" after-empty-string #t #F))
|
|
|
|
(define-syntax
|
|
"lysp"
|
|
:styles
|
|
("keyword" :fg 'red)
|
|
("symbol" :fg 'cyan)
|
|
("comment" :fg 'white :bold)
|
|
("string" :fg 'yellow)
|
|
("custom-syntax" :fg 'red :bold)
|
|
("number" :fg 'cyan :bold)
|
|
("constant" :fg 'cyan :bold)
|
|
:rules
|
|
;; keywords
|
|
(:keyword
|
|
"let" "let*" "progn" "defun" "defmacro" "setq"
|
|
"when" "unless" "if" "while" "loop" "&optional"
|
|
"&rest" "&otherwise" "cond" "nil" "lambda" "ignore"
|
|
:category "keyword"
|
|
)
|
|
;; prelude functions
|
|
(:keyword
|
|
"car" "cdr" "caar" "cadr" "cdar" "cddr" "cadar"
|
|
"caddr" "list?" "nil?" "cons?" "string?" "symbol?"
|
|
"cons" "list" "print" "not" "or" "and" "=" ">="
|
|
"<=" "/=" "error" "import" "apply" "find"
|
|
:category "symbol"
|
|
)
|
|
(:keyword
|
|
"#t" "#T" "#f" "#F"
|
|
:category "constant"
|
|
)
|
|
;; strings
|
|
(:regex "." "string" :prev-state 1)
|
|
(:regex "[^\\\\]\"" "string" :prev-state 1 :next-state 0)
|
|
(:regex "\"" "string" :next-state 1)
|
|
(:regex "\"\"" "string")
|
|
;; :keywords
|
|
(:regex ":[\\-\\w]+" "custom-syntax")
|
|
;; numbers
|
|
(:regex "(0x|0o|0b)?\\d+" "number")
|
|
;; comments
|
|
(:regex ";.*$" "comment")
|
|
)
|