feat: DB管线补全 + 新增orchestrator_db/program_schema/to_sql + 清理临时脚本
This commit is contained in:
@@ -221,10 +221,30 @@ def extract_branch_tree(source: str, data_fields: list = None) -> tuple[Any, lis
|
||||
while len(stack) > 1 and stack[-1].kind == "WHEN":
|
||||
stack.pop()
|
||||
cond = m.group(1).strip().rstrip('.')
|
||||
# Peek ahead for multi-line condition continuations (AND/OR)
|
||||
j = i + 1
|
||||
while j < len(lines):
|
||||
next_raw = lines[j]
|
||||
next_line = _clean_line(next_raw)
|
||||
if not next_line:
|
||||
j += 1
|
||||
continue
|
||||
if any(next_line.startswith(kw) for kw in (
|
||||
'IF', 'ELSE', 'WHEN', 'OTHER', 'EVALUATE',
|
||||
'END-IF', 'END-EVALUATE', 'END-PERFORM', 'END-READ', 'END-CALL',
|
||||
'DISPLAY', 'MOVE', 'ADD', 'SUBTRACT', 'MULTIPLY', 'DIVIDE', 'COMPUTE',
|
||||
'STRING', 'UNSTRING', 'SET', 'INSPECT', 'INITIALIZE', 'CONTINUE',
|
||||
'PERFORM', 'CALL', 'EXIT', 'GOBACK', 'STOP', 'THEN',
|
||||
'READ', 'WRITE', 'DELETE', 'REWRITE', 'ACCEPT', 'OPEN', 'CLOSE',
|
||||
'EXEC', 'END-EXEC',
|
||||
)):
|
||||
break
|
||||
cond += ' ' + next_line
|
||||
j += 1
|
||||
i = j
|
||||
when_node = BranchNode("WHEN", branch_names=[f"WHEN({cond})"])
|
||||
stack[-1].children.append(when_node)
|
||||
stack.append(when_node)
|
||||
i += 1
|
||||
continue
|
||||
|
||||
# WHEN OTHER
|
||||
|
||||
Reference in New Issue
Block a user