jscert / jsexplain

Apache License 2.0
26 stars 4 forks source link

add reserved words to the generator #13

Closed brabalan closed 6 years ago

brabalan commented 6 years ago

The generator should not accept variable names that are reserved JavaScript words.

IgnoredAmbience commented 6 years ago

Turns out that we already did special-case arguments, eval, and caller keywords, we just hadn't bothered completing the rest of the list. Currently these are unsupported as identifiers in the ocaml source code. I propose to permit them, but to prefix the variable name with a $ character. We already use $ in place of ', and ocaml does not permit ' as the first character of an identifier, so we should be safe to use it as a prefix.

We may also use any Unicode character that has the ID_Continue property that is not in the ocaml identifier range ([a-zA-Z0-9] and ISO8859-1 characters 192–214, 216–246, 248–255).

IgnoredAmbience commented 6 years ago

Fixed in 68fef4b.

IgnoredAmbience commented 6 years ago

If anyone has any preference for a symbol to prefix these identifiers other than 𝕍, feel free to suggest one/update the code.