Skip to content

Commit

Permalink
feat(query): improve quote and sexp comment highlight
Browse files Browse the repository at this point in the history
  • Loading branch information
6cdh committed Mar 15, 2024
1 parent 6c77a5b commit 184e759
Showing 1 changed file with 44 additions and 4 deletions.
48 changes: 44 additions & 4 deletions queries/highlights.scm
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@

(escape_sequence) @escape

[(comment)
(block_comment)
(directive)] @comment

(list
.
(symbol) @function)
Expand Down Expand Up @@ -42,3 +38,47 @@
"^(caar|cadr|call-with-input-file|call-with-output-file|cdar|cddr|list|open-input-file|open-output-file|with-input-from-file|with-output-to-file|\\*|\\+|-|/|<|<=|=|>|>=|abs|acos|angle|append|apply|asin|assoc|assq|assv|atan|boolean\\?|caaaar|caaadr|caaar|caadar|caaddr|caadr|cadaar|cadadr|cadar|caddar|cadddr|caddr|call-with-current-continuation|call-with-values|car|cdaaar|cdaadr|cdaar|cdadar|cdaddr|cdadr|cddaar|cddadr|cddar|cdddar|cddddr|cdddr|cdr|ceiling|char->integer|char-alphabetic\\?|char-ci<=\\?|char-ci<\\?|char-ci=\\?|char-ci>=\\?|char-ci>\\?|char-downcase|char-lower-case\\?|char-numeric\\?|char-ready\\?|char-upcase|char-upper-case\\?|char-whitespace\\?|char<=\\?|char<\\?|char=\\?|char>=\\?|char>\\?|char\\?|close-input-port|close-output-port|complex\\?|cons|cos|current-error-port|current-input-port|current-output-port|denominator|display|dynamic-wind|eof-object\\?|eq\\?|equal\\?|eqv\\?|eval|even\\?|exact->inexact|exact\\?|exp|expt|floor|flush-output|for-each|force|gcd|imag-part|inexact->exact|inexact\\?|input-port\\?|integer->char|integer\\?|interaction-environment|lcm|length|list->string|list->vector|list-ref|list-tail|list\\?|load|log|magnitude|make-polar|make-rectangular|make-string|make-vector|map|max|member|memq|memv|min|modulo|negative\\?|newline|not|null-environment|null\\?|number->string|number\\?|numerator|odd\\?|output-port\\?|pair\\?|peek-char|positive\\?|procedure\\?|quotient|rational\\?|rationalize|read|read-char|real-part|real\\?|remainder|reverse|round|scheme-report-environment|set-car!|set-cdr!|sin|sqrt|string|string->list|string->number|string->symbol|string-append|string-ci<=\\?|string-ci<\\?|string-ci=\\?|string-ci>=\\?|string-ci>\\?|string-copy|string-fill!|string-length|string-ref|string-set!|string<=\\?|string<\\?|string=\\?|string>=\\?|string>\\?|string\\?|substring|symbol->string|symbol\\?|tan|transcript-off|transcript-on|truncate|values|vector|vector->list|vector-fill!|vector-length|vector-ref|vector-set!|vector\\?|write|write-char|zero\\?)$"
))

;; quote ;;

;; hardcoded highlight four levels of nested structure

; 'atom
(quote
_ @constant)

; '()
(quote
(_ _* @constant))

; '(())
(quote
(_ (_ _* @constant)))

; '((()))
(quote
(_ (_ (_ _* @constant))))

;; sexp comment ;;

;; hardcoded highlight four levels of nested structure

; #;atom
(comment
_ @comment)

; #;(list)
(comment
(_ _* @comment))

; #;(list (list))
(comment
(_ (_ _* @comment)))

; #;(list (list (list)))
(comment
(_ (_ (_ _ @comment))))

[(comment)
(block_comment)
(directive)] @comment

0 comments on commit 184e759

Please sign in to comment.