;;; racket-font-lock.el ;; Copyright (c) 2013-2018 by Greg Hendershott. ;; Author: Greg Hendershott ;; URL: https://github.com/greghendershott/racket-mode ;; License: ;; This is free software; you can redistribute it and/or modify it ;; under the terms of the GNU General Public License as published by ;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. This is distributed in the hope that it will be ;; useful, but without any warranty; without even the implied warranty ;; of merchantability or fitness for a particular purpose. See the GNU ;; General Public License for more details. See ;; http://www.gnu.org/licenses/ for details. (require 'cl-lib) (require 'racket-custom) (require 'racket-keywords-and-builtins) (require 'racket-ppss) (require 'racket-util) ;; Define 3 levels of font-lock, as documented in 23.6.5 "Levels of ;; Font Lock". User may control using `font-lock-maximum-decoration'. ;; Note: font-lock iterates by matcher, doing an re-search-forward ;; over the entire region. As a result, it's faster to consolidate ;; matchers that will yield the same result (unless they need to be ;; tried in a certain order). ;; Note: This relies on our character syntax already having been ;; applied. For example a Racket identifier like `|name with spaces|` ;; will already have word/symbol syntax on everything including the ;; pipe and space chars. (defconst racket-font-lock-keywords-0 (eval-when-compile `( ;; #shebang (,(rx bol "#!" (+ nonl) eol) . font-lock-comment-face) ;; #lang (,(rx (group (group "#lang") (1+ " ") (group (1+ not-newline)))) (2 font-lock-keyword-face nil t) (3 font-lock-variable-name-face nil t)) ;; #; sexp comments ;; ;; We don't put any comment syntax on these -- that way things ;; like indent and nav work within the sexp. They are solely ;; font-locked as comments, here. (,#'racket--font-lock-sexp-comments) ;; #<< here strings ;; ;; We only handle the opening #<