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

FR: syntax highlighting for Modula-2 and Modula-3 #251

Open
iahung3 opened this issue Apr 15, 2024 · 8 comments
Open

FR: syntax highlighting for Modula-2 and Modula-3 #251

iahung3 opened this issue Apr 15, 2024 · 8 comments
Assignees
Labels
enhancement New feature or request syntax highlight

Comments

@iahung3
Copy link

iahung3 commented Apr 15, 2024

List of text editors support Modula-3:

modula3/cm3#1130

Scintillua lexers for Modula-2 and Modula-3:

https://github.com/paaguti/textadept-modula-lexers

@SpartanJ SpartanJ self-assigned this Apr 15, 2024
@SpartanJ SpartanJ added enhancement New feature or request syntax highlight labels Apr 15, 2024
@iahung3 iahung3 closed this as not planned Won't fix, can't repro, duplicate, stale Apr 15, 2024
@iahung3 iahung3 reopened this Apr 15, 2024
@iahung3 iahung3 closed this as not planned Won't fix, can't repro, duplicate, stale Apr 15, 2024
@iahung3 iahung3 reopened this Apr 15, 2024
@iahung3
Copy link
Author

iahung3 commented Apr 15, 2024

I'm unable to make the lexers myself. Waiting for the developer.

@SpartanJ
Copy link
Owner

You're confusing me. You deleted your comments (try not to because it's hard to follow), but I have the notifications so let me answer: if it's not possible with Lua Patterns it will be probably possible with with a regex. I don't see anything particularly impossible with Lua Patterns there though, only that some will require more than one pattern to be solvable.

@iahung3
Copy link
Author

iahung3 commented Apr 15, 2024

You're confusing me. You deleted your comments (try not to because it's hard to follow), but I have the notifications so let me answer: if it's not possible with Lua Patterns it will be probably possible with with a regex. I don't see anything particularly impossible with Lua Patterns there though, only that some will require more than one pattern to be solvable.

I'm confused, too. I don't know what I'm doing. I open/close this issue and post/delete comments like crazy.

@iahung3
Copy link
Author

iahung3 commented Apr 16, 2024

Modula-2 weirdness:

The numerical literals part, you might be read the document wrong.

Numbers are (unsigned) integers or real numbers. Integers are sequences of digits. If the number is followed by the letter B, it is taken as an octal number; if it is followed by the letter H, it is taken as a hexadecimal number; if it is followed by the letter C, it denotes the character with the given (octal) ordinal number (and is of type CHAR).

https://www.modula2.org/reference/vocabulary.php

Taken from your code: local modula_octal = R("07")^1*R("BC")

Please pardon me as I don't understand Lua, but only with either B or C is enough for it to be an octal number, not needed to be both BC. In case it has both B, C and H then it will be a hex number.

Note: please notice on the examples on the document, B and C will never go together unless they are also go with H. I don't understand EBNF, but I think | is or so it's B or C not B and C.

(source: paaguti/textadept-modula-lexers#2)

Modula-3 weirdness:

http://modula3.github.io/cm3/reference/complete/html/2_6_4Numeric_literals.html

@SpartanJ
Copy link
Owner

Something ending optionally with B or C in Lua Patterns is as simple as [BC]?, for octal would be just [0-7]+[BC]?H?. I don't see anything particularly complicated.

@iahung3
Copy link
Author

iahung3 commented Apr 17, 2024

Something ending optionally with B or C in Lua Patterns is as simple as [BC]?, for octal would be just [0-7]+[BC]?H?. I don't see anything particularly complicated.

If all B, C, and H are available, then it's no longer an octal, as it's now a hex!

@iahung3 iahung3 closed this as not planned Won't fix, can't repro, duplicate, stale Apr 21, 2024
@iahung3
Copy link
Author

iahung3 commented Apr 22, 2024

I still think Modula-3's syntax for numerical literals is weird until I know the syntax for numerical literals in Ada!

https://www.adacore.com/gems/ada-gem-7

@iahung3 iahung3 reopened this Apr 22, 2024
@SpartanJ
Copy link
Owner

Sometimes you don't need to be 100% perfect but have a close enough implementation that doesn't have false-positives. Anyway, I have no idea about Modula-2 and 3 besides what I've seen because you mentioned, I think copying the scintillua implementation should be good enough for a niche language, if any Modula user feels the need to improve that implementation it can send a PR with improvements, that should be the spirit of open-source project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request syntax highlight
Projects
None yet
Development

No branches or pull requests

2 participants