Skip to content

Lexical analysis - Section 2.4.1 - More accurate description for long[string/bytes]char #110942

Description

@josepojr

Documentation

In expressions like longstringchar and longbyteschar, I will suggest changes to make it clearer and more precise.

Before:

longstringchar ::= <any source character except "\">
longbyteschar ::= <any ASCII character except "\">

After:

longstringchar ::= <any source character except "\" or triple quote>
longbyteschar ::= <any ASCII character except "\" or triple quote>

Because the tokenizer can recognize three consecutive quotes (mapped by three longstringchar or longbyteschar) which ends up becoming one triple quote (for example). This will break longstring or longbytes recognition as show below:

longstring ::= "'''" longstringitem* "'''" | '"""' longstringitem* '"""'
longbytes ::= "'''" longbytesitem* "'''" | '"""' longbytesitem* '"""'

longstringitem ::= longstringchar | stringescapeseq
longbytesitem ::= longbyteschar | bytesescapeseq

Otherwise we will have triple quotes inside the longstringitem or longbytesitem. Can this? Absolutely not.

Thank you for your attention.

José Oliveira

Activity

  1. StanFromIreland commented on Oct 30, 2025

    @StanFromIreland
    Member

    This has been fixed in 777159f

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsDocumentation in the Doc dir

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions