Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Coloring character literals #5

Open
dvanhorn opened this issue Nov 17, 2020 · 2 comments
Open

Coloring character literals #5

dvanhorn opened this issue Nov 17, 2020 · 2 comments

Comments

@dvanhorn
Copy link
Member

DrRacket mis-colors some character literals, likely due to a mismatch between the documentation on character literals and the implementation of the reader. See racket/racket#3506 and racket/racket#3507 for examples of character literals that fall outside the spec given in the document, but are considered valid.

So #\U000000AA should be colored as a character literal, but is currently colored as a literal followed by an identifier AA. #\71 is colored as a character literal but should be red since it is not valid.

@rfindler
Copy link
Member

The relevant code is here and here's a drracket-free version of the code:

#lang racket/base
(require syntax-color/racket-lexer)
(define (get-tokens str)
  (define sp (open-input-string str))
  (let loop ()
    (define-values (maybe-eof token paren start end)
      (racket-lexer sp))
    (cond
      [(eof-object? maybe-eof) '()]
      [else (cons (list token start end) (loop))])))

(get-tokens "#\\U000000AA")
(get-tokens "#\\71")

@rfindler
Copy link
Member

rfindler commented Nov 17, 2020

I'm going to try to transfer this to racket/syntax-color (from racket/drracket)

@rfindler rfindler transferred this issue from racket/drracket Nov 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants