Don't parse a block begin while inside a block
If a PEM contained anything like <foobar>, the parser was doomed. Fixes #78
This commit is contained in:
parent
d22420c06b
commit
ccb6329f05
@ -187,6 +187,7 @@ public class ConfigurationParser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if unsupportedError == nil {
|
if unsupportedError == nil {
|
||||||
|
if currentBlockName == nil {
|
||||||
Regex.blockBegin.enumerateComponents(in: line) {
|
Regex.blockBegin.enumerateComponents(in: line) {
|
||||||
isHandled = true
|
isHandled = true
|
||||||
let tag = $0.first!
|
let tag = $0.first!
|
||||||
@ -196,6 +197,7 @@ public class ConfigurationParser {
|
|||||||
currentBlockName = String(tag[from..<to])
|
currentBlockName = String(tag[from..<to])
|
||||||
currentBlock = []
|
currentBlock = []
|
||||||
}
|
}
|
||||||
|
}
|
||||||
Regex.blockEnd.enumerateComponents(in: line) {
|
Regex.blockEnd.enumerateComponents(in: line) {
|
||||||
isHandled = true
|
isHandled = true
|
||||||
let tag = $0.first!
|
let tag = $0.first!
|
||||||
|
Loading…
Reference in New Issue
Block a user