File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change 23
23
class _SourceReader ():
24
24
# Used to tokenize python source code
25
25
def __init__ (self , source ):
26
- self .lines = re .findall (r'[^\n]*\n' , source )
26
+ self .lines = re .findall (r'[^\n]*\n? ' , source )
27
27
# To pop lines later
28
28
self .lines .reverse ()
29
29
@@ -118,12 +118,12 @@ def _search_symbol(source, symbol):
118
118
if source_tokens_str [i :i + symbol_len ] == symbol_tokens_str :
119
119
location_range = {
120
120
'start' : {
121
- 'line' : source_tokens [2 ][0 ] - 1 ,
122
- 'character' : source_tokens [2 ][1 ],
121
+ 'line' : source_tokens [i ][ 2 ][0 ] - 1 ,
122
+ 'character' : source_tokens [i ][ 2 ][1 ],
123
123
},
124
124
'end' : {
125
- 'line' : source_tokens [3 ][0 ] - 1 ,
126
- 'character' : source_tokens [3 ][1 ],
125
+ 'line' : source_tokens [i + symbol_len - 1 ][ 3 ][0 ] - 1 ,
126
+ 'character' : source_tokens [i + symbol_len - 1 ][ 3 ][1 ],
127
127
}
128
128
}
129
129
locations .append (location_range )
You can’t perform that action at this time.
0 commit comments