[plt-scheme] Lexer regular expressions

From: Will Donnelly (Will.Donnelly at gmail.com)
Date: Tue Jul 8 22:34:49 EDT 2008

I am trying to implement a simple lexer/parser for C header files, to
automatically generate the boring bits of a FFI for me.  I am mainly
doing this because I am lazy and don't want to have to type everything
by hand, but also because I think knowing how to do lexing and parsing
stuff could be useful in the future.

Most of the documentation makes sense, but i seem to have hit one
rather annoying little snag.  I want to identify keywords in a case-
insensitive manner, and this is proving to be much harder than I
anticipated.  I noticed this while i was trying to add a lexer entry
for the #define keyword.  First, I looked for some SRE operator to
match text while ignoring case, but found nothing.  So then I tried
#rx"#[Dd][Ee][Ff][Ii][Nn][Ee]"  Unfortunately, this seems not to work
either.  Please tell me, is there any way of achieving this
functionality short of saying "(:: "#" (:or "D""d") (:or "E""e") (:or
"F""f") (:or "I""i") (:or "N""n") (:or "E""e"))" ?  This seems way too
verbose to do such a simple thing.  Please tell me what I'm missing.

Posted on the users mailing list.