mirror of
https://github.com/tstack/lnav
synced 2024-11-01 21:40:34 +00:00
[parser] handle empty groups
This commit is contained in:
parent
2b76181fd6
commit
54b9c5ebf5
@ -323,7 +323,7 @@ public:
|
||||
|
||||
void update_capture(void)
|
||||
{
|
||||
if (this->e_sub_elements != NULL) {
|
||||
if (this->e_sub_elements != NULL && !this->e_sub_elements->empty()) {
|
||||
this->e_capture.c_begin =
|
||||
this->e_sub_elements->front().e_capture.c_begin;
|
||||
this->e_capture.c_end =
|
||||
@ -907,13 +907,20 @@ private:
|
||||
std::list<element_list_t>::reverse_iterator riter =
|
||||
this->dp_group_stack.rbegin();
|
||||
++riter;
|
||||
state_stack.top().finalize();
|
||||
this->dp_group_stack.back().el_format = state_stack.top().dfs_format;
|
||||
state_stack.pop();
|
||||
if (!this->dp_group_stack.back().empty()) {
|
||||
state_stack.top().finalize();
|
||||
this->dp_group_stack.back().el_format = state_stack.top().dfs_format;
|
||||
state_stack.pop();
|
||||
(*riter).PUSH_BACK(element(this->dp_group_stack.back(),
|
||||
DNT_GROUP));
|
||||
}
|
||||
else {
|
||||
(*riter).PUSH_BACK(element());
|
||||
riter->back().e_capture.c_begin = elem.e_capture.c_begin;
|
||||
riter->back().e_capture.c_end = elem.e_capture.c_begin;
|
||||
riter->back().e_token = DNT_GROUP;
|
||||
riter->back().assign_elements(this->dp_group_stack.back());
|
||||
}
|
||||
this->dp_group_stack.pop_back();
|
||||
}
|
||||
else {
|
||||
|
19
test/datafile_simple.17
Normal file
19
test/datafile_simple.17
Normal file
@ -0,0 +1,19 @@
|
||||
foo=[]; bar=['a', 'b']
|
||||
key 0:3 ^-^ foo
|
||||
grp 5:5 ^
|
||||
val 5:5 ^
|
||||
pair 0:5 ^---^ foo=[
|
||||
key 8:11 ^-^ bar
|
||||
key 14:14 ^
|
||||
quot 14:15 ^ a
|
||||
val 14:15 ^ a
|
||||
pair 14:15 ^ a
|
||||
key 19:19 ^
|
||||
quot 19:20 ^ b
|
||||
val 19:20 ^ b
|
||||
pair 19:20 ^ b
|
||||
grp 14:20 ^----^ a', 'b
|
||||
val 14:20 ^----^ a', 'b
|
||||
pair 8:20 ^----------^ bar=['a', 'b
|
||||
msg :foo=[]; bar=['a', 'b']
|
||||
format :foo=[#]; bar=[#]
|
Loading…
Reference in New Issue
Block a user