diff options
author | Kshitij Bansal <kshitij@cs.nyu.edu> | 2014-04-29 19:07:20 -0400 |
---|---|---|
committer | Kshitij Bansal <kshitij@cs.nyu.edu> | 2014-04-29 19:07:20 -0400 |
commit | 47139e8b11b0f11289a1b6cca46cd62e0814eaa3 (patch) | |
tree | 02b678ba6a0a7acf1a00ead8d3bab16213c430a3 /src | |
parent | 71e27a89c1500766c7d3da622192b6cf2f200d44 (diff) |
fix was compiler warning in antlr_input, crashing test case with the old fix
Diffstat (limited to 'src')
-rw-r--r-- | src/parser/antlr_input.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/parser/antlr_input.cpp b/src/parser/antlr_input.cpp index 88b43eb0e..ee4e2ff37 100644 --- a/src/parser/antlr_input.cpp +++ b/src/parser/antlr_input.cpp @@ -374,9 +374,9 @@ std::string parseErrorHelper(const char* lineStart, int charPositionInLine, cons string word = slice.substr(caretPos, (caretPosOrig - caretPos + 1)); int messagePosSt = message.find(word); int messagePosEn = messagePosSt + (caretPosOrig - caretPos); - if( messagePosSt < string::npos && + if( (size_t)messagePosSt < string::npos && (messagePosSt == 0 || !isSimpleChar(message[messagePosSt-1]) ) && - (messagePosEn+1 == message.size() || !isSimpleChar(message[messagePosEn+1]) ) ) { + ((size_t)messagePosEn+1 == message.size() || !isSimpleChar(message[messagePosEn+1]) ) ) { // ^the complicated if statement is just 'whole-word' match Debug("friendlyparser") << "[friendlyparser] Feeling good." << std::endl; } @@ -398,9 +398,9 @@ std::string parseErrorHelper(const char* lineStart, int charPositionInLine, cons Debug("friendlyparser") << "[friendlyparser] nearest word = " << word << std::endl; int messagePosSt = message.find(word); int messagePosEn = messagePosSt + (nearestWordEn - nearestWordSt + 1); - if( messagePosSt < string::npos && + if( (size_t)messagePosSt < string::npos && (messagePosSt == 0 || !isSimpleChar(message[messagePosSt-1]) ) && - (messagePosEn+1 == message.size() || !isSimpleChar(message[messagePosEn+1]) ) ) { + ((size_t)messagePosEn+1 == message.size() || !isSimpleChar(message[messagePosEn+1]) ) ) { // ^the complicated if statement is just 'whole-word' match Debug("friendlyparser") << "[friendlyparser] strong evidence that caret should be at " << nearestWordSt << std::endl; |