diff options
author | Lefteris Karapetsas <lefteris@refu.co> | 2015-01-15 23:54:59 +0800 |
---|---|---|
committer | Lefteris Karapetsas <lefteris@refu.co> | 2015-01-15 23:56:40 +0800 |
commit | 9c8ce499693c13c32773ae65181573140ca1fc74 (patch) | |
tree | 5b4aecd920decfe148373315562664232e7148b9 /ASTJsonConverter.h | |
parent | 2eaf9ff865c029fb1a2aa3595a93275963ffe0cd (diff) | |
download | dexon-solidity-9c8ce499693c13c32773ae65181573140ca1fc74.tar.gz dexon-solidity-9c8ce499693c13c32773ae65181573140ca1fc74.tar.zst dexon-solidity-9c8ce499693c13c32773ae65181573140ca1fc74.zip |
Solidity AST Json Exporter
- A first version of the exporter is ready with this commit
- Further refinement will follow once it gets used
Diffstat (limited to 'ASTJsonConverter.h')
-rw-r--r-- | ASTJsonConverter.h | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/ASTJsonConverter.h b/ASTJsonConverter.h index 6db625fe..69030f39 100644 --- a/ASTJsonConverter.h +++ b/ASTJsonConverter.h @@ -114,21 +114,20 @@ public: void endVisit(Literal const&) override; private: - void addJsonNode(std::string const& _typeName, + void addKeyValue(Json::Value& _obj, std::string const& _key, std::string const& _val); + void addJsonNode(std::string const& _nodeName, std::initializer_list<std::pair<std::string const, std::string const>> _list, bool _hasChildren); - void printType(Expression const& _expression); + std::string const getType(Expression const& _expression); inline void goUp() { - std::cout << "goUp" << std::endl; - m_jsonNodePtrs.pop(); - m_depth--; - if (m_depth < 0) + if (m_jsonNodePtrs.empty()) BOOST_THROW_EXCEPTION(InternalCompilerError() << errinfo_comment("Internal error")); + m_jsonNodePtrs.pop(); }; Json::Value m_astJson; - std::stack<Json::Value> m_jsonNodePtrs; + std::stack<Json::Value*> m_jsonNodePtrs; std::string m_source; ASTNode const* m_ast; int m_depth; |