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 VERSION = "0.0.1"
|
||||||
let SWIFT_REGEX = "NSLocalizedString\\(\"([^\\x00-\\xff]+)\", comment: \"\"\\)"
|
let SWIFT_REGEX = "NSLocalizedString\\(\"(.+?)\", comment: (.+?)\\)"
|
||||||
let OC_REGEX = "NSLocalizedString\\(@\"([^\\x00-\\xff]+)\", (.*?)\\)"
|
let OC_REGEX = "NSLocalizedString\\(@\"(.+?)\", (.+?)\\)"
|
||||||
let LOCAL_ERGEX = "\".*?\""
|
let LOCAL_ERGEX = "\".*?\""
|
||||||
let COMMONT = "/* No comment provided by engineer. */"
|
let COMMONT = "/* No comment provided by engineer. */"
|
||||||
let TEST_REGEX = "NSLocalizedString\\(\"([^\\x00-\\xff]+)\", comment: \"\"\\)"
|
let TEST_REGEX = "NSLocalizedString\\(\"([^\\x00-\\xff]+)\", comment: \"\"\\)"
|
||||||
|
|
|
@ -44,7 +44,7 @@ public struct localizationCommand :RegexStringsSearcher,RegexStringsWriter{
|
||||||
}
|
}
|
||||||
|
|
||||||
for item in Progress(swiftPath) {
|
for item in Progress(swiftPath) {
|
||||||
patterns = [TEST_REGEX]
|
patterns = [SWIFT_REGEX]
|
||||||
search(in: item)
|
search(in: item)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ public struct localizationCommand :RegexStringsSearcher,RegexStringsWriter{
|
||||||
}
|
}
|
||||||
|
|
||||||
defer {
|
defer {
|
||||||
// DataHandleManager.defaltManager.mapError()
|
DataHandleManager.defaltManager.mapError()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -60,19 +60,23 @@ extension RegexStringsSearcher {
|
||||||
|
|
||||||
/// over here, if localizedString is isAmbiguous,we analysis error
|
/// over here, if localizedString is isAmbiguous,we analysis error
|
||||||
if localizedString.isAmbiguous {
|
if localizedString.isAmbiguous {
|
||||||
|
print(path.description.red)
|
||||||
errors.append(value)
|
errors.append(value)
|
||||||
}else{
|
}else{
|
||||||
extracts.append(value)
|
extracts.append(value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if extracts.count > 0 {
|
||||||
if path.lastComponent.contains("swift") {
|
if path.lastComponent.contains("swift") {
|
||||||
DataHandleManager.defaltManager.swift_listNode?.insert(values: extracts, className: path.lastComponent, path: path.description)
|
DataHandleManager.defaltManager.swift_listNode?.insert(values: extracts, className: path.lastComponent, path: path.description)
|
||||||
}else{
|
}else{
|
||||||
DataHandleManager.defaltManager.oc_listNode?.insert(values: extracts, className: path.lastComponent, path: path.description)
|
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)
|
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?"){
|
$0.it("isAmbiguous test correct?"){
|
||||||
|
|
||||||
let str1 = "fdjaklfda%j@fdklafjkld"
|
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 str3 = "[_shiftButton setTitle:@\"省\" forState:UIControlStateNormal];"
|
||||||
let str4 = "nsstring.init(%d,213123);"
|
let str4 = "nsstring.init(%d,213123);"
|
||||||
try expect(str1.isAmbiguous).to.beFalse()
|
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(str3.isAmbiguous).to.beFalse()
|
||||||
try expect(str4.isAmbiguous).to.beTrue()
|
try expect(str4.isAmbiguous).to.beTrue()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue