mirror of
https://github.com/kalmarek/SmallHyperbolic
synced 2024-11-27 08:30:27 +01:00
fix _tf_missing
This commit is contained in:
parent
8339cbd5cf
commit
9d6415dcb8
@ -29,15 +29,16 @@ end
|
|||||||
|
|
||||||
# parse_grouppresentations_abstract("./data/presentations_2_4_4.txt")
|
# parse_grouppresentations_abstract("./data/presentations_2_4_4.txt")
|
||||||
|
|
||||||
function _tf_missing(x::Any)
|
function _tf_missing(x::AbstractString)
|
||||||
s = strip(x)
|
s = strip(x)
|
||||||
mis = !isnothing(match(r"(\?)*", x))
|
yes = !isnothing(match(r"yes"i, s))
|
||||||
no = !isnothing(match(r"no"i, x))
|
no = !isnothing(match(r"no"i, s))
|
||||||
yes = !isnothing(match(r"yes"i, x))
|
mis = !isnothing(match(r"(\?)+", s))
|
||||||
mis && return missing
|
@debug "string for true/false/missing : $s" parsed=(yes, no, mis)
|
||||||
yes && !no && return true
|
yes && !no && !mis && return true
|
||||||
!yes && no && return false
|
!yes && no && !mis && return false
|
||||||
throw(ArgumentError("Unrecognized option: $x"))
|
!yes && !no && mis && return missing
|
||||||
|
throw(ArgumentError("Unrecognized string as true/false/missing: $x"))
|
||||||
end
|
end
|
||||||
|
|
||||||
function parse_vec(s::AbstractString)
|
function parse_vec(s::AbstractString)
|
||||||
|
Loading…
Reference in New Issue
Block a user