# E4224

Compiler diagnostic name: `lexscan_catchall_missing`.

The regex cases in a `lexmatch` or `lexscan` expression are not exhaustive, and
the expression has no catch-all case.

The compiler checks whether the regex cases cover every possible input,
including empty input and, for streaming scans, end of input. An exhaustive
expression may omit the catch-all. Otherwise, add a final catch-all branch to
define the result when no regex case matches.

## Erroneous example

```{literalinclude} /sources/error_codes/4224_error/top.mbt
:language: moonbit
```

## Suggestion

Make the regex cases exhaustive, or add a final catch-all case. A `lexmatch`
catch-all may bind the unmatched input; a streaming `lexscan` catch-all must be
written as `_`. If a catch-all exists but is not last, see [E4171](E4171.md).

```{literalinclude} /sources/error_codes/4224_fixed/top.mbt
:language: moonbit
```
