Skip to content

Commit bc61cde

Browse files
committed
Fix issue with tokenizer crash
1 parent cc2a610 commit bc61cde

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

identifier/tasks_identifier/code_task/AnnotationTask.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ def process_part(
4141
or part.content[parantheses_position[1][0]][0] != symbol
4242
):
4343
extractions.append(([(i, i + 1)], symbol, line))
44-
i = parantheses_position[1][0]
4544
else:
4645
extractions.append(
4746
(

utils.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,14 @@ def tokenize(s: str) -> list[str]:
4545
def find_token_substitution(s1: str, s2: str):
4646
IDENTIFIER_NAME = javalang.tokenizer.Identifier.__name__
4747
LITTERAL = []
48-
49-
s1_tokens = tokenize(s1)
50-
s2_tokens = tokenize(s2)
48+
s1_tokens = None
49+
s2_tokens = None
50+
51+
try:
52+
s1_tokens = tokenize(s1)
53+
s2_tokens = tokenize(s2)
54+
except:
55+
return None
5156

5257
LITTERAL += [
5358
v[2] for v in s1_tokens if issubclass(v[3], javalang.tokenizer.Literal)

0 commit comments

Comments
 (0)