added support for C++14/17 number literals

This commit is contained in:
Günter Obiltschnig
2018-12-30 21:00:17 +01:00
parent 5d3d62bb54
commit d6f97fe346
4 changed files with 177 additions and 50 deletions

View File

@@ -33,7 +33,7 @@ class CppParser_API CppToken: public Poco::Token
public:
CppToken();
~CppToken();
protected:
void syntaxError(const std::string& expected, const std::string& actual);
};
@@ -66,7 +66,7 @@ public:
OP_BITAND_ASSIGN, // &=
OP_AND, // &&
OP_BITOR, // |
OP_BITOR_ASSIGN, // |=
OP_BITOR_ASSIGN, // |=
OP_OR, // ||
OP_XOR, // ^
OP_XOR_ASSIGN, // ^=
@@ -92,17 +92,17 @@ public:
OP_SEMICOLON, // ;
OP_QUESTION // ?
};
OperatorToken();
~OperatorToken();
Poco::Token::Class tokenClass() const;
bool start(char c, std::istream& istr);
void finish(std::istream& istr);
int asInteger() const;
private:
typedef std::map<std::string, int> OpMap;
OpMap _opMap;
};
@@ -197,17 +197,17 @@ public:
KW_XOR,
KW_XOR_EQ
};
IdentifierToken();
~IdentifierToken();
Poco::Token::Class tokenClass() const;
bool start(char c, std::istream& istr);
void finish(std::istream& istr);
int asInteger() const;
private:
typedef std::map<std::string, int> KWMap;
KWMap _kwMap;
};
@@ -244,9 +244,16 @@ public:
Poco::Token::Class tokenClass() const;
bool start(char c, std::istream& istr);
void finish(std::istream& istr);
int asInteger() const;
double asFloat() const;
protected:
void finishHex(std::istream& istr, int next);
void finishBin(std::istream& istr, int next);
void finishExp(std::istream& istr, int next);
void finishSuffix(std::istream& istr, int next);
private:
bool _isFloat;
};