mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-15 15:16:49 +02:00
updated CppParser
This commit is contained in:
@@ -4,14 +4,12 @@ vc.project.target = Poco${vc.project.name}
|
||||
vc.project.type = library
|
||||
vc.project.pocobase = ..
|
||||
vc.project.outdir = ${vc.project.pocobase}
|
||||
vc.project.platforms = Win32, x64
|
||||
vc.project.platforms = Win32, x64, WinCE
|
||||
vc.project.configurations = debug_shared, release_shared, debug_static_mt, release_static_mt, debug_static_md, release_static_md
|
||||
vc.project.prototype = CppParser_vs90.vcproj
|
||||
vc.project.prototype = ${vc.project.name}_vs90.vcproj
|
||||
vc.project.compiler.include = ..\\Foundation\\include
|
||||
vc.project.compiler.defines =
|
||||
vc.project.compiler.defines.shared = ${vc.project.name}_EXPORTS
|
||||
vc.project.compiler.defines.debug_shared = ${vc.project.compiler.defines.shared}
|
||||
vc.project.compiler.defines.release_shared = ${vc.project.compiler.defines.shared}
|
||||
vc.project.linker.dependencies =
|
||||
vc.solution.create = true
|
||||
vc.solution.include = testsuite\\TestSuite
|
||||
|
@@ -411,6 +411,8 @@
|
||||
Name="Symbol Table">
|
||||
<Filter
|
||||
Name="Header Files">
|
||||
<File
|
||||
RelativePath=".\include\Poco\CppParser\BuiltIn.h"/>
|
||||
<File
|
||||
RelativePath=".\include\Poco\CppParser\Decl.h"/>
|
||||
<File
|
||||
@@ -434,6 +436,8 @@
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Source Files">
|
||||
<File
|
||||
RelativePath=".\src\BuiltIn.cpp"/>
|
||||
<File
|
||||
RelativePath=".\src\Decl.cpp"/>
|
||||
<File
|
||||
|
@@ -1,7 +1,7 @@
|
||||
#
|
||||
# Makefile
|
||||
#
|
||||
# $Id: //poco/1.3/CppParser/Makefile#1 $
|
||||
# $Id: //poco/1.4/CppParser/Makefile#2 $
|
||||
#
|
||||
# Makefile for Poco CppParser
|
||||
#
|
||||
@@ -11,7 +11,7 @@ include $(POCO_BASE)/build/rules/global
|
||||
SHAREDOPT_CXX += -DCppParser_EXPORTS
|
||||
|
||||
objects = CppToken Decl Enum EnumValue Function NameSpace Parameter \
|
||||
Parser Struct Symbol Tokenizer TypeDef Utility Variable \
|
||||
Parser Struct Symbol Tokenizer TypeDef BuiltIn Utility Variable \
|
||||
Attributes AttributesParser
|
||||
|
||||
target = PocoCppParser
|
||||
|
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// Attributes.h
|
||||
//
|
||||
// $Id: //poco/1.3/CppParser/include/Poco/CppParser/Attributes.h#1 $
|
||||
// $Id: //poco/1.4/CppParser/include/Poco/CppParser/Attributes.h#2 $
|
||||
//
|
||||
// Library: CppParser
|
||||
// Package: Attributes
|
||||
@@ -106,6 +106,10 @@ public:
|
||||
void set(const std::string& name, const std::string& value);
|
||||
/// Sets the value of an attribute.
|
||||
|
||||
void remove(const std::string& name);
|
||||
/// Removes the attribute with the given name.
|
||||
/// Does nothing if the attribute does not exist.
|
||||
|
||||
const std::string& operator [] (const std::string& name) const;
|
||||
std::string& operator [] (const std::string& name);
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// AttributesParser.h
|
||||
//
|
||||
// $Id: //poco/1.3/CppParser/include/Poco/CppParser/AttributesParser.h#1 $
|
||||
// $Id: //poco/1.4/CppParser/include/Poco/CppParser/AttributesParser.h#2 $
|
||||
//
|
||||
// Library: CppParser
|
||||
// Package: Attributes
|
||||
@@ -61,10 +61,10 @@ class CppParser_API AttributesParser
|
||||
/// with the syntax:
|
||||
/// //@ <attrDecl>[,<attrDec>...]
|
||||
/// where <attrDecl> is
|
||||
/// <name>=<value>
|
||||
/// <name>[=<value>]
|
||||
/// <name> is a valid C++ identifier, or two identifiers separated by
|
||||
/// a period (struct accessor notation).
|
||||
/// <value> is a string, integer, bool literal, or a complex value
|
||||
/// <value> is a string, integer, identifier, bool literal, or a complex value
|
||||
/// in the form
|
||||
/// {<name>=<value>[,<name>=<value>...]}
|
||||
{
|
||||
|
69
CppParser/include/Poco/CppParser/BuiltIn.h
Normal file
69
CppParser/include/Poco/CppParser/BuiltIn.h
Normal file
@@ -0,0 +1,69 @@
|
||||
//
|
||||
// BuiltIn.h
|
||||
//
|
||||
// $Id: //poco/1.4/CppParser/include/Poco/CppParser/BuiltIn.h#1 $
|
||||
//
|
||||
// Library: CppParser
|
||||
// Package: SymbolTable
|
||||
// Module: BuiltIn
|
||||
//
|
||||
// Definition of the BuiltIn class.
|
||||
//
|
||||
// Copyright (c) 2011, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#ifndef CppParser_BuiltIn_INCLUDED
|
||||
#define CppParser_BuiltIn_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/CppParser/CppParser.h"
|
||||
#include "Poco/CppParser/Symbol.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace CppParser {
|
||||
|
||||
|
||||
class CppParser_API BuiltIn: public Symbol
|
||||
/// A placeholder for a built-in type.
|
||||
{
|
||||
public:
|
||||
BuiltIn(const std::string& name, NameSpace* pNameSpace);
|
||||
/// Creates the BuiltIn.
|
||||
|
||||
~BuiltIn();
|
||||
/// Destroys the BuiltIn.
|
||||
|
||||
Symbol::Kind kind() const;
|
||||
std::string toString() const;
|
||||
};
|
||||
|
||||
|
||||
} } // namespace Poco::CppParser
|
||||
|
||||
|
||||
#endif // CppParser_BuiltIn_INCLUDED
|
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// CppParser.h
|
||||
//
|
||||
// $Id: //poco/1.3/CppParser/include/Poco/CppParser/CppParser.h#2 $
|
||||
// $Id: //poco/1.4/CppParser/include/Poco/CppParser/CppParser.h#2 $
|
||||
//
|
||||
// Library: CppParser
|
||||
// Package: CppParser
|
||||
|
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// CppToken.h
|
||||
//
|
||||
// $Id: //poco/1.3/CppParser/include/Poco/CppParser/CppToken.h#2 $
|
||||
// $Id: //poco/1.4/CppParser/include/Poco/CppParser/CppToken.h#1 $
|
||||
//
|
||||
// Library: CppParser
|
||||
// Package: CppParser
|
||||
|
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// Decl.h
|
||||
//
|
||||
// $Id: //poco/1.3/CppParser/include/Poco/CppParser/Decl.h#1 $
|
||||
// $Id: //poco/1.4/CppParser/include/Poco/CppParser/Decl.h#1 $
|
||||
//
|
||||
// Library: CppParser
|
||||
// Package: SymbolTable
|
||||
|
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// Enum.h
|
||||
//
|
||||
// $Id: //poco/1.3/CppParser/include/Poco/CppParser/Enum.h#1 $
|
||||
// $Id: //poco/1.4/CppParser/include/Poco/CppParser/Enum.h#1 $
|
||||
//
|
||||
// Library: CppParser
|
||||
// Package: SymbolTable
|
||||
|
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// EnumValue.h
|
||||
//
|
||||
// $Id: //poco/1.3/CppParser/include/Poco/CppParser/EnumValue.h#1 $
|
||||
// $Id: //poco/1.4/CppParser/include/Poco/CppParser/EnumValue.h#1 $
|
||||
//
|
||||
// Library: CppParser
|
||||
// Package: SymbolTable
|
||||
|
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// Function.h
|
||||
//
|
||||
// $Id: //poco/1.3/CppParser/include/Poco/CppParser/Function.h#1 $
|
||||
// $Id: //poco/1.4/CppParser/include/Poco/CppParser/Function.h#1 $
|
||||
//
|
||||
// Library: CppParser
|
||||
// Package: SymbolTable
|
||||
|
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// NameSpace.h
|
||||
//
|
||||
// $Id: //poco/1.3/CppParser/include/Poco/CppParser/NameSpace.h#2 $
|
||||
// $Id: //poco/1.4/CppParser/include/Poco/CppParser/NameSpace.h#1 $
|
||||
//
|
||||
// Library: CppParser
|
||||
// Package: SymbolTable
|
||||
|
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// Parameter.h
|
||||
//
|
||||
// $Id: //poco/1.3/CppParser/include/Poco/CppParser/Parameter.h#1 $
|
||||
// $Id: //poco/1.4/CppParser/include/Poco/CppParser/Parameter.h#1 $
|
||||
//
|
||||
// Library: CppParser
|
||||
// Package: SymbolTable
|
||||
|
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// Parser.h
|
||||
//
|
||||
// $Id: //poco/1.3/CppParser/include/Poco/CppParser/Parser.h#3 $
|
||||
// $Id: //poco/1.4/CppParser/include/Poco/CppParser/Parser.h#1 $
|
||||
//
|
||||
// Library: CppParser
|
||||
// Package: CppParser
|
||||
|
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// Struct.h
|
||||
//
|
||||
// $Id: //poco/1.3/CppParser/include/Poco/CppParser/Struct.h#1 $
|
||||
// $Id: //poco/1.4/CppParser/include/Poco/CppParser/Struct.h#1 $
|
||||
//
|
||||
// Library: CppParser
|
||||
// Package: SymbolTable
|
||||
|
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// Symbol.h
|
||||
//
|
||||
// $Id: //poco/1.3/CppParser/include/Poco/CppParser/Symbol.h#1 $
|
||||
// $Id: //poco/1.4/CppParser/include/Poco/CppParser/Symbol.h#2 $
|
||||
//
|
||||
// Library: CppParser
|
||||
// Package: SymbolTable
|
||||
@@ -68,6 +68,7 @@ public:
|
||||
SYM_PARAMETER, /// A function parameter
|
||||
SYM_STRUCT, /// A struct or class
|
||||
SYM_TYPEDEF, /// A typedef
|
||||
SYM_BUILTIN, /// A built-in type
|
||||
SYM_VARIABLE /// A (member) variable
|
||||
};
|
||||
|
||||
@@ -141,6 +142,9 @@ public:
|
||||
const Attributes& attrs() const;
|
||||
/// Returns the symbol's attributes.
|
||||
|
||||
Attributes& attrs();
|
||||
/// Returns the symbol's attributes.
|
||||
|
||||
const Attributes& getAttributes() const;
|
||||
/// Returns the symbol's attributes.
|
||||
|
||||
@@ -254,6 +258,12 @@ inline const Attributes& Symbol::attrs() const
|
||||
}
|
||||
|
||||
|
||||
inline Attributes& Symbol::attrs()
|
||||
{
|
||||
return _attrs;
|
||||
}
|
||||
|
||||
|
||||
inline bool Symbol::isPublic() const
|
||||
{
|
||||
return _access == ACC_PUBLIC;
|
||||
|
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// Tokenizer.h
|
||||
//
|
||||
// $Id: //poco/1.3/CppParser/include/Poco/CppParser/Tokenizer.h#1 $
|
||||
// $Id: //poco/1.4/CppParser/include/Poco/CppParser/Tokenizer.h#1 $
|
||||
//
|
||||
// Library: CppParser
|
||||
// Package: CppParser
|
||||
|
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// TypeDef.h
|
||||
//
|
||||
// $Id: //poco/1.3/CppParser/include/Poco/CppParser/TypeDef.h#2 $
|
||||
// $Id: //poco/1.4/CppParser/include/Poco/CppParser/TypeDef.h#1 $
|
||||
//
|
||||
// Library: CppParser
|
||||
// Package: SymbolTable
|
||||
|
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// Utility.h
|
||||
//
|
||||
// $Id: //poco/1.3/CppParser/include/Poco/CppParser/Utility.h#1 $
|
||||
// $Id: //poco/1.4/CppParser/include/Poco/CppParser/Utility.h#1 $
|
||||
//
|
||||
// Library: CppParser
|
||||
// Package: CppParser
|
||||
|
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// Variable.h
|
||||
//
|
||||
// $Id: //poco/1.3/CppParser/include/Poco/CppParser/Variable.h#2 $
|
||||
// $Id: //poco/1.4/CppParser/include/Poco/CppParser/Variable.h#1 $
|
||||
//
|
||||
// Library: CppParser
|
||||
// Package: SymbolTable
|
||||
|
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// Attributes.cpp
|
||||
//
|
||||
// $Id: //poco/1.3/CppParser/src/Attributes.cpp#1 $
|
||||
// $Id: //poco/1.4/CppParser/src/Attributes.cpp#2 $
|
||||
//
|
||||
// Library: CppParser
|
||||
// Package: Attributes
|
||||
@@ -143,6 +143,14 @@ void Attributes::set(const std::string& name, const std::string& value)
|
||||
}
|
||||
|
||||
|
||||
void Attributes::remove(const std::string& name)
|
||||
{
|
||||
AttrMap::iterator it = _map.find(name);
|
||||
if (it != _map.end())
|
||||
_map.erase(it);
|
||||
}
|
||||
|
||||
|
||||
const std::string& Attributes::operator [] (const std::string& name) const
|
||||
{
|
||||
AttrMap::const_iterator it = _map.find(name);
|
||||
|
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// AttributesParser.cpp
|
||||
//
|
||||
// $Id: //poco/1.3/CppParser/src/AttributesParser.cpp#1 $
|
||||
// $Id: //poco/1.4/CppParser/src/AttributesParser.cpp#1 $
|
||||
//
|
||||
// Library: CppParser
|
||||
// Package: Attributes
|
||||
|
69
CppParser/src/BuiltIn.cpp
Normal file
69
CppParser/src/BuiltIn.cpp
Normal file
@@ -0,0 +1,69 @@
|
||||
//
|
||||
// BuiltIn.cpp
|
||||
//
|
||||
// $Id: //poco/1.4/CppParser/src/BuiltIn.cpp#1 $
|
||||
//
|
||||
// Library: CppParser
|
||||
// Package: SymbolTable
|
||||
// Module: BuiltIn
|
||||
//
|
||||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#include "Poco/CppParser/BuiltIn.h"
|
||||
#include "Poco/String.h"
|
||||
#include <cctype>
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace CppParser {
|
||||
|
||||
|
||||
BuiltIn::BuiltIn(const std::string& name, NameSpace* pNameSpace):
|
||||
Symbol(name, pNameSpace)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
BuiltIn::~BuiltIn()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Symbol::Kind BuiltIn::kind() const
|
||||
{
|
||||
return Symbol::SYM_BUILTIN;
|
||||
}
|
||||
|
||||
|
||||
std::string BuiltIn::toString() const
|
||||
{
|
||||
return fullName();
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::CppParser
|
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// CppToken.cpp
|
||||
//
|
||||
// $Id: //poco/1.3/CppParser/src/CppToken.cpp#4 $
|
||||
// $Id: //poco/1.4/CppParser/src/CppToken.cpp#2 $
|
||||
//
|
||||
// Library: CppParser
|
||||
// Package: CppParser
|
||||
@@ -36,6 +36,7 @@
|
||||
|
||||
#include "Poco/CppParser/CppToken.h"
|
||||
#include "Poco/Exception.h"
|
||||
#include "Poco/NumberParser.h"
|
||||
#include <cctype>
|
||||
#include <cstdlib>
|
||||
|
||||
@@ -613,14 +614,14 @@ void NumberLiteralToken::finish(std::istream& istr)
|
||||
|
||||
int NumberLiteralToken::asInteger() const
|
||||
{
|
||||
return static_cast<int>(strtol(_value.c_str(), 0, 0));
|
||||
return static_cast<int>(std::strtol(_value.c_str(), 0, 0));
|
||||
|
||||
}
|
||||
|
||||
|
||||
double NumberLiteralToken::asFloat() const
|
||||
{
|
||||
return strtod(_value.c_str(), 0);
|
||||
return std::strtod(_value.c_str(), 0);
|
||||
}
|
||||
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// Decl.cpp
|
||||
//
|
||||
// $Id: //poco/1.3/CppParser/src/Decl.cpp#2 $
|
||||
// $Id: //poco/1.4/CppParser/src/Decl.cpp#1 $
|
||||
//
|
||||
// Library: CppParser
|
||||
// Package: SymbolTable
|
||||
|
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// Enum.cpp
|
||||
//
|
||||
// $Id: //poco/1.3/CppParser/src/Enum.cpp#1 $
|
||||
// $Id: //poco/1.4/CppParser/src/Enum.cpp#1 $
|
||||
//
|
||||
// Library: CppParser
|
||||
// Package: SymbolTable
|
||||
|
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// EnumValue.cpp
|
||||
//
|
||||
// $Id: //poco/1.3/CppParser/src/EnumValue.cpp#1 $
|
||||
// $Id: //poco/1.4/CppParser/src/EnumValue.cpp#1 $
|
||||
//
|
||||
// Library: CppParser
|
||||
// Package: SymbolTable
|
||||
|
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// Function.cpp
|
||||
//
|
||||
// $Id: //poco/1.3/CppParser/src/Function.cpp#3 $
|
||||
// $Id: //poco/1.4/CppParser/src/Function.cpp#1 $
|
||||
//
|
||||
// Library: CppParser
|
||||
// Package: SymbolTable
|
||||
|
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// Namespace.cpp
|
||||
//
|
||||
// $Id: //poco/1.3/CppParser/src/NameSpace.cpp#3 $
|
||||
// $Id: //poco/1.4/CppParser/src/NameSpace.cpp#1 $
|
||||
//
|
||||
// Library: CppParser
|
||||
// Package: SymbolTable
|
||||
|
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// Parameter.cpp
|
||||
//
|
||||
// $Id: //poco/1.3/CppParser/src/Parameter.cpp#3 $
|
||||
// $Id: //poco/1.4/CppParser/src/Parameter.cpp#2 $
|
||||
//
|
||||
// Library: CppParser
|
||||
// Package: SymbolTable
|
||||
@@ -57,10 +57,12 @@ Parameter::Parameter(const std::string& decl, Function* pFunction):
|
||||
_isPointer(false),
|
||||
_isConst(false)
|
||||
{
|
||||
|
||||
std::size_t pos = declaration().rfind(name());
|
||||
|
||||
std::string tmp = declaration().substr(0, pos);
|
||||
std::string tmp;
|
||||
if (pos == 0 && name().size() == declaration().size())
|
||||
tmp = declaration();
|
||||
else
|
||||
tmp = declaration().substr(0, pos);
|
||||
_type = Poco::trim(tmp);
|
||||
std::size_t rightCut = _type.size();
|
||||
while (rightCut > 0 && (_type[rightCut-1] == '&' || _type[rightCut-1] == '*' || _type[rightCut-1] == '\t' || _type[rightCut-1] == ' '))
|
||||
@@ -83,7 +85,6 @@ Parameter::Parameter(const std::string& decl, Function* pFunction):
|
||||
_isConst = true;
|
||||
}
|
||||
|
||||
|
||||
Poco::trimInPlace(_type);
|
||||
pos = decl.find("=");
|
||||
_hasDefaultValue = (pos != std::string::npos);
|
||||
@@ -154,7 +155,6 @@ std::string Parameter::handleDecl(const std::string& decl)
|
||||
mustAdd = true;
|
||||
if (mustAdd)
|
||||
{
|
||||
|
||||
result.append(" ");
|
||||
result.append("param");
|
||||
result.append(Poco::NumberFormatter::format(++_count));
|
||||
|
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// Parser.cpp
|
||||
//
|
||||
// $Id: //poco/1.3/CppParser/src/Parser.cpp#7 $
|
||||
// $Id: //poco/1.4/CppParser/src/Parser.cpp#1 $
|
||||
//
|
||||
// Library: CppParser
|
||||
// Package: CppParser
|
||||
@@ -682,13 +682,18 @@ const Token* Parser::parseParameters(const Token* pNext, Function* pFunc)
|
||||
{
|
||||
std::string decl;
|
||||
int depth = 0;
|
||||
while ((depth > 0 || (!isOperator(pNext, OperatorToken::OP_CLOSPARENT) && !isOperator(pNext, OperatorToken::OP_COMMA))) && !isEOF(pNext))
|
||||
int tdepth = 0;
|
||||
while ((depth > 0 || tdepth > 0 || (!isOperator(pNext, OperatorToken::OP_CLOSPARENT) && !isOperator(pNext, OperatorToken::OP_COMMA))) && !isEOF(pNext))
|
||||
{
|
||||
append(decl, pNext);
|
||||
if (isOperator(pNext, OperatorToken::OP_OPENPARENT))
|
||||
++depth;
|
||||
else if (isOperator(pNext, OperatorToken::OP_CLOSPARENT))
|
||||
--depth;
|
||||
else if (isOperator(pNext, OperatorToken::OP_LT))
|
||||
++tdepth;
|
||||
else if (isOperator(pNext, OperatorToken::OP_GT))
|
||||
--tdepth;
|
||||
pNext = next();
|
||||
}
|
||||
if (isOperator(pNext, OperatorToken::OP_COMMA))
|
||||
|
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// Struct.cpp
|
||||
//
|
||||
// $Id: //poco/1.3/CppParser/src/Struct.cpp#2 $
|
||||
// $Id: //poco/1.4/CppParser/src/Struct.cpp#1 $
|
||||
//
|
||||
// Library: CppParser
|
||||
// Package: SymbolTable
|
||||
|
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// Symbol.cpp
|
||||
//
|
||||
// $Id: //poco/1.3/CppParser/src/Symbol.cpp#6 $
|
||||
// $Id: //poco/1.4/CppParser/src/Symbol.cpp#1 $
|
||||
//
|
||||
// Library: CppParser
|
||||
// Package: SymbolTable
|
||||
@@ -136,8 +136,14 @@ std::string Symbol::extractName(const std::string& decl)
|
||||
{
|
||||
poco_assert (!decl.empty());
|
||||
|
||||
// special cases: operator () and operator []
|
||||
if (decl.find("operator ()") != std::string::npos)
|
||||
return "operator ()";
|
||||
else if (decl.find("operator[]") != std::string::npos)
|
||||
return "operator []";
|
||||
|
||||
std::string::size_type pos = decl.find('(');
|
||||
// check for function pointer
|
||||
// another special case: function pointer
|
||||
if (pos != std::string::npos && pos < decl.size() - 1)
|
||||
{
|
||||
std::string::size_type i = pos + 1;
|
||||
@@ -154,11 +160,14 @@ std::string Symbol::extractName(const std::string& decl)
|
||||
if (pos == std::string::npos || (pos > 0 && decl[pos - 1] == '('))
|
||||
pos = decl.size();
|
||||
--pos;
|
||||
// check for constant
|
||||
std::string::size_type eqPos = decl.find('=');
|
||||
if (eqPos != std::string::npos)
|
||||
{
|
||||
// special case: default template parameter
|
||||
std::string::size_type gtPos = decl.find('>', eqPos);
|
||||
if ((gtPos == std::string::npos || gtPos > pos) && eqPos < pos && eqPos > 0 && decl[eqPos + 1] != '=')
|
||||
std::string::size_type ltPos = decl.find('<', eqPos);
|
||||
if ((gtPos == std::string::npos || gtPos > pos || (ltPos != std::string::npos && gtPos > ltPos)) && eqPos < pos && eqPos > 0 && decl[eqPos + 1] != '=')
|
||||
pos = eqPos - 1;
|
||||
}
|
||||
while (pos > 0 && std::isspace(decl[pos])) --pos;
|
||||
|
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// Tokenizer.cpp
|
||||
//
|
||||
// $Id: //poco/1.3/CppParser/src/Tokenizer.cpp#1 $
|
||||
// $Id: //poco/1.4/CppParser/src/Tokenizer.cpp#1 $
|
||||
//
|
||||
// Library: CppParser
|
||||
// Package: CppParser
|
||||
|
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// TypeDef.cpp
|
||||
//
|
||||
// $Id: //poco/1.3/CppParser/src/TypeDef.cpp#3 $
|
||||
// $Id: //poco/1.4/CppParser/src/TypeDef.cpp#1 $
|
||||
//
|
||||
// Library: CppParser
|
||||
// Package: SymbolTable
|
||||
|
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// Utility.cpp
|
||||
//
|
||||
// $Id: //poco/1.3/CppParser/src/Utility.cpp#5 $
|
||||
// $Id: //poco/1.4/CppParser/src/Utility.cpp#2 $
|
||||
//
|
||||
// Library: CppParser
|
||||
// Package: CppParser
|
||||
@@ -186,6 +186,7 @@ void Utility::detectPrefixAndIncludes(const std::string& origHFile, std::vector<
|
||||
istr.close();
|
||||
}
|
||||
|
||||
|
||||
std::string Utility::preprocessFile(const std::string& file, const std::string& exec, const std::string& options, const std::string& path)
|
||||
{
|
||||
Path pp(file);
|
||||
@@ -276,17 +277,16 @@ void Utility::buildFileList(std::set<std::string>& files, const std::vector<std:
|
||||
Glob::glob(*itInc, temp, options);
|
||||
}
|
||||
|
||||
std::vector <std::string>::const_iterator itExc = excludePattern.begin();
|
||||
std::vector <std::string>::const_iterator itExcEnd = excludePattern.end();
|
||||
|
||||
for (std::set<std::string>::const_iterator it = temp.begin(); it != temp.end(); ++it)
|
||||
{
|
||||
Path p(*it);
|
||||
bool include = true;
|
||||
std::vector <std::string>::const_iterator itExc = excludePattern.begin();
|
||||
std::vector <std::string>::const_iterator itExcEnd = excludePattern.end();
|
||||
for (; itExc != itExcEnd; ++itExc)
|
||||
{
|
||||
Glob glob(*itExc, options);
|
||||
if (glob.match(p.getFileName()))
|
||||
if (glob.match(p.toString()))
|
||||
include = false;
|
||||
}
|
||||
if (include)
|
||||
|
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// Variable.cpp
|
||||
//
|
||||
// $Id: //poco/1.3/CppParser/src/Variable.cpp#3 $
|
||||
// $Id: //poco/1.4/CppParser/src/Variable.cpp#1 $
|
||||
//
|
||||
// Library: CppParser
|
||||
// Package: SymbolTable
|
||||
|
Reference in New Issue
Block a user