@@ -33,7 +33,7 @@ of this software and associated documentation files (the "Software"), to deal
33
33
34
34
public abstract class PythonLexerBase extends Lexer {
35
35
// A stack that keeps track of the indentation lengths
36
- private final Deque <Integer > _indentLengthStack = new ArrayDeque <>();
36
+ private Deque <Integer > _indentLengthStack = new ArrayDeque <>();
37
37
// A linked where tokens are waiting to be loaded into the token stream
38
38
private LinkedList <Token > _pendingTokens = new LinkedList <>();
39
39
@@ -49,15 +49,30 @@ public abstract class PythonLexerBase extends Lexer {
49
49
private boolean _wasIndentationMixedWithSpacesAndTabs = false ;
50
50
private final int _INVALID_LENGTH = -1 ;
51
51
52
- private CommonToken _curToken ; // current (under processing) token
53
- private Token _ffgToken ; // following (look ahead) token
52
+ private CommonToken _curToken = null ; // current (under processing) token
53
+ private Token _ffgToken = null ; // following (look ahead) token
54
54
55
55
private final String _ERR_TXT = " ERROR: " ;
56
56
57
57
protected PythonLexerBase (CharStream input ) {
58
58
super (input );
59
59
}
60
60
61
+ @ Override
62
+ public void reset () {
63
+ _indentLengthStack = new ArrayDeque <>();
64
+ _pendingTokens = new LinkedList <>();
65
+ _previousPendingTokenType = 0 ;
66
+ _lastPendingTokenTypeFromDefaultChannel = 0 ;
67
+ _opened = 0 ;
68
+ _wasSpaceIndentation = false ;
69
+ _wasTabIndentation = false ;
70
+ _wasIndentationMixedWithSpacesAndTabs = false ;
71
+ _curToken = null ;
72
+ _ffgToken = null ;
73
+ super .reset ();
74
+ }
75
+
61
76
@ Override
62
77
public Token nextToken () { // reading the input stream until a return EOF
63
78
checkNextToken ();
0 commit comments