diff options
| author | Li Jin <dragon-fly@qq.com> | 2017-07-19 11:05:45 +0800 |
|---|---|---|
| committer | Li Jin <dragon-fly@qq.com> | 2017-07-19 11:05:45 +0800 |
| commit | 65dd230959dbab99b52b99fd807534c254fb4ed9 (patch) | |
| tree | fb5b2718be96bf1f67bf8b015fcc8e2b1dfd5d7e /MoonParser/moon_parser.h | |
| parent | 2531792fa8da2a2f2ae218c43937f88028d26888 (diff) | |
| download | yuescript-65dd230959dbab99b52b99fd807534c254fb4ed9.tar.gz yuescript-65dd230959dbab99b52b99fd807534c254fb4ed9.tar.bz2 yuescript-65dd230959dbab99b52b99fd807534c254fb4ed9.zip | |
add codes.
Diffstat (limited to '')
| -rw-r--r-- | MoonParser/moon_parser.h | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/MoonParser/moon_parser.h b/MoonParser/moon_parser.h new file mode 100644 index 0000000..0c3f427 --- /dev/null +++ b/MoonParser/moon_parser.h | |||
| @@ -0,0 +1,31 @@ | |||
| 1 | #pragma once | ||
| 2 | |||
| 3 | #include <string> | ||
| 4 | #include <codecvt> | ||
| 5 | #include <unordered_set> | ||
| 6 | #include <stack> | ||
| 7 | #include <algorithm> | ||
| 8 | #include <sstream> | ||
| 9 | #include <vector> | ||
| 10 | #include "parserlib.hpp" | ||
| 11 | using namespace parserlib; | ||
| 12 | |||
| 13 | struct State | ||
| 14 | { | ||
| 15 | State() | ||
| 16 | { | ||
| 17 | indents.push(0); | ||
| 18 | stringOpen = -1; | ||
| 19 | } | ||
| 20 | std::stringstream buffer; | ||
| 21 | size_t stringOpen; | ||
| 22 | std::stack<int> indents; | ||
| 23 | std::stack<bool> doStack; | ||
| 24 | std::unordered_set<std::string> keywords = { | ||
| 25 | "and", "while", "else", "using", "continue", | ||
| 26 | "local", "not", "then", "return", "from", | ||
| 27 | "extends", "for", "do", "or", "export", | ||
| 28 | "class", "in", "unless", "when", "elseif", | ||
| 29 | "switch", "break", "if", "with", "import" | ||
| 30 | }; | ||
| 31 | }; | ||
