Skip to content

Commit

Permalink
Change global ::Grammar variables
Browse files Browse the repository at this point in the history
Missed these vars first time around.
  • Loading branch information
ingydotnet committed Dec 11, 2014
1 parent 1dc4fc8 commit 83554f9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 14 deletions.
12 changes: 1 addition & 11 deletions lib/Inline/CPP.pm
Expand Up @@ -287,17 +287,7 @@ sub info {
# Generate a C++ parser
#============================================================================
sub get_parser {
my $o = shift;
die 42;
my $grammar = Inline::CPP::Parser::RecDescent::grammar()
or croak "Can't find C++ grammar\n";
no warnings qw/ once /; ## no critic (warnings)
$::RD_HINT = 1; # Turns on Parse::RecDescent's warnings/diagnostics.
require Parse::RecDescent;
my $parser = Parse::RecDescent->new($grammar);
$parser->{data}{typeconv} = $o->{ILSM}{typeconv};
$parser->{ILSM} = $o->{ILSM}; # give parser access to config options
return $parser;
return Inline::CPP::Parser::RecDescent->get_parser_recdescent();
}

#============================================================================
Expand Down
6 changes: 3 additions & 3 deletions lib/Inline/CPP/Parser/RecDescent.pm
Expand Up @@ -17,7 +17,7 @@ sub register {
}

sub get_parser {
Inline::CPP::Parser::RecDescent::get_parser_recdescent();
return Inline::CPP::Parser::RecDescent::get_parser_recdescent();
}

sub get_parser_recdescent {
Expand Down Expand Up @@ -68,13 +68,13 @@ use vars qw( $code_block $string $number $parens $funccall );

# $RE{balanced}{-parens=>q|{}()[]"'|}
eval <<'END'; ## no critic (eval)
$code_block = qr'(?-xism:(?-xism:(?:[{](?:(?>[^][)(}{]+)|(??{$Inline::CPP::Grammar::code_block}))*[}]))|(?-xism:(?-xism:(?:[(](?:(?>[^][)(}{]+)|(??{$Inline::CPP::Grammar::code_block}))*[)]))|(?-xism:(?-xism:(?:[[](?:(?>[^][)(}{]+)|(??{$Inline::CPP::Grammar::code_block}))*[]]))|(?-xism:(?!)))))';
$code_block = qr'(?-xism:(?-xism:(?:[{](?:(?>[^][)(}{]+)|(??{$Inline::CPP::Parser::RecDescent::code_block}))*[}]))|(?-xism:(?-xism:(?:[(](?:(?>[^][)(}{]+)|(??{$Inline::CPP::Parser::RecDescent::code_block}))*[)]))|(?-xism:(?-xism:(?:[[](?:(?>[^][)(}{]+)|(??{$Inline::CPP::Parser::RecDescent::code_block}))*[]]))|(?-xism:(?!)))))';
END
$code_block = qr'{[^}]*}' if $@; # For the stragglers: here's a lame regexp.

# $RE{balanced}{-parens=>q|()"'|}
eval <<'END'; ## no critic (eval)
$parens = qr'(?-xism:(?-xism:(?:[(](?:(?>[^)(]+)|(??{$Inline::CPP::Grammar::parens}))*[)]))|(?-xism:(?!)))';
$parens = qr'(?-xism:(?-xism:(?:[(](?:(?>[^)(]+)|(??{$Inline::CPP::Parser::RecDescent::parens}))*[)]))|(?-xism:(?!)))';
END
$parens = qr'\([^)]*\)' if $@; # For the stragglers: here's another

Expand Down

0 comments on commit 83554f9

Please sign in to comment.