Feat/agent mode #1

Closed
tmm621 wants to merge 85 commits from feat/agent-mode into main
Showing only changes of commit 3eb356d711 - Show all commits
+10
View File
@@ -100,6 +100,9 @@ def parse_single_condition(text, fields=None):
# Bare field reference (no operator, no NOT): WS-EOF → WS-EOF = 'Y'
if re.match(r'^[A-Z][A-Z0-9_-]*(?:\([^)]*\))?\s*$', text, re.IGNORECASE):
bare = __import__('re').match(r'^[A-Z][A-Z0-9_-]*', text, re.IGNORECASE)
if bare:
return (bare.group(0), '=', 'Y')
return (text, '=', 'Y')
# Bare NOT field reference (no operator): NOT WS-EOF → WS-EOF <> 'Y'
@@ -159,6 +162,10 @@ def parse_single_condition(text, fields=None):
# Clean trailing ' NOT' that got swallowed by lazy match
if field.upper().endswith(' NOT'):
field = field[:-4].strip()
# Strip subscript: WS-KEY-DUP-CNT(WS-J) -> WS-KEY-DUP-CNT
bare_m = __import__('re').match(r'^(\w[\w-]*)', field)
if bare_m:
field = bare_m.group(1)
return (field, m.group(2), m.group(3).strip().strip("'").strip('"'))
# Standard regex: FIELD OP VALUE
@@ -176,6 +183,9 @@ def parse_single_condition(text, fields=None):
# Bare field: WS-EOF (no operator) -> WS-EOF = 'Y'
if re.match(r'^[A-Z][A-Z0-9_-]*(?:\([^)]*\))?\s*$', text, re.IGNORECASE):
bare = __import__('re').match(r'^[A-Z][A-Z0-9_-]*', text, re.IGNORECASE)
if bare:
return (bare.group(0), '=', 'Y')
return (text, '=', 'Y')
return None