diff options
| author | Li Jin <dragon-fly@qq.com> | 2020-01-10 16:30:34 +0800 |
|---|---|---|
| committer | Li Jin <dragon-fly@qq.com> | 2020-01-10 16:30:34 +0800 |
| commit | 52a6536103f46c26a3ba9b149b0fe7b40d524d8c (patch) | |
| tree | 67e4759f8e1ea922079d0e162d84ecba5e558261 /src/MoonP/parser.cpp | |
| parent | 975167856ed0b11c2ede03c6eb750ca4e4a6a7fc (diff) | |
| download | yuescript-52a6536103f46c26a3ba9b149b0fe7b40d524d8c.tar.gz yuescript-52a6536103f46c26a3ba9b149b0fe7b40d524d8c.tar.bz2 yuescript-52a6536103f46c26a3ba9b149b0fe7b40d524d8c.zip | |
update.
Diffstat (limited to '')
| -rw-r--r-- | src/MoonP/parser.cpp (renamed from MoonParser/parser.cpp) | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/MoonParser/parser.cpp b/src/MoonP/parser.cpp index 03857c6..19c0068 100644 --- a/MoonParser/parser.cpp +++ b/src/MoonP/parser.cpp | |||
| @@ -1,3 +1,13 @@ | |||
| 1 | /* Copyright (c) 2012, Achilleas Margaritis, modified by Jin Li | ||
| 2 | All rights reserved. | ||
| 3 | |||
| 4 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: | ||
| 5 | |||
| 6 | Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. | ||
| 7 | Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. | ||
| 8 | |||
| 9 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ | ||
| 10 | |||
| 1 | #include <cstdlib> | 11 | #include <cstdlib> |
| 2 | #include <cstring> | 12 | #include <cstring> |
| 3 | #include <cassert> | 13 | #include <cassert> |
| @@ -5,7 +15,7 @@ | |||
| 5 | #include <unordered_map> | 15 | #include <unordered_map> |
| 6 | #include <unordered_set> | 16 | #include <unordered_set> |
| 7 | 17 | ||
| 8 | #include "parser.hpp" | 18 | #include "MoonP/parser.hpp" |
| 9 | 19 | ||
| 10 | 20 | ||
| 11 | namespace parserlib { | 21 | namespace parserlib { |
| @@ -768,12 +778,12 @@ public: | |||
| 768 | class _true : public _expr { | 778 | class _true : public _expr { |
| 769 | public: | 779 | public: |
| 770 | //parse with whitespace | 780 | //parse with whitespace |
| 771 | virtual bool parse_non_term(_context &con) const { | 781 | virtual bool parse_non_term(_context &) const { |
| 772 | return true; | 782 | return true; |
| 773 | } | 783 | } |
| 774 | 784 | ||
| 775 | //parse terminal | 785 | //parse terminal |
| 776 | virtual bool parse_term(_context &con) const { | 786 | virtual bool parse_term(_context &) const { |
| 777 | return true; | 787 | return true; |
| 778 | } | 788 | } |
| 779 | }; | 789 | }; |
| @@ -783,12 +793,12 @@ public: | |||
| 783 | class _false: public _expr { | 793 | class _false: public _expr { |
| 784 | public: | 794 | public: |
| 785 | //parse with whitespace | 795 | //parse with whitespace |
| 786 | virtual bool parse_non_term(_context &con) const { | 796 | virtual bool parse_non_term(_context &) const { |
| 787 | return false; | 797 | return false; |
| 788 | } | 798 | } |
| 789 | 799 | ||
| 790 | //parse terminal | 800 | //parse terminal |
| 791 | virtual bool parse_term(_context &con) const { | 801 | virtual bool parse_term(_context &) const { |
| 792 | return false; | 802 | return false; |
| 793 | } | 803 | } |
| 794 | }; | 804 | }; |
| @@ -1208,10 +1218,9 @@ rule::rule(rule &r) : | |||
| 1208 | 1218 | ||
| 1209 | 1219 | ||
| 1210 | /** invalid constructor from rule (required by gcc). | 1220 | /** invalid constructor from rule (required by gcc). |
| 1211 | @param r rule. | ||
| 1212 | @exception std::logic_error always thrown. | 1221 | @exception std::logic_error always thrown. |
| 1213 | */ | 1222 | */ |
| 1214 | rule::rule(const rule &r) { | 1223 | rule::rule(const rule &) { |
| 1215 | throw std::logic_error("invalid operation"); | 1224 | throw std::logic_error("invalid operation"); |
| 1216 | } | 1225 | } |
| 1217 | 1226 | ||
