(parse): Set the beginning and ending line number for each entry as it
is parsed.
This commit is contained in:
parent
afa807a678
commit
92e591c237
1 changed files with 17 additions and 10 deletions
|
|
@ -467,6 +467,7 @@ unsigned int textual_parser_t::parse(std::istream& in,
|
||||||
while (in.good() && ! in.eof()) {
|
while (in.good() && ! in.eof()) {
|
||||||
try {
|
try {
|
||||||
istream_pos_type beg_pos = in.tellg();
|
istream_pos_type beg_pos = in.tellg();
|
||||||
|
unsigned long beg_line = linenum;
|
||||||
|
|
||||||
in.getline(line, MAX_LINE);
|
in.getline(line, MAX_LINE);
|
||||||
if (in.eof())
|
if (in.eof())
|
||||||
|
|
@ -631,7 +632,9 @@ unsigned int textual_parser_t::parse(std::istream& in,
|
||||||
journal->auto_entries.push_back(ae);
|
journal->auto_entries.push_back(ae);
|
||||||
ae->src_idx = src_idx;
|
ae->src_idx = src_idx;
|
||||||
ae->beg_pos = beg_pos;
|
ae->beg_pos = beg_pos;
|
||||||
|
ae->beg_line = beg_line;
|
||||||
ae->end_pos = in.tellg();
|
ae->end_pos = in.tellg();
|
||||||
|
ae->end_line = linenum;
|
||||||
} else {
|
} else {
|
||||||
throw parse_error(path, linenum,
|
throw parse_error(path, linenum,
|
||||||
"Automated entry failed to balance");
|
"Automated entry failed to balance");
|
||||||
|
|
@ -652,7 +655,9 @@ unsigned int textual_parser_t::parse(std::istream& in,
|
||||||
journal->period_entries.push_back(pe);
|
journal->period_entries.push_back(pe);
|
||||||
pe->src_idx = src_idx;
|
pe->src_idx = src_idx;
|
||||||
pe->beg_pos = beg_pos;
|
pe->beg_pos = beg_pos;
|
||||||
|
pe->beg_line = beg_line;
|
||||||
pe->end_pos = in.tellg();
|
pe->end_pos = in.tellg();
|
||||||
|
pe->end_line = linenum;
|
||||||
} else {
|
} else {
|
||||||
throw parse_error(path, linenum, "Period entry failed to balance");
|
throw parse_error(path, linenum, "Period entry failed to balance");
|
||||||
}
|
}
|
||||||
|
|
@ -725,7 +730,9 @@ unsigned int textual_parser_t::parse(std::istream& in,
|
||||||
if (journal->add_entry(entry)) {
|
if (journal->add_entry(entry)) {
|
||||||
entry->src_idx = src_idx;
|
entry->src_idx = src_idx;
|
||||||
entry->beg_pos = beg_pos;
|
entry->beg_pos = beg_pos;
|
||||||
|
entry->beg_line = beg_line;
|
||||||
entry->end_pos = in.tellg();
|
entry->end_pos = in.tellg();
|
||||||
|
entry->end_line = linenum;
|
||||||
count++;
|
count++;
|
||||||
} else {
|
} else {
|
||||||
print_entry(std::cerr, *entry);
|
print_entry(std::cerr, *entry);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue