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
121
src/textual.cc
121
src/textual.cc
|
|
@ -125,7 +125,7 @@ namespace {
|
||||||
void tag_directive(char * line);
|
void tag_directive(char * line);
|
||||||
void pop_directive(char * line);
|
void pop_directive(char * line);
|
||||||
void define_directive(char * line);
|
void define_directive(char * line);
|
||||||
void general_directive(char * line);
|
bool general_directive(char * line);
|
||||||
|
|
||||||
post_t * parse_post(char * line,
|
post_t * parse_post(char * line,
|
||||||
std::streamsize len,
|
std::streamsize len,
|
||||||
|
|
@ -354,51 +354,53 @@ void instance_t::read_next_directive()
|
||||||
period_xact_directive(line);
|
period_xact_directive(line);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#if defined(TIMELOG_SUPPORT)
|
|
||||||
case 'i':
|
|
||||||
clock_in_directive(line, false);
|
|
||||||
break;
|
|
||||||
case 'I':
|
|
||||||
clock_in_directive(line, true);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'o':
|
|
||||||
clock_out_directive(line, false);
|
|
||||||
break;
|
|
||||||
case 'O':
|
|
||||||
clock_out_directive(line, true);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'h':
|
|
||||||
case 'b':
|
|
||||||
break;
|
|
||||||
#endif // TIMELOG_SUPPORT
|
|
||||||
|
|
||||||
case 'A': // a default account for unbalanced posts
|
|
||||||
default_account_directive(line);
|
|
||||||
break;
|
|
||||||
case 'C': // a set of conversions
|
|
||||||
price_conversion_directive(line);
|
|
||||||
break;
|
|
||||||
case 'D': // a default commodity for "xact"
|
|
||||||
default_commodity_directive(line);
|
|
||||||
break;
|
|
||||||
case 'N': // don't download prices
|
|
||||||
nomarket_directive(line);
|
|
||||||
break;
|
|
||||||
case 'P': // a pricing xact
|
|
||||||
price_xact_directive(line);
|
|
||||||
break;
|
|
||||||
case 'Y': // set the current year
|
|
||||||
year_directive(line);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case '@':
|
case '@':
|
||||||
case '!':
|
case '!':
|
||||||
line++;
|
line++;
|
||||||
// fall through...
|
// fall through...
|
||||||
default: // some other directive
|
default: // some other directive
|
||||||
general_directive(line);
|
if (! general_directive(line)) {
|
||||||
|
switch (line[0]) {
|
||||||
|
#if defined(TIMELOG_SUPPORT)
|
||||||
|
case 'i':
|
||||||
|
clock_in_directive(line, false);
|
||||||
|
break;
|
||||||
|
case 'I':
|
||||||
|
clock_in_directive(line, true);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'o':
|
||||||
|
clock_out_directive(line, false);
|
||||||
|
break;
|
||||||
|
case 'O':
|
||||||
|
clock_out_directive(line, true);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'h':
|
||||||
|
case 'b':
|
||||||
|
break;
|
||||||
|
#endif // TIMELOG_SUPPORT
|
||||||
|
|
||||||
|
case 'A': // a default account for unbalanced posts
|
||||||
|
default_account_directive(line);
|
||||||
|
break;
|
||||||
|
case 'C': // a set of conversions
|
||||||
|
price_conversion_directive(line);
|
||||||
|
break;
|
||||||
|
case 'D': // a default commodity for "xact"
|
||||||
|
default_commodity_directive(line);
|
||||||
|
break;
|
||||||
|
case 'N': // don't download prices
|
||||||
|
nomarket_directive(line);
|
||||||
|
break;
|
||||||
|
case 'P': // a pricing xact
|
||||||
|
price_xact_directive(line);
|
||||||
|
break;
|
||||||
|
case 'Y': // set the current year
|
||||||
|
year_directive(line);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -689,58 +691,56 @@ void instance_t::define_directive(char * line)
|
||||||
def.compile(scope); // causes definitions to be established
|
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 * p = line;
|
||||||
char * arg = next_element(line);
|
|
||||||
|
|
||||||
if (*p == '@' || *p == '!')
|
if (*p == '@' || *p == '!')
|
||||||
p++;
|
p++;
|
||||||
|
|
||||||
switch (*p) {
|
switch (*p) {
|
||||||
case 'a':
|
case 'a':
|
||||||
if (std::strcmp(p, "account") == 0) {
|
if (std::strcmp(p, "account") == 0) {
|
||||||
account_directive(arg);
|
account_directive(next_element(line));
|
||||||
return;
|
return true;
|
||||||
}
|
}
|
||||||
else if (std::strcmp(p, "alias") == 0) {
|
else if (std::strcmp(p, "alias") == 0) {
|
||||||
alias_directive(arg);
|
alias_directive(next_element(line));
|
||||||
return;
|
return true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'd':
|
case 'd':
|
||||||
if (std::strcmp(p, "def") == 0) {
|
if (std::strcmp(p, "def") == 0) {
|
||||||
define_directive(arg);
|
define_directive(next_element(line));
|
||||||
return;
|
return true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'e':
|
case 'e':
|
||||||
if (std::strcmp(p, "end") == 0) {
|
if (std::strcmp(p, "end") == 0) {
|
||||||
end_directive(arg);
|
end_directive(next_element(line));
|
||||||
return;
|
return true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'i':
|
case 'i':
|
||||||
if (std::strcmp(p, "include") == 0) {
|
if (std::strcmp(p, "include") == 0) {
|
||||||
include_directive(arg);
|
include_directive(next_element(line));
|
||||||
return;
|
return true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'p':
|
case 'p':
|
||||||
if (std::strcmp(p, "pop") == 0) {
|
if (std::strcmp(p, "pop") == 0) {
|
||||||
pop_directive(arg);
|
pop_directive(next_element(line));
|
||||||
return;
|
return true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 't':
|
case 't':
|
||||||
if (std::strcmp(p, "tag") == 0) {
|
if (std::strcmp(p, "tag") == 0) {
|
||||||
tag_directive(arg);
|
tag_directive(next_element(line));
|
||||||
return;
|
return true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -749,7 +749,10 @@ void instance_t::general_directive(char * line)
|
||||||
call_scope_t args(*this);
|
call_scope_t args(*this);
|
||||||
args.push_back(string_value(p));
|
args.push_back(string_value(p));
|
||||||
op->as_function()(args);
|
op->as_function()(args);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
post_t * instance_t::parse_post(char * line,
|
post_t * instance_t::parse_post(char * line,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue