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

LABEL not allowed in loop statements #120

Closed
wollmers opened this issue Apr 23, 2022 · 2 comments
Closed

LABEL not allowed in loop statements #120

wollmers opened this issue Apr 23, 2022 · 2 comments
Labels

Comments

@wollmers
Copy link

Example:

PATH: for my $path (0..1) {
    next PATH unless ($path > 0);
    print '$path: ',$path, "\n";
}

Throws:

$ perl ternary.pl
File 'ternary.pl' does not pass Standard Perl.
Parser says:
> Error in SLIF parse: No lexeme found at line 31, column 5
> * String before error: ) : {}, ref( $class || $class )\n    );\n}\n\nPATH
> * The error was at line 31, column 5, and at character 0x003a ':', ...
> * here: : for my $path (0..1) {\n    next PATH unless ($pa
> Marpa::R2 exception at /Users/helmut/perl5/perlbrew/perls/perl-5.32.0/lib/site_perl/5.32.0/Guacamole.pm line 2103.
> 
> Failed to parse past: PATH (char 122, length 1), expected LParen,OpArrow,PackageSep at /Users/helmut/perl5/perlbrew/perls/perl-5.32.0/lib/site_perl/5.32.0/Guacamole.pm line 2119.
$path: 1

Label is defined in lib/Guacamole.pm

Label ::= IdentComp Colon

but nut used in the grammar of the LoopStatements.

@xsawyerx xsawyerx added the bug label May 30, 2022
@xsawyerx
Copy link
Owner

Labels should be supported in front of every statement since you can goto them from anywhere:

goto NEXT;
FIRST: print "no\n";
NEXT:
print "yes\n";

@xsawyerx
Copy link
Owner

Closing this in favor of the earliest ticket still open: supporting labels. :) #16.

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

2 participants