Last active
August 29, 2015 14:01
-
-
Save amieres/ec8c5b8332c267871ea1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public int Position = 0; | |
String Token = null; | |
string CurrentString; | |
bool R(string RegEx) { | |
SkipSpacesComments(); | |
Match M = Regex.Match(CurrentString, "^" + RegEx | |
, RegexOptions.IgnoreCase); | |
if (M.Success) { | |
Token = CurrentString.Substring(0, M.Length); | |
Position += M.Length + SpaceLength; | |
} | |
return M.Success; | |
} | |
bool W(string C) { | |
return R(C + "\\b"); // whole words only | |
} | |
bool C(string C) { | |
return R(Regex.Escape(C)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment