On this page:
racket-lexer
racket-lexer*
racket-lexer/  status
racket-lexer*/  status
racket-nobar-lexer/  status
racket-nobar-lexer*/  status

3 Racket Lexer🔗

 (require syntax-color/racket-lexer)
  package: syntax-color-lib

procedure

(racket-lexer in)  
(or/c string? eof-object?)
symbol?
(or/c symbol? #f)
(or/c number? #f)
(or/c number? #f)
  in : input-port?
A lexer for Racket, including reader extensions (Reader Extension), built specifically for color:text<%>.

The racket-lexer function returns 5 values:

procedure

(racket-lexer* in offset mode)

  
(or/c string? eof-object?)
(or/c symbol?
      (and/c (hash/c symbol? any/c) immutable?))
(or/c symbol? #f)
(or/c number? #f)
(or/c number? #f)
exact-nonnegative-integer?
any/c
  in : input-port?
  offset : exact-nonnegative-integer?
  mode : any/c
Like racket-lexer, but uses the extended lexer protocol to track and report regions that are commented out with #;.

Added in version 1.2 of package syntax-color-lib.

procedure

(racket-lexer/status in)  
(or/c string? eof-object?)
symbol?
(or/c symbol? #f)
(or/c number? #f)
(or/c number? #f)
(or/c 'datum 'open 'close 'continue)
  in : input-port?
Like racket-lexer, but returns an extra value. The last return value indicates whether the consumed token should count as a datum, an opening parenthesis (or similar starting token to group other tokens), a closing parenthesis (or similar), or a prefix (such as whitespace) on a datum.

procedure

(racket-lexer*/status in offset mode)

  
(or/c string? eof-object?)
(or/c symbol?
      (and/c (hash/c symbol? any/c) immutable?))
(or/c symbol? #f)
(or/c number? #f)
(or/c number? #f)
exact-nonnegative-integer?
any/c
(or/c 'datum 'open 'close 'continue)
  in : input-port?
  offset : exact-nonnegative-integer?
  mode : any/c
Like racket-lexer/status, but with comment tracking like racket-lexer*.

Added in version 1.2 of package syntax-color-lib.

procedure

(racket-nobar-lexer/status in)

  
(or/c string? eof-object?)
symbol?
(or/c symbol? #f)
(or/c number? #f)
(or/c number? #f)
(or/c 'datum 'open 'close 'continue)
  in : input-port?
Like racket-lexer/status, except it treats | as a delimiter instead of quoting syntax for a symbol. This function is used by scribble-lexer.

procedure

(racket-nobar-lexer*/status in offset mode)

  
(or/c string? eof-object?)
(or/c symbol?
      (and/c (hash/c symbol? any/c) immutable?))
(or/c symbol? #f)
(or/c number? #f)
(or/c number? #f)
exact-nonnegative-integer?
any/c
(or/c 'datum 'open 'close 'continue)
  in : input-port?
  offset : exact-nonnegative-integer?
  mode : any/c
Like racket-nobar-lexer/status, but with comment tracking like racket-lexer*.

Added in version 1.2 of package syntax-color-lib.