MCPcopy Create free account
hub / github.com/FlyingFeather/DEA-SQL / parse_val_unit

Function parse_val_unit

hardness_eval.py:258–280  ·  view source on GitHub ↗
(toks, start_idx, tables_with_alias, schema, default_tables=None)

Source from the content-addressed store, hash-verified

256
257
258def parse_val_unit(toks, start_idx, tables_with_alias, schema, default_tables=None):
259 idx = start_idx
260 len_ = len(toks)
261 isBlock = False
262 if toks[idx] == '(':
263 isBlock = True
264 idx += 1
265
266 col_unit1 = None
267 col_unit2 = None
268 unit_op = UNIT_OPS.index('none')
269
270 idx, col_unit1 = parse_col_unit(toks, idx, tables_with_alias, schema, default_tables)
271 if idx < len_ and toks[idx] in UNIT_OPS:
272 unit_op = UNIT_OPS.index(toks[idx])
273 idx += 1
274 idx, col_unit2 = parse_col_unit(toks, idx, tables_with_alias, schema, default_tables)
275
276 if isBlock:
277 assert toks[idx] == ')'
278 idx += 1 # skip ')'
279
280 return idx, (unit_op, col_unit1, col_unit2)
281
282
283def parse_table_unit(toks, start_idx, tables_with_alias, schema):

Callers 3

parse_conditionFunction · 0.70
parse_selectFunction · 0.70
parse_order_byFunction · 0.70

Calls 1

parse_col_unitFunction · 0.70

Tested by

no test coverage detected