Fixed a lot of bugs. Actually gets through the entire experimental grammer. (A largeish experimental grammer for Kraken written to continue testing and to really start language development.
This commit is contained in:
@@ -67,7 +67,37 @@ std::string StringReader::getTokens(std::vector<std::string> stop_chars, bool tr
|
||||
}
|
||||
|
||||
if (rd_string[str_pos] == '\"') {
|
||||
found_pos = rd_string.find("\"", str_pos+1);
|
||||
//See if we have an even or odd number of backslashes (that is, this quote is not or is escaped)
|
||||
int numBackslashes = 0;
|
||||
int countBack = 1;
|
||||
while (str_pos-countBack >= 0 && rd_string[str_pos-countBack] == '\\') {
|
||||
numBackslashes++;
|
||||
countBack++;
|
||||
}
|
||||
//If the quote is not escaped
|
||||
if (numBackslashes % 2 == 0) {
|
||||
//Find the next quote
|
||||
found_pos = rd_string.find("\"", str_pos+1);
|
||||
//Check to see if the quote is escaped
|
||||
numBackslashes = 0;
|
||||
countBack = 1;
|
||||
while (found_pos-countBack >= 0 && rd_string[found_pos-countBack] == '\\') {
|
||||
numBackslashes++;
|
||||
countBack++;
|
||||
}
|
||||
//While the quote is escaped
|
||||
while (numBackslashes % 2 == 1) {
|
||||
//find the next quote
|
||||
found_pos = rd_string.find("\"", found_pos+1);
|
||||
//Check to see if it's escaped
|
||||
numBackslashes = 0;
|
||||
countBack = 1;
|
||||
while (found_pos-countBack >= 0 && rd_string[found_pos-countBack] == '\\') {
|
||||
numBackslashes++;
|
||||
countBack++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (found_pos == str_pos) //We are at the endline
|
||||
|
||||
Reference in New Issue
Block a user