[racket] matching eof in a parser-tools lex-abbrev
In a "define-lex-abbrev", how do I match an EOF?
For example:
---- BEGIN ----
#lang racket/base
(require parser-tools/lex
parser-tools/lex-sre)
(define-lex-abbrev my-newline-or-eof-abbrev
(: (? #\return)
(or #\newline #;eos)))
;; TODO: Need to match EOF where "#;eos" is above.
(define my-lexer
(lexer (my-newline-or-eof-abbrev 'newline-or-eof)))
(require (planet neil/overeasy))
(test (my-lexer (open-input-string "\r\n")) 'newline-or-eof)
(test (my-lexer (open-input-string "\r")) 'newline-or-eof)
---- END ----
--
http://www.neilvandyke.org/