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

MiniZinc specification of string syntax problems #722

Open
PerMildner opened this issue Aug 16, 2023 · 0 comments
Open

MiniZinc specification of string syntax problems #722

PerMildner opened this issue Aug 16, 2023 · 0 comments

Comments

@PerMildner
Copy link

String Literals and String Interpolation says: "\x[0-9a-fA-F][0-9a-fA-F]? for an arbitrary 8-bit character specified by the given hexadecimal number" (and similar for octal).

This is incorrect and contradicts the "you can use the hexadecimal or octal notation to insert the UTF-8 byte sequences" later on the page. That is, the \x.. syntax species bytes making up the UTF-8 encoding of the (Unicode) character code, the \x.. construct does not specify a "8-bit character".

Also, the BNF grammar in the same section:

<string-contents> ::= ([^"\n\] | \[0-7][0-7?][0-7]? | \x[0-9a-fA-F][0-9a-fA-F]? | \n | \t | \" | \\)*

The [0-7?] should presumably be [0-7]?.

Nit: Also, in the same grammar definition: [^"\n\] is unclear (or at least abusing notation). The first backslash is presumably part of \n whereas the second backslash means a literal backslash. The Notation says "A newline character or CRLF sequence is written \n." which is fine in EBNF but is less suitable in a regexp character set [...] notation (e.g. can a lone CR appear as itself in a string-contents?).

On the other hand, in the same grammar definition, ... | \n | ... presumably does not mean a "newline character or CRLF sequence" but rather the two character sequence \ n.

(Yes, I am of the opinion that grammars should be boringly formal. Not everyone agrees.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant