in reply to Re: Bash Parser
in thread Bash Parser
Using undef my %... is redundant as you say, really serves no purpose.
eval {$file =~ s/\$$variable/$path/g;}
I will add proper error checking to files, just didn't bother.
You are correct about the substitution, just couldn't find a better approach to do it. Which you neatly just gave me :D.
if(/^[ \t]*source +([\w\-\/\.\_\$]+)/)
The regular expression was more adapted to what people use through testing than what they might use, I will add you suggestions.
if($check_if_bash == 1 && $line_number == 1 && ! /bash/) { return }
Was mainly to exclude scripts that are executable but not bash. If you have a good idea how to verify if a script is indeed bash when it lacks #!/usr/bin/bash id be greatful.
You are right %%...%% isn't a comment it's usually a text block, the main reason to detect it was to avoid parsing it later. But it should not be included in comment statistics.
match/get_sources have slightly different structure since I don't want the statistics from sourced files since the statistics is per script and sourced files are individually included in the end.
There is as you say a possibility of a race condition I will fix this. Thanks
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Bash Parser
by jakobi (Pilgrim) on Sep 30, 2009 at 19:22 UTC |