Open ghost opened 4 months ago
I'm unable to make the lexers myself. Waiting for the developer.
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.
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.
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
orC
is enough for it to be an octal number, not needed to be bothBC
. In case it has bothB
,C
andH
then it will be a hex number.Note: please notice on the examples on the document,
B
andC
will never go together unless they are also go withH
. I don't understand EBNF, but I think|
isor
so it'sB
orC
notB
andC
.
(source: https://github.com/paaguti/textadept-modula-lexers/issues/2)
Modula-3 weirdness:
http://modula3.github.io/cm3/reference/complete/html/2_6_4Numeric_literals.html
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.
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!
I still think Modula-3's syntax for numerical literals is weird until I know the syntax for numerical literals in Ada!
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.
List of text editors support Modula-3:
https://github.com/modula3/cm3/discussions/1130
Scintillua lexers for Modula-2 and Modula-3:
https://github.com/paaguti/textadept-modula-lexers