Directives no longer require @ or ! prefix char
This commit is contained in:
parent
c927c74c2d
commit
09c9ec4b41
1 changed files with 62 additions and 59 deletions
|
|
@ -125,7 +125,7 @@ namespace {
|
|||
void tag_directive(char * line);
|
||||
void pop_directive(char * line);
|
||||
void define_directive(char * line);
|
||||
void general_directive(char * line);
|
||||
bool general_directive(char * line);
|
||||
|
||||
post_t * parse_post(char * line,
|
||||
std::streamsize len,
|
||||
|
|
@ -354,6 +354,13 @@ void instance_t::read_next_directive()
|
|||
period_xact_directive(line);
|
||||
break;
|
||||
|
||||
case '@':
|
||||
case '!':
|
||||
line++;
|
||||
// fall through...
|
||||
default: // some other directive
|
||||
if (! general_directive(line)) {
|
||||
switch (line[0]) {
|
||||
#if defined(TIMELOG_SUPPORT)
|
||||
case 'i':
|
||||
clock_in_directive(line, false);
|
||||
|
|
@ -392,13 +399,8 @@ void instance_t::read_next_directive()
|
|||
case 'Y': // set the current year
|
||||
year_directive(line);
|
||||
break;
|
||||
|
||||
case '@':
|
||||
case '!':
|
||||
line++;
|
||||
// fall through...
|
||||
default: // some other directive
|
||||
general_directive(line);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -689,58 +691,56 @@ void instance_t::define_directive(char * line)
|
|||
def.compile(scope); // causes definitions to be established
|
||||
}
|
||||
|
||||
void instance_t::general_directive(char * line)
|
||||
bool instance_t::general_directive(char * line)
|
||||
{
|
||||
char * p = line;
|
||||
char * arg = next_element(line);
|
||||
|
||||
if (*p == '@' || *p == '!')
|
||||
p++;
|
||||
|
||||
switch (*p) {
|
||||
case 'a':
|
||||
if (std::strcmp(p, "account") == 0) {
|
||||
account_directive(arg);
|
||||
return;
|
||||
account_directive(next_element(line));
|
||||
return true;
|
||||
}
|
||||
else if (std::strcmp(p, "alias") == 0) {
|
||||
alias_directive(arg);
|
||||
return;
|
||||
alias_directive(next_element(line));
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'd':
|
||||
if (std::strcmp(p, "def") == 0) {
|
||||
define_directive(arg);
|
||||
return;
|
||||
define_directive(next_element(line));
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'e':
|
||||
if (std::strcmp(p, "end") == 0) {
|
||||
end_directive(arg);
|
||||
return;
|
||||
end_directive(next_element(line));
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'i':
|
||||
if (std::strcmp(p, "include") == 0) {
|
||||
include_directive(arg);
|
||||
return;
|
||||
include_directive(next_element(line));
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'p':
|
||||
if (std::strcmp(p, "pop") == 0) {
|
||||
pop_directive(arg);
|
||||
return;
|
||||
pop_directive(next_element(line));
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
|
||||
case 't':
|
||||
if (std::strcmp(p, "tag") == 0) {
|
||||
tag_directive(arg);
|
||||
return;
|
||||
tag_directive(next_element(line));
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
@ -749,7 +749,10 @@ void instance_t::general_directive(char * line)
|
|||
call_scope_t args(*this);
|
||||
args.push_back(string_value(p));
|
||||
op->as_function()(args);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
post_t * instance_t::parse_post(char * line,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue