diff options
| author | Li Jin <dragon-fly@qq.com> | 2020-01-30 19:19:45 +0800 |
|---|---|---|
| committer | Li Jin <dragon-fly@qq.com> | 2020-01-30 19:19:45 +0800 |
| commit | 3f535edc133d7d6eb45ebf50627f3ee5deae1155 (patch) | |
| tree | 35ea1b1733d01683dfe149b011e8ddb33912f5a8 /src/MoonP/moon_parser.cpp | |
| parent | f6a9052be67134aeaad59d0e6f4058dfd09ce324 (diff) | |
| download | yuescript-3f535edc133d7d6eb45ebf50627f3ee5deae1155.tar.gz yuescript-3f535edc133d7d6eb45ebf50627f3ee5deae1155.tar.bz2 yuescript-3f535edc133d7d6eb45ebf50627f3ee5deae1155.zip | |
make gcc happy.
Diffstat (limited to '')
| -rw-r--r-- | src/MoonP/moon_parser.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/MoonP/moon_parser.cpp b/src/MoonP/moon_parser.cpp index 60096af..b2aba20 100644 --- a/src/MoonP/moon_parser.cpp +++ b/src/MoonP/moon_parser.cpp | |||
| @@ -496,8 +496,8 @@ MoonParser::MoonParser() { | |||
| 496 | ParseInfo MoonParser::parse(const std::string& codes, rule& r) { | 496 | ParseInfo MoonParser::parse(const std::string& codes, rule& r) { |
| 497 | ParseInfo res; | 497 | ParseInfo res; |
| 498 | try { | 498 | try { |
| 499 | res.input = std::make_unique<input>(); | 499 | res.codes = std::make_unique<input>(); |
| 500 | *(res.input) = _converter.from_bytes(codes); | 500 | *(res.codes) = _converter.from_bytes(codes); |
| 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; |
| @@ -505,7 +505,7 @@ ParseInfo MoonParser::parse(const std::string& codes, rule& r) { | |||
| 505 | error_list errors; | 505 | error_list errors; |
| 506 | try { | 506 | try { |
| 507 | State state; | 507 | State state; |
| 508 | res.node.set(pl::parse(*(res.input), r, errors, &state)); | 508 | res.node.set(pl::parse(*(res.codes), r, errors, &state)); |
| 509 | } catch (const std::logic_error& err) { | 509 | } catch (const std::logic_error& err) { |
| 510 | res.error = err.what(); | 510 | res.error = err.what(); |
| 511 | return res; | 511 | return res; |
| @@ -536,12 +536,12 @@ std::string MoonParser::toString(input::iterator begin, input::iterator end) { | |||
| 536 | return _converter.to_bytes(std::wstring(begin, end)); | 536 | return _converter.to_bytes(std::wstring(begin, end)); |
| 537 | } | 537 | } |
| 538 | 538 | ||
| 539 | input MoonParser::encode(std::string_view input) { | 539 | input MoonParser::encode(std::string_view codes) { |
| 540 | return _converter.from_bytes(std::string(input)); | 540 | return _converter.from_bytes(std::string(codes)); |
| 541 | } | 541 | } |
| 542 | 542 | ||
| 543 | std::string MoonParser::decode(const input& input) { | 543 | std::string MoonParser::decode(const input& codes) { |
| 544 | return _converter.to_bytes(input); | 544 | return _converter.to_bytes(codes); |
| 545 | } | 545 | } |
| 546 | 546 | ||
| 547 | namespace Utils { | 547 | namespace Utils { |
| @@ -557,10 +557,10 @@ namespace Utils { | |||
| 557 | std::string ParseInfo::errorMessage(std::string_view msg, const input_range* loc) const { | 557 | std::string ParseInfo::errorMessage(std::string_view msg, const input_range* loc) const { |
| 558 | const int ASCII = 255; | 558 | const int ASCII = 255; |
| 559 | int length = loc->m_begin.m_line; | 559 | int length = loc->m_begin.m_line; |
| 560 | auto begin = input->begin(); | 560 | auto begin = codes->begin(); |
| 561 | auto end = input->end(); | 561 | auto end = codes->end(); |
| 562 | int count = 0; | 562 | int count = 0; |
| 563 | for (auto it = input->begin(); it != input->end(); ++it) { | 563 | for (auto it = codes->begin(); it != codes->end(); ++it) { |
| 564 | if (*it == '\n') { | 564 | if (*it == '\n') { |
| 565 | if (count + 1 == length) { | 565 | if (count + 1 == length) { |
| 566 | end = it; | 566 | end = it; |
