Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 64109fc

Browse files
Neighbor should be none instead of end of file token And additional check for none
resolves #26 A check for none was missingAce but more importantly most of the functions expected none values When at the end of file But received EOF token instead
1 parent f662883 commit 64109fc

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

‎library/repair.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ def get_dummy(atok):
1818

1919
def neighbors(atok,t):
2020
x = next_token(atok,t)
21+
x = x if x and x.type != 0 else None
2122
y = next_token(atok,x) if x else None
2223
z = previous_token(atok,t)
2324
w = previous_token(atok,z) if z else None
@@ -123,7 +124,7 @@ def after_both_sides(t):
123124
return t[1] is None or not(
124125
start_atom(t[1]) or
125126
t[1].string in STARTING_UNARY or
126-
(t[1].string,t[2].string) in STARTING_UNARY
127+
(t[2] isnotNoneand (t[1].string,t[2].string) in STARTING_UNARY)
127128
)
128129

129130
def before_both_sides(t):

‎library/selection_node.py‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,11 @@ def nearest_node_from_offset(root,atok,offset,special=False):
1717
following = next_token(atok,original_token)
1818
while following and following.string.isspace():
1919
token = following
20-
following = next_token(atok,original_token)
20+
following = next_token(atok,token)
2121
if following:
2222
token = following
23-
raise Exception("boom")
2423
s = token.startpos
2524
r = node_from_range(root,atok,(s,s),special= special,lenient = True)
26-
print("r",r,ast.dump(r))
27-
raise Exception("boom")
2825
return r
2926

3027
def node_from_range_old(root,atok, r ):

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /