Skip to content

Commit

Permalink
merge changes from upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
obiltschnig committed Mar 17, 2024
1 parent 54e93d8 commit 3eaf2b4
Show file tree
Hide file tree
Showing 46 changed files with 528 additions and 144 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Release 2024.1 - 2024-02-XX
# Release 2024.1 - 2024-03-XX

- Upgraded JavaScript engine to a newer V8 version (v8.7)
- Various improvements to the JavaScript engine, including new File and Crypto APIs
Expand Down
4 changes: 2 additions & 2 deletions platform/CppParser/include/Poco/CppParser/Attributes.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ class CppParser_API Attributes
/// name and values are strings.
{
public:
typedef std::map<std::string, std::string> AttrMap;
typedef AttrMap::const_iterator Iterator;
using AttrMap = std::map<std::string, std::string>;
using Iterator = AttrMap::const_iterator;

Attributes();
/// Creates the Attributes object.
Expand Down
9 changes: 6 additions & 3 deletions platform/CppParser/include/Poco/CppParser/CppToken.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ class CppParser_API OperatorToken: public CppToken
{
OP_OPENBRACKET = 1, // [
OP_CLOSBRACKET, // ]
OP_DBL_OPENBRACKET, // [[
OP_DBL_CLOSBRACKET, // ]]
OP_OPENPARENT, // (
OP_CLOSPARENT, // )
OP_OPENBRACE, // {
Expand All @@ -58,6 +60,7 @@ class CppParser_API OperatorToken: public CppToken
OP_GE, // >=
OP_SHR, // >>
OP_SHR_ASSIGN, // >>=
OP_SPACESHIP, // <=>
OP_ASSIGN, // =
OP_EQ, // ==
OP_NOT, // !
Expand Down Expand Up @@ -101,7 +104,7 @@ class CppParser_API OperatorToken: public CppToken
int asInteger() const;

private:
typedef std::map<std::string, int> OpMap;
using OpMap = std::map<std::string, int>;

OpMap _opMap;
};
Expand All @@ -112,7 +115,7 @@ class CppParser_API IdentifierToken: public CppToken
public:
enum Keywords
{
KW_ALIGNAS = 1,
KW_ALIGNAS = 100, // Note: start with 100 to avoid overlapping definitions with operators
KW_ALIGNOF,
KW_AND,
KW_AND_EQ,
Expand Down Expand Up @@ -206,7 +209,7 @@ class CppParser_API IdentifierToken: public CppToken
int asInteger() const;

private:
typedef std::map<std::string, int> KWMap;
using KWMap = std::map<std::string, int>;

KWMap _kwMap;
};
Expand Down
2 changes: 1 addition & 1 deletion platform/CppParser/include/Poco/CppParser/Decl.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ namespace CppParser {

class CppParser_API Decl: public Symbol
/// This class represents a simple declaration in a C++ source file.
/// It is a base class for Function, TypeDef or Variable.
/// It is a base class for Function, TypeDef, Using or Variable.
{
public:
Decl(const std::string& decl, NameSpace* pNameSpace);
Expand Down
4 changes: 2 additions & 2 deletions platform/CppParser/include/Poco/CppParser/Enum.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ class CppParser_API Enum: public Symbol
/// a collection of EnumValues.
{
public:
typedef std::vector<EnumValue*> Values;
typedef Values::const_iterator Iterator;
using Values = std::vector<EnumValue*>;
using Iterator = Values::const_iterator;

enum Flags
{
Expand Down
4 changes: 2 additions & 2 deletions platform/CppParser/include/Poco/CppParser/Function.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ class CppParser_API Function: public Decl
FN_DELETE = 1024 /// The function has been deleted.
};

typedef std::vector<Parameter*> Parameters;
typedef Parameters::const_iterator Iterator;
using Parameters = std::vector<Parameter*>;
using Iterator = Parameters::const_iterator;

Function(const std::string& decl, NameSpace* pNameSpace);
/// Creates the Function.
Expand Down
8 changes: 4 additions & 4 deletions platform/CppParser/include/Poco/CppParser/NameSpace.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ class CppParser_API NameSpace: public Symbol
/// This class represents a namespace.
{
public:
typedef std::multimap<std::string, Symbol*> SymbolTable;
typedef SymbolTable::const_iterator Iterator;
typedef std::map<std::string, std::string> AliasMap;
typedef std::vector<std::string> NameSpaceVec;
using SymbolTable = std::multimap<std::string, Symbol*>;
using Iterator = SymbolTable::const_iterator;
using AliasMap = std::map<std::string, std::string>;
using NameSpaceVec = std::vector<std::string>;

NameSpace();
/// Creates the NameSpace.
Expand Down
5 changes: 3 additions & 2 deletions platform/CppParser/include/Poco/CppParser/Parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class CppParser_API Parser
const Poco::Token* parseExtern(const Poco::Token* pNext);
const Poco::Token* parseTypeDef(const Poco::Token* pNext);
const Poco::Token* parseUsing(const Poco::Token* pNext);
const Poco::Token* parseFunc(const Poco::Token* pNext, std::string& decl);
const Poco::Token* parseFunc(const Poco::Token* pNext, const std::string& attrs, std::string& decl);
const Poco::Token* parseParameters(const Poco::Token* pNext, Function* pFunc);
const Poco::Token* parseBlock(const Poco::Token* pNext);
const Poco::Token* parseEnum(const Poco::Token* pNext);
Expand All @@ -82,6 +82,7 @@ class CppParser_API Parser
const Poco::Token* parseClassMembers(const Poco::Token* pNext, Struct* pClass);
const Poco::Token* parseAccess(const Poco::Token* pNext);
const Poco::Token* parseIdentifier(const Poco::Token* pNext, std::string& id);
const Poco::Token* parseAttributes(const Poco::Token* pNext, std::string& attrs);

void addSymbol(Symbol* pSymbol, int lineNumber, bool addGST = true);
void pushNameSpace(NameSpace* pNameSpace, int lineNumber, bool addGST = true);
Expand All @@ -102,7 +103,7 @@ class CppParser_API Parser
const Poco::Token* nextToken();

private:
typedef std::vector<NameSpace*> NSStack;
using NSStack = std::vector<NameSpace*>;

NameSpace::SymbolTable& _gst;
Poco::CountingInputStream _istr;
Expand Down
14 changes: 7 additions & 7 deletions platform/CppParser/include/Poco/CppParser/Struct.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,13 @@ class CppParser_API Struct: public NameSpace
Struct* pClass;
};

typedef std::vector<Base> BaseClasses;
typedef BaseClasses::const_iterator BaseIterator;
typedef std::vector<Struct*> StructVec;
typedef StructVec::const_iterator DerivedIterator;
typedef std::vector<Function*> Functions;
typedef std::set<Function*> FunctionSet;
typedef std::set<Struct*> StructSet;
using BaseClasses = std::vector<Base>;
using BaseIterator = BaseClasses::const_iterator;
using StructVec = std::vector<Struct*>;
using DerivedIterator = StructVec::const_iterator;
using Functions = std::vector<Function*>;
using FunctionSet = std::set<Function*>;
using StructSet = std::set<Struct*>;

Struct(const std::string& decl, bool isClass, NameSpace* pNameSpace);
/// Creates the Struct.
Expand Down
14 changes: 14 additions & 0 deletions platform/CppParser/include/Poco/CppParser/Symbol.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,13 @@ class CppParser_API Symbol
Access getAccess() const;
/// Returns the symbol's access.

void setAttributeList(const std::string& attrs);
/// Sets the C++11 attribute list, e.g. "[[noreturn]]".

const std::string& getAttributeList() const;
/// Returns the C++11 attribute list, or an empty string
/// if the symbol does not have one.

void setDocumentation(const std::string& text);
/// Sets the symbol's documentation.

Expand Down Expand Up @@ -169,6 +176,7 @@ class CppParser_API Symbol
std::string _package;
std::string _library;
Attributes _attrs;
std::string _attributeList;

static int _nextId;
};
Expand All @@ -189,6 +197,12 @@ inline const std::string& Symbol::name() const
}


inline const std::string& Symbol::getAttributeList() const
{
return _attributeList;
}


inline const std::string& Symbol::getDocumentation() const
{
return _documentation;
Expand Down
29 changes: 24 additions & 5 deletions platform/CppParser/src/CppToken.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,11 @@ void CppToken::syntaxError(const std::string& expected, const std::string& actua

OperatorToken::OperatorToken()
{
int i = 1;
int i = OP_OPENBRACKET;
_opMap["["] = i++;
_opMap["]"] = i++;
_opMap["[["] = i++;
_opMap["]]"] = i++;
_opMap["("] = i++;
_opMap[")"] = i++;
_opMap["{"] = i++;
Expand All @@ -64,6 +66,7 @@ OperatorToken::OperatorToken()
_opMap[">="] = i++;
_opMap[">>"] = i++;
_opMap[">>="] = i++;
_opMap["<=>"] = i++;
_opMap["="] = i++;
_opMap["=="] = i++;
_opMap["!"] = i++;
Expand Down Expand Up @@ -159,13 +162,23 @@ void OperatorToken::finish(std::istream& istr)
case ')':
case '{':
case '}':
case '[':
case ']':
case ';':
case '?':
case '~':
case ',':
break;
case '[':
if (next == '[')
{
_value += (char) istr.get();
}
break;
case ']':
if (next == ']')
{
_value += (char) istr.get();
}
break;
case '.':
if (next == '.')
{
Expand All @@ -182,8 +195,14 @@ void OperatorToken::finish(std::istream& istr)
{
_value += (char) istr.get();
next = (char) istr.peek();
if (next == '=') _value += (char) istr.get();
}
else if (next == '=')
{
_value += (char) istr.get();
next = (char) istr.peek();
if (next == '>') _value += (char) istr.get();
}
if (next == '=') _value += (char) istr.get();
break;
case '>':
if (next == '>')
Expand Down Expand Up @@ -231,7 +250,7 @@ int OperatorToken::asInteger() const

IdentifierToken::IdentifierToken()
{
int i = 1;
int i = KW_ALIGNAS;
_kwMap["alignas"] = i++;
_kwMap["alignof"] = i++;
_kwMap["and"] = i++;
Expand Down
Loading

0 comments on commit 3eaf2b4

Please sign in to comment.