E4184#
Compiler diagnostic name: start_rest_binder_is_not_supported_in_longest_match_strategy.
This diagnostic described a leading rest binder in the earlier lexical pattern syntax and is not emitted by the current compiler. The corresponding current binding error is E4220.
In lexmatch ... with longest, each regex starts at the beginning of the input,
so before= is not available.
Erroneous example#
///|
pub fn match_text(text : String) -> Unit {
lexmatch text with longest {
(_, "abc", _) => ()
_ => ()
}
}
The first _ attempts to bind or skip input before the "abc" regex pattern.
Suggestion#
Use a ^-anchored regex and bind only the suffix with after= when needed.
///|
pub fn match_text(text : String) -> Unit {
lexmatch text with longest {
(re"^abc", after=_) => ()
_ => ()
}
}