Permalink
Browse files

Add language rules for Perl6 and its cousin Not Quite Perl (#274)

* Add Perl6 rule

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>

* Add Not Quite Perl rule

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>

* Add Perl6 test

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>

* Fix Perl6 test, oops

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>

* Add Not Quite Perl test

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
  • Loading branch information...
alekratz authored and Aaronepower committed Oct 15, 2018
1 parent 9d8e28a commit 21f6fc0c1108b298ac6e40ff6a2318f2876781e9
Showing with 67 additions and 0 deletions.
  1. +32 −0 languages.json
  2. +24 −0 tests/data/nqp.nqp
  3. +11 −0 tests/data/perl6.pl6
View
@@ -1099,6 +1099,38 @@
"pm"
]
},
"Perl6":{
"line_comment":[
"#"
],
"multi_line":[
["=begin", "=end"]
],
"quotes":[
["\\\"", "\\\""],
["'", "'"]
],
"extensions":[
"pl6",
"pm6"
]
},
"NotQuitePerl":{
"name": "Not Quite Perl",
"line_comment":[
"#"
],
"multi_line":[
["=begin", "=end"]
],
"quotes":[
["\\\"", "\\\""],
["'", "'"]
],
"extensions":[
"nqp"
]
},
"Php":{
"name":"PHP",
"line_comment":[
View
@@ -0,0 +1,24 @@
# 24 lines 15 code 7 comments 2 blanks
=begin
Regex methods and functions
=end
=begin item match
Match C<$text> against C<$regex>. If the C<$global> flag is
given, then return an array of all non-overlapping matches.
=end item
sub match ($text, $regex, :$global?) {
my $match := $text ~~ $regex;
if $global {
my @matches;
while $match {
nqp::push(@matches, $match);
$match := $match.parse($text, :rule($regex), :c($match.to));
}
@matches;
}
else {
$match;
}
}
View
@@ -0,0 +1,11 @@
# 11 lines 5 code 4 comments 2 blanks
=begin pod
Defines a fun infix operator.
This was stolen from http://tpm2016.zoffix.com/#/14
=end pod
sub infix:<¯\(°_o)/¯> {
($^a, $^b).pick
}
say 'Coke' ¯\(°_o)/¯ 'Pepsi';

0 comments on commit 21f6fc0

Please sign in to comment.