Skip to content

Commit 648fb37

Browse files
committed
use temporary preprocessing state object for preprocessing temporary token list
1 parent 7d28d64 commit 648fb37

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

messer.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1606,6 +1606,7 @@ class phase4_t{
16061606
}
16071607
}
16081608
copy.push_front({{"", token_type::empty}, it->annotation()});
1609+
pp_state copy_state{copy, std::move(tmp_state.replaced)};
16091610
std::size_t index = 0;
16101611
auto func_yield = [&](auto it_, std::size_t id){
16111612
std::vector<output_range<std::list<token_t>::const_iterator>> ret;
@@ -1630,7 +1631,7 @@ class phase4_t{
16301631
ret.emplace_back(b, it_),
16311632
b = std::next(it_);
16321633
ret.emplace_back(arg_it, end);
1633-
yield(state, tmp_state, it_, ret);
1634+
yield(state, copy_state, it_, ret);
16341635
};
16351636
func_yield(std::next(copy.begin()), index);
16361637
for(auto it_ = std::next(copy.begin()); it_ != copy.end();){
@@ -1672,7 +1673,7 @@ class phase4_t{
16721673
copy_insert(copy, next, args[-next_ai-1].begin(), args.back().end());
16731674
else if(next_ai > 0)
16741675
copy_insert(copy, next, args[ next_ai-1].begin(), args[next_ai-1].end());
1675-
apply_cat(it_, tmp_state);
1676+
apply_cat(it_, copy_state);
16761677
it_ = next_next;
16771678
index = next_i+1;
16781679
func_yield(it_, index);
@@ -1699,12 +1700,13 @@ class phase4_t{
16991700
copy_insert(copy, it_, args[ ai-1].begin(), args[ai-1].end());
17001701
else
17011702
if(ai < 0)
1702-
copy_eval_insert(copy_eval_insert, copy, it_, args[-ai-1].begin(), args.back().end(), index, tmp_state);
1703+
copy_eval_insert(copy_eval_insert, copy, it_, args[-ai-1].begin(), args.back().end(), index, copy_state);
17031704
else
1704-
copy_eval_insert(copy_eval_insert, copy, it_, args[ ai-1].begin(), args[ai-1].end(), index, tmp_state);
1705+
copy_eval_insert(copy_eval_insert, copy, it_, args[ ai-1].begin(), args[ai-1].end(), index, copy_state);
17051706
++index;
17061707
}
17071708
copy.pop_front();
1709+
tmp_state.replaced = std::move(copy_state.replaced);
17081710
for(auto it_ = copy.begin(), end_ = copy.end(); it_ != end_; ++it_){
17091711
if(tmp_state.replaced[it_].empty())
17101712
tmp_state.replaced[it_] = recur;

0 commit comments

Comments
 (0)