Skip to content

Instantly share code, notes, and snippets.

View FROGGS's full-sized avatar

Tobias Leich FROGGS

  • Germany (near Berlin)
View GitHub Profile
@FROGGS
FROGGS / use_v5.diff
Last active December 15, 2015 15:59
diff --git a/src/Perl6/Grammar.pm b/src/Perl6/Grammar.pm
index abf96b7..c5f9177 100644
--- a/src/Perl6/Grammar.pm
+++ b/src/Perl6/Grammar.pm
@@ -1156,7 +1156,12 @@ grammar Perl6::Grammar is HLL::Grammar does STD {
$<doc>=[ 'DOC' \h+ ]?
<sym> <.ws>
[
- | <version>
+ | <version> <?{ ~$<version><vnum>[0] ne '5' }>
# References ISO/IEC 9899:1990 "Information technology - Programming Language C" (C89 for short)
grammar C::StdC89Lexer;
#rule TOP {
# ^ <c-token>+ $
#}
# SS 6.4
proto token c-token {*}
@FROGGS
FROGGS / nfa.pl
Last active December 14, 2015 13:38
working NFA example
sub store_regex_alt_nfa($code_obj, $key, @alternatives) {
my @saved;
for @alternatives {
@saved.push($_.save(:non_empty));
}
$code_obj.SET_ALT_NFA($key, @saved);
}
my $code_obj := nqp::create(NQPRegex);
my $ast := QAST::Regex.new(
@FROGGS
FROGGS / 1.diff
Created February 25, 2013 23:36
cclass oddity 2000
diff --git a/src/QRegex/P6Regex/Actions.nqp b/src/QRegex/P6Regex/Actions.nqp
index dff6757..1ab5bc3 100755
--- a/src/QRegex/P6Regex/Actions.nqp
+++ b/src/QRegex/P6Regex/Actions.nqp
@@ -432,6 +432,7 @@ class QRegex::P6Regex::Actions is HLL::Actions {
while $i < $n {
my $ast := $clist[$i].ast;
if $ast.negate {
+ say("method assertion:sym<[>($/) while negate");
if $ast.rxtype eq 'cclass' {
diff --git a/src/QRegex/P6Regex/Actions.nqp b/src/QRegex/P6Regex/Actions.nqp
index 5fe283a..dff6757 100755
--- a/src/QRegex/P6Regex/Actions.nqp
+++ b/src/QRegex/P6Regex/Actions.nqp
@@ -432,7 +432,12 @@ class QRegex::P6Regex::Actions is HLL::Actions {
while $i < $n {
my $ast := $clist[$i].ast;
if $ast.negate {
- $ast.subtype('zerowidth');
+ if $ast.rxtype eq 'cclass' {
@FROGGS
FROGGS / nil.diff
Created February 24, 2013 12:27
patch for returning Nil for failed matches
diff --git a/src/core/Cursor.pm b/src/core/Cursor.pm
index 2654bfe..d6f81c8 100644
--- a/src/core/Cursor.pm
+++ b/src/core/Cursor.pm
@@ -41,8 +41,11 @@ my class Cursor does NQPCursorRole {
method MATCH_SAVE() {
my $match := self.MATCH();
- $last_match := $match if $match;
- $match;
@FROGGS
FROGGS / nqp.diff
Created February 19, 2013 09:00
Allow / [ a || b || @A ] / to do sequential matching instead of LTM.
diff --git a/src/NQP/Actions.pm b/src/NQP/Actions.pm
index 0d3111e..6fbeccb 100644
--- a/src/NQP/Actions.pm
+++ b/src/NQP/Actions.pm
@@ -1665,7 +1665,8 @@ class NQP::RegexActions is QRegex::P6Regex::Actions {
method metachar:sym<nqpvar>($/) {
make QAST::Regex.new( QAST::Node.new(
QAST::SVal.new( :value('!INTERPOLATE') ),
- $<var>.ast),
+ $<var>.ast,
@FROGGS
FROGGS / p003.pl
Last active December 12, 2015 01:28 — forked from gerdr/p003.pl
use v6;
sub largest-prime-factor($n is copy) {
for 2, 3, *+2 ... * {
while $n %% $_ {
$n div= $_;
return $_ if $_ > $n;
}
};
1
@FROGGS
FROGGS / out.txt
Created January 2, 2013 18:15
$_.value
Stage start : 0.000
get_bool() not implemented in class 'PROCESS'
current instr.: '' pc 4376 (src/gen/perl6-symboltable.pir:1639) (src/Perl6/World.pm:277)
called from Sub 'import' pc 4188 (src/gen/perl6-symboltable.pir:1565) (src/Perl6/World.pm:260)
called from Sub '' pc 19787 (src/gen/perl6-grammar.pir:7252) (src/Perl6/Grammar.pm:1221)
called from Sub '' pc 19315 (src/gen/perl6-grammar.pir:7057) (src/Perl6/Grammar.pm:1217)
called from Sub 'do_import' pc 19184 (src/gen/perl6-grammar.pir:7000) (src/Perl6/Grammar.pm:1194)
called from Sub '' pc 75983 (src/gen/perl6-grammar.pir:26121) (src/Perl6/Grammar.pm:1184)
called from Sub '' pc 75838 (src/gen/perl6-grammar.pir:26064) (src/Perl6/Grammar.pm:1179)
called from Sub 'statement_control:sym<use>' pc 74918 (src/gen/perl6-grammar.pir:25730) (src/Perl6/Grammar.pm:1134)
@FROGGS
FROGGS / Bar.pm
Created December 17, 2012 20:16
Merge globals bug in rakudo
module Bar;
multi trait_mod:<is>(Routine $r, :$bar!) is export { }