summaryrefslogtreecommitdiff
path: root/src/textual.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2011-02-12 16:46:33 -0500
committerJohn Wiegley <johnw@newartisans.com>2011-02-12 17:55:56 -0500
commit30e830626b9fb3ef7684e29f90de4631d9bc2973 (patch)
tree818c16a5b4c61316e889c428880f19fd082181ee /src/textual.cc
parent1292eec17b317e5bd910760f74cf5849e272e23d (diff)
downloadfork-ledger-30e830626b9fb3ef7684e29f90de4631d9bc2973.tar.gz
fork-ledger-30e830626b9fb3ef7684e29f90de4631d9bc2973.tar.bz2
fork-ledger-30e830626b9fb3ef7684e29f90de4631d9bc2973.zip
Added "comment" and "test" directives
Diffstat (limited to 'src/textual.cc')
-rw-r--r--src/textual.cc21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/textual.cc b/src/textual.cc
index 97a34268..5bcbf86b 100644
--- a/src/textual.cc
+++ b/src/textual.cc
@@ -151,6 +151,7 @@ namespace {
void define_directive(char * line);
void assert_directive(char * line);
void check_directive(char * line);
+ void comment_directive(char * line);
void expr_directive(char * line);
bool general_directive(char * line);
@@ -310,7 +311,6 @@ void instance_t::read_next_directive()
{
char * line;
std::streamsize len = read_line(line);
-
if (len == 0 || line == NULL)
return;
@@ -911,6 +911,17 @@ void instance_t::check_directive(char * line)
warning_(_("Check failed: %1") << line);
}
+void instance_t::comment_directive(char * line)
+{
+ while (in.good() && ! in.eof()) {
+ if (read_line(line) > 0) {
+ std::string buf(line);
+ if (starts_with(buf, "end comment") || starts_with(buf, "end test"))
+ break;
+ }
+ }
+}
+
void instance_t::expr_directive(char * line)
{
expr_t expr(line);
@@ -961,6 +972,10 @@ bool instance_t::general_directive(char * line)
check_directive(arg);
return true;
}
+ else if (std::strcmp(p, "comment") == 0) {
+ comment_directive(arg);
+ return true;
+ }
break;
case 'd':
@@ -1007,6 +1022,10 @@ bool instance_t::general_directive(char * line)
tag_directive(arg);
return true;
}
+ else if (std::strcmp(p, "test") == 0) {
+ comment_directive(arg);
+ return true;
+ }
break;
case 'y':