From 8dd97e04d47437581ca2fcb19a94aeb5cbd1dba2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matth=C3=A4us=20G=2E=20Chajdas?= Date: Mon, 29 Apr 2024 13:10:39 +0200 Subject: [PATCH] Improve docs. Use Whitespace instead of text in the samples. --- doc/docs/lexerdevelopment.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/docs/lexerdevelopment.rst b/doc/docs/lexerdevelopment.rst index cf37f4e198..675a1d7fdf 100644 --- a/doc/docs/lexerdevelopment.rst +++ b/doc/docs/lexerdevelopment.rst @@ -250,11 +250,11 @@ sections, comments and ``key = value`` pairs:: tokens = { 'root': [ - (r'\s+', Text), + (r'\s+', Whitespace), (r';.*', Comment), (r'\[.*?\]$', Keyword), (r'(.*?)(\s*)(=)(\s*)(.*)', - bygroups(Name.Attribute, Text, Operator, Text, String)) + bygroups(Name.Attribute, Whitespace, Operator, Whitespace, String)) ] } @@ -467,7 +467,7 @@ defined in the parent and child class are merged. For example:: ('[a-z]+', Name), (r'/\*', Comment, 'comment'), ('"', String, 'string'), - (r'\s+', Text), + (r'\s+', Whitespace), ], 'string': [ ('[^"]+', String), @@ -824,7 +824,7 @@ contribute a new lexer, but you might find it useful in any case. r'"(\\?.)*?"' If the ending quote is missing, the regular expression engine will - find that it cannot match at the end, and try to backtrack with less + find that it cannot match at the end, and try to backtrack with fewer matches in the ``*?``. When it finds a backslash, as it has already tried the possibility ``\\.``, it tries ``.`` (recognizing it as a simple character without meaning), which leads to the same