timew: Instantiates Grammar

This commit is contained in:
Paul Beckingham 2015-12-20 16:20:15 -05:00
parent a5922b7797
commit 801f39d2fa
3 changed files with 31 additions and 0 deletions

View file

@ -26,6 +26,7 @@
#include <cmake.h>
#include <Grammar.h>
#include <text.h>
////////////////////////////////////////////////////////////////////////////////
Grammar::Grammar ()
@ -33,3 +34,22 @@ Grammar::Grammar ()
}
////////////////////////////////////////////////////////////////////////////////
void Grammar::loadFromFile (File& file)
{
if (file.exists ())
{
std::string contents;
file.read (contents);
loadFromString (contents);
}
else
throw format ("Grammar file '{0}'not found.", static_cast<std::string> (file));
}
////////////////////////////////////////////////////////////////////////////////
void Grammar::loadFromString (const std::string& input)
{
// TODO Load and parse BNF.
}
////////////////////////////////////////////////////////////////////////////////