@@ -22,7 +22,7 @@ namespace JsonParser {
2222 *
2323 */
2424 class Grammar {
25- friend Node* Parser (const std::vector<std::string> &chs);
25+ friend Node Parser (const std::vector<std::string> &chs);
2626private:
2727 /* *
2828 * @brief Process <Array> in recursive descent parser.
@@ -108,7 +108,7 @@ namespace JsonParser {
108108 if (chs[index_current + 1 ][0 ] != ' "' ) {
109109 throw std::runtime_error (" At Object(): '\" ' is expected, however other character is set." );
110110 }
111- child = new Node (chs[index_current + 1 ]);
111+ child = new Node (chs[index_current + 1 ]. substr ( 1 , chs[index_current + 1 ]. size () - 2 ) );
112112
113113 // Check exists ":" between "key" and Value.
114114 if (index_current + 2 >= chs.size ()) {
@@ -182,9 +182,9 @@ namespace JsonParser {
182182 * @param[in] const std::vector<std::string> &chs Token array from lexical analyzer
183183 * @return JsonParser::Node* Pointer indicating the root AST node
184184 */
185- inline Node* Parser (const std::vector<std::string> &chs) {
186- Node* root = new Node (" " );
187- if (Grammar::Value (0 , chs, root) != chs.size ()) {
185+ inline Node Parser (const std::vector<std::string> &chs) {
186+ Node root (" " );
187+ if (Grammar::Value (0 , chs, & root) != chs.size ()) {
188188 throw std::runtime_error (" At Parser(): Return value of Value() is not equal to chs.size()." );
189189 }
190190 return root;
0 commit comments