From d1e19d31717cea5c2c2f891176596f9dbeb4549a Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Tue, 22 Dec 2015 09:43:04 -0500 Subject: [PATCH] Grammar: Validates the presence of a start rule --- src/Grammar.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Grammar.cpp b/src/Grammar.cpp index bd577ee6..f6a0d192 100644 --- a/src/Grammar.cpp +++ b/src/Grammar.cpp @@ -172,6 +172,9 @@ std::string Grammar::dump () const //////////////////////////////////////////////////////////////////////////////// void Grammar::validate () const { + if (_start == "") + throw std::string ("There are no rules defined."); + std::vector allRules; std::vector allTokens; std::vector allLeftRecursive;