Oh, some more detail: this is on the latest git clone via the instructions
on the Web site. I just wanted to see if things were in the kind of shape
where I could start sketching out some libraries (figured I'd start with
some URL parsing and work my way up to a JavaScript implementation once R*
comes out).

On Wed, May 12, 2010 at 4:08 PM, Aaron Sherman <a...@ajs.com> wrote:

> I'm getting errors when I do this:
>
> rule aaa { 'a' }
> my $str = "a";
> say "yes" if $str ~~ m/<aaa>/;
>
>
> The error is "Useless declaration of has-scoped rule in a module; add our
> or my to install it in the lexpad or namespace".
>
> So I suspected that this would not work correctly outside of a grammar. I
> then tried:
>
> grammar Foo {
>   rule aaa { 'a' }
>   method main() {
>     my $str = "a";
>     say "yes" if $str ~~ m/<aaa>/;
>   }
> }
> Foo.main();
>
>
> Now I get: Method 'aaa' not found for invocant of class 'Regex;Cursor'
>
> No matter what I do, I don't seem to be able to define and invoke a rule
> from a regex. Am I just missing something fundamental? I thought I'd been
> able to do this back a few months ago when I tried.
>
> --
> Aaron Sherman
> Email or GTalk: a...@ajs.com
> http://www.ajs.com/~ajs
>



-- 
Aaron Sherman
Email or GTalk: a...@ajs.com
http://www.ajs.com/~ajs

Reply via email to