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

Perl 6 -> Raku rename #3777

Merged
merged 5 commits into from
Jul 21, 2023
Merged

Perl 6 -> Raku rename #3777

merged 5 commits into from
Jul 21, 2023

Conversation

coke
Copy link
Contributor

@coke coke commented Jul 19, 2023

A first pass at converting Perl6 to Raku.

@coke
Copy link
Contributor Author

coke commented Jul 19, 2023

I couldn't see how to add this to the 'make units' test; everything seems to get built and all other tests pass, however. Please review and let me know if I can do anything to improve the PR.

@coke
Copy link
Contributor Author

coke commented Jul 19, 2023

Once this is approved, someone (me?) can work on updating any syntax changes since the original Perl 6 version, and perhaps removing the code to sniff out the differences between 5 & 6 (which are now using different extensions entirely)

{
static const char *const extensions[] = { "p6", "pm6", "pm", "pl6",
"t6", "raku", "rakumod", "rakutest", NULL };
static const char *const extensions[] = { "raku", "rakumod", "rakutest", "rakudoc", NULL };
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ctags should support older code.
With this change, ctags cannot handle Perl6 files having '.pl6' as a suffix.
This is degrading.

@masatake
Copy link
Member

Can we assume Raku is a superset of Perl6?

This change may break two things:

  1. ctags cannot read *.pl6 files.
  2. options of ctags command lines like --kind-Perl6=+c don't work.

I found two approaches:

A. add a new file, raku.c, by copying perl6.c.

  • then revise raku.c to the latest Raku syntax, and
  • remove Raku-specific code from perl6. e.g. static const char *const extensions[] = { ... , "raku", "rakumod", "rakutest", NULL };

B. add a parserDefinition for Raku to perl6.c like:

diff --git a/parsers/perl6.c b/parsers/perl6.c
index e455642e5..d691e6828 100644
--- a/parsers/perl6.c
+++ b/parsers/perl6.c
@@ -327,15 +327,31 @@ findPerl6Tags (void)
 parserDefinition *
 Perl6Parser (void)
 {
-    static const char *const extensions[] = { "p6", "pm6", "pm", "pl6",
-		"t6", "raku", "rakumod", "rakutest", NULL };
+    static const char *const extensions[] = { "p6", "pm6", "pm", "pl6",NULL };
     static selectLanguage selectors [] = { selectByPickingPerlVersion,
 					   NULL };
     parserDefinition* def = parserNew("Perl6");
     def->kindTable      = perl6Kinds;
     def->kindCount  = ARRAY_SIZE(perl6Kinds);
     def->extensions = extensions;
+	def->aliases = aliases;
     def->parser     = findPerl6Tags;
     def->selectLanguage = selectors;
     return def;
 }
+
+parserDefinition *
+RakuParser (void)
+{
+    static const char *const extensions[] = { "raku", "rakumod", "rakutest", NULL };
+    static selectLanguage selectors [] = { selectByPicking?Version,
+					   NULL };
+    parserDefinition* def = parserNew("Raku");
+    def->kindTable      = ?Kinds;
+    def->kindCount  = ARRAY_SIZE(?Kinds);
+    def->extensions = extensions;
+	def->aliases = aliases;
+    def->parser     = find?Tags;
+    def->selectLanguage = selectors;
+    return def;
+}

? are debatable.

If we should think perl6 and raku are different languages, we should choose A.
If not, B can be a choice.

@dtikhonov Do you have comments?

@coke
Copy link
Contributor Author

coke commented Jul 20, 2023

Perl6 no longer exists, since 2019. It was renamed to Raku. So, not two different languages.

Despite that, I can keep the old extensions.

I’ll undo the ws change, sorry about that.

@masatake
Copy link
Member

I guess Raku doesn't accept '*.pm' So you don't have to change selectors.c
selectors.c is for arbitrating between Perl6 and Perl; both two can handle '.pm' files.

Your change looks o.k.
I would like to adjust RakuParser and keep Perl6Parser like:

parserDefinition *
RakuParser (void)
{
    static const char *const extensions[] = { "raku", "rakumod", "rakutest", NULL };
    parserDefinition* def = parserNew("Raku");
    def->kindTable      = raku6Kinds;
    def->kindCount  = ARRAY_SIZE(rakuKinds);
    def->extensions = extensions;
    def->parser     = findRakuTags;
    return def;
}

/* For keeping the name "Perl6". */
#define perl6Kinds rakuKinds /* TODO: kinds should not be shared the kind spec between parsers. */
#define findPerl6Tags raku6Kinds
parserDefinition *
Perl6Parser (void)
{
    static const char *const extensions[] = { "p6", "pm6", "pm", "pl6", "t6", NULL };
    static selectLanguage selectors [] = { selectByPickingPerlVersion,
					   NULL };
    parserDefinition* def = parserNew("Perl6");
    def->kindTable      = perl6Kinds;
    def->kindCount  = ARRAY_SIZE(perl6Kinds);
    def->extensions = extensions;
    def->parser     = findPerl6Tags;
    def->selectLanguage = selectors;
    return def;
}

@masatake
Copy link
Member

BTW, you use your master branch for making a pull request.
I think you should make a topic branch.

@masatake masatake self-assigned this Jul 20, 2023
@masatake masatake added this to the 6.1 milestone Jul 20, 2023
@dtikhonov
Copy link
Member

No, I don't have comments about the code change, @masatake.

@codecov
Copy link

codecov bot commented Jul 20, 2023

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (caeb22a) 83.04% compared to head (947b5b4) 83.04%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #3777   +/-   ##
=======================================
  Coverage   83.04%   83.04%           
=======================================
  Files         227      227           
  Lines       55184    55192    +8     
=======================================
+ Hits        45828    45836    +8     
  Misses       9356     9356           
Impacted Files Coverage Δ
parsers/raku.c 96.93% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@masatake masatake marked this pull request as ready for review July 21, 2023 01:18
@masatake
Copy link
Member

I pushed commits reflecting my review comments to your branch.
I think this is ready for merging after squashing the commits into one.

@coke Will you modify or update this pull request more before merging?

@coke
Copy link
Contributor Author

coke commented Jul 21, 2023

I am very surprised that you would push into my fork on the branch I was working on. I didn't even realize this would be allowed by default.

Please merge what you like: if you're happy with the current state. I do note that "make units | grep -i raku" still shows no tests being run.

@coke
Copy link
Contributor Author

coke commented Jul 21, 2023

I am very surprised that you would push into my fork on the branch I was working on. I didn't even realize this would be allowed by default.

Looking at settings on coke/ctags, no one else is permitted; I'm very confused.

@coke
Copy link
Contributor Author

coke commented Jul 21, 2023

I'm very confused.

When opening a PR, "allow edits by maintainers" setting is apparently enabled by default.

@masatake
Copy link
Member

I do note that "make units | grep -i raku" still shows no tests being run.

Thank you. I didn't recognize it.
I inspected it.

I guess you did git mv Units/parser-perl6.r Unit/parser-raku.
This should be git mv Units/parser-perl6.r Unit/parser-raku.r.

@masatake
Copy link
Member

image

@masatake masatake merged commit 70c7b9a into universal-ctags:master Jul 21, 2023
38 checks passed
@masatake
Copy link
Member

Thank you. I'm waiting for more contributions from you:-).
I hope https://docs.ctags.io/en/latest/testing-parser.html may help you improve the parser.

I am very surprised that you would push into my fork on the branch I was working on. I didn't even realize this would be allowed by default.

I was very surprised by the feature, too.

I have used the feature only when I want to merge a pull request quickly.
I should not use "push --force" with this feature not to break contributors' work critically.
"git push" can keep all the original commits on the branch. Instead, I use the "Squash and Merge" button on GitHub.

@coke
Copy link
Contributor Author

coke commented Jul 21, 2023

This should be git mv Units/parser-perl6.r Unit/parser-raku.r.

Good catch!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants