Open-Source Programming Tools

autogenproto

autogenproto

Trekkies may be amused by this comment in src/parser.l


/*****************************************************************************
 * These regular expressions were written and given to me by Seven of Nine.
 * I stared and told her, "Hey, this isn't your real phone number!".
 * #7 replied, "Moron, it means to match up to one or two lines that contain
 * several groups of C types or whitespace, the last line must contain
 * a left parenthesis, the bounding parentheses can contain a few lines of
 * identifiers and array/pointer/reference operators, but no parentheses
 * nor brackets, the right parenthesis can be followed by whitespace or nothing,
 * and opening/closing braces of the function definition must start on new lines.
 * It must adapt itself to pointer/array/reference syntax (*,[],&).
 * Object-oriented programming is irrelevant (ignore C++ scope operator "::")."
 * #7 added, "And you can forget about being assimilated".
 *****************************************************************************/

%%

                /* Matches function definitions with parameters */
^(([a-z_][a-z_0-9]*[*& \t]*(\[\])?|[ \t]+){1,14}\n){0,1}([a-z_] \
[a-z_0-9]*[*& \t]*(\[\])?|[ \t]+){1,14}\((([a-z_][a-z_0-9]*[*& \t]* \
(\[\])?[, \t]*|[ \t]+)\n?){1,30}\)[ \t]*\n\{ {
                return LexToken( TOKEN_FUNC_DEF );
                }

home    send email
© 2012 Jim Brooks
Last modified: Thu May 17 13:26:09 EDT 2012