/usr/share/doc/re2c/manual/eof
Sentinel character ------------------ In this example the lexer uses a sentinel character to handle the end of input. The program counts space-separated words in a null-terminated string. Configuration ``re2c:yyfill:enable = 0;`` suppresses the generation of bounds checks and ``YYFILL`` invocations. The sentinel character is null. It is the last character of each input string, and it is not allowed in the middle of a lexeme by any of the rules (in particular, it is not included in the character ranges, where it is easy to overlook). If a null occurs in the middle of a string, it is a syntax error and the lexer will match default rule ``*``, but it won't read past the end of input or crash. `-Wsentinel-in-midrule <https://re2c.org/manual/warnings/warnings.html#wsentinel-in-midrule>`_ warning verifies that the rules do not allow sentinel in the middle (it is possible to tell re2c which character is used as a sentinel with ``re2c:sentinel`` configuration --- the default assumption is null, since this is the most common case).
.
Edit
..
Edit
01_sentinel.rst_
Edit
02_bounds_checking.rst_
Edit
03_eof_rule.rst_
Edit
04_generic_api.rst_
Edit
eof.rst_
Edit