Fixed #1823 (tokenize && wrong)
This commit is contained in:
parent
b02fc037ed
commit
18a75edd20
|
@ -341,6 +341,13 @@ void Tokenizer::createTokens(std::istream &code)
|
|||
{
|
||||
// Don't separate doubles "4.2e+10"
|
||||
}
|
||||
else if (ch=='&' && CurrentToken.empty() && code.peek() == '&')
|
||||
{
|
||||
// &&
|
||||
ch = code.get();
|
||||
addtoken("&&", lineno, FileIndex, true);
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (CurrentToken == "#file")
|
||||
|
@ -1672,7 +1679,6 @@ bool Tokenizer::tokenize(std::istream &code, const char FileName[], const std::s
|
|||
{
|
||||
{ "<", "<", "<<" },
|
||||
|
||||
{ "&", "&", "&&" },
|
||||
{ "|", "|", "||" },
|
||||
|
||||
{ "+", "=", "+=" },
|
||||
|
|
|
@ -520,6 +520,7 @@ private:
|
|||
|
||||
ASSERT_EQUALS("( p1 || ! p2 )", tokenizeAndStringify("( p1 != NULL || p2 == NULL )", true));
|
||||
ASSERT_EQUALS("( p1 && ! p2 )", tokenizeAndStringify("( p1 != NULL && p2 == NULL )", true));
|
||||
ASSERT_EQUALS("a & & b", tokenizeAndStringify("a & &b", true));
|
||||
|
||||
ASSERT_EQUALS("( ! p )", tokenizeAndStringify("( p == false )", true));
|
||||
ASSERT_EQUALS("( ! p )", tokenizeAndStringify("( p == 0 )", true));
|
||||
|
|
Loading…
Reference in New Issue