diff options
-rw-r--r-- | MoonParser.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist | 8 | ||||
-rw-r--r-- | MoonParser/moon_ast.cpp | 13 |
2 files changed, 17 insertions, 4 deletions
diff --git a/MoonParser.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/MoonParser.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/MoonParser.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist | |||
@@ -0,0 +1,8 @@ | |||
1 | <?xml version="1.0" encoding="UTF-8"?> | ||
2 | <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
3 | <plist version="1.0"> | ||
4 | <dict> | ||
5 | <key>IDEDidComputeMac32BitWarning</key> | ||
6 | <true/> | ||
7 | </dict> | ||
8 | </plist> | ||
diff --git a/MoonParser/moon_ast.cpp b/MoonParser/moon_ast.cpp index 9627eab..2a6ca61 100644 --- a/MoonParser/moon_ast.cpp +++ b/MoonParser/moon_ast.cpp | |||
@@ -158,18 +158,23 @@ import hello, \func from thing | |||
158 | if (parse(i, BlockEnd, el, root, &st)) | 158 | if (parse(i, BlockEnd, el, root, &st)) |
159 | { | 159 | { |
160 | std::cout << "matched!\n"; | 160 | std::cout << "matched!\n"; |
161 | root->visit([](ast_node* node) | 161 | int indent = 0; |
162 | root->visit([&](ast_node* node) | ||
162 | { | 163 | { |
163 | if (std::string("Seperator") != node->getName()) | 164 | if (std::string("Seperator") != node->getName()) |
164 | { | 165 | { |
165 | std::cout << "{" << node->getName(); | 166 | indent++; |
167 | for (int i = 0; i < indent; i++) std::cout << " "; | ||
168 | std::cout << "{" << node->getName() << "\n"; | ||
166 | } | 169 | } |
167 | return false; | 170 | return false; |
168 | }, [](ast_node* node) | 171 | }, [&](ast_node* node) |
169 | { | 172 | { |
170 | if (std::string("Seperator") != node->getName()) | 173 | if (std::string("Seperator") != node->getName()) |
171 | { | 174 | { |
172 | std::cout << "}" ; | 175 | for (int i = 0; i < indent; i++) std::cout << " "; |
176 | std::cout << "}\n" ; | ||
177 | indent--; | ||
173 | } | 178 | } |
174 | return false; | 179 | return false; |
175 | }); | 180 | }); |