Page 1 of 2
Raku Lexer
Posted: 31.05.2021 20:43
by demanuel
Hi!
I added some keywords to the raku lexer. Don't know if they are in the right place, though....
I also changed the displaying types in the code browser, because it's possible to put comments in the signature and it will make the display unusable.
The lcf file is attached.
Another thing that i did was a linter for raku. You can find the source for it in:
https://github.com/demanuel/cuda_lint_raku
Please confirm that everything's fine.
Posted: 31.05.2021 21:25
by uvviewsoft
You added keywords:
proto regex.
You added special words which start code-tree items:
'model'
'module'
'monitor'
'proto'
Did you check that these 4 blocks are OK on code-tree? I don't know the syntax and don't have sample files.
Posted: 31.05.2021 21:37
by uvviewsoft
Linter is now published to addons, thanks for your work.
Posted: 31.05.2021 22:45
by demanuel
New version attached.
The only issue i see is with the code
Code: Select all
grammar Calculator {
token TOP { [ <add> | <sub> ] }
rule add { <num> '+' <num> }
rule sub { <num> '-' <num> }
token num { \d+ }
}
in the code tree for the
sub rule it becomes
Code: Select all
gramar Calculator
token TOP
rule add
sub {
token num
How do i make it
Code: Select all
gramar Calculator
token TOP
rule add
rule sub
token num
?
Posted: 31.05.2021 23:08
by uvviewsoft
1. I can fix it but need to know: are all these words- keywords, and must be bold-black (default theme)?
class
grammar
method
model
module
monitor
package
proto
regex
role
rule
sub
submethod
token
2. if 'sub' is keyword, then this line is bad?
token TOP { [ <add> | <sub> ] }
and this?
rule sub { <num> '-' <num> }
or 'sub' is not always a keyword?
Posted: 31.05.2021 23:13
by uvviewsoft
3. Can i consider all these words as keywords IF the next 'token' is identifier?
'sub Id' = here 'sub' is keyword?
'rule sub { ... }' = here 'sub' is not keyword?
Posted: 01.06.2021 09:22
by demanuel
uvviewsoft wrote:3. Can i consider all these words as keywords IF the next 'token' is identifier?
'sub Id' = here 'sub' is keyword?
'rule sub { ... }' = here 'sub' is not keyword?
The example is correct. sub is not always a keyword.
This is valid code with the sub as the name of the rule:
https://docs.raku.org/language/grammars ... to_regexes
Code: Select all
grammar Calculator {
token TOP { [ <add> | <sub> ] }
rule add { <num> '+' <num> }
rule sub { <num> '-' <num> }
token num { \d+ }
}
Posted: 01.06.2021 11:59
by uvviewsoft
Adjusted as suggested, pls update lexer (Addon Manager) and test. 'sub' is now not always a keyword.
Posted: 02.06.2021 08:03
by demanuel
Seems good now

Posted: 04.08.2021 21:13
by demanuel
H, uvviewsoft,
I updated the
https://github.com/demanuel/cuda_lint_raku however i'm unable to create a PR as your repo is a fork of mine
