mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-07-07 20:06:39 +02:00
timew: Instantiates Grammar
This commit is contained in:
parent
a5922b7797
commit
801f39d2fa
3 changed files with 31 additions and 0 deletions
|
@ -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.
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue