aboutsummaryrefslogtreecommitdiff
path: root/src/MoonP/parser.cpp
diff options
context:
space:
mode:
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
2All 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
9THIS 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
11namespace parserlib { 21namespace parserlib {
@@ -768,12 +778,12 @@ public:
768class _true : public _expr { 778class _true : public _expr {
769public: 779public:
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:
783class _false: public _expr { 793class _false: public _expr {
784public: 794public:
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 */
1214rule::rule(const rule &r) { 1223rule::rule(const rule &) {
1215 throw std::logic_error("invalid operation"); 1224 throw std::logic_error("invalid operation");
1216} 1225}
1217 1226