Skip to content

Commit de8b655

Browse files
committed
refactor(ast): update variable names for clarity
1 parent 5180765 commit de8b655

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

fortls/parsers/internal/ast.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def __init__(self, file_obj=None):
3939
self.none_scope = None
4040
self.inc_scope = None
4141
self.current_scope = None
42-
self.END_SCOPE_REGEX: Pattern = None
42+
self.end_scope_regex: Pattern = None
4343
self.enc_scope_name: str = None
4444
self.last_obj = None
4545
self.pending_doc: str = None
@@ -60,7 +60,7 @@ def get_enc_scope_name(self):
6060
def add_scope(
6161
self,
6262
new_scope: Scope,
63-
END_SCOPE_REGEX: Pattern[str],
63+
end_scope_regex: Pattern[str],
6464
exportable: bool = True,
6565
req_container: bool = False,
6666
):
@@ -80,10 +80,10 @@ def add_scope(
8080
else:
8181
self.current_scope.add_child(new_scope)
8282
self.scope_stack.append(self.current_scope)
83-
if self.END_SCOPE_REGEX is not None:
84-
self.end_stack.append(self.END_SCOPE_REGEX)
83+
if self.end_scope_regex is not None:
84+
self.end_stack.append(self.end_scope_regex)
8585
self.current_scope = new_scope
86-
self.END_SCOPE_REGEX = END_SCOPE_REGEX
86+
self.end_scope_regex = end_scope_regex
8787
self.enc_scope_name = self.get_enc_scope_name()
8888
self.last_obj = new_scope
8989
if self.pending_doc is not None:
@@ -102,9 +102,9 @@ def end_scope(self, line_number: int, check: bool = True):
102102
else:
103103
self.current_scope = None
104104
if len(self.end_stack) > 0:
105-
self.END_SCOPE_REGEX = self.end_stack.pop()
105+
self.end_scope_regex = self.end_stack.pop()
106106
else:
107-
self.END_SCOPE_REGEX = None
107+
self.end_scope_regex = None
108108
self.enc_scope_name = self.get_enc_scope_name()
109109

110110
def add_variable(self, new_var: Variable):

fortls/parsers/internal/parser.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1352,7 +1352,7 @@ def parse(
13521352
line = multi_lines.pop()
13531353
line_stripped = line
13541354
# Test for scope end
1355-
if file_ast.END_SCOPE_REGEX is not None:
1355+
if file_ast.end_scope_regex is not None:
13561356
match = FRegex.END_WORD.match(line_no_comment)
13571357
# Handle end statement
13581358
if self.parse_end_scope_word(line_no_comment, line_no, file_ast, match):
@@ -1766,7 +1766,7 @@ def parse_end_scope_word(
17661766
):
17671767
file_ast.end_errors.append([ln, file_ast.current_scope.sline])
17681768
else:
1769-
scope_match = file_ast.END_SCOPE_REGEX.match(line[match.start(1) :])
1769+
scope_match = file_ast.end_scope_regex.match(line[match.start(1) :])
17701770
if scope_match is not None:
17711771
end_scope_word = scope_match.group(0)
17721772
if end_scope_word is not None:

0 commit comments

Comments
 (0)