feat: add azxs preprocessing support for component category
All checks were successful
NTFY Notification / notify (push) Successful in 13s
All checks were successful
NTFY Notification / notify (push) Successful in 13s
Extend M05_PreProcessor to support category-specific preprocessing: - "接头" category: Full preprocessing (azxs + lcfw mapping, OR merging, parentheses simplification) - "部件" category: Partial preprocessing (azxs mapping only, OR merging, parentheses simplification) - Other categories: No preprocessing Add new function ApplyPreprocessingWithoutLcfw() to handle component category preprocessing. Add unit tests (PP_09 through PP_12) to verify: - azxs mapping for component category - lcfw conditions remain unchanged for component category - OR condition merging and parentheses simplification Update CLAUDE.md documentation with category-specific preprocessing table. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
' ==============================================================================
|
||||
' 模块: M05_PreProcessor
|
||||
' 职责: 预处理条件表达式,用于"接头"类别的值映射和去重
|
||||
' 职责: 预处理条件表达式,支持不同类别的差异化处理
|
||||
' - "接头"类别: 完整预处理(azxs映射 + lcfw映射 + OR合并 + 括号简化)
|
||||
' - "部件"类别: 部分预处理(azxs映射 + OR合并 + 括号简化,不处理lcfw)
|
||||
' - 其他类别: 不进行预处理
|
||||
' 使用正则表达式实现高效的值映射和OR条件合并
|
||||
' ==============================================================================
|
||||
Option Explicit
|
||||
@@ -35,24 +38,32 @@ End Function
|
||||
|
||||
' ------------------------------------------------------------------------------
|
||||
' 主入口:预处理条件表达式
|
||||
' 支持的类别:
|
||||
' - "接头": 完整预处理(azxs映射 + lcfw映射 + OR合并 + 括号简化)
|
||||
' - "部件": 部分预处理(azxs映射 + OR合并 + 括号简化,不处理lcfw)
|
||||
' - 其他: 不进行预处理
|
||||
' ------------------------------------------------------------------------------
|
||||
Public Function PreprocessCondition( _
|
||||
ByVal strCondition As String, _
|
||||
ByVal strCategory As String, _
|
||||
ByVal rowIdx As Long _
|
||||
) As String
|
||||
' 仅对"接头"类别进行预处理
|
||||
If strCategory <> "接头" Then
|
||||
PreprocessCondition = strCondition
|
||||
Exit Function
|
||||
End If
|
||||
|
||||
If Not g_IsInitialized Then
|
||||
PreprocessCondition = strCondition
|
||||
Exit Function
|
||||
End If
|
||||
|
||||
PreprocessCondition = ApplyPreprocessing(strCondition, rowIdx)
|
||||
' 根据类别选择处理策略
|
||||
If strCategory = "接头" Then
|
||||
' 完整预处理:azxs + lcfw + OR合并 + 括号简化
|
||||
PreprocessCondition = ApplyPreprocessing(strCondition, rowIdx)
|
||||
ElseIf strCategory = "部件" Then
|
||||
' 部分预处理:azxs + OR合并 + 括号简化(不处理 lcfw)
|
||||
PreprocessCondition = ApplyPreprocessingWithoutLcfw(strCondition, rowIdx)
|
||||
Else
|
||||
' 其他类别:不处理
|
||||
PreprocessCondition = strCondition
|
||||
End If
|
||||
End Function
|
||||
|
||||
' ------------------------------------------------------------------------------
|
||||
@@ -143,6 +154,35 @@ Private Function ApplyPreprocessing( _
|
||||
ApplyPreprocessing = strCondition
|
||||
End Function
|
||||
|
||||
' ------------------------------------------------------------------------------
|
||||
' 应用预处理(不含 lcfw 映射):用于"部件"类别
|
||||
' 执行步骤:azxs 映射 → 嵌套表达式处理 → OR合并 → 括号简化
|
||||
' ------------------------------------------------------------------------------
|
||||
Private Function ApplyPreprocessingWithoutLcfw( _
|
||||
ByVal strCondition As String, _
|
||||
ByVal rowIdx As Long _
|
||||
) As String
|
||||
' 步骤1: 应用 azxs 映射
|
||||
strCondition = ApplyRegexMapping( _
|
||||
strCondition, _
|
||||
"(azxs)( *=|!= *)([a-zA-Z0-9]{2})", _
|
||||
g_AzxsMapping, _
|
||||
rowIdx, _
|
||||
"azxs" _
|
||||
)
|
||||
|
||||
' 步骤2: 递归处理嵌套括号内的表达式(合并OR,简化括号)
|
||||
strCondition = ProcessNestedExpressions(strCondition, rowIdx)
|
||||
|
||||
' 步骤3: 合并顶层重复的OR条件
|
||||
strCondition = MergeDuplicateORConditions(strCondition)
|
||||
|
||||
' 步骤4: 简化不必要的括号
|
||||
strCondition = SimplifyParentheses(strCondition)
|
||||
|
||||
ApplyPreprocessingWithoutLcfw = strCondition
|
||||
End Function
|
||||
|
||||
' ------------------------------------------------------------------------------
|
||||
' 递归处理嵌套表达式:先预处理括号内的内容,再进行OR合并
|
||||
' ------------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user