Skip to content

Instantly share code, notes, and snippets.

@amieres
Last active August 29, 2015 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amieres/ec8c5b8332c267871ea1 to your computer and use it in GitHub Desktop.
Save amieres/ec8c5b8332c267871ea1 to your computer and use it in GitHub Desktop.
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