fix regex , fix mapError,add error infomation
This commit is contained in:
parent
e764cc81e3
commit
0df3ad7a87
|
@ -15,8 +15,8 @@ enum FileType :String{
|
|||
}
|
||||
|
||||
let VERSION = "0.0.1"
|
||||
let SWIFT_REGEX = "NSLocalizedString\\(\"([^\\x00-\\xff]+)\", comment: \"\"\\)"
|
||||
let OC_REGEX = "NSLocalizedString\\(@\"([^\\x00-\\xff]+)\", (.*?)\\)"
|
||||
let SWIFT_REGEX = "NSLocalizedString\\(\"(.+?)\", comment: (.+?)\\)"
|
||||
let OC_REGEX = "NSLocalizedString\\(@\"(.+?)\", (.+?)\\)"
|
||||
let LOCAL_ERGEX = "\".*?\""
|
||||
let COMMONT = "/* No comment provided by engineer. */"
|
||||
let TEST_REGEX = "NSLocalizedString\\(\"([^\\x00-\\xff]+)\", comment: \"\"\\)"
|
||||
|
|
|
@ -44,7 +44,7 @@ public struct localizationCommand :RegexStringsSearcher,RegexStringsWriter{
|
|||
}
|
||||
|
||||
for item in Progress(swiftPath) {
|
||||
patterns = [TEST_REGEX]
|
||||
patterns = [SWIFT_REGEX]
|
||||
search(in: item)
|
||||
}
|
||||
|
||||
|
@ -67,7 +67,7 @@ public struct localizationCommand :RegexStringsSearcher,RegexStringsWriter{
|
|||
}
|
||||
|
||||
defer {
|
||||
// DataHandleManager.defaltManager.mapError()
|
||||
DataHandleManager.defaltManager.mapError()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -60,20 +60,24 @@ extension RegexStringsSearcher {
|
|||
|
||||
/// over here, if localizedString is isAmbiguous,we analysis error
|
||||
if localizedString.isAmbiguous {
|
||||
print(path.description.red)
|
||||
errors.append(value)
|
||||
}else{
|
||||
extracts.append(value)
|
||||
}
|
||||
}
|
||||
|
||||
if extracts.count > 0 {
|
||||
if path.lastComponent.contains("swift") {
|
||||
DataHandleManager.defaltManager.swift_listNode?.insert(values: extracts, className: path.lastComponent, path: path.description)
|
||||
}else{
|
||||
DataHandleManager.defaltManager.oc_listNode?.insert(values: extracts, className: path.lastComponent, path: path.description)
|
||||
}
|
||||
}
|
||||
|
||||
if errors.count > 0 {
|
||||
DataHandleManager.defaltManager.error_listNode?.insert(values: errors, className: path.lastComponent, path: path.description)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -93,11 +93,11 @@ public func CommandLineToolSpectre() {
|
|||
$0.it("isAmbiguous test correct?"){
|
||||
|
||||
let str1 = "fdjaklfda%j@fdklafjkld"
|
||||
let str2 = "_shiftButton setTitle:@\"ABC\" forState:UIControlStateNorma"
|
||||
let str2 = "_shiftButton setTi%dtle:@\"ABC\" forState:UIControlStateNorma"
|
||||
let str3 = "[_shiftButton setTitle:@\"省\" forState:UIControlStateNormal];"
|
||||
let str4 = "nsstring.init(%d,213123);"
|
||||
try expect(str1.isAmbiguous).to.beFalse()
|
||||
try expect(str2.isAmbiguous).to.beFalse()
|
||||
try expect(str2.isAmbiguous).to.beTrue()
|
||||
try expect(str3.isAmbiguous).to.beFalse()
|
||||
try expect(str4.isAmbiguous).to.beTrue()
|
||||
|
||||
|
|
Loading…
Reference in New Issue