in Sources/_StringProcessing/ConsumerInterface.swift [502:543]
func generateConsumer(
_ opts: MatchingOptions
) -> Program<String>.ConsumeFunction {
// FIXME: semantic levels, modes, etc
switch self {
case .alnum:
return consumeScalarProp {
$0.isAlphabetic || $0.numericType != nil
}
case .blank:
return consumeScalar { s in
s.properties.generalCategory == .spaceSeparator ||
s == "\t"
}
case .graph:
return consumeScalarProp { p in
!(
p.isWhitespace ||
p.generalCategory == .control ||
p.generalCategory == .surrogate ||
p.generalCategory == .unassigned
)
}
case .print:
return consumeScalarProp { p in
// FIXME: better def
p.generalCategory != .control
}
case .word:
return consumeScalarProp { p in
// FIXME: better def
p.isAlphabetic || p.numericType != nil
|| p.isJoinControl
|| p.isDash// marks and connectors...
}
case .xdigit:
return consumeScalarProp(\.isHexDigit) // or number
}
}