(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()) {
|
||||
try {
|
||||
istream_pos_type beg_pos = in.tellg();
|
||||
unsigned long beg_line = linenum;
|
||||
|
||||
in.getline(line, MAX_LINE);
|
||||
if (in.eof())
|
||||
|
|
@ -631,7 +632,9 @@ unsigned int textual_parser_t::parse(std::istream& in,
|
|||
journal->auto_entries.push_back(ae);
|
||||
ae->src_idx = src_idx;
|
||||
ae->beg_pos = beg_pos;
|
||||
ae->beg_line = beg_line;
|
||||
ae->end_pos = in.tellg();
|
||||
ae->end_line = linenum;
|
||||
} else {
|
||||
throw parse_error(path, linenum,
|
||||
"Automated entry failed to balance");
|
||||
|
|
@ -652,7 +655,9 @@ unsigned int textual_parser_t::parse(std::istream& in,
|
|||
journal->period_entries.push_back(pe);
|
||||
pe->src_idx = src_idx;
|
||||
pe->beg_pos = beg_pos;
|
||||
pe->beg_line = beg_line;
|
||||
pe->end_pos = in.tellg();
|
||||
pe->end_line = linenum;
|
||||
} else {
|
||||
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)) {
|
||||
entry->src_idx = src_idx;
|
||||
entry->beg_pos = beg_pos;
|
||||
entry->beg_line = beg_line;
|
||||
entry->end_pos = in.tellg();
|
||||
entry->end_line = linenum;
|
||||
count++;
|
||||
} else {
|
||||
print_entry(std::cerr, *entry);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue