my $level = 1; my $from=pos($$input); my $to; while($$input =~ /\G(.*? (?: \#[^\n]*\n # Perl like comments | \/\*.*?\*\/ # C like comments | \/\/[^\n]*\n # C++ like comments | (?<!\\)'.*?(?<!\\)' # Single-quoted strings | (?<!\\)".*?(?<!\\)" # Double-quoted strings | ([{}]|$) # Our match or EOF ) )/xsgc) { if (defined $2) { if ($2 eq '}') { $level--; unless($level) { $to = pos($$input) - 1; last; } } elsif ($2 eq '{') { $level++; } else { $to = length $$input; print(2,"Unmatched { opened line $old_lineno",-1); last; } } } $code = substr($$input,$from,$to-$from); $lineno+= $code=~tr/\n//; return('BRACED_CODE',[ $code, $old_lineno ]); };
yagg::TerminalParser - An internal class for the yagg parser.
To install yagg, copy and paste the appropriate command in to your terminal.
cpanm
cpanm yagg
CPAN shell
perl -MCPAN -e shell install yagg
For more information on module installation, please visit the detailed CPAN module installation guide.