Empirical
|
Basic regular expression handler. More...
#include <ostream>
#include <sstream>
#include <string>
#include "../base/vector.h"
#include "../base/Ptr.h"
#include "BitSet.h"
#include "lexer_utils.h"
#include "NFA.h"
#include "string_utils.h"
Go to the source code of this file.
Classes | |
class | emp::RegEx |
A basic regular expression handler. More... | |
Namespaces | |
emp | |
If we are in emscripten, make sure to include the header. | |
Functions | |
static NFA | emp::to_NFA (const RegEx ®ex, size_t stop_id=1) |
Simple conversion of RegEx to NFA (mostly implemented in RegEx) More... | |
static DFA | emp::to_DFA (const RegEx ®ex) |
Conversion of RegEx to DFA, via NFA intermediate. More... | |
Basic regular expression handler.
A fully (well, mostly) functional regular expression processor.
Special chars: '|' - or '*' - zero or more of previous '+' - one or more of previous '?' - previous is optional '.' - Match any character except
Pluse the following group contents (and change may translation rules) '(' and ')' - group contents '"' - Ignore special characters in contents (quotes still need to be escaped) '[' and ']' - character set – choose ONE character ^ as first char negates contents ; - indicates range UNLESS first or last.
Additional overloads for functions in lexer_utils.h:
static NFA to_NFA(const RegEx & regex, int stop_id=1); static DFA to_DFA(const RegEx & regex);
Need to implement ^ and $ (beginning and end of line)
Need to implement {n}, {n,} and {n,m} (exactly n, at least n, and n-m copies, respecitvely)