mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-12 05:36:59 -04:00
Spelling of canonical
This commit is contained in:
@@ -220,7 +220,7 @@ void TokenIterator::readToken() {
|
|||||||
// name, or a number after a . token, as in array.0
|
// name, or a number after a . token, as in array.0
|
||||||
size_t start = pos - 1;
|
size_t start = pos - 1;
|
||||||
while (pos < input.size() && isAlnum_(input.GetChar(pos))) ++pos;
|
while (pos < input.size() && isAlnum_(input.GetChar(pos))) ++pos;
|
||||||
addToken(TOK_NAME, canonical_name_form(input.substr(start, pos-start)), start); // convert name to cannocial form
|
addToken(TOK_NAME, canonical_name_form(input.substr(start, pos-start)), start); // convert name to canonical form
|
||||||
} else if (isDigit(c)) {
|
} else if (isDigit(c)) {
|
||||||
// number
|
// number
|
||||||
size_t start = pos - 1;
|
size_t start = pos - 1;
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ Variable string_to_variable(const String& s) {
|
|||||||
if (it == variables.end()) {
|
if (it == variables.end()) {
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
variable_names.push_back(s);
|
variable_names.push_back(s);
|
||||||
assert(s == canonical_name_form(s)); // only use cannocial names
|
assert(s == canonical_name_form(s)); // only use canonical names
|
||||||
#endif
|
#endif
|
||||||
Variable v = (Variable)variables.size();
|
Variable v = (Variable)variables.size();
|
||||||
variables.insert(make_pair(s,v));
|
variables.insert(make_pair(s,v));
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ class GetMember : private GetDefaultMember {
|
|||||||
/// Handle an object: we are done if the name matches
|
/// Handle an object: we are done if the name matches
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void handle(const Char* name, const T& object) {
|
void handle(const Char* name, const T& object) {
|
||||||
if (!gdm.result() && cannocial_name_compare(target_name, name)) {
|
if (!gdm.result() && canonical_name_compare(target_name, name)) {
|
||||||
gdm.handle(object);
|
gdm.handle(object);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ bool Reader::enterAnyBlock() {
|
|||||||
bool Reader::enterBlock(const Char* name) {
|
bool Reader::enterBlock(const Char* name) {
|
||||||
if (state == ENTERED) moveNext(); // on the key of the parent block, first move inside it
|
if (state == ENTERED) moveNext(); // on the key of the parent block, first move inside it
|
||||||
if (indent != expected_indent) return false; // not enough indentation
|
if (indent != expected_indent) return false; // not enough indentation
|
||||||
if (cannocial_name_compare(key, name)) {
|
if (canonical_name_compare(key, name)) {
|
||||||
state = ENTERED;
|
state = ENTERED;
|
||||||
expected_indent += 1; // the indent inside the block must be at least this much
|
expected_indent += 1; // the indent inside the block must be at least this much
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
+1
-1
@@ -391,7 +391,7 @@ bool is_substr_i(const String& str, size_t pos, const String& cmp) {
|
|||||||
return is_substr_i(str, pos, static_cast<const Char*>(cmp.c_str()));
|
return is_substr_i(str, pos, static_cast<const Char*>(cmp.c_str()));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cannocial_name_compare(const String& as, const Char* b) {
|
bool canonical_name_compare(const String& as, const Char* b) {
|
||||||
const Char* a = as.c_str();
|
const Char* a = as.c_str();
|
||||||
while (true) {
|
while (true) {
|
||||||
if (*a != *b && !(*a == _(' ') && *b == _('_'))) return false;
|
if (*a != *b && !(*a == _(' ') && *b == _('_'))) return false;
|
||||||
|
|||||||
+1
-1
@@ -210,7 +210,7 @@ bool is_substr_i(const String& str, size_t pos, const String& cmp);
|
|||||||
size_t find_i(const String& heystack, const String& needle);
|
size_t find_i(const String& heystack, const String& needle);
|
||||||
|
|
||||||
/// Compare two strings for equality, b may contain '_' where a contains ' '
|
/// Compare two strings for equality, b may contain '_' where a contains ' '
|
||||||
bool cannocial_name_compare(const String& a, const Char* b);
|
bool canonical_name_compare(const String& a, const Char* b);
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------- : Regular expressions
|
// ----------------------------------------------------------------------------- : Regular expressions
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user