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

Function parse_val_unit

evaluation/test-suite-sql-eval/process_sql.py:229–251  ·  view source on GitHub ↗
(toks, start_idx, tables_with_alias, schema, default_tables=None)

Source from the content-addressed store, hash-verified

227
228
229def parse_val_unit(toks, start_idx, tables_with_alias, schema, default_tables=None):
230 idx = start_idx
231 len_ = len(toks)
232 isBlock = False
233 if toks[idx] == '(':
234 isBlock = True
235 idx += 1
236
237 col_unit1 = None
238 col_unit2 = None
239 unit_op = UNIT_OPS.index('none')
240
241 idx, col_unit1 = parse_col_unit(toks, idx, tables_with_alias, schema, default_tables)
242 if idx < len_ and toks[idx] in UNIT_OPS:
243 unit_op = UNIT_OPS.index(toks[idx])
244 idx += 1
245 idx, col_unit2 = parse_col_unit(toks, idx, tables_with_alias, schema, default_tables)
246
247 if isBlock:
248 assert toks[idx] == ')'
249 idx += 1 # skip ')'
250
251 return idx, (unit_op, col_unit1, col_unit2)
252
253
254def 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