Skip to content

Commit

Permalink
Improve docs.
Browse files Browse the repository at this point in the history
Use Whitespace instead of text in the samples.
  • Loading branch information
Anteru committed Apr 29, 2024
1 parent 26179d6 commit 8dd97e0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions doc/docs/lexerdevelopment.rst
Expand Up @@ -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))
]
}

Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 8dd97e0

Please sign in to comment.