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

Make "use vstring" for v < 5 or v > 6 an error. #3622

Closed
p6rt opened this issue Dec 25, 2014 · 4 comments
Closed

Make "use vstring" for v < 5 or v > 6 an error. #3622

p6rt opened this issue Dec 25, 2014 · 4 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Dec 25, 2014

Migrated from rt.perl.org#123496 (status was 'resolved')

Searchable as RT123496$

@p6rt
Copy link
Author

p6rt commented Dec 25, 2014

From x.fix@o2.pl


src/Perl6/Grammar.nqp | 32 +++++++++++++++++++++++---------
src/core/Exception.pm | 7 +++++++
2 files changed, 30 insertions(+), 9 deletions(-)

Inline Patch
diff --git a/src/Perl6/Grammar.nqp b/src/Perl6/Grammar.nqp
index 2000376..69bef42 100644
--- a/src/Perl6/Grammar.nqp
+++ b/src/Perl6/Grammar.nqp
@@ -1576,15 +1576,29 @@ grammar Perl6::Grammar is HLL::Grammar does STD {
         $<doc>=[ 'DOC' \h+ ]**0..1
         <sym> <.ws>
         [
-        | <version> [ <?{ ~$<version><vnum>[0] eq '5' }> {
-                        my $module := $*W.load_module($/, 'Perl5', {}, $*GLOBALish);
-                        do_import($/, $module, 'Perl5');
-                        $/.CURSOR.import_EXPORTHOW($/, $module);
-                    } ]?
-                    [ <?{ ~$<version><vnum>[0] eq '6' }> {
-                        $*MAIN   := 'MAIN';
-                        $*STRICT := 1 if $*begin_compunit;
-                    } ]?
+        | <version> [
+                    ||  <?{ $<version><vnum>[0] == 5 }> {
+                            my $module := $*W.load_module($/, 'Perl5', {}, $*GLOBALish);
+                            do_import($/, $module, 'Perl5');
+                            $/.CURSOR.import_EXPORTHOW($/, $module);
+                        }
+                    ||  <?{ $<version><vnum>[0] == 6 }> {
+                            my $version_parts := $<version><vnum>;
+                            my $tokens := +$version_parts;
+                            my $position := 1;
+                            while $position < $tokens {
+                                if $version_parts[$position] != 0 {
+                                    $/.CURSOR.typed_panic: 'X::Language::Unsupported', version => ~$<version>;
+                                }
+                                $position++;
+                            }
+                            $*MAIN   := 'MAIN';
+                            $*STRICT := 1 if $*begin_compunit;
+                        }
+                    ||  {
+                            $/.CURSOR.typed_panic: 'X::Language::Unsupported', version => ~$<version>;
+                        }
+                    ]
         | <module_name>
             {
                 $longname := $<module_name><longname>;
diff --git a/src/core/Exception.pm b/src/core/Exception.pm
index 1bc3739..4b26419 100644
--- a/src/core/Exception.pm
+++ b/src/core/Exception.pm
@@ -1614,4 +1614,11 @@ my class X::EXPORTHOW::Conflict does X::Comp {
     }
 }
 
+my class X::Language::Unsupported is Exception {
+    has $.version;
+    method message() {
+        "No compiler available for Perl $.version"
+    }
+}
+
 # vim: ft=perl6 expandtab sw=4
-- 
2.2.1

@p6rt
Copy link
Author

p6rt commented Oct 11, 2015

From @niner

Patch updated and committed as rakudo/rakudo@9c1afaf3ab

Thanks for the help!

@p6rt
Copy link
Author

p6rt commented Oct 11, 2015

The RT System itself - Status changed from 'new' to 'open'

@p6rt p6rt closed this as completed Oct 11, 2015
@p6rt
Copy link
Author

p6rt commented Oct 11, 2015

@niner - Status changed from 'open' to 'resolved'

@p6rt p6rt added the patch label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant