|
|
@ -158,9 +158,7 @@ bool Lexer::getString() |
|
|
|
{ |
|
|
|
{ |
|
|
|
size_t column = m_column; |
|
|
|
size_t column = m_column; |
|
|
|
std::string symbol = ""; |
|
|
|
std::string symbol = ""; |
|
|
|
|
|
|
|
std::string breakOnCharacter = std::string() + '"' + '\r' + '\n' + '\0'; |
|
|
|
// Break on "\r\n
|
|
|
|
|
|
|
|
std::string breakOnGrammar = std::string("\"") + '\r' + '\n' + '\0'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool escape = false; |
|
|
|
bool escape = false; |
|
|
|
char character = consume(); |
|
|
|
char character = consume(); |
|
|
@ -174,7 +172,7 @@ bool Lexer::getString() |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (!escape && breakOnGrammar.find(character) != std::string::npos) { |
|
|
|
if (!escape && breakOnCharacter.find(character) != std::string::npos) { |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -200,13 +198,12 @@ bool Lexer::getNumberOrLiteral(Token::Type type) |
|
|
|
{ |
|
|
|
{ |
|
|
|
size_t column = m_column; |
|
|
|
size_t column = m_column; |
|
|
|
std::string symbol = ""; |
|
|
|
std::string symbol = ""; |
|
|
|
std::string breakOnGrammar = std::string("{}[]:,\" ") + '\t' + '\r' + '\n' + '\0'; |
|
|
|
std::string breakOnCharacter = std::string("{}[]:,") + '"' + ' ' + '\t' + '\r' + '\n' + '\0'; |
|
|
|
|
|
|
|
|
|
|
|
for (char character;;) { |
|
|
|
for (char character;;) { |
|
|
|
character = peek(); |
|
|
|
character = peek(); |
|
|
|
|
|
|
|
|
|
|
|
// Break on all valid JSON grammar thats not a number or literal
|
|
|
|
if (breakOnCharacter.find(character) != std::string::npos) { |
|
|
|
if (breakOnGrammar.find(character) != std::string::npos) { |
|
|
|
|
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|