Skip to content

Commit

Permalink
Merge pull request #1633 from GillesDuvert/close_issue_1632
Browse files Browse the repository at this point in the history
close #1632
  • Loading branch information
GillesDuvert authored Sep 8, 2023
2 parents b419d27 + 9dfac0a commit 26411df
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
7 changes: 4 additions & 3 deletions src/GDLLexer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,14 @@ class CUSTOM_API GDLLexer : public antlr::CharScanner, public GDLTokenTypes
// make copy as we delete 'this'
antlr::TokenStreamSelector* sel=selector;

// here 'this' is deleted (pops selector)
delete sel->getCurrentStream();

// make sure errors are reported in right file
parserPtr->setFilename(
static_cast<GDLLexer*>(selector->getCurrentStream())->getFilename());


// here 'this' is deleted (pops selector)
delete sel->getCurrentStream();

// don't allow EOF until main lexer. Force the
// selector to retry for another token.
sel->retry();
Expand Down
9 changes: 5 additions & 4 deletions src/gdlc.g
Original file line number Diff line number Diff line change
Expand Up @@ -2152,13 +2152,14 @@ tokens {
// make copy as we delete 'this'
antlr::TokenStreamSelector* sel=selector;

// here 'this' is deleted (pops selector)
delete sel->getCurrentStream();

// make sure errors are reported in right file
parserPtr->setFilename(
static_cast<GDLLexer*>(selector->getCurrentStream())->getFilename());


//GD: see issue #1632 -- deletion must be here and not before previous line!
// here 'this' is deleted (pops selector)
delete sel->getCurrentStream();

// don't allow EOF until main lexer. Force the
// selector to retry for another token.
sel->retry();
Expand Down

0 comments on commit 26411df

Please sign in to comment.