Skip navigation

For whatever reason, I decided to start working on a Regex Parser. Though, I did something funny… for testing I allowed for statically compiled regexes to be defined. This caused some rather crazy code:

Regex_Hack::Regex reg( "Integer", //Value, used for name
                       Regex::ONE, //times to find in a row...
                       Regex::ROOT, //root node, basically says to ignore the previous two arguments
                       //Following == [1-9][0-9]*
                       Regex_Hack::Group(Regex_Hack::Regex::ONE, //repeat finding of group once only
                                         Regex_Hack::Range('1','9') //range of numbers 1-9 repeated once ([1-9])
                                         << //craziness to solve variadic argument problem... basically rigged an ostream
                                         Regex_Hack::Digit(Regex_Hack::Regex::ZERO_OR_MORE))); //range 0-9 repeated zero+ ([0-9]*)

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.