Tidy array validation flow
Agent-Logs-Url: https://github.com/wesleyel/swiftui-math/sessions/56436444-e15b-4dd0-8a70-c87df1e3dc4e Co-authored-by: wesleyel <48174882+wesleyel@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
1091e9c83d
commit
77d6794b26
@@ -712,7 +712,7 @@ extension Math {
|
|||||||
return table
|
return table
|
||||||
}
|
}
|
||||||
} else if env == "array" {
|
} else if env == "array" {
|
||||||
guard let columnAlignments, !columnAlignments.isEmpty else {
|
guard let columnAlignments else {
|
||||||
let message = "array environment requires at least 1 column alignment"
|
let message = "array environment requires at least 1 column alignment"
|
||||||
if error == nil {
|
if error == nil {
|
||||||
error = ParserError(code: .invalidEnvironment, message: message)
|
error = ParserError(code: .invalidEnvironment, message: message)
|
||||||
|
|||||||
@@ -1332,18 +1332,22 @@ extension Math {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if self.error == nil && !foundClosingBrace {
|
if !foundClosingBrace {
|
||||||
self.setError(.characterNotFound, message: "Missing } after array column format")
|
self.setError(.characterNotFound, message: "Missing } after array column format")
|
||||||
}
|
}
|
||||||
|
|
||||||
if self.error == nil && columnAlignments.isEmpty {
|
if columnAlignments.isEmpty {
|
||||||
self.setError(
|
self.setError(
|
||||||
.invalidEnvironment,
|
.invalidEnvironment,
|
||||||
message: "array environment requires at least one column alignment specifier (l, c, or r)"
|
message: "array environment requires at least one column alignment specifier (l, c, or r)"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
return self.error == nil ? (columnAlignments, format) : (nil, nil)
|
if self.error != nil {
|
||||||
|
return (nil, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
return (columnAlignments, format)
|
||||||
}
|
}
|
||||||
|
|
||||||
func assertNotSpace(_ ch: Character) {
|
func assertNotSpace(_ ch: Character) {
|
||||||
|
|||||||
Reference in New Issue
Block a user