toParser method
Converts this string to a corresponding parser.
Implementation
@useResult
Parser<String> toParser({
bool isPattern = false,
bool caseInsensitive = false,
String? message,
}) {
if (isEmpty) {
return epsilonWith<String>(this);
} else if (length == 1) {
return caseInsensitive
? charIgnoringCase(this, message)
: char(this, message);
} else {
if (isPattern) {
return caseInsensitive
? patternIgnoreCase(this, message)
: pattern(this, message);
} else {
return caseInsensitive
? stringIgnoreCase(this, message)
: string(this, message);
}
}
}