Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

defining a regex after a grammar places the regex in the grammar namespace #303

Closed
p6rt opened this issue Sep 8, 2008 · 4 comments
Closed
Labels

Comments

@p6rt
Copy link

p6rt commented Sep 8, 2008

Migrated from rt.perl.org#58678 (status was 'resolved')

Searchable as RT58678$

@p6rt
Copy link
Author

p6rt commented Sep 8, 2008

From @cjfields

Rakudo, r30888. When defining a grammar and regex, defining a regex
after a grammar places the regex in the grammar namespace, but vice
versa works fine. Below is some demo code (switch the definition
placements and comment out the check against Foo​::Bar to see it
magically work)​:

grammar Foo {
  rule TOP {\d+}
};

regex Bar {\d+};

# smart match against Foo may change based on RT 58676
'123' ~~ Foo;
say $/;

'1234' ~~ Foo​::Bar; # works?!?
say $/;

'12345' ~~ Bar; # fails
say $/;

chris

@p6rt
Copy link
Author

p6rt commented Sep 11, 2008

From @jnthn

On Mon Sep 08 09​:08​:50 2008, cjfields@​illinois.edu wrote​:

Rakudo, r30888. When defining a grammar and regex, defining a regex
after a grammar places the regex in the grammar namespace, but vice
versa works fine. Below is some demo code (switch the definition
placements and comment out the check against Foo​::Bar to see it
magically work)​:

grammar Foo {
rule TOP {\d+}
};

regex Bar {\d+};

# smart match against Foo may change based on RT 58676
'123' ~~ Foo;
say $/;

'1234' ~~ Foo​::Bar; # works?!?
say $/;

'12345' ~~ Bar; # fails
say $/;

Ah yes, forgot to clear the thingy holding the current namespace. Fixed
it in r31006; if you have time to contribute a test for this somewhere,
that'd be wonderful.

Thanks for reporting,

Jonathan

@p6rt
Copy link
Author

p6rt commented Sep 11, 2008

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Sep 11, 2008

@jnthn - Status changed from 'open' to 'resolved'

@p6rt p6rt closed this as completed Sep 11, 2008
@p6rt p6rt added the Bug label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant