Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _isolate(self, block, drop=False):
self._push_cst()
try:
block()
cst = self.cst
finally:
self._pop_cst()
if is_list(cst):
cst = closure(cst)
if not drop:
self._add_cst_node(cst)
return cst
def _positive_closure(self, block, sep=None, omitsep=False):
self._push_cst()
try:
block()
self.cst = [self.cst]
self._repeat(block, prefix=sep, dropprefix=omitsep)
cst = closure(self.cst)
finally:
self._pop_cst()
self._add_cst_node(cst)
self.last_node = cst
return cst
def _save_result(self, key, result):
if is_list(result.node):
result = RuleResult(closure(result.node), result.newpos, result.newstate)
self._results[key] = result
def varumozhiexpression(self, ast):
பதம் = ast[1].strip()
filters = ast[0]
for i in range(len(filters)-1,-1,-1):
filter = filters[i]
if type(filter) is list or type(filter) is tatsu.contexts.closure:
func = filter[0]
params = '\'' + பதம் + '\'' # default paramater
params = params + ',' + '\'' + filter[1] + '\'' # additional parameter from rules
else:
func = filter
params = '\'' + பதம் + '\'' # default paramater
பதம் = eval(func+'(' + params + ')')
return பதம்
def _closure(self, block, sep=None, omitsep=False):
self._push_cst()
try:
self.cst = []
with self._optional():
block()
self.cst = [self.cst]
self._repeat(block, prefix=sep, dropprefix=omitsep)
cst = closure(self.cst)
finally:
self._pop_cst()
self._add_cst_node(cst)
self.last_node = cst
return cst