From 0d421b32b2e221700a1def4a66b9e9243cf824d5 Mon Sep 17 00:00:00 2001 From: starg Date: Thu, 15 Sep 2016 01:46:51 +0900 Subject: [PATCH] =?utf8?q?composition=20=E3=81=8B=20phrase=20=E4=BB=A5?= =?utf8?q?=E5=A4=96=E3=81=AE=E3=83=88=E3=83=BC=E3=82=AF=E3=83=B3=E3=81=8C?= =?utf8?q?=E3=81=82=E3=82=8B=E3=81=A8=E3=81=8D=E3=81=AE=E3=82=A8=E3=83=A9?= =?utf8?q?=E3=83=BC=E3=83=A1=E3=83=83=E3=82=BB=E3=83=BC=E3=82=B8=E3=82=92?= =?utf8?q?=E6=94=B9=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- include/message/id.hpp | 1 + src/driver/msgcallback.cpp | 3 ++- src/parser/error_module.hpp | 3 +++ src/parser/parser_module.hpp | 12 +++++++++++- 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/include/message/id.hpp b/include/message/id.hpp index 7c7749a..bc5b492 100644 --- a/include/message/id.hpp +++ b/include/message/id.hpp @@ -60,6 +60,7 @@ enum class MessageID : int GrammarUntilSingleQuote, // error_module.hpp + GrammarTrapNeitherCompositionNorPhrase, GrammarPhrasesAndCompositions, // grammar_phrase.hpp diff --git a/src/driver/msgcallback.cpp b/src/driver/msgcallback.cpp index 59a5071..9050d3d 100644 --- a/src/driver/msgcallback.cpp +++ b/src/driver/msgcallback.cpp @@ -81,7 +81,8 @@ MessagePrinter::MessagePrinter(IStdErrWriter* pStdErrWriter) {Message::MessageID::GrammarUntilSingleQuote, "unterminated string literal (missing single quote)"}, // error_module.hpp - {Message::MessageID::GrammarPhrasesAndCompositions, "parse error: GrammarPhrasesAndCompositions"}, + {Message::MessageID::GrammarTrapNeitherCompositionNorPhrase, "unexpected token '{0}', expecting 'phrase' or 'composition'"}, + {Message::MessageID::GrammarPhrasesAndCompositions, "expecting 'phrase' or 'composition'"}, // grammar_phrase.hpp {Message::MessageID::GrammarNoteSequenceBlockWithoutAttributes, "expecting '{' here"}, diff --git a/src/parser/error_module.hpp b/src/parser/error_module.hpp index 50e8faf..4c266df 100644 --- a/src/parser/error_module.hpp +++ b/src/parser/error_module.hpp @@ -13,6 +13,9 @@ namespace Parser { template<> +const Message::MessageID ErrorControl::ID = Message::MessageID::GrammarTrapNeitherCompositionNorPhrase; + +template<> const Message::MessageID ErrorControl::ID = Message::MessageID::GrammarPhrasesAndCompositions; template<> diff --git a/src/parser/parser_module.hpp b/src/parser/parser_module.hpp index b1ef2df..d809a14 100644 --- a/src/parser/parser_module.hpp +++ b/src/parser/parser_module.hpp @@ -3,6 +3,7 @@ #include +#include "parser_attribute.hpp" #include "parser_composition.hpp" #include "parser_phrase.hpp" #include "parser_skips.hpp" @@ -16,7 +17,16 @@ namespace Parser namespace Grammar { -class PhrasesAndCompositions : public pegtl::star, Separator>> +class TrapNeitherCompositionNorPhrase + : public pegtl::seq< + pegtl::disable, + pegtl::not_at, + pegtl::raise + > +{ +}; + +class PhrasesAndCompositions : public pegtl::star, Separator>> { }; -- 2.11.0