xsawyerx / guacamole

Guacamole is a parser toolkit for Standard Perl. It provides fully static BNF-based parsing capability to a reasonable subset of Perl.
https://metacpan.org/pod/Guacamole
20 stars 8 forks source link

All blocks must end with semicolon, unless last statement #44

Closed xsawyerx closed 4 years ago

xsawyerx commented 4 years ago

[Edit: added all blocks.]

Because subroutines are considered Statements and Statements use Semicolon between them, the following fails:

sub foo () {...}
sub bar () {...}

Instead, it has to be written this way:

sub foo () {...};
sub bar () {...};

This also affects if() conditions:

if ($foo) {1}                          # ok
if ($foo) {1} foo()                    # not ok
if ($foo) {1}; foo()                   # ok
if ($foo) {1} elsif ($bar) {2} foo();  # not ok
if ($foo) {1} elsif ($bar) {2}; foo(); # ok
gonzus commented 4 years ago

Hum... I think this will cause riots, asking for your head on a pike.

[Spoken as a true member of the peanut gallery, BTW]

xsawyerx commented 4 years ago

Yeah, I agree. :)

xsawyerx commented 4 years ago

And @vickenty works his magic yet again! :)