7 #ifndef RETDEC_BORLAND_AST_PARSER_H
8 #define RETDEC_BORLAND_AST_PARSER_H
10 #include <llvm/Demangle/StringView.h>
43 void parse(
const std::string &mangled);
45 std::shared_ptr<Node>
ast();
51 bool peek(
char c)
const;
66 bool parseBackref(std::shared_ptr<NodeArray> ¶mArray);
77 std::shared_ptr<Node>
parseTemplate(std::shared_ptr<Node> templateNamespace);
88 std::shared_ptr<NodeArray> ¶ms);
92 std::shared_ptr<Node>
_ast;
Parses name mangled by borland mangling scheme into AST.
Definition: borland_ast_parser.h:29
StringView _mangled
Definition: borland_ast_parser.h:91
void parse(const std::string &mangled)
Main method of parser. Tries to create AST, sets status.
Definition: borland_ast_parser.cpp:180
char peek() const
Definition: borland_ast_parser.cpp:67
std::shared_ptr< Node > parseOperator()
Definition: borland_ast_parser.cpp:432
bool couldBeOperator()
Definition: borland_ast_parser.cpp:359
std::shared_ptr< Node > parseFuncName()
Definition: borland_ast_parser.cpp:239
BorlandASTParser(Context &context)
Constructor for AST parser. Immediately parses name mangled by borland mangling scheme into AST.
Definition: borland_ast_parser.cpp:42
std::shared_ptr< Node > parseTemplateName(std::shared_ptr< Node > templateNamespace)
Definition: borland_ast_parser.cpp:981
std::shared_ptr< Node > parseFuncNameClasic()
Definition: borland_ast_parser.cpp:261
Status _status
Definition: borland_ast_parser.h:90
std::shared_ptr< FunctionTypeNode > parseFuncType(Qualifiers &quals)
Definition: borland_ast_parser.cpp:601
std::shared_ptr< Node > parseAsNameUntil(const char *end)
Definition: borland_ast_parser.cpp:554
std::shared_ptr< Node > parseTemplateParams()
Definition: borland_ast_parser.cpp:1019
std::shared_ptr< TypeNode > parseType()
Definition: borland_ast_parser.cpp:724
unsigned peekNumber() const
Definition: borland_ast_parser.cpp:91
std::shared_ptr< TypeNode > parsePointer(const Qualifiers &quals)
Definition: borland_ast_parser.cpp:776
std::shared_ptr< TypeNode > parseRReference()
Definition: borland_ast_parser.cpp:815
Context & _context
Definition: borland_ast_parser.h:93
std::shared_ptr< Node > _ast
Definition: borland_ast_parser.h:92
bool parseBackref(std::shared_ptr< NodeArray > ¶mArray)
Definition: borland_ast_parser.cpp:694
std::shared_ptr< TypeNode > parseReference()
Definition: borland_ast_parser.cpp:790
std::shared_ptr< Node > parseTemplate(std::shared_ptr< Node > templateNamespace)
Definition: borland_ast_parser.cpp:1149
std::shared_ptr< TypeNode > parseBuildInType(const Qualifiers &quals)
Definition: borland_ast_parser.cpp:863
bool consumeIfPossible(char c)
Definition: borland_ast_parser.cpp:134
Status status()
Definition: borland_ast_parser.cpp:59
std::shared_ptr< TypeNode > parseNamedType(unsigned nameLen, const Qualifiers &quals)
Definition: borland_ast_parser.cpp:950
bool consume(char c)
Definition: borland_ast_parser.cpp:151
std::shared_ptr< Node > ast()
Definition: borland_ast_parser.cpp:51
std::shared_ptr< NodeArray > parseFuncParams()
Definition: borland_ast_parser.cpp:666
std::shared_ptr< TypeNode > parseArray(const Qualifiers &quals)
Definition: borland_ast_parser.cpp:838
std::shared_ptr< Node > parseFunction()
Definition: borland_ast_parser.cpp:202
Qualifiers parseQualifiers()
Definition: borland_ast_parser.cpp:633
std::shared_ptr< Node > parseIntExpresion(StringView &s)
Definition: borland_ast_parser.cpp:1108
unsigned parseNumber()
Definition: borland_ast_parser.cpp:927
CallConv parseCallConv()
Definition: borland_ast_parser.cpp:646
bool checkResult(std::shared_ptr< Node > node)
Definition: borland_ast_parser.cpp:121
Status
Definition: borland_ast_parser.h:32
@ unknown_error
Definition: borland_ast_parser.h:37
@ in_progress
Definition: borland_ast_parser.h:35
@ invalid_mangled_name
Definition: borland_ast_parser.h:36
@ init
Definition: borland_ast_parser.h:34
@ success
Definition: borland_ast_parser.h:33
bool parseTemplateBackref(StringView &mangled, std::shared_ptr< NodeArray > ¶ms)
Definition: borland_ast_parser.cpp:1082
bool statusOk() const
Definition: borland_ast_parser.cpp:110
std::shared_ptr< Node > parseFuncNameLlvm()
Definition: borland_ast_parser.cpp:329
Storage for functions, types and names. Used for cacheing.
Definition: context.h:38
Representation of function types. Used for information about functions without name.
Definition: function_type.h:32
Node for representation of arrays of nodes.
Definition: node_array.h:20
Definition: qualifiers.h:20
Storage for all created nodes in borland AST.
llvm::itanium_demangle::StringView StringView
Definition: borland_ast_parser.h:19
CallConv
Definition: function_type.h:19
Definition: archive_wrapper.h:19
Base class for all nodes in borland AST.