Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplifying single-line-raw-string-body in the v2 spec #508

Open
poliorcetics opened this issue Feb 23, 2025 · 1 comment
Open

Simplifying single-line-raw-string-body in the v2 spec #508

poliorcetics opened this issue Feb 23, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@poliorcetics
Copy link

kdl/draft-marchan-kdl2.md

Lines 1002 to 1007 in b942867

single-line-raw-string-body :=
'' |
(single-line-raw-string-char - '"')
single-line-raw-string-char*? |
'"' (single-line-raw-string-char - '"')
single-line-raw-string-char*?

This excerpt, once reformated reads as follow:

single-line-raw-string-body :=
    ''
    | (single-line-raw-string-char - '"') single-line-raw-string-char*?
    | '"' (single-line-raw-string-char - '"') single-line-raw-string-char*?

To me, this is exactly equivalent to

single-line-raw-string-body :=
    ''
    | '"'? (single-line-raw-string-char - '"') single-line-raw-string-char*?

Am I missing something or could the grammar definition be simplified here ?

@tabatkins
Copy link
Contributor

Hmmmmm, I think the grammar is actually slightly wrong. The final clause implies that #""#"# is a valid string containing the value "#. I think that second clause needs to substract # from its first char as well. (This would suggest they do indeed need to stay as separate clauses, then.)

@tabatkins tabatkins added the bug Something isn't working label Feb 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants