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.cpp | |
| parent | 2e9e28ceb3444e0aaf0ff7c704800b9cdc25dc87 (diff) | |
| download | yuescript-39457b75c0923cf287c9145fd9c9a6ba4a86767b.tar.gz yuescript-39457b75c0923cf287c9145fd9c9a6ba4a86767b.tar.bz2 yuescript-39457b75c0923cf287c9145fd9c9a6ba4a86767b.zip | |
change some interfaces.
Diffstat (limited to '')
| -rw-r--r-- | src/MoonP/moon_parser.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/MoonP/moon_parser.cpp b/src/MoonP/moon_parser.cpp index 39551d2..1502f3c 100644 --- a/src/MoonP/moon_parser.cpp +++ b/src/MoonP/moon_parser.cpp | |||
| @@ -493,11 +493,11 @@ MoonParser::MoonParser() { | |||
| 493 | File = White >> -Shebang >> Block >> eof(); | 493 | File = White >> -Shebang >> Block >> eof(); |
| 494 | } | 494 | } |
| 495 | 495 | ||
| 496 | ParseInfo MoonParser::parse(const std::string& codes, rule& r) { | 496 | ParseInfo MoonParser::parse(std::string_view codes, rule& r) { |
| 497 | ParseInfo res; | 497 | ParseInfo res; |
| 498 | try { | 498 | try { |
| 499 | res.codes = std::make_unique<input>(); | 499 | res.codes = std::make_unique<input>(); |
| 500 | *(res.codes) = _converter.from_bytes(codes); | 500 | *(res.codes) = _converter.from_bytes(codes.begin(), codes.end()); |
| 501 | } catch (const std::range_error&) { | 501 | } catch (const std::range_error&) { |
| 502 | res.error = "Invalid text encoding."sv; | 502 | res.error = "Invalid text encoding."sv; |
| 503 | return res; | 503 | return res; |
| @@ -537,7 +537,7 @@ std::string MoonParser::toString(input::iterator begin, input::iterator end) { | |||
| 537 | } | 537 | } |
| 538 | 538 | ||
| 539 | input MoonParser::encode(std::string_view codes) { | 539 | input MoonParser::encode(std::string_view codes) { |
| 540 | return _converter.from_bytes(std::string(codes)); | 540 | return _converter.from_bytes(codes.begin(), codes.end()); |
| 541 | } | 541 | } |
| 542 | 542 | ||
| 543 | std::string MoonParser::decode(const input& codes) { | 543 | std::string MoonParser::decode(const input& codes) { |
