Skip to content

Commit

Permalink
Fix #3613 (#3614)
Browse files Browse the repository at this point in the history
  • Loading branch information
kaby76 authored Jul 15, 2023
1 parent 8dda450 commit bca917e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
9 changes: 9 additions & 0 deletions gdscript/CSharp/GDScriptLexerBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -165,4 +165,13 @@ public void onNewLine(){
}
}
}

public override void Reset()
{
Tokens = new LinkedList<IToken>();
Indents = new Stack<int>();
Opened = 0;
LastToken = null;
base.Reset();
}
}
12 changes: 11 additions & 1 deletion gdscript/Java/GDScriptLexerBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ protected GDScriptLexerBase(CharStream input) {
// A queue where extra tokens are pushed on (see the NEWLINE lexer rule).
private java.util.LinkedList<Token> tokens = new java.util.LinkedList<>();
// The stack that keeps track of the indentation level.
private final Deque<Integer> indents = new ArrayDeque<>();
private Deque<Integer> indents = new ArrayDeque<>();
// The amount of opened braces, brackets and parenthesis.
private int opened = 0;
// The most recently produced token.
Expand Down Expand Up @@ -143,4 +143,14 @@ else if (indent > previous) {
}
}
}

@Override
public void reset()
{
tokens = new java.util.LinkedList<>();
indents = new ArrayDeque<>();
opened = 0;
lastToken = null;
super.reset();
}
}

0 comments on commit bca917e

Please sign in to comment.