Root Zanli
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
proc
/
thread-self
/
root
/
usr
/
share
/
doc
/
re2c
/
manual
/
eof
/
Filename :
01_sentinel.rst_
back
Copy
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).