My grammar doesn't seem to match the 'other' rule. What's wrong with it?

grammar Weave {
        token TOP {  <el> * }
        rule el {  <lt> | <tilde> | <other>  }
        rule lt { '<'  }
        rule tilde { '~' \S+ }
        rule other { .  }
}

class Weaver {
        has Str $.outstr;

        method TOP   ($/) { make $<el> ; put("top called") ; put($<el>) }
        method el    ($/) { put($/) }
        method tilde ($/) { say 'tilde called' }
        method lt    ($/) { make '&lt;' ; put('&lt'); $!outstr ~= 'X' }
        method other ($/) { $!outstr ~= '.'; say 'other called'; put('.'); }

}

$input = '~i <<<YZ';
my $w = Weaver.new();
Weave.parse($input, :actions($w));
say $w.outstr; # outputs XXX

It never once says 'other called'. It seems to be matching the '<' signs OK, and I think the '~' is OK, too. It's just any other token that it's not matching.

Reply via email to