Added "comment" and "test" directives

This commit is contained in:
John Wiegley 2011-02-12 16:46:33 -05:00
parent 1292eec17b
commit 30e830626b

View file

@ -151,6 +151,7 @@ namespace {
void define_directive(char * line); void define_directive(char * line);
void assert_directive(char * line); void assert_directive(char * line);
void check_directive(char * line); void check_directive(char * line);
void comment_directive(char * line);
void expr_directive(char * line); void expr_directive(char * line);
bool general_directive(char * line); bool general_directive(char * line);
@ -310,7 +311,6 @@ void instance_t::read_next_directive()
{ {
char * line; char * line;
std::streamsize len = read_line(line); std::streamsize len = read_line(line);
if (len == 0 || line == NULL) if (len == 0 || line == NULL)
return; return;
@ -911,6 +911,17 @@ void instance_t::check_directive(char * line)
warning_(_("Check failed: %1") << 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) void instance_t::expr_directive(char * line)
{ {
expr_t expr(line); expr_t expr(line);
@ -961,6 +972,10 @@ bool instance_t::general_directive(char * line)
check_directive(arg); check_directive(arg);
return true; return true;
} }
else if (std::strcmp(p, "comment") == 0) {
comment_directive(arg);
return true;
}
break; break;
case 'd': case 'd':
@ -1007,6 +1022,10 @@ bool instance_t::general_directive(char * line)
tag_directive(arg); tag_directive(arg);
return true; return true;
} }
else if (std::strcmp(p, "test") == 0) {
comment_directive(arg);
return true;
}
break; break;
case 'y': case 'y':