Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@tocariimaa
Copy link
Contributor

Problem: the regex for number literals is wrong, first it uses - for negative numbers instead of ~; second, it allows 0X as the hexadecimal literal prefix (SML only supports using 0x); and third, it doesn't recognize word literals (like 0w1234 or 0wx2fe).

Solution: correct the regex.

@dkearns
Copy link
Contributor

dkearns commented Nov 7, 2025

IIRC Markus isn't really maintaining this file these days so he might be willing to hand over the reigns if you approach him about it.

Fix the regex for reals too, I had forgot about it.

Signed-off-by: tocariimaa <[email protected]>
@benknoble
Copy link
Contributor

FWIW, ~ is just an operator (well, function), no? I don't think there are negative literals in the language (and ~x is valid for a variable x). Anyway, the wrong syntax being corrected there doesn't even highlight for me, since AFAICT the - isn't included in the match.

The additions for words look good.

@dkearns
Copy link
Contributor

dkearns commented Nov 9, 2025

No it is part of the literal. The grammar uses the same production for the exponent as well.

An integer constant (in decimal notation) is an optional negation symbol (~) followed by a non-empty sequence of decimal digits 0, . . , 9. An integer constant (in hexadecimal notation) is an optional negation symbol followed by 0x followed by a non-empty sequence of hexadecimal digits 0, . . , 9 and a, . . , f. (A, . . , F may be used as alternatives for a, . . , f.)

See https://smlfamily.github.io/sml97-defn.pdf

@chrisbra
Copy link
Member

chrisbra commented Nov 9, 2025

Thanks. so, do you want to check with Markus if a maintainer change would make sense?

@tocariimaa
Copy link
Contributor Author

Thanks. so, do you want to check with Markus if a maintainer change would make sense?

I was planning on contacting him after this PR since I got more changes in the syntax file I want to make a PR of later

@dkearns
Copy link
Contributor

dkearns commented Nov 10, 2025

When you're working on it @tocariimaa it might be helpful to keep in mind that it was, I seem to recall, a port of the OCaml syntax file and there's always been some lingering OCaml-isms.

@tocariimaa
Copy link
Contributor Author

When you're working on it @tocariimaa it might be helpful to keep in mind that it was, I seem to recall, a port of the OCaml syntax file and there's always been some lingering OCaml-isms.

Yeah I also noticed that, I'll clean those later.

@chrisbra
Copy link
Member

okay thanks, then let me include it now

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

Successfully merging this pull request may close these issues.

4 participants