@@ -26,12 +26,18 @@ class Token(object):
2626 and :attr:`end_col_offset` attributes, respectively. Tokens representing
2727 error also have their error message in :attr:`error` attribute.
2828
29- If :attr:`value` is not given when :class:`Token` is initialized and
30- :attr:`type` is ``IF``, ``ELSE_IF``, ``ELSE``, ``FOR``, ``END``, or
31- ``CONTINUATION`` the value is automatically set to the correct marker value.
32- If :attr:`type` is ``EOL`` in this case, the value is set to ``\\ n``.
29+ Token types are declared as class attributes such as :attr:`SETTING_HEADER`
30+ and :attr:`EOL`. Values of these constants have changed slightly in Robot
31+ Framework 4.0 and they may change again in the future. It is thus safer
32+ to use the constants, not their values, when types are needed. For example,
33+ use ``Token(Token.EOL)`` instead of ``Token('EOL')`` and
34+ ``token.type == Token.EOL`` instead of ``token.type == 'EOL'``.
3335
34- Token types are declared as class attributes.
36+ If :attr:`value` is not given when :class:`Token` is initialized and
37+ :attr:`type` is :attr:`IF`, :attr:`ELSE_IF`, :attr:`ELSE`, :attr:`FOR`,
38+ :attr:`END` or :attr:`CONTINUATION`, the value is automatically set
39+ to the correct marker value like ``'IF'`` or ``'ELSE IF'``. If :attr:`type`
40+ is :attr:`EOL` in this case, the value is set to ``'\\ n'``.
3541 """
3642
3743 SETTING_HEADER = 'SETTING HEADER'
0 commit comments