Permalink
Browse files

Pass on NFA from wrapper, fixing LTM issues.

  • Loading branch information...
jnthn committed Feb 2, 2017
1 parent 833ebe2 commit 51c3ca218a35d318f4e5e78650a35651e3ae968e
Showing with 11 additions and 3 deletions.
  1. +10 −1 lib/Grammar/Debugger/WrapCache.pm6
  2. +1 −1 lib/Grammar/Tracer.pm6
  3. +0 −1 t/ltm.t
@@ -6,7 +6,16 @@ role Grammar::Debugger::WrapCache {
unwrapped
}
- method !cache-wrapped(Str $name, \wrapped) {
+ method !cache-wrapped(Str $name, Mu \orig, \wrapped) {
+ my role Forward {
+ has Mu $.NFA;
+ method SET-ORIG(Mu \orig --> Nil) {
+ my Mu $raw-meth = orig.^lookup('NFA');
+ $!NFA := $raw-meth(orig);
+ }
+ }
+ wrapped does Forward;
+ wrapped.SET-ORIG(orig);
%!cache{$name} := wrapped;
wrapped
}
View
@@ -16,7 +16,7 @@ my class TracedGrammarHOW is Metamodel::GrammarHOW does Grammar::Debugger::WrapC
self!cache-unwrapped: $name, $meth;
}
else {
- self!cache-wrapped: $name, -> $c, |args {
+ self!cache-wrapped: $name, $meth, -> $c, |args {
# Method name.
say ('| ' x $indent) ~ BOLD() ~ $name ~ RESET();
View
@@ -30,5 +30,4 @@ my $outcome = do {
my $*OUT = class { method say(*@x) { }; method print(*@x) { }; method flush(*@x) { } }
MyGrammar.parse('aa', :rule<test>, :actions(MyActions)).made
}
-todo 'Grammar::Tracer busts LTM';
is $outcome, 'correct', 'Picked longest token';

0 comments on commit 51c3ca2

Please sign in to comment.