Simple, but significant improvement to the parser for accurate function call catching. Removed unused code from output modules. Mantis: 2691

git-svn-id: file:///srv/svn/scanner/trunk@12 a0501263-5b7a-4423-a8ba-1edf086583e7
This commit is contained in:
Correl Roush 2008-02-28 18:56:58 +00:00
parent ea365a09dd
commit dd214f3451
3 changed files with 7 additions and 2 deletions

View file

@ -65,7 +65,6 @@ class HTMLOutput extends OutputModule {
); );
$current_file = ''; $current_file = '';
foreach( $faults as $id => $fault ) { foreach( $faults as $id => $fault ) {
$svn = serialize( $fault['svn'] );
if( $current_file != $fault['object']['file'] ) { if( $current_file != $fault['object']['file'] ) {
if( $current_file != '' ) { if( $current_file != '' ) {
fwrite( $output, '</ul></dd>' ); fwrite( $output, '</ul></dd>' );

View file

@ -8,7 +8,6 @@ class TextOutput extends OutputModule {
return false; return false;
} }
foreach( $faults as $fault ) { foreach( $faults as $fault ) {
$svn = serialize( $fault['svn'] );
fprintf( $output, "%s\t%d\t%s\t%d\t%s\t%d\t%s\n", fprintf( $output, "%s\t%d\t%s\t%d\t%s\t%d\t%s\n",
$fault['module'], $fault['module'],
$fault['level'], $fault['level'],

View file

@ -155,6 +155,13 @@ class PHPParser {
) ); ) );
} }
break; break;
default:
/* Should be able to add a hook here later on to catch the use of defines,
which are basically just T_STRINGs that PHP can't find anything else to
do with. That could be useful in determining whether a define is defined.
*/
$string = null;
break;
} }
if( !in_array( $token, array( '(', ')' ) ) ) { $last_token = null; } if( !in_array( $token, array( '(', ')' ) ) ) { $last_token = null; }
if( (bool)($this->fetch_mode & PHPPARSER_FETCH_EXPRESSIONS) && in_array( $token, array( '{', '}', ';', '=', '?', ':' ) ) && strlen( trim( $expression ) ) > 0 ) { if( (bool)($this->fetch_mode & PHPPARSER_FETCH_EXPRESSIONS) && in_array( $token, array( '{', '}', ';', '=', '?', ':' ) ) && strlen( trim( $expression ) ) > 0 ) {