phase3: improve arg-bang handler (allow ! in chains, ; terminator). 574->440
This commit is contained in:
@@ -121,7 +121,7 @@ def insert_arg_bang(line, col0):
|
||||
elif ch in ')]}':
|
||||
if depth==0: end=i; break
|
||||
depth-=1
|
||||
elif ch==',' and depth==0: end=i; break
|
||||
elif ch in ',;}' and depth==0: end=i; break
|
||||
if end is None: end=len(line)
|
||||
# 值的实际末尾(跳过空白)
|
||||
j=end-1
|
||||
@@ -132,7 +132,7 @@ def insert_arg_bang(line, col0):
|
||||
if not val: return None
|
||||
if val[0] in '0123456789"\'': return None # 字面量跳过
|
||||
if val in ('true','false','null'): return None
|
||||
if not re.fullmatch(r'[\w.\[\]()]+', val): return None # 含运算符等跳过
|
||||
if not re.fullmatch(r'[\w.\[\()!]+', val): return None # 含运算符/空格跳过
|
||||
return line[:j+1]+'!'+line[j+1:]
|
||||
|
||||
def make_field_nullable(lines, name):
|
||||
|
||||
Reference in New Issue
Block a user