diff options
| author | Li Jin <dragon-fly@qq.com> | 2020-02-22 01:24:47 +0800 |
|---|---|---|
| committer | Li Jin <dragon-fly@qq.com> | 2020-02-22 01:24:47 +0800 |
| commit | 39457b75c0923cf287c9145fd9c9a6ba4a86767b (patch) | |
| tree | 975f5adcad63d17821b2f40020dc2e15fae1bdac /src/MoonP/moon_parser.h | |
| parent | 2e9e28ceb3444e0aaf0ff7c704800b9cdc25dc87 (diff) | |
| download | yuescript-39457b75c0923cf287c9145fd9c9a6ba4a86767b.tar.gz yuescript-39457b75c0923cf287c9145fd9c9a6ba4a86767b.tar.bz2 yuescript-39457b75c0923cf287c9145fd9c9a6ba4a86767b.zip | |
change some interfaces.
Diffstat (limited to 'src/MoonP/moon_parser.h')
| -rw-r--r-- | src/MoonP/moon_parser.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/MoonP/moon_parser.h b/src/MoonP/moon_parser.h index 7a1a8a9..215c6a4 100644 --- a/src/MoonP/moon_parser.h +++ b/src/MoonP/moon_parser.h | |||
| @@ -45,7 +45,7 @@ public: | |||
| 45 | MoonParser(); | 45 | MoonParser(); |
| 46 | 46 | ||
| 47 | template<class AST> | 47 | template<class AST> |
| 48 | ParseInfo parse(const std::string& codes) { | 48 | ParseInfo parse(std::string_view codes) { |
| 49 | error_list errors; | 49 | error_list errors; |
| 50 | auto res = parse(codes, getRule<AST>()); | 50 | auto res = parse(codes, getRule<AST>()); |
| 51 | if (res.node.template is<AST>()) { | 51 | if (res.node.template is<AST>()) { |
| @@ -55,7 +55,7 @@ public: | |||
| 55 | } | 55 | } |
| 56 | 56 | ||
| 57 | template <class AST> | 57 | template <class AST> |
| 58 | bool match(const std::string& codes) { | 58 | bool match(std::string_view codes) { |
| 59 | auto rEnd = rule(getRule<AST>() >> eof()); | 59 | auto rEnd = rule(getRule<AST>() >> eof()); |
| 60 | return parse(codes, rEnd).node; | 60 | return parse(codes, rEnd).node; |
| 61 | } | 61 | } |
| @@ -67,7 +67,7 @@ public: | |||
| 67 | std::string decode(const input& input); | 67 | std::string decode(const input& input); |
| 68 | 68 | ||
| 69 | protected: | 69 | protected: |
| 70 | ParseInfo parse(const std::string& codes, rule& r); | 70 | ParseInfo parse(std::string_view codes, rule& r); |
| 71 | 71 | ||
| 72 | struct State { | 72 | struct State { |
| 73 | State() { | 73 | State() { |
