mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Added traceLog() call into Scanner.handleProblem() and updated ParserFactory.createPreprocessor()'s error handling.
This commit is contained in:
parent
ee9dc1d5a5
commit
d228fe824a
3 changed files with 26 additions and 11 deletions
|
@ -1,3 +1,6 @@
|
||||||
|
2004-01-20 John Camelon
|
||||||
|
Added traceLog() call into Scanner.handleProblem() and updated ParserFactory.createPreprocessor() for extra error handling.
|
||||||
|
|
||||||
2004-01-20 John Camelon
|
2004-01-20 John Camelon
|
||||||
Tidied up Scanner implementation for unused fields, inefficient String manipulations and redundant parameters.
|
Tidied up Scanner implementation for unused fields, inefficient String manipulations and redundant parameters.
|
||||||
|
|
||||||
|
|
|
@ -74,9 +74,14 @@ public class ParserFactory {
|
||||||
|
|
||||||
public static IPreprocessor createPreprocessor( Reader input, String fileName, IScannerInfo info, ParserMode mode, ParserLanguage language, ISourceElementRequestor requestor, IParserLogService logService )
|
public static IPreprocessor createPreprocessor( Reader input, String fileName, IScannerInfo info, ParserMode mode, ParserLanguage language, ISourceElementRequestor requestor, IParserLogService logService )
|
||||||
{
|
{
|
||||||
|
if( input == null ) throw new ParserFactoryError( ParserFactoryError.Kind.NULL_READER );
|
||||||
|
if( fileName == null ) throw new ParserFactoryError( ParserFactoryError.Kind.NULL_FILENAME );
|
||||||
|
if( info == null ) throw new ParserFactoryError( ParserFactoryError.Kind.NULL_CONFIG );
|
||||||
|
if( language == null ) throw new ParserFactoryError( ParserFactoryError.Kind.NULL_LANGUAGE );
|
||||||
|
IParserLogService log = ( logService == null ) ? createDefaultLogService() : logService;
|
||||||
ParserMode ourMode = ( (mode == null )? ParserMode.COMPLETE_PARSE : mode );
|
ParserMode ourMode = ( (mode == null )? ParserMode.COMPLETE_PARSE : mode );
|
||||||
ISourceElementRequestor ourRequestor = (( requestor == null) ? new NullSourceElementRequestor() : requestor );
|
ISourceElementRequestor ourRequestor = (( requestor == null) ? new NullSourceElementRequestor() : requestor );
|
||||||
IPreprocessor s = new Preprocessor( input, fileName, info, ourRequestor, ourMode, language, logService );
|
IPreprocessor s = new Preprocessor( input, fileName, info, ourRequestor, ourMode, language, log );
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -80,9 +80,16 @@ public class Scanner implements IScanner {
|
||||||
String attributes [] = problemFactory.getRequiredAttributesForId( problemID );
|
String attributes [] = problemFactory.getRequiredAttributesForId( problemID );
|
||||||
arguments.put( attributes[ 0 ], argument );
|
arguments.put( attributes[ 0 ], argument );
|
||||||
}
|
}
|
||||||
IProblem p = problemFactory.createProblem( problemID, beginningOffset, getCurrentOffset(), contextStack.getCurrentLineNumber(), getCurrentFile().toCharArray(), arguments, warning, error );
|
|
||||||
if( (! requestor.acceptProblem( p )) && extra )
|
IProblem problem = problemFactory.createProblem( problemID, beginningOffset, getCurrentOffset(), contextStack.getCurrentLineNumber(), getCurrentFile().toCharArray(), arguments, warning, error );
|
||||||
throw new ScannerException( p );
|
|
||||||
|
// trace log
|
||||||
|
StringBuffer logMessage = new StringBuffer( "Scanner problem encountered: ");
|
||||||
|
logMessage.append( problem.getMessage() );
|
||||||
|
log.traceLog( logMessage.toString() );
|
||||||
|
|
||||||
|
if( (! requestor.acceptProblem( problem )) && extra )
|
||||||
|
throw new ScannerException( problem );
|
||||||
}
|
}
|
||||||
|
|
||||||
public Scanner(Reader reader, String filename, IScannerInfo info, ISourceElementRequestor requestor, ParserMode parserMode, ParserLanguage language, IParserLogService log ) {
|
public Scanner(Reader reader, String filename, IScannerInfo info, ISourceElementRequestor requestor, ParserMode parserMode, ParserLanguage language, IParserLogService log ) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue