Add script to trim whitespace

This commit is contained in:
Max Brunsfeld 2014-03-09 19:49:35 -07:00
parent e681a63552
commit 39aa0ccc91
66 changed files with 350 additions and 347 deletions

View file

@ -3,24 +3,24 @@
namespace tree_sitter {
using std::string;
namespace rules {
static const char MAX_CHAR = '\xff';
CharacterRange::CharacterRange(char value) : min(value), max(value) {}
CharacterRange::CharacterRange(char min, char max) : min(min), max(max) {}
bool CharacterRange::operator==(const CharacterRange &other) const {
return min == other.min && max == other.max;
}
bool CharacterRange::operator<(const CharacterRange &other) const {
if (min < other.min) return true;
if (min > other.min) return false;
if (max < other.max) return true;
return false;
}
string escape_character(char input) {
switch (input) {
case '\0':
@ -31,7 +31,7 @@ namespace tree_sitter {
return string() + input;
}
}
string CharacterRange::to_string() const {
if (min == 0 && max == MAX_CHAR)
return "<ANY>";