Skip to content

Commit dc2c9c5

Browse files
committed
Test done
1 parent c402204 commit dc2c9c5

11 files changed

Lines changed: 181 additions & 118 deletions

File tree

stroll/src/parser.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,20 @@ def atom(token):
1010
return str(token)
1111

1212
def parse(tokens):
13-
#print(tokens)
1413
token = tokens.pop(0)
14+
#a = tokens.copy()
1515
if token == '(':
1616
L = []
17-
while tokens[0] != ')':
18-
L.append(parse(tokens))
19-
tokens.pop(0)
20-
return L
17+
try:
18+
while tokens[0] != ')':
19+
L.append(parse(tokens))
20+
if len(tokens) == 0:
21+
break
22+
try:
23+
tokens.pop(0)
24+
finally:
25+
return L
26+
except Exception as e:
27+
print(e)
2128
else:
2229
return atom(token)

0 commit comments

Comments
 (0)