Skip to content

Commit

Permalink
Update symbol pos map
Browse files Browse the repository at this point in the history
  • Loading branch information
shubhamugare committed Sep 14, 2024
1 parent be2fabc commit 0ef52a9
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions syncode/parsers/incremental_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,17 @@ def add_symbol_pos(self, symbol:str, pos:Tuple[int, int]):
if len(self._pos_map[symbol]) == 0 or self._pos_map[symbol][-1][0] != start_pos:
self._pos_map[symbol].append(pos)

def get_symbol_pos_start(self, symbol:str, k:int) -> int:
def get_symbol_pos_start(self, symbol:str, idx:int) -> int:
"""
Returns the k-th position of the symbol in the code.
"""
return self._pos_map[symbol][k][0]
return self._pos_map[symbol][idx][0]

def get_symbol_pos_end(self, symbol:str, idx:int) -> int:
"""
Returns the k-th position of the symbol in the code.
"""
return self._pos_map[symbol][idx][1]

def get_symbol_pos_all(self, symbol:str) -> list:
"""
Expand Down

0 comments on commit 0ef52a9

Please sign in to comment.