Merge pull request #12369 from simon-walton/BugFix

Lexer code has confusion between strings and chars
This commit is contained in:
Stephen Birarda 2018-03-22 12:03:47 -07:00 committed by GitHub
commit e8bea3a611
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -190,7 +190,7 @@ bool JSBaker::handleMultiLineComments(QTextStream& in) {
while (!in.atEnd()) { while (!in.atEnd()) {
in >> character; in >> character;
if (character == '*') { if (character == '*') {
if (in.read(1) == '/') { if (in.read(1) == "/") {
return true; return true;
} }
} }
@ -228,7 +228,7 @@ bool JSBaker::isSpecialCharacter(QChar c) {
// If previous character is a special character, maybe don't omit new line (depends on next character as well) // If previous character is a special character, maybe don't omit new line (depends on next character as well)
bool JSBaker::isSpecialCharacterPrevious(QChar c) { bool JSBaker::isSpecialCharacterPrevious(QChar c) {
return (c == '\'' || c == '$' || c == '_' || c == '}' || c == ']' || c == ')' || c == '+' || c == '-' return (c == '\'' || c == '$' || c == '_' || c == '}' || c == ']' || c == ')' || c == '+' || c == '-'
|| c == '"' || c == "'"); || c == '"' || c == '\'');
} }
// If next character is a special character, maybe don't omit new line (depends on previous character as well) // If next character is a special character, maybe don't omit new line (depends on previous character as well)
@ -243,5 +243,5 @@ bool JSBaker::isSpaceOrTab(QChar c) {
// Check If the currentCharacter is " or ' or ` // Check If the currentCharacter is " or ' or `
bool JSBaker::isQuote(QChar c) { bool JSBaker::isQuote(QChar c) {
return (c == '"' || c == "'" || c == '`'); return (c == '"' || c == '\'' || c == '`');
} }