Permalink
Browse files

Added Syntax::Perl5Var exception, to be used later at your convenience

  • Loading branch information...
1 parent 932bfc8 commit bda446566ac41af280f372c82d390a6f069c4e01 @lizmat lizmat committed Aug 20, 2013
Showing with 63 additions and 0 deletions.
  1. +63 −0 src/core/Exception.pm
View
@@ -853,6 +853,69 @@ my class X::Syntax::Missing does X::Syntax {
method message() { "Missing $.what" }
}
+my class X::Syntax::Perl5Var does X::Syntax {
+ has $.name;
+ my %m =
+ '$*' => '^^ and $$',
+ '$"' => '.join() method',
+ '$$' => '$*PID',
+ '$(' => '$*GID',
+ '$)' => '$*EGID',
+ '$<' => '$*UID',
+ '$>' => '$*EUID',
+ '$;' => 'real multidimensional hashes',
+ '$&' => '$<>',
+ '$`' => 'explicit pattern before <(',
+ '$\'' => 'explicit pattern after )>',
+ '$,' => '$*OUT.output_field_separator()',
+ '$.' => "the filehandle's .line method",
+ '$\\' => "the filehandle's .ors attribute",
+ '$|' => ':autoflush on open',
+ '$?' => '$! for handling child errors also',
+ '$@' => '$!',
+ '$#' => '.fmt',
+ '$[' => 'user-defined array indices',
+ '$]' => '$*PERL_VERSION',
+
+ '$^C' => 'COMPILING namespace',
+ '$^D' => '$*DEBUGGING',
+ '$^E' => '$!.extended_os_error',
+ '$^F' => '$*SYSTEM_FD_MAX',
+ '$^H' => '$?FOO variables',
+ '$^I' => '$*INPLACE',
+ '$^M' => 'a global form such as $*M',
+ '$^N' => '$/[*-1]',
+ '$^O' => '$?OS or $*OS',
+ '$^R' => 'an explicit result variable',
+ '$^S' => 'context function',
+ '$^T' => '$*BASETIME',
+ '$^V' => '$*PERL_VERSION',
+ '$^W' => '$*WARNING',
+ '$^X' => '$*EXECUTABLE_NAME',
+
+ '$:' => 'Form module',
+ '$-' => 'Form module',
+ '$+' => 'Form module',
+ '$=' => 'Form module',
+ '$%' => 'Form module',
+ '$^' => 'Form module',
+ '$~' => 'Form module',
+ '$^A' => 'Form module',
+ '$^L' => 'Form module',
+
+ '@-' => '.from method',
+ '@+' => '.to method',
+
+ '%-' => '.from method',
+ '%+' => '.to method',
+ '%!' => 'your time to implement this',
+ '%^H' => '$?FOO variables',
+ ;
+ method message() {
+ "Unsupported use of {$.name} variable"
+ ~ ( %m{$.name} ?? "; in Perl 6 please use {%m{$.name}}" !! '' );
+ }
+}
my class X::Syntax::SigilWithoutName does X::Syntax {
method message() { 'Non-declarative sigil is missing its name' }
}

0 comments on commit bda4465

Please sign in to comment.