Skip to content

Disallow empty placeholders in the syntax #345

Closed
@stasm

Description

@stasm

I'm refactoring our BNF in #344 to explicitly define whitespace rules. In order to do so, I had to change our grammar from LL(1) to LL(1) with backtracking.

In the process I noticed an opportunity to make the grammar LL(2). IIUC, this provides more guarantees about the complexity of parsing than LL(1) with backtracking. LL(2) is still O(n), while backtracking can be arbitrarily long and can result in exponential worst-case complexity.

-Placeholder ::= '{' s? (Expression | Markup | MarkupEnd)? s? '}'
+Placeholder ::= '{' s? (Expression | Markup | MarkupEnd) s? '}'

Do we need empty placeholders?

I recall previous discussions with @eemeli about potentially allowing comment-only or metadata-only placeholders in the future. Any thoughts on this?

Originally posted by @stasm in #344 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    blocker-candidateThe submitter thinks this might be a block for the next releaseresolve-candidateThis issue appears to have been answered or resolved, and may be closed soon.syntaxIssues related with syntax or ABNF

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions