Skip to content

Commit

Permalink
min change
Browse files Browse the repository at this point in the history
  • Loading branch information
Tanay Kar committed Sep 25, 2023
1 parent 0a6276d commit 00913a8
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ def push(self,obj, l:list, depth):

l.append(obj)

def parse(self,s):
def parse_paren(self,s):
groups = []
depth = 0

Expand All @@ -197,7 +197,10 @@ def parse(self,s):
if depth > 0:
raise ValueError('Parentheses mismatch')
else:
return groups
return groups

def parse(self):
self.tokens = self.parse_paren()

class MasterParser:
def __init__(self, tokens, grammar: dict):
Expand Down Expand Up @@ -299,7 +302,7 @@ def parse(self):
tok = [i for i in tokens]
# print(tokens)
tp = TupleParser(tok)
print(tp.parse(tok))
print(tp.parse())
# with open('grammar.json', 'r') as f:
# grammar = json.load(f)
# parser = MasterParser(tokens, grammar)
Expand Down

0 comments on commit 00913a8

Please sign in to comment.