diff options
author | Thiago Macieira <thiago.macieira@nokia.com> | 2009-07-27 21:47:03 +0200 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@nokia.com> | 2009-08-03 14:59:42 +0200 |
commit | d0457b70e33f1a090a91b0037e9254a0e14b8427 (patch) | |
tree | 2984b2db2129ba8cfefeac46d246a4a335b92150 /src/shared/cplusplus/Literals.cpp | |
parent | 88549a4b1dbbb16c7d63f176fd870ec8bdb61477 (diff) | |
download | qt-creator-d0457b70e33f1a090a91b0037e9254a0e14b8427.tar.gz |
Compile the C++ parser library with Sun CC 5.9.
Things you mustn't do:
1) end an enum with a comma
2) #include <cxxxx> and not use std::
3) use anonymous structures
All three things are invalid C++. Anonymous structures inside
anonymous unions are allowed by GCC, but that doesn't mean it's valid.
Diffstat (limited to 'src/shared/cplusplus/Literals.cpp')
-rw-r--r-- | src/shared/cplusplus/Literals.cpp | 46 |
1 files changed, 24 insertions, 22 deletions
diff --git a/src/shared/cplusplus/Literals.cpp b/src/shared/cplusplus/Literals.cpp index bf243373ec..07259ca2bb 100644 --- a/src/shared/cplusplus/Literals.cpp +++ b/src/shared/cplusplus/Literals.cpp @@ -51,6 +51,8 @@ #include <algorithm> #include <iostream> +using namespace std; + CPLUSPLUS_BEGIN_NAMESPACE //////////////////////////////////////////////////////////////////////////////// @@ -113,20 +115,20 @@ enum { NumericLiteralIsDouble, NumericLiteralIsLongDouble, NumericLiteralIsLong, - NumericLiteralIsLongLong, + NumericLiteralIsLongLong }; NumericLiteral::NumericLiteral(const char *chars, unsigned size) : Literal(chars, size), _flags(0) { - _type = NumericLiteralIsInt; + f._type = NumericLiteralIsInt; if (chars[0] == '\'') { - _type = NumericLiteralIsChar; + f._type = NumericLiteralIsChar; } else if (size > 1 && chars[0] == 'L' && chars[1] == '\'') { - _type = NumericLiteralIsWideChar; + f._type = NumericLiteralIsWideChar; } else if (size > 1 && chars[0] == '0' && (chars[1] == 'x' || chars[1] == 'X')) { - _isHex = true; + f._isHex = true; } else { const char *begin = chars; const char *end = begin + size; @@ -149,23 +151,23 @@ NumericLiteral::NumericLiteral(const char *chars, unsigned size) for (const char *dot = it; it != begin - 1; --it) { if (*dot == '.') - _type = NumericLiteralIsDouble; + f._type = NumericLiteralIsDouble; } for (++it; it != end; ++it) { if (*it == 'l' || *it == 'L') { - if (_type == NumericLiteralIsDouble) { - _type = NumericLiteralIsLongDouble; + if (f._type == NumericLiteralIsDouble) { + f._type = NumericLiteralIsLongDouble; } else if (it + 1 != end && (it[1] == 'l' || it[1] == 'L')) { ++it; - _type = NumericLiteralIsLongLong; + f._type = NumericLiteralIsLongLong; } else { - _type = NumericLiteralIsLong; + f._type = NumericLiteralIsLong; } } else if (*it == 'f' || *it == 'F') { - _type = NumericLiteralIsFloat; + f._type = NumericLiteralIsFloat; } else if (*it == 'u' || *it == 'U') { - _isUnsigned = true; + f._isUnsigned = true; } } } @@ -175,34 +177,34 @@ NumericLiteral::~NumericLiteral() { } bool NumericLiteral::isHex() const -{ return _isHex; } +{ return f._isHex; } bool NumericLiteral::isUnsigned() const -{ return _isUnsigned; } +{ return f._isUnsigned; } bool NumericLiteral::isChar() const -{ return _type == NumericLiteralIsChar; } +{ return f._type == NumericLiteralIsChar; } bool NumericLiteral::isWideChar() const -{ return _type == NumericLiteralIsWideChar; } +{ return f._type == NumericLiteralIsWideChar; } bool NumericLiteral::isInt() const -{ return _type == NumericLiteralIsInt; } +{ return f._type == NumericLiteralIsInt; } bool NumericLiteral::isFloat() const -{ return _type == NumericLiteralIsFloat; } +{ return f._type == NumericLiteralIsFloat; } bool NumericLiteral::isDouble() const -{ return _type == NumericLiteralIsDouble; } +{ return f._type == NumericLiteralIsDouble; } bool NumericLiteral::isLongDouble() const -{ return _type == NumericLiteralIsLongDouble; } +{ return f._type == NumericLiteralIsLongDouble; } bool NumericLiteral::isLong() const -{ return _type == NumericLiteralIsLong; } +{ return f._type == NumericLiteralIsLong; } bool NumericLiteral::isLongLong() const -{ return _type == NumericLiteralIsLongLong; } +{ return f._type == NumericLiteralIsLongLong; } //////////////////////////////////////////////////////////////////////////////// Identifier::Identifier(const char *chars, unsigned size) |