I think that you have to make the syntax colorer discover which is the @ character in the same way "#lang pollen" discovers it and then pass that along to the scribble-inside-lexer. (This may require changing scribble-inside-lexer to be more flexible in when it accepts the character.) Lexers have a way to track context information (via the "mode" argument and the last result) and so that can be extended to track whether or not the character has been seen yet and, if it has, what it is.
Robby On Fri, Nov 27, 2015 at 10:09 AM, <m...@mbtype.com> wrote: > In `#lang pollen`, which uses a variant of at-expressions, you can change the > command character on a per-source-file basis, so you can say `◊(+ 1 1)` or > `∆(+ 1 1)` or `@(+ 1 1)` ... > > I'm trying to figure out if I can bubble this up to DrRacket for syntax > coloring. I see two wrinkles: > > 1) For syntax-coloring purposes, the command character is set in the > `get-info` function for the #lang, which in pollen looks like this: > > (define (get-info in mod line col pos) > (λ (key default) > (case key > [(color-lexer) > (define make-scribble-inside-lexer2 > (dynamic-require 'syntax-color/scribble-lexer > 'make-scribble-inside-lexer (λ () #f))) > (cond [make-scribble-inside-lexer2 > (make-scribble-inside-lexer2 #:command-char #\◊)] > [else default])] > [else default]))) > > > I could set the command character properly if I had access to the path of the > source file. But IIUC DrRacket invokes the `get-info` for a #lang on a > "global" basis, i.e., before it considers any source-specific information. > > > 2) DrRacket seems to cache the result of `get-info` for a whole session. So > even if I could set the command character correctly for the first source > file, it wouldn't change if I had multiple source files open with multiple > command characters (in different tabs or windows). > > > > > -- > You received this message because you are subscribed to the Google Groups > "Racket Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to racket-users+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.