[racket] A simple lexer question

From: Gregory Woodhouse (gregwoodhouse at me.com)
Date: Wed Jun 20 01:26:34 EDT 2012

I want to write a rule that will recognize strings in a language (MUMPS) that doubles double quotes as a means of escaping them. For example "The double quote symbol is \"." would be "The double quote symbol is ""." and "\"" would be """". That seems simple enough except that I need to write regular expression that matches any printing character (including #\spacer  and #\tab except, of course #\". There is the complement operator, but that gives me any character but #\", not quite what I want.  With a set difference, I suppose I could do something like

DQUOTE (DQUOTE DQUOTE | printing - DQUOTE)* DQUOTE

but again, I'm not quite sure how to express this in the lexer.

Posted on the users mailing list.