1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

bug 53213- Externalize Strings

This commit is contained in:
Andrew Niefer 2004-03-04 18:00:20 +00:00
parent df6bb6a3af
commit 71de5821df
13 changed files with 445 additions and 317 deletions

View file

@ -1,3 +1,6 @@
2004-03-04 Andrew Niefer
bug 53213 externalize strings
2004-03-03 John Camelon 2004-03-03 John Camelon
Refactored parser for further content assist work. Refactored parser for further content assist work.

View file

@ -12,6 +12,8 @@ package org.eclipse.cdt.core.parser;
import java.util.Map; import java.util.Map;
import org.eclipse.cdt.internal.core.parser.ParserMessages;
/** /**
* @author jcamelon * @author jcamelon
* *
@ -105,7 +107,7 @@ public interface IProblem
/** /**
* Unknown filename sentinel value * Unknown filename sentinel value
*/ */
public final static String FILENAME_NOT_PROVIDED = "<unknown>"; public final static String FILENAME_NOT_PROVIDED = ParserMessages.getString("IProblem.unknownFileName"); //$NON-NLS-1$
/** /**
* Problem Categories * Problem Categories
@ -168,17 +170,17 @@ public interface IProblem
/** /**
* The text that follows a #error preprocessor directive * The text that follows a #error preprocessor directive
*/ */
public final static String A_PREPROC_POUND_ERROR = "#error text"; public final static String A_PREPROC_POUND_ERROR = ParserMessages.getString("IProblem.preproc.poundError"); //$NON-NLS-1$
/** /**
* The filename that failed somehow in an preprocessor include directive * The filename that failed somehow in an preprocessor include directive
*/ */
public final static String A_PREPROC_INCLUDE_FILENAME = "include file"; public final static String A_PREPROC_INCLUDE_FILENAME = ParserMessages.getString("IProblem.preproc.include"); //$NON-NLS-1$
/** /**
* A preprocessor macro name * A preprocessor macro name
*/ */
public final static String A_PREPROC_MACRO_NAME = "macro name"; public final static String A_PREPROC_MACRO_NAME = ParserMessages.getString("IProblem.preproc.macro"); //$NON-NLS-1$
/** /**
* A preprocessor conditional that could not be evaluated * A preprocessor conditional that could not be evaluated
@ -186,14 +188,14 @@ public interface IProblem
* #if X + Y == Z <== that one, if X, Y or Z are not defined * #if X + Y == Z <== that one, if X, Y or Z are not defined
* #endif * #endif
*/ */
public final static String A_PREPROC_CONDITION = "preprocessor condition"; public final static String A_PREPROC_CONDITION = ParserMessages.getString("IProblem.preproc.condition"); //$NON-NLS-1$
/** /**
* A preprocessor directive that could not be interpretted * A preprocessor directive that could not be interpretted
* *
* e.g. #blah * e.g. #blah
*/ */
public final static String A_PREPROC_UNKNOWN_DIRECTIVE = "bad preprocessor directive"; public final static String A_PREPROC_UNKNOWN_DIRECTIVE = ParserMessages.getString("IProblem.preproc.unknownDirective"); //$NON-NLS-1$
/** /**
* The preprocessor conditional statement that caused an unbalanced mismatch. * The preprocessor conditional statement that caused an unbalanced mismatch.
@ -203,7 +205,7 @@ public interface IProblem
* #else <=== that one * #else <=== that one
* #endif * #endif
*/ */
public final static String A_PREPROC_CONDITIONAL_MISMATCH = "conditional mismatch"; public final static String A_PREPROC_CONDITIONAL_MISMATCH = ParserMessages.getString("IProblem.preproc.conditionalMismatch"); //$NON-NLS-1$
/** /**
* The Bad character encountered in scanner * The Bad character encountered in scanner
@ -213,17 +215,17 @@ public interface IProblem
/** /**
* A_SYMBOL_NAME - symbol name * A_SYMBOL_NAME - symbol name
*/ */
public static final String A_SYMBOL_NAME = "symbol name"; public static final String A_SYMBOL_NAME = ParserMessages.getString("IProblem.symbolName"); //$NON-NLS-1$
/** /**
* A_NAMESPACE_NAME = namespace name * A_NAMESPACE_NAME = namespace name
*/ */
public static final String A_NAMESPACE_NAME = "namespace name"; public static final String A_NAMESPACE_NAME = ParserMessages.getString("IProblem.namespaceName"); //$NON-NLS-1$
/** /**
* A_TYPE_NAME - type name * A_TYPE_NAME - type name
*/ */
public static final String A_TYPE_NAME = "type name"; public static final String A_TYPE_NAME = ParserMessages.getString("IProblem.typeName"); //$NON-NLS-1$
/** /**
* Below are listed all available problem IDs. Note that this list could be augmented in the future, * Below are listed all available problem IDs. Note that this list could be augmented in the future,

View file

@ -124,92 +124,92 @@ public interface IASTExpression extends ISourceElementCallbackDelegate
static static
{ {
names = new Hashtable(); names = new Hashtable();
names.put( PRIMARY_EMPTY, "PRIMARY_EMPTY" ); names.put( PRIMARY_EMPTY, "PRIMARY_EMPTY" ); //$NON-NLS-1$
names.put( PRIMARY_INTEGER_LITERAL , "PRIMARY_INTEGER_LITERAL" ); names.put( PRIMARY_INTEGER_LITERAL , "PRIMARY_INTEGER_LITERAL" ); //$NON-NLS-1$
names.put( PRIMARY_CHAR_LITERAL , "PRIMARY_CHAR_LITERAL" ); names.put( PRIMARY_CHAR_LITERAL , "PRIMARY_CHAR_LITERAL" ); //$NON-NLS-1$
names.put( PRIMARY_FLOAT_LITERAL , "PRIMARY_FLOAT_LITERAL" ); names.put( PRIMARY_FLOAT_LITERAL , "PRIMARY_FLOAT_LITERAL" ); //$NON-NLS-1$
names.put( PRIMARY_STRING_LITERAL , "PRIMARY_STRING_LITERAL" ); names.put( PRIMARY_STRING_LITERAL , "PRIMARY_STRING_LITERAL" ); //$NON-NLS-1$
names.put( PRIMARY_BOOLEAN_LITERAL , "PRIMARY_BOOLEAN_LITERAL" ); names.put( PRIMARY_BOOLEAN_LITERAL , "PRIMARY_BOOLEAN_LITERAL" ); //$NON-NLS-1$
names.put( PRIMARY_THIS , "PRIMARY_THIS"); names.put( PRIMARY_THIS , "PRIMARY_THIS"); //$NON-NLS-1$
names.put( PRIMARY_BRACKETED_EXPRESSION , "PRIMARY_BRACKETED_EXPRESSION"); names.put( PRIMARY_BRACKETED_EXPRESSION , "PRIMARY_BRACKETED_EXPRESSION"); //$NON-NLS-1$
names.put( ID_EXPRESSION , "ID_EXPRESSION"); names.put( ID_EXPRESSION , "ID_EXPRESSION"); //$NON-NLS-1$
names.put( POSTFIX_SUBSCRIPT , "POSTFIX_SUBSCRIPT"); names.put( POSTFIX_SUBSCRIPT , "POSTFIX_SUBSCRIPT"); //$NON-NLS-1$
names.put( POSTFIX_FUNCTIONCALL , "POSTFIX_FUNCTIONCALL"); names.put( POSTFIX_FUNCTIONCALL , "POSTFIX_FUNCTIONCALL"); //$NON-NLS-1$
names.put( POSTFIX_SIMPLETYPE_INT , "POSTFIX_SIMPLETYPE_INT"); names.put( POSTFIX_SIMPLETYPE_INT , "POSTFIX_SIMPLETYPE_INT"); //$NON-NLS-1$
names.put( POSTFIX_SIMPLETYPE_SHORT , "POSTFIX_SIMPLETYPE_SHORT"); names.put( POSTFIX_SIMPLETYPE_SHORT , "POSTFIX_SIMPLETYPE_SHORT"); //$NON-NLS-1$
names.put( POSTFIX_SIMPLETYPE_DOUBLE , "POSTFIX_SIMPLETYPE_DOUBLE"); names.put( POSTFIX_SIMPLETYPE_DOUBLE , "POSTFIX_SIMPLETYPE_DOUBLE"); //$NON-NLS-1$
names.put( POSTFIX_SIMPLETYPE_FLOAT , "POSTFIX_SIMPLETYPE_FLOAT"); names.put( POSTFIX_SIMPLETYPE_FLOAT , "POSTFIX_SIMPLETYPE_FLOAT"); //$NON-NLS-1$
names.put( POSTFIX_SIMPLETYPE_CHAR , "POSTFIX_SIMPLETYPE_CHAR"); names.put( POSTFIX_SIMPLETYPE_CHAR , "POSTFIX_SIMPLETYPE_CHAR"); //$NON-NLS-1$
names.put( POSTFIX_SIMPLETYPE_WCHART , "POSTFIX_SIMPLETYPE_WCHART"); names.put( POSTFIX_SIMPLETYPE_WCHART , "POSTFIX_SIMPLETYPE_WCHART"); //$NON-NLS-1$
names.put( POSTFIX_SIMPLETYPE_SIGNED , "POSTFIX_SIMPLETYPE_SIGNED"); names.put( POSTFIX_SIMPLETYPE_SIGNED , "POSTFIX_SIMPLETYPE_SIGNED"); //$NON-NLS-1$
names.put( POSTFIX_SIMPLETYPE_UNSIGNED , "POSTFIX_SIMPLETYPE_UNSIGNED"); names.put( POSTFIX_SIMPLETYPE_UNSIGNED , "POSTFIX_SIMPLETYPE_UNSIGNED"); //$NON-NLS-1$
names.put( POSTFIX_SIMPLETYPE_BOOL , "POSTFIX_SIMPLETYPE_BOOL"); names.put( POSTFIX_SIMPLETYPE_BOOL , "POSTFIX_SIMPLETYPE_BOOL"); //$NON-NLS-1$
names.put( POSTFIX_SIMPLETYPE_LONG , "POSTFIX_SIMPLETYPE_LONG"); names.put( POSTFIX_SIMPLETYPE_LONG , "POSTFIX_SIMPLETYPE_LONG"); //$NON-NLS-1$
names.put( POSTFIX_TYPENAME_IDENTIFIER , "POSTFIX_TYPENAME_IDENTIFIER"); names.put( POSTFIX_TYPENAME_IDENTIFIER , "POSTFIX_TYPENAME_IDENTIFIER"); //$NON-NLS-1$
names.put( POSTFIX_TYPENAME_TEMPLATEID, "POSTFIX_TYPENAME_TEMPLATEID" ); names.put( POSTFIX_TYPENAME_TEMPLATEID, "POSTFIX_TYPENAME_TEMPLATEID" ); //$NON-NLS-1$
names.put( POSTFIX_DOT_IDEXPRESSION , "POSTFIX_DOT_IDEXPRESSION"); names.put( POSTFIX_DOT_IDEXPRESSION , "POSTFIX_DOT_IDEXPRESSION"); //$NON-NLS-1$
names.put( POSTFIX_ARROW_IDEXPRESSION , "POSTFIX_ARROW_IDEXPRESSION"); names.put( POSTFIX_ARROW_IDEXPRESSION , "POSTFIX_ARROW_IDEXPRESSION"); //$NON-NLS-1$
names.put( POSTFIX_DOT_TEMPL_IDEXPRESS , "POSTFIX_DOT_TEMPL_IDEXPRESS"); names.put( POSTFIX_DOT_TEMPL_IDEXPRESS , "POSTFIX_DOT_TEMPL_IDEXPRESS"); //$NON-NLS-1$
names.put( POSTFIX_ARROW_TEMPL_IDEXP , "POSTFIX_ARROW_TEMPL_IDEXP"); names.put( POSTFIX_ARROW_TEMPL_IDEXP , "POSTFIX_ARROW_TEMPL_IDEXP"); //$NON-NLS-1$
names.put( POSTFIX_DOT_DESTRUCTOR , "POSTFIX_DOT_DESTRUCTOR"); names.put( POSTFIX_DOT_DESTRUCTOR , "POSTFIX_DOT_DESTRUCTOR"); //$NON-NLS-1$
names.put( POSTFIX_ARROW_DESTRUCTOR , "POSTFIX_ARROW_DESTRUCTOR"); names.put( POSTFIX_ARROW_DESTRUCTOR , "POSTFIX_ARROW_DESTRUCTOR"); //$NON-NLS-1$
names.put( POSTFIX_INCREMENT , "POSTFIX_INCREMENT"); names.put( POSTFIX_INCREMENT , "POSTFIX_INCREMENT"); //$NON-NLS-1$
names.put( POSTFIX_DECREMENT , "POSTFIX_DECREMENT"); names.put( POSTFIX_DECREMENT , "POSTFIX_DECREMENT"); //$NON-NLS-1$
names.put( POSTFIX_DYNAMIC_CAST , "POSTFIX_DYNAMIC_CAST"); names.put( POSTFIX_DYNAMIC_CAST , "POSTFIX_DYNAMIC_CAST"); //$NON-NLS-1$
names.put( POSTFIX_REINTERPRET_CAST , "POSTFIX_REINTERPRET_CAST"); names.put( POSTFIX_REINTERPRET_CAST , "POSTFIX_REINTERPRET_CAST"); //$NON-NLS-1$
names.put( POSTFIX_STATIC_CAST , "POSTFIX_STATIC_CAST"); names.put( POSTFIX_STATIC_CAST , "POSTFIX_STATIC_CAST"); //$NON-NLS-1$
names.put( POSTFIX_CONST_CAST , "POSTFIX_CONST_CAST"); names.put( POSTFIX_CONST_CAST , "POSTFIX_CONST_CAST"); //$NON-NLS-1$
names.put( POSTFIX_TYPEID_EXPRESSION , "POSTFIX_TYPEID_EXPRESSION"); names.put( POSTFIX_TYPEID_EXPRESSION , "POSTFIX_TYPEID_EXPRESSION"); //$NON-NLS-1$
names.put( POSTFIX_TYPEID_TYPEID , "POSTFIX_TYPEID_TYPEID"); names.put( POSTFIX_TYPEID_TYPEID , "POSTFIX_TYPEID_TYPEID"); //$NON-NLS-1$
names.put( UNARY_INCREMENT , "UNARY_INCREMENT"); names.put( UNARY_INCREMENT , "UNARY_INCREMENT"); //$NON-NLS-1$
names.put( UNARY_DECREMENT , "UNARY_DECREMENT"); names.put( UNARY_DECREMENT , "UNARY_DECREMENT"); //$NON-NLS-1$
names.put( UNARY_STAR_CASTEXPRESSION , "UNARY_STAR_CASTEXPRESSION"); names.put( UNARY_STAR_CASTEXPRESSION , "UNARY_STAR_CASTEXPRESSION"); //$NON-NLS-1$
names.put( UNARY_AMPSND_CASTEXPRESSION , "UNARY_AMPSND_CASTEXPRESSION"); names.put( UNARY_AMPSND_CASTEXPRESSION , "UNARY_AMPSND_CASTEXPRESSION"); //$NON-NLS-1$
names.put( UNARY_PLUS_CASTEXPRESSION , "UNARY_PLUS_CASTEXPRESSION"); names.put( UNARY_PLUS_CASTEXPRESSION , "UNARY_PLUS_CASTEXPRESSION"); //$NON-NLS-1$
names.put( UNARY_MINUS_CASTEXPRESSION , "UNARY_MINUS_CASTEXPRESSION"); names.put( UNARY_MINUS_CASTEXPRESSION , "UNARY_MINUS_CASTEXPRESSION"); //$NON-NLS-1$
names.put( UNARY_NOT_CASTEXPRESSION , "UNARY_NOT_CASTEXPRESSION"); names.put( UNARY_NOT_CASTEXPRESSION , "UNARY_NOT_CASTEXPRESSION"); //$NON-NLS-1$
names.put( UNARY_TILDE_CASTEXPRESSION , "UNARY_TILDE_CASTEXPRESSION"); names.put( UNARY_TILDE_CASTEXPRESSION , "UNARY_TILDE_CASTEXPRESSION"); //$NON-NLS-1$
names.put( UNARY_SIZEOF_UNARYEXPRESSION , "UNARY_SIZEOF_UNARYEXPRESSION"); names.put( UNARY_SIZEOF_UNARYEXPRESSION , "UNARY_SIZEOF_UNARYEXPRESSION"); //$NON-NLS-1$
names.put( UNARY_SIZEOF_TYPEID , "UNARY_SIZEOF_TYPEID"); names.put( UNARY_SIZEOF_TYPEID , "UNARY_SIZEOF_TYPEID"); //$NON-NLS-1$
names.put( NEW_NEWTYPEID , "NEW_NEWTYPEID"); names.put( NEW_NEWTYPEID , "NEW_NEWTYPEID"); //$NON-NLS-1$
names.put( NEW_TYPEID , "NEW_TYPEID"); names.put( NEW_TYPEID , "NEW_TYPEID"); //$NON-NLS-1$
names.put( DELETE_CASTEXPRESSION , "DELETE_CASTEXPRESSION"); names.put( DELETE_CASTEXPRESSION , "DELETE_CASTEXPRESSION"); //$NON-NLS-1$
names.put( DELETE_VECTORCASTEXPRESSION , "DELETE_VECTORCASTEXPRESSION"); names.put( DELETE_VECTORCASTEXPRESSION , "DELETE_VECTORCASTEXPRESSION"); //$NON-NLS-1$
names.put( CASTEXPRESSION , "CASTEXPRESSION"); names.put( CASTEXPRESSION , "CASTEXPRESSION"); //$NON-NLS-1$
names.put( PM_DOTSTAR , "PM_DOTSTAR"); names.put( PM_DOTSTAR , "PM_DOTSTAR"); //$NON-NLS-1$
names.put( PM_ARROWSTAR , "PM_ARROWSTAR"); names.put( PM_ARROWSTAR , "PM_ARROWSTAR"); //$NON-NLS-1$
names.put( MULTIPLICATIVE_MULTIPLY , "MULTIPLICATIVE_MULTIPLY"); names.put( MULTIPLICATIVE_MULTIPLY , "MULTIPLICATIVE_MULTIPLY"); //$NON-NLS-1$
names.put( MULTIPLICATIVE_DIVIDE , "MULTIPLICATIVE_DIVIDE"); names.put( MULTIPLICATIVE_DIVIDE , "MULTIPLICATIVE_DIVIDE"); //$NON-NLS-1$
names.put( MULTIPLICATIVE_MODULUS , "MULTIPLICATIVE_MODULUS"); names.put( MULTIPLICATIVE_MODULUS , "MULTIPLICATIVE_MODULUS"); //$NON-NLS-1$
names.put( ADDITIVE_PLUS , "ADDITIVE_PLUS"); names.put( ADDITIVE_PLUS , "ADDITIVE_PLUS"); //$NON-NLS-1$
names.put( ADDITIVE_MINUS , "ADDITIVE_MINUS"); names.put( ADDITIVE_MINUS , "ADDITIVE_MINUS"); //$NON-NLS-1$
names.put( SHIFT_LEFT , "SHIFT_LEFT"); names.put( SHIFT_LEFT , "SHIFT_LEFT"); //$NON-NLS-1$
names.put( SHIFT_RIGHT , "SHIFT_RIGHT"); names.put( SHIFT_RIGHT , "SHIFT_RIGHT"); //$NON-NLS-1$
names.put( RELATIONAL_LESSTHAN , "RELATIONAL_LESSTHAN"); names.put( RELATIONAL_LESSTHAN , "RELATIONAL_LESSTHAN"); //$NON-NLS-1$
names.put( RELATIONAL_GREATERTHAN , "RELATIONAL_GREATERTHAN"); names.put( RELATIONAL_GREATERTHAN , "RELATIONAL_GREATERTHAN"); //$NON-NLS-1$
names.put( RELATIONAL_LESSTHANEQUALTO , "RELATIONAL_LESSTHANEQUALTO"); names.put( RELATIONAL_LESSTHANEQUALTO , "RELATIONAL_LESSTHANEQUALTO"); //$NON-NLS-1$
names.put( RELATIONAL_GREATERTHANEQUALTO, "RELATIONAL_GREATERTHANEQUALTO" ); names.put( RELATIONAL_GREATERTHANEQUALTO, "RELATIONAL_GREATERTHANEQUALTO" ); //$NON-NLS-1$
names.put( EQUALITY_EQUALS , "EQUALITY_EQUALS"); names.put( EQUALITY_EQUALS , "EQUALITY_EQUALS"); //$NON-NLS-1$
names.put( EQUALITY_NOTEQUALS , "EQUALITY_NOTEQUALS"); names.put( EQUALITY_NOTEQUALS , "EQUALITY_NOTEQUALS"); //$NON-NLS-1$
names.put( ANDEXPRESSION , "ANDEXPRESSION"); names.put( ANDEXPRESSION , "ANDEXPRESSION"); //$NON-NLS-1$
names.put( EXCLUSIVEOREXPRESSION , "EXCLUSIVEOREXPRESSION"); names.put( EXCLUSIVEOREXPRESSION , "EXCLUSIVEOREXPRESSION"); //$NON-NLS-1$
names.put( INCLUSIVEOREXPRESSION , "INCLUSIVEOREXPRESSION"); names.put( INCLUSIVEOREXPRESSION , "INCLUSIVEOREXPRESSION"); //$NON-NLS-1$
names.put( LOGICALANDEXPRESSION , "LOGICALANDEXPRESSION"); names.put( LOGICALANDEXPRESSION , "LOGICALANDEXPRESSION"); //$NON-NLS-1$
names.put( LOGICALOREXPRESSION , "LOGICALOREXPRESSION"); names.put( LOGICALOREXPRESSION , "LOGICALOREXPRESSION"); //$NON-NLS-1$
names.put( CONDITIONALEXPRESSION , "CONDITIONALEXPRESSION"); names.put( CONDITIONALEXPRESSION , "CONDITIONALEXPRESSION"); //$NON-NLS-1$
names.put( THROWEXPRESSION , "THROWEXPRESSION"); names.put( THROWEXPRESSION , "THROWEXPRESSION"); //$NON-NLS-1$
names.put( ASSIGNMENTEXPRESSION_NORMAL , "ASSIGNMENTEXPRESSION_NORMAL"); names.put( ASSIGNMENTEXPRESSION_NORMAL , "ASSIGNMENTEXPRESSION_NORMAL"); //$NON-NLS-1$
names.put( ASSIGNMENTEXPRESSION_PLUS , "ASSIGNMENTEXPRESSION_PLUS"); names.put( ASSIGNMENTEXPRESSION_PLUS , "ASSIGNMENTEXPRESSION_PLUS"); //$NON-NLS-1$
names.put( ASSIGNMENTEXPRESSION_MINUS , "ASSIGNMENTEXPRESSION_MINUS"); names.put( ASSIGNMENTEXPRESSION_MINUS , "ASSIGNMENTEXPRESSION_MINUS"); //$NON-NLS-1$
names.put( ASSIGNMENTEXPRESSION_MULT , "ASSIGNMENTEXPRESSION_MULT"); names.put( ASSIGNMENTEXPRESSION_MULT , "ASSIGNMENTEXPRESSION_MULT"); //$NON-NLS-1$
names.put( ASSIGNMENTEXPRESSION_DIV , "ASSIGNMENTEXPRESSION_DIV"); names.put( ASSIGNMENTEXPRESSION_DIV , "ASSIGNMENTEXPRESSION_DIV"); //$NON-NLS-1$
names.put( ASSIGNMENTEXPRESSION_MOD , "ASSIGNMENTEXPRESSION_MOD"); names.put( ASSIGNMENTEXPRESSION_MOD , "ASSIGNMENTEXPRESSION_MOD"); //$NON-NLS-1$
names.put( ASSIGNMENTEXPRESSION_LSHIFT , "ASSIGNMENTEXPRESSION_LSHIFT"); names.put( ASSIGNMENTEXPRESSION_LSHIFT , "ASSIGNMENTEXPRESSION_LSHIFT"); //$NON-NLS-1$
names.put( ASSIGNMENTEXPRESSION_RSHIFT , "ASSIGNMENTEXPRESSION_RSHIFT"); names.put( ASSIGNMENTEXPRESSION_RSHIFT , "ASSIGNMENTEXPRESSION_RSHIFT"); //$NON-NLS-1$
names.put( ASSIGNMENTEXPRESSION_AND , "ASSIGNMENTEXPRESSION_AND"); names.put( ASSIGNMENTEXPRESSION_AND , "ASSIGNMENTEXPRESSION_AND"); //$NON-NLS-1$
names.put( ASSIGNMENTEXPRESSION_OR , "ASSIGNMENTEXPRESSION_OR"); names.put( ASSIGNMENTEXPRESSION_OR , "ASSIGNMENTEXPRESSION_OR"); //$NON-NLS-1$
names.put( ASSIGNMENTEXPRESSION_XOR , "ASSIGNMENTEXPRESSION_XOR"); names.put( ASSIGNMENTEXPRESSION_XOR , "ASSIGNMENTEXPRESSION_XOR"); //$NON-NLS-1$
names.put( EXPRESSIONLIST , "EXPRESSIONLIST"); names.put( EXPRESSIONLIST , "EXPRESSIONLIST"); //$NON-NLS-1$
} }
/** /**

View file

@ -0,0 +1,78 @@
/**********************************************************************
* Copyright (c) 2004 Rational Software Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v0.5
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v05.html
*
* Contributors:
* IBM Rational Software - Initial API and implementation
***********************************************************************/
package org.eclipse.cdt.internal.core.parser;
import java.text.MessageFormat;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
/**
* @author aniefer
*
* To change the template for this generated type comment go to
* Window - Preferences - Java - Code Generation - Code and Comments
*/
public class ParserMessages {
private static final String BUNDLE_NAME = "org.eclipse.cdt.internal.core.parser.ParserMessages";//$NON-NLS-1$
private static ResourceBundle resourceBundle;
static {
try {
resourceBundle = ResourceBundle.getBundle( BUNDLE_NAME );
} catch (MissingResourceException x) {
resourceBundle = null;
}
}
/**
*
*/
private ParserMessages() {
}
/**
* @param key
* @return
*/
public static String getString(String key) {
if( resourceBundle == null ){
return '#' + key +'#';
} else {
try {
return resourceBundle.getString(key);
} catch (MissingResourceException e) {
return '!' + key + '!';
}
}
}
/**
* Gets a string from the resource bundle and formats it with the argument
*
* @param key the string used to get the bundle value, must not be null
*/
public static String getFormattedString(String key, Object[] args) {
String format = getString( key );
return MessageFormat.format(format, args);
}
/**
* Gets a string from the resource bundle and formats it with the argument
*
* @param key the string used to get the bundle value, must not be null
*/
public static String getFormattedString(String key, Object arg) {
String format = getString( key );
if (arg == null)
arg = ""; //$NON-NLS-1$
return MessageFormat.format(format, new Object[] { arg });
}
}

View file

@ -0,0 +1,50 @@
###########################################################################
# Copyright (c) 2004 IBM - Rational Software and others.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Common Public License v0.5
# which accompanies this distribution, and is available at
# http://www.eclipse.org/legal/cpl-v05.html
#
# Contributors:
# IBM Rational Software - Initial API and implementation
#############################################################################
IProblem.unknownFileName=<unknown>
IProblem.preproc.poundError=#error text
IProblem.preproc.include=include file
IProblem.preproc.macro=macro name
IProblem.preproc.condition=preprocessor condition
IProblem.preproc.unknownDirective=bad preprocessor directive
IProblem.preproc.conditionalMismatch=conditional mismatch
IProblem.symbolName=symbol name
IProblem.namespaceName=namespace name
IProblem.typeName=type name
QuickParseCallback.exception.constIterator=OffsetableIterator is a const iterator
ScannerProblemFactory.error.preproc.error=#error encountered with text: {0}
ScannerProblemFactory.error.preproc.inclusionNotFound=Preprocessor Inclusion not found: {0}
ScannerProblemFactory.error.preproc.definitionNotFound=Macro definition not found: {0}
ScannerProblemFactory.error.preproc.invalidMacroDefn=Macro definition malformed for macro: {0}
ScannerProblemFactory.error.preproc.invalidMacroRedefn=Invalid macro redefinition for macro : {0}
ScannerProblemFactory.error.preproc.unbalancedConditional=Preprocessor Conditionals unbalanced : {0}
ScannerProblemFactory.error.preproc.conditionalEval=Expression Evaluation error for condition : {0}
ScannerProblemFactory.error.preproc.macroUsage=Macro usage error for macro : {0}
ScannerProblemFactory.error.preproc.circularInclusion=Circular inclusion for file : {0}
ScannerProblemFactory.error.preproc.invalidDirective=Invalid preprocessor directive : {0}
ScannerProblemFactory.error.preproc.macroPasting=Invalid use of macro pasting in macro : {0}
ScannerProblemFactory.error.scanner.invalidEscapeChar=Invalid escape character encountered
ScannerProblemFactory.error.scanner.unboundedString=Unbounded string encountered
ScannerProblemFactory.error.scanner.badFloatingPoint=Invalid floating point format encountered
ScannerProblemFactory.error.scanner.badHexFormat=Invalid hexidecimal format encountered
ScannerProblemFactory.error.scanner.unexpectedEOF=Unexpected End Of File encountered
ScannerProblemFactory.error.scanner.badCharacter=Bad character sequence encountered : {0}
ASTProblemFactory.error.semantic.uniqueNamePredefined=Attempt to introduce unique symbol failed : {0}
ASTProblemFactory.error.semantic.nameNotFound=Attempt to use symbol failed : {0}
ASTProblemFactory.error.semantic.nameNotProvided=Name not provided.
LineOffsetReconciler.error.couldNotResetReader=Could not reset Reader
BaseProblemFactory.problemPattern=IProblem : {0} in file: {1} on line: {2, number, integer}.

View file

@ -186,7 +186,7 @@ public class QuickParseCallback extends NullSourceElementRequestor implements IQ
* @see java.util.Iterator#remove() * @see java.util.Iterator#remove()
*/ */
public void remove() { public void remove() {
throw new UnsupportedOperationException( "OffsetableIterator is a const iterator"); throw new UnsupportedOperationException( ParserMessages.getString("QuickParseCallback.exception.constIterator")); //$NON-NLS-1$
} }
} }

View file

@ -10,10 +10,12 @@
******************************************************************************/ ******************************************************************************/
package org.eclipse.cdt.internal.core.parser.ast.complete; package org.eclipse.cdt.internal.core.parser.ast.complete;
import java.text.MessageFormat;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import org.eclipse.cdt.core.parser.IProblem; import org.eclipse.cdt.core.parser.IProblem;
import org.eclipse.cdt.internal.core.parser.ParserMessages;
import org.eclipse.cdt.internal.core.parser.problem.BaseProblemFactory; import org.eclipse.cdt.internal.core.parser.problem.BaseProblemFactory;
import org.eclipse.cdt.internal.core.parser.problem.IProblemFactory; import org.eclipse.cdt.internal.core.parser.problem.IProblemFactory;
@ -29,26 +31,24 @@ public class ASTProblemFactory extends BaseProblemFactory implements IProblemFac
protected static final Map errorMessages; protected static final Map errorMessages;
static { static {
errorMessages = new HashMap(); errorMessages = new HashMap();
errorMessages.put( new Integer( IProblem.SEMANTIC_UNIQUE_NAME_PREDEFINED),"Attempt to introduce unique symbol failed : "); errorMessages.put( new Integer( IProblem.SEMANTIC_UNIQUE_NAME_PREDEFINED),ParserMessages.getString("ASTProblemFactory.error.semantic.uniqueNamePredefined")); //$NON-NLS-1$
errorMessages.put( new Integer( IProblem.SEMANTIC_NAME_NOT_FOUND), "Attempt to use symbol failed : "); errorMessages.put( new Integer( IProblem.SEMANTIC_NAME_NOT_FOUND), ParserMessages.getString("ASTProblemFactory.error.semantic.nameNotFound")); //$NON-NLS-1$
errorMessages.put( new Integer( IProblem.SEMANTIC_NAME_NOT_PROVIDED), "Name not provided."); errorMessages.put( new Integer( IProblem.SEMANTIC_NAME_NOT_PROVIDED), ParserMessages.getString("ASTProblemFactory.error.semantic.nameNotProvided")); //$NON-NLS-1$
} }
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.parser.problem.BaseProblemFactory#createMessage(int, java.util.Map, int, char[]) * @see org.eclipse.cdt.internal.core.parser.problem.BaseProblemFactory#createMessage(int, java.util.Map, int, char[])
*/ */
public String createMessage(int id, Map arguments, int lineNumber, public String createMessage(int id, Map arguments, int lineNumber, char[] fileName) {
char[] fileName) { String message = (String) errorMessages.get( new Integer(id) );
StringBuffer buffer = new StringBuffer(); String arg = null;
buffer.append(PROBLEM);
buffer.append(errorMessages.get(new Integer(id)));
switch (id) switch (id)
{ {
case IProblem.SEMANTIC_UNIQUE_NAME_PREDEFINED: case IProblem.SEMANTIC_UNIQUE_NAME_PREDEFINED:
case IProblem.SEMANTIC_NAME_NOT_FOUND: case IProblem.SEMANTIC_NAME_NOT_FOUND:
buffer.append(arguments.get(IProblem.A_SYMBOL_NAME)); arg = (String) arguments.get((IProblem.A_SYMBOL_NAME));
break; break;
case IProblem.SEMANTIC_NAME_NOT_PROVIDED: case IProblem.SEMANTIC_NAME_NOT_PROVIDED:
break; break;
@ -56,18 +56,12 @@ public class ASTProblemFactory extends BaseProblemFactory implements IProblemFac
return null; return null;
} }
if( fileName != null ) if( arg != null ){
{ message = MessageFormat.format( message, new Object [] { arg } );
buffer.append( IN_FILE );
buffer.append(fileName);
} }
if( lineNumber > 0 ) Object [] args = { message, new String( fileName ), new Integer( lineNumber ) };
{ return ParserMessages.getFormattedString( PROBLEM_PATTERN, args );
buffer.append( ON_LINE );
buffer.append(lineNumber);
}
return buffer.toString();
} }
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.parser.problem.IProblemFactory#createProblem(int, int, int, int, char[], java.util.Map, boolean, boolean) * @see org.eclipse.cdt.internal.core.parser.problem.IProblemFactory#createProblem(int, int, int, int, char[], java.util.Map, boolean, boolean)

View file

@ -633,7 +633,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
IProblem p = problemFactory.createProblem( id, IProblem p = problemFactory.createProblem( id,
startOffset, endOffset, lineNumber, fileProvider.getCurrentFilename(), arguments, false, true ); startOffset, endOffset, lineNumber, fileProvider.getCurrentFilename(), arguments, false, true );
StringBuffer logMessage = new StringBuffer( "CompleteParseASTFactory - IProblem : "); StringBuffer logMessage = new StringBuffer( "CompleteParseASTFactory - IProblem : "); //$NON-NLS-1$
logMessage.append( p.getMessage() ); logMessage.append( p.getMessage() );
logService.traceLog( logMessage.toString() ); logService.traceLog( logMessage.toString() );
throw new ASTSemanticException(p); throw new ASTSemanticException(p);
@ -817,16 +817,16 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
ITokenDuple idExpression, String literal, IASTNewExpressionDescriptor newDescriptor) throws ASTSemanticException ITokenDuple idExpression, String literal, IASTNewExpressionDescriptor newDescriptor) throws ASTSemanticException
{ {
StringBuffer logMessage = new StringBuffer(); StringBuffer logMessage = new StringBuffer();
logMessage.append( "Entering createExpression with Kind=" ); logMessage.append( "Entering createExpression with Kind=" ); //$NON-NLS-1$
logMessage.append( kind.getKindName() ); logMessage.append( kind.getKindName() );
if( idExpression != null ) if( idExpression != null )
{ {
logMessage.append( " idexpression=" ); logMessage.append( " idexpression=" ); //$NON-NLS-1$
logMessage.append( "idExpression.toString()"); logMessage.append( "idExpression.toString()"); //$NON-NLS-1$
} }
else if( literal != null && !literal.equals( "" )) else if( literal != null && !literal.equals( "" )) //$NON-NLS-1$
{ {
logMessage.append( " literal=" ); logMessage.append( " literal=" ); //$NON-NLS-1$
logMessage.append( literal ); logMessage.append( literal );
} }
@ -878,7 +878,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
try{ try{
symbol = startingScope.lookup("this"); //$NON-NLS-1$ symbol = startingScope.lookup("this"); //$NON-NLS-1$
}catch (ParserSymbolTableException e){ }catch (ParserSymbolTableException e){
handleProblem( e.createProblemID(), "this"); handleProblem( e.createProblemID(), "this"); //$NON-NLS-1$
} }
} }
// lookup symbol if it is a function call // lookup symbol if it is a function call

View file

@ -20,9 +20,7 @@ import org.eclipse.cdt.core.parser.IProblem;
*/ */
public abstract class BaseProblemFactory { public abstract class BaseProblemFactory {
protected final static String PROBLEM = "IProblem : "; protected final static String PROBLEM_PATTERN = "BaseProblemFactory.problemPattern"; //$NON-NLS-1$
protected final static String IN_FILE = " in file: ";
protected final static String ON_LINE = " on line: ";
public abstract String createMessage(int id, Map arguments, int lineNumber, char[] fileName ); public abstract String createMessage(int id, Map arguments, int lineNumber, char[] fileName );

View file

@ -74,23 +74,23 @@ public class FunctionMacroDescriptor implements IMacroDescriptor {
StringBuffer buffer = new StringBuffer( 128 ); StringBuffer buffer = new StringBuffer( 128 );
int count = getParameters().size(); int count = getParameters().size();
buffer.append( "MacroDescriptor with name=" + getName() + "\n" ); //$NON-NLS-2$ buffer.append( "MacroDescriptor with name=" + getName() + "\n" ); //$NON-NLS-1$//$NON-NLS-2$
buffer.append( "Number of parameters = " + count + "\n" ); //$NON-NLS-2$ buffer.append( "Number of parameters = " + count + "\n" ); //$NON-NLS-1$//$NON-NLS-2$
Iterator iter = getParameters().iterator(); Iterator iter = getParameters().iterator();
int current = 0; int current = 0;
while( iter.hasNext() ) while( iter.hasNext() )
{ {
buffer.append( "Parameter #" + current++ + " with name=" + (String) iter.next() + "\n" ); //$NON-NLS-3$ buffer.append( "Parameter #" + current++ + " with name=" + (String) iter.next() + "\n" ); //$NON-NLS-1$ //$NON-NLS-2$//$NON-NLS-3$
} }
count = getTokenizedExpansion().size(); count = getTokenizedExpansion().size();
iter = getTokenizedExpansion().iterator(); iter = getTokenizedExpansion().iterator();
buffer.append( "Number of tokens = " + count + "\n" ); //$NON-NLS-2$ buffer.append( "Number of tokens = " + count + "\n" ); //$NON-NLS-1$//$NON-NLS-2$
current = 0; current = 0;
while( iter.hasNext() ) while( iter.hasNext() )
{ {
buffer.append( "Token #" + current++ + " is " + ((IToken)iter.next()).toString() + "\n" ); //$NON-NLS-3$ buffer.append( "Token #" + current++ + " is " + ((IToken)iter.next()).toString() + "\n" ); //$NON-NLS-1$ //$NON-NLS-2$//$NON-NLS-3$
} }
return buffer.toString(); return buffer.toString();

View file

@ -15,6 +15,7 @@ import java.io.Reader;
import org.eclipse.cdt.core.parser.ILineOffsetReconciler; import org.eclipse.cdt.core.parser.ILineOffsetReconciler;
import org.eclipse.cdt.core.parser.IOffsetDuple; import org.eclipse.cdt.core.parser.IOffsetDuple;
import org.eclipse.cdt.internal.core.parser.ParserMessages;
import org.eclipse.cdt.internal.core.parser.token.OffsetDuple; import org.eclipse.cdt.internal.core.parser.token.OffsetDuple;
/** /**
@ -75,7 +76,7 @@ public class LineOffsetReconciler implements ILineOffsetReconciler
} }
catch (IOException e) catch (IOException e)
{ {
throw new Error( "Could not reset Reader" ); throw new Error( ParserMessages.getString("LineOffsetReconciler.error.couldNotResetReader") ); //$NON-NLS-1$
} }
} }
/* (non-Javadoc) /* (non-Javadoc)

View file

@ -27,8 +27,7 @@ import java.util.Map;
import java.util.StringTokenizer; import java.util.StringTokenizer;
import java.util.Vector; import java.util.Vector;
import org.eclipse.cdt.core.parser.BacktrackException; import org.eclipse.cdt.core.parser.BacktrackException;import org.eclipse.cdt.core.parser.Directives;
import org.eclipse.cdt.core.parser.Directives;
import org.eclipse.cdt.core.parser.EndOfFileException; import org.eclipse.cdt.core.parser.EndOfFileException;
import org.eclipse.cdt.core.parser.IMacroDescriptor; import org.eclipse.cdt.core.parser.IMacroDescriptor;
import org.eclipse.cdt.core.parser.IParserLogService; import org.eclipse.cdt.core.parser.IParserLogService;
@ -67,7 +66,7 @@ import org.eclipse.cdt.internal.core.parser.token.Token;
public class Scanner implements IScanner { public class Scanner implements IScanner {
private final static String SCRATCH = "<scratch>"; private final static String SCRATCH = "<scratch>"; //$NON-NLS-1$
protected final IScannerData scannerData; protected final IScannerData scannerData;
private boolean initialContextInitialized = false; private boolean initialContextInitialized = false;
@ -95,7 +94,7 @@ public class Scanner implements IScanner {
IProblem problem = scannerData.getProblemFactory().createProblem( problemID, beginningOffset, getCurrentOffset(), scannerData.getContextStack().getCurrentLineNumber(), getCurrentFile().toCharArray(), arguments, warning, error ); IProblem problem = scannerData.getProblemFactory().createProblem( problemID, beginningOffset, getCurrentOffset(), scannerData.getContextStack().getCurrentLineNumber(), getCurrentFile().toCharArray(), arguments, warning, error );
// trace log // trace log
StringBuffer logMessage = new StringBuffer( "Scanner problem encountered: "); StringBuffer logMessage = new StringBuffer( "Scanner problem encountered: "); //$NON-NLS-1$
logMessage.append( problem.getMessage() ); logMessage.append( problem.getMessage() );
scannerData.getLogService().traceLog( logMessage.toString() ); scannerData.getLogService().traceLog( logMessage.toString() );
@ -175,18 +174,18 @@ public class Scanner implements IScanner {
scannerExtension.setupBuiltInMacros(scannerData.getLanguage()); scannerExtension.setupBuiltInMacros(scannerData.getLanguage());
if( getDefinition(__STDC__) == null ) if( getDefinition(__STDC__) == null )
addDefinition( __STDC__, new ObjectMacroDescriptor( __STDC__, "1") ); addDefinition( __STDC__, new ObjectMacroDescriptor( __STDC__, "1") ); //$NON-NLS-1$
if( scannerData.getLanguage() == ParserLanguage.C ) if( scannerData.getLanguage() == ParserLanguage.C )
{ {
if( getDefinition(__STDC_HOSTED__) == null ) if( getDefinition(__STDC_HOSTED__) == null )
addDefinition( __STDC_HOSTED__, new ObjectMacroDescriptor( __STDC_HOSTED__, "0")); addDefinition( __STDC_HOSTED__, new ObjectMacroDescriptor( __STDC_HOSTED__, "0")); //$NON-NLS-1$
if( getDefinition( __STDC_VERSION__) == null ) if( getDefinition( __STDC_VERSION__) == null )
addDefinition( __STDC_VERSION__, new ObjectMacroDescriptor( __STDC_VERSION__, "199001L")); addDefinition( __STDC_VERSION__, new ObjectMacroDescriptor( __STDC_VERSION__, "199001L")); //$NON-NLS-1$
} }
else else
if( getDefinition( __CPLUSPLUS ) == null ) if( getDefinition( __CPLUSPLUS ) == null )
addDefinition( __CPLUSPLUS, new ObjectMacroDescriptor( __CPLUSPLUS, "199711L")); addDefinition( __CPLUSPLUS, new ObjectMacroDescriptor( __CPLUSPLUS, "199711L")); //$NON-NLS-1$
if( getDefinition(__FILE__) == null ) if( getDefinition(__FILE__) == null )
addDefinition( __FILE__, addDefinition( __FILE__,
@ -211,29 +210,29 @@ public class Scanner implements IScanner {
public String getMonth() public String getMonth()
{ {
if( Calendar.MONTH == Calendar.JANUARY ) return "Jan" ; if( Calendar.MONTH == Calendar.JANUARY ) return "Jan" ; //$NON-NLS-1$
if( Calendar.MONTH == Calendar.FEBRUARY) return "Feb"; if( Calendar.MONTH == Calendar.FEBRUARY) return "Feb"; //$NON-NLS-1$
if( Calendar.MONTH == Calendar.MARCH) return "Mar"; if( Calendar.MONTH == Calendar.MARCH) return "Mar"; //$NON-NLS-1$
if( Calendar.MONTH == Calendar.APRIL) return "Apr"; if( Calendar.MONTH == Calendar.APRIL) return "Apr"; //$NON-NLS-1$
if( Calendar.MONTH == Calendar.MAY) return "May"; if( Calendar.MONTH == Calendar.MAY) return "May"; //$NON-NLS-1$
if( Calendar.MONTH == Calendar.JUNE) return "Jun"; if( Calendar.MONTH == Calendar.JUNE) return "Jun"; //$NON-NLS-1$
if( Calendar.MONTH == Calendar.JULY) return "Jul"; if( Calendar.MONTH == Calendar.JULY) return "Jul"; //$NON-NLS-1$
if( Calendar.MONTH == Calendar.AUGUST) return "Aug"; if( Calendar.MONTH == Calendar.AUGUST) return "Aug"; //$NON-NLS-1$
if( Calendar.MONTH == Calendar.SEPTEMBER) return "Sep"; if( Calendar.MONTH == Calendar.SEPTEMBER) return "Sep"; //$NON-NLS-1$
if( Calendar.MONTH == Calendar.OCTOBER) return "Oct"; if( Calendar.MONTH == Calendar.OCTOBER) return "Oct"; //$NON-NLS-1$
if( Calendar.MONTH == Calendar.NOVEMBER) return "Nov"; if( Calendar.MONTH == Calendar.NOVEMBER) return "Nov"; //$NON-NLS-1$
if( Calendar.MONTH == Calendar.DECEMBER) return "Dec"; if( Calendar.MONTH == Calendar.DECEMBER) return "Dec"; //$NON-NLS-1$
return ""; return ""; //$NON-NLS-1$
} }
public String execute() { public String execute() {
StringBuffer result = new StringBuffer(); StringBuffer result = new StringBuffer();
result.append( getMonth() ); result.append( getMonth() );
result.append(" "); result.append(" "); //$NON-NLS-1$
if( Calendar.DAY_OF_MONTH < 10 ) if( Calendar.DAY_OF_MONTH < 10 )
result.append(" "); result.append(" "); //$NON-NLS-1$
result.append(Calendar.DAY_OF_MONTH); result.append(Calendar.DAY_OF_MONTH);
result.append(" "); result.append(" "); //$NON-NLS-1$
result.append( Calendar.YEAR ); result.append( Calendar.YEAR );
return result.toString(); return result.toString();
} }
@ -593,14 +592,14 @@ public class Scanner implements IScanner {
// constants // constants
private static final int NOCHAR = -1; private static final int NOCHAR = -1;
private static final String TEXT = "<text>"; private static final String TEXT = "<text>"; //$NON-NLS-1$
private static final String START = "<initial reader>"; private static final String START = "<initial reader>"; //$NON-NLS-1$
private static final String EXPRESSION = "<expression>"; private static final String EXPRESSION = "<expression>"; //$NON-NLS-1$
private static final String PASTING = "<pasting>"; private static final String PASTING = "<pasting>"; //$NON-NLS-1$
private static final String DEFINED = "defined"; private static final String DEFINED = "defined"; //$NON-NLS-1$
private static final String _PRAGMA = "_Pragma"; private static final String _PRAGMA = "_Pragma"; //$NON-NLS-1$
private static final String POUND_DEFINE = "#define "; private static final String POUND_DEFINE = "#define "; //$NON-NLS-1$
private IScannerContext lastContext = null; private IScannerContext lastContext = null;
@ -668,39 +667,39 @@ public class Scanner implements IScanner {
c = getChar(insideString); c = getChar(insideString);
switch (c) { switch (c) {
case '(': case '(':
expandDefinition("??(", "[", baseOffset); expandDefinition("??(", "[", baseOffset); //$NON-NLS-1$ //$NON-NLS-2$
c = getChar(insideString); c = getChar(insideString);
break; break;
case ')': case ')':
expandDefinition("??)", "]", baseOffset); expandDefinition("??)", "]", baseOffset); //$NON-NLS-1$ //$NON-NLS-2$
c = getChar(insideString); c = getChar(insideString);
break; break;
case '<': case '<':
expandDefinition("??<", "{", baseOffset); expandDefinition("??<", "{", baseOffset); //$NON-NLS-1$ //$NON-NLS-2$
c = getChar(insideString); c = getChar(insideString);
break; break;
case '>': case '>':
expandDefinition("??>", "}", baseOffset); expandDefinition("??>", "}", baseOffset); //$NON-NLS-1$ //$NON-NLS-2$
c = getChar(insideString); c = getChar(insideString);
break; break;
case '=': case '=':
expandDefinition("??=", "#", baseOffset); expandDefinition("??=", "#", baseOffset); //$NON-NLS-1$ //$NON-NLS-2$
c = getChar(insideString); c = getChar(insideString);
break; break;
case '/': case '/':
expandDefinition("??/", "\\", baseOffset); expandDefinition("??/", "\\", baseOffset); //$NON-NLS-1$ //$NON-NLS-2$
c = getChar(insideString); c = getChar(insideString);
break; break;
case '\'': case '\'':
expandDefinition("??\'", "^", baseOffset); expandDefinition("??\'", "^", baseOffset); //$NON-NLS-1$ //$NON-NLS-2$
c = getChar(insideString); c = getChar(insideString);
break; break;
case '!': case '!':
expandDefinition("??!", "|", baseOffset); expandDefinition("??!", "|", baseOffset); //$NON-NLS-1$ //$NON-NLS-2$
c = getChar(insideString); c = getChar(insideString);
break; break;
case '-': case '-':
expandDefinition("??-", "~", baseOffset); expandDefinition("??-", "~", baseOffset); //$NON-NLS-1$ //$NON-NLS-2$
c = getChar(insideString); c = getChar(insideString);
break; break;
default: default:
@ -743,10 +742,10 @@ public class Scanner implements IScanner {
if (c == '<') { if (c == '<') {
c = getChar(false); c = getChar(false);
if (c == '%') { if (c == '%') {
expandDefinition("<%", "{", baseOffset); expandDefinition("<%", "{", baseOffset); //$NON-NLS-1$ //$NON-NLS-2$
c = getChar(false); c = getChar(false);
} else if (c == ':') { } else if (c == ':') {
expandDefinition("<:", "[", baseOffset); expandDefinition("<:", "[", baseOffset); //$NON-NLS-1$ //$NON-NLS-2$
c = getChar(false); c = getChar(false);
} else { } else {
// Not a digraph // Not a digraph
@ -756,7 +755,7 @@ public class Scanner implements IScanner {
} else if (c == ':') { } else if (c == ':') {
c = getChar(false); c = getChar(false);
if (c == '>') { if (c == '>') {
expandDefinition(":>", "]", baseOffset); expandDefinition(":>", "]", baseOffset); //$NON-NLS-1$ //$NON-NLS-2$
c = getChar(false); c = getChar(false);
} else { } else {
// Not a digraph // Not a digraph
@ -766,10 +765,10 @@ public class Scanner implements IScanner {
} else if (c == '%') { } else if (c == '%') {
c = getChar(false); c = getChar(false);
if (c == '>') { if (c == '>') {
expandDefinition("%>", "}", baseOffset); expandDefinition("%>", "}", baseOffset); //$NON-NLS-1$ //$NON-NLS-2$
c = getChar(false); c = getChar(false);
} else if (c == ':') { } else if (c == ':') {
expandDefinition("%:", "#", baseOffset); expandDefinition("%:", "#", baseOffset); //$NON-NLS-1$ //$NON-NLS-2$
c = getChar(false); c = getChar(false);
} else { } else {
// Not a digraph // Not a digraph
@ -1115,17 +1114,17 @@ public class Scanner implements IScanner {
if( ! firstCharZero && floatingPoint && !(c >= '0' && c <= '9') ){ if( ! firstCharZero && floatingPoint && !(c >= '0' && c <= '9') ){
//if pasting, there could actually be a float here instead of just a . //if pasting, there could actually be a float here instead of just a .
if( buff.toString().equals( "." ) ){ if( buff.toString().equals( "." ) ){ //$NON-NLS-1$
if( c == '*' ){ if( c == '*' ){
return newToken( IToken.tDOTSTAR, ".*", scannerData.getContextStack().getCurrentContext() ); return newToken( IToken.tDOTSTAR, ".*", scannerData.getContextStack().getCurrentContext() ); //$NON-NLS-1$
} else if( c == '.' ){ } else if( c == '.' ){
if( getChar() == '.' ) if( getChar() == '.' )
return newToken( IToken.tELLIPSIS, "...", scannerData.getContextStack().getCurrentContext() ); return newToken( IToken.tELLIPSIS, "...", scannerData.getContextStack().getCurrentContext() ); //$NON-NLS-1$
else else
handleProblem( IProblem.SCANNER_BAD_FLOATING_POINT, null, beginOffset, false, true ); handleProblem( IProblem.SCANNER_BAD_FLOATING_POINT, null, beginOffset, false, true );
} else { } else {
ungetChar( c ); ungetChar( c );
return newToken( IToken.tDOT, ".", scannerData.getContextStack().getCurrentContext() ); return newToken( IToken.tDOT, ".", scannerData.getContextStack().getCurrentContext() ); //$NON-NLS-1$
} }
} }
} else if (c == 'x') { } else if (c == 'x') {
@ -1246,7 +1245,7 @@ public class Scanner implements IScanner {
int tokenType; int tokenType;
String result = buff.toString(); String result = buff.toString();
if( floatingPoint && result.equals(".") ) if( floatingPoint && result.equals(".") ) //$NON-NLS-1$
tokenType = IToken.tDOT; tokenType = IToken.tDOT;
else else
tokenType = floatingPoint ? IToken.tFLOATINGPT : IToken.tINTEGER; tokenType = floatingPoint ? IToken.tFLOATINGPT : IToken.tINTEGER;
@ -1272,12 +1271,12 @@ public class Scanner implements IScanner {
if( c == '#' ) if( c == '#' )
{ {
if( skipped ) if( skipped )
handleProblem( IProblem.PREPROCESSOR_INVALID_DIRECTIVE, "# #", beginningOffset, false, true ); handleProblem( IProblem.PREPROCESSOR_INVALID_DIRECTIVE, "# #", beginningOffset, false, true ); //$NON-NLS-1$
else else
return newToken( tPOUNDPOUND, "##" ); return newToken( tPOUNDPOUND, "##" ); //$NON-NLS-1$
} else if( tokenizingMacroReplacementList ) { } else if( tokenizingMacroReplacementList ) {
ungetChar( c ); ungetChar( c );
return newToken( tPOUND, "#" ); return newToken( tPOUND, "#" ); //$NON-NLS-1$
} }
while (((c >= 'a') && (c <= 'z')) while (((c >= 'a') && (c <= 'z'))
@ -1297,7 +1296,7 @@ public class Scanner implements IScanner {
if (directive == null) { if (directive == null) {
if( scannerExtension.canHandlePreprocessorDirective( token ) ) if( scannerExtension.canHandlePreprocessorDirective( token ) )
scannerExtension.handlePreprocessorDirective( token, getRestOfPreprocessorLine() ); scannerExtension.handlePreprocessorDirective( token, getRestOfPreprocessorLine() );
StringBuffer buffer = new StringBuffer( "#"); StringBuffer buffer = new StringBuffer( "#"); //$NON-NLS-1$
buffer.append( token ); buffer.append( token );
handleProblem( IProblem.PREPROCESSOR_INVALID_DIRECTIVE, buffer.toString(), beginningOffset, false, true ); handleProblem( IProblem.PREPROCESSOR_INVALID_DIRECTIVE, buffer.toString(), beginningOffset, false, true );
} else { } else {
@ -1354,8 +1353,8 @@ public class Scanner implements IScanner {
if( isLimitReached() ) if( isLimitReached() )
handleCompletionOnExpression( expression ); handleCompletionOnExpression( expression );
if (expression.trim().equals("")) if (expression.trim().equals("")) //$NON-NLS-1$
handleProblem( IProblem.PREPROCESSOR_INVALID_DIRECTIVE, "#if", beginningOffset, false, true ); handleProblem( IProblem.PREPROCESSOR_INVALID_DIRECTIVE, "#if", beginningOffset, false, true ); //$NON-NLS-1$
boolean expressionEvalResult = false; boolean expressionEvalResult = false;
@ -1389,9 +1388,9 @@ public class Scanner implements IScanner {
if( isLimitReached() ) if( isLimitReached() )
handleInvalidCompletion(); handleInvalidCompletion();
if( ! restOfLine.equals( "" ) ) if( ! restOfLine.equals( "" ) ) //$NON-NLS-1$
{ {
StringBuffer buffer = new StringBuffer("#endif "); StringBuffer buffer = new StringBuffer("#endif "); //$NON-NLS-1$
buffer.append( restOfLine ); buffer.append( restOfLine );
handleProblem( IProblem.PREPROCESSOR_INVALID_DIRECTIVE, buffer.toString(), beginningOffset, false, true ); handleProblem( IProblem.PREPROCESSOR_INVALID_DIRECTIVE, buffer.toString(), beginningOffset, false, true );
} }
@ -1449,8 +1448,8 @@ public class Scanner implements IScanner {
handleCompletionOnExpression( elifExpression ); handleCompletionOnExpression( elifExpression );
if (elifExpression.equals("")) if (elifExpression.equals("")) //$NON-NLS-1$
handleProblem( IProblem.PREPROCESSOR_INVALID_DIRECTIVE, "#elif", beginningOffset, false, true ); handleProblem( IProblem.PREPROCESSOR_INVALID_DIRECTIVE, "#elif", beginningOffset, false, true ); //$NON-NLS-1$
boolean elsifResult = false; boolean elsifResult = false;
if( scannerData.getBranchTracker().queryCurrentBranchForElif() ) if( scannerData.getBranchTracker().queryCurrentBranchForElif() )
@ -1501,15 +1500,15 @@ public class Scanner implements IScanner {
case PreprocessorDirectives.BLANK : case PreprocessorDirectives.BLANK :
String remainderOfLine = String remainderOfLine =
getRestOfPreprocessorLine().trim(); getRestOfPreprocessorLine().trim();
if (!remainderOfLine.equals("")) { if (!remainderOfLine.equals("")) { //$NON-NLS-1$
StringBuffer buffer = new StringBuffer( "# "); StringBuffer buffer = new StringBuffer( "# "); //$NON-NLS-1$
buffer.append( remainderOfLine ); buffer.append( remainderOfLine );
handleProblem( IProblem.PREPROCESSOR_INVALID_DIRECTIVE, buffer.toString(), beginningOffset, false, true); handleProblem( IProblem.PREPROCESSOR_INVALID_DIRECTIVE, buffer.toString(), beginningOffset, false, true);
} }
c = getChar(); c = getChar();
continue; continue;
default : default :
StringBuffer buffer = new StringBuffer( "# "); StringBuffer buffer = new StringBuffer( "# "); //$NON-NLS-1$
buffer.append( token ); buffer.append( token );
handleProblem( IProblem.PREPROCESSOR_INVALID_DIRECTIVE, buffer.toString(), beginningOffset, false, true ); handleProblem( IProblem.PREPROCESSOR_INVALID_DIRECTIVE, buffer.toString(), beginningOffset, false, true );
} }
@ -1524,51 +1523,51 @@ public class Scanner implements IScanner {
case ':' : case ':' :
return newToken( return newToken(
IToken.tCOLONCOLON, IToken.tCOLONCOLON,
"::", "::", //$NON-NLS-1$
scannerData.getContextStack().getCurrentContext()); scannerData.getContextStack().getCurrentContext());
default : default :
ungetChar(c); ungetChar(c);
return newToken( return newToken(
IToken.tCOLON, IToken.tCOLON,
":", ":", //$NON-NLS-1$
scannerData.getContextStack().getCurrentContext()); scannerData.getContextStack().getCurrentContext());
} }
case ';' : case ';' :
return newToken(IToken.tSEMI, ";", scannerData.getContextStack().getCurrentContext()); return newToken(IToken.tSEMI, ";", scannerData.getContextStack().getCurrentContext()); //$NON-NLS-1$
case ',' : case ',' :
return newToken(IToken.tCOMMA, ",", scannerData.getContextStack().getCurrentContext()); return newToken(IToken.tCOMMA, ",", scannerData.getContextStack().getCurrentContext()); //$NON-NLS-1$
case '?' : case '?' :
return newToken(IToken.tQUESTION, "?", scannerData.getContextStack().getCurrentContext()); return newToken(IToken.tQUESTION, "?", scannerData.getContextStack().getCurrentContext()); //$NON-NLS-1$
case '(' : case '(' :
return newToken(IToken.tLPAREN, "(", scannerData.getContextStack().getCurrentContext()); return newToken(IToken.tLPAREN, "(", scannerData.getContextStack().getCurrentContext()); //$NON-NLS-1$
case ')' : case ')' :
return newToken(IToken.tRPAREN, ")", scannerData.getContextStack().getCurrentContext()); return newToken(IToken.tRPAREN, ")", scannerData.getContextStack().getCurrentContext()); //$NON-NLS-1$
case '[' : case '[' :
return newToken(IToken.tLBRACKET, "[", scannerData.getContextStack().getCurrentContext()); return newToken(IToken.tLBRACKET, "[", scannerData.getContextStack().getCurrentContext()); //$NON-NLS-1$
case ']' : case ']' :
return newToken(IToken.tRBRACKET, "]", scannerData.getContextStack().getCurrentContext()); return newToken(IToken.tRBRACKET, "]", scannerData.getContextStack().getCurrentContext()); //$NON-NLS-1$
case '{' : case '{' :
return newToken(IToken.tLBRACE, "{", scannerData.getContextStack().getCurrentContext()); return newToken(IToken.tLBRACE, "{", scannerData.getContextStack().getCurrentContext()); //$NON-NLS-1$
case '}' : case '}' :
return newToken(IToken.tRBRACE, "}", scannerData.getContextStack().getCurrentContext()); return newToken(IToken.tRBRACE, "}", scannerData.getContextStack().getCurrentContext()); //$NON-NLS-1$
case '+' : case '+' :
c = getChar(); c = getChar();
switch (c) { switch (c) {
case '=' : case '=' :
return newToken( return newToken(
IToken.tPLUSASSIGN, IToken.tPLUSASSIGN,
"+=", "+=", //$NON-NLS-1$
scannerData.getContextStack().getCurrentContext()); scannerData.getContextStack().getCurrentContext());
case '+' : case '+' :
return newToken( return newToken(
IToken.tINCR, IToken.tINCR,
"++", "++", //$NON-NLS-1$
scannerData.getContextStack().getCurrentContext()); scannerData.getContextStack().getCurrentContext());
default : default :
ungetChar(c); ungetChar(c);
return newToken( return newToken(
IToken.tPLUS, IToken.tPLUS,
"+", "+", //$NON-NLS-1$
scannerData.getContextStack().getCurrentContext()); scannerData.getContextStack().getCurrentContext());
} }
case '-' : case '-' :
@ -1577,12 +1576,12 @@ public class Scanner implements IScanner {
case '=' : case '=' :
return newToken( return newToken(
IToken.tMINUSASSIGN, IToken.tMINUSASSIGN,
"-=", "-=", //$NON-NLS-1$
scannerData.getContextStack().getCurrentContext()); scannerData.getContextStack().getCurrentContext());
case '-' : case '-' :
return newToken( return newToken(
IToken.tDECR, IToken.tDECR,
"--", "--", //$NON-NLS-1$
scannerData.getContextStack().getCurrentContext()); scannerData.getContextStack().getCurrentContext());
case '>' : case '>' :
c = getChar(); c = getChar();
@ -1590,20 +1589,20 @@ public class Scanner implements IScanner {
case '*' : case '*' :
return newToken( return newToken(
IToken.tARROWSTAR, IToken.tARROWSTAR,
"->*", "->*", //$NON-NLS-1$
scannerData.getContextStack().getCurrentContext()); scannerData.getContextStack().getCurrentContext());
default : default :
ungetChar(c); ungetChar(c);
return newToken( return newToken(
IToken.tARROW, IToken.tARROW,
"->", "->", //$NON-NLS-1$
scannerData.getContextStack().getCurrentContext()); scannerData.getContextStack().getCurrentContext());
} }
default : default :
ungetChar(c); ungetChar(c);
return newToken( return newToken(
IToken.tMINUS, IToken.tMINUS,
"-", "-", //$NON-NLS-1$
scannerData.getContextStack().getCurrentContext()); scannerData.getContextStack().getCurrentContext());
} }
case '*' : case '*' :
@ -1612,13 +1611,13 @@ public class Scanner implements IScanner {
case '=' : case '=' :
return newToken( return newToken(
IToken.tSTARASSIGN, IToken.tSTARASSIGN,
"*=", "*=", //$NON-NLS-1$
scannerData.getContextStack().getCurrentContext()); scannerData.getContextStack().getCurrentContext());
default : default :
ungetChar(c); ungetChar(c);
return newToken( return newToken(
IToken.tSTAR, IToken.tSTAR,
"*", "*", //$NON-NLS-1$
scannerData.getContextStack().getCurrentContext()); scannerData.getContextStack().getCurrentContext());
} }
case '%' : case '%' :
@ -1627,13 +1626,13 @@ public class Scanner implements IScanner {
case '=' : case '=' :
return newToken( return newToken(
IToken.tMODASSIGN, IToken.tMODASSIGN,
"%=", "%=", //$NON-NLS-1$
scannerData.getContextStack().getCurrentContext()); scannerData.getContextStack().getCurrentContext());
default : default :
ungetChar(c); ungetChar(c);
return newToken( return newToken(
IToken.tMOD, IToken.tMOD,
"%", "%", //$NON-NLS-1$
scannerData.getContextStack().getCurrentContext()); scannerData.getContextStack().getCurrentContext());
} }
case '^' : case '^' :
@ -1642,13 +1641,13 @@ public class Scanner implements IScanner {
case '=' : case '=' :
return newToken( return newToken(
IToken.tXORASSIGN, IToken.tXORASSIGN,
"^=", "^=", //$NON-NLS-1$
scannerData.getContextStack().getCurrentContext()); scannerData.getContextStack().getCurrentContext());
default : default :
ungetChar(c); ungetChar(c);
return newToken( return newToken(
IToken.tXOR, IToken.tXOR,
"^", "^", //$NON-NLS-1$
scannerData.getContextStack().getCurrentContext()); scannerData.getContextStack().getCurrentContext());
} }
case '&' : case '&' :
@ -1657,18 +1656,18 @@ public class Scanner implements IScanner {
case '=' : case '=' :
return newToken( return newToken(
IToken.tAMPERASSIGN, IToken.tAMPERASSIGN,
"&=", "&=", //$NON-NLS-1$
scannerData.getContextStack().getCurrentContext()); scannerData.getContextStack().getCurrentContext());
case '&' : case '&' :
return newToken( return newToken(
IToken.tAND, IToken.tAND,
"&&", "&&", //$NON-NLS-1$
scannerData.getContextStack().getCurrentContext()); scannerData.getContextStack().getCurrentContext());
default : default :
ungetChar(c); ungetChar(c);
return newToken( return newToken(
IToken.tAMPER, IToken.tAMPER,
"&", "&", //$NON-NLS-1$
scannerData.getContextStack().getCurrentContext()); scannerData.getContextStack().getCurrentContext());
} }
case '|' : case '|' :
@ -1677,35 +1676,35 @@ public class Scanner implements IScanner {
case '=' : case '=' :
return newToken( return newToken(
IToken.tBITORASSIGN, IToken.tBITORASSIGN,
"|=", "|=", //$NON-NLS-1$
scannerData.getContextStack().getCurrentContext()); scannerData.getContextStack().getCurrentContext());
case '|' : case '|' :
return newToken( return newToken(
IToken.tOR, IToken.tOR,
"||", "||", //$NON-NLS-1$
scannerData.getContextStack().getCurrentContext()); scannerData.getContextStack().getCurrentContext());
default : default :
ungetChar(c); ungetChar(c);
return newToken( return newToken(
IToken.tBITOR, IToken.tBITOR,
"|", "|", //$NON-NLS-1$
scannerData.getContextStack().getCurrentContext()); scannerData.getContextStack().getCurrentContext());
} }
case '~' : case '~' :
return newToken(IToken.tCOMPL, "~", scannerData.getContextStack().getCurrentContext()); return newToken(IToken.tCOMPL, "~", scannerData.getContextStack().getCurrentContext()); //$NON-NLS-1$
case '!' : case '!' :
c = getChar(); c = getChar();
switch (c) { switch (c) {
case '=' : case '=' :
return newToken( return newToken(
IToken.tNOTEQUAL, IToken.tNOTEQUAL,
"!=", "!=", //$NON-NLS-1$
scannerData.getContextStack().getCurrentContext()); scannerData.getContextStack().getCurrentContext());
default : default :
ungetChar(c); ungetChar(c);
return newToken( return newToken(
IToken.tNOT, IToken.tNOT,
"!", "!", //$NON-NLS-1$
scannerData.getContextStack().getCurrentContext()); scannerData.getContextStack().getCurrentContext());
} }
case '=' : case '=' :
@ -1714,13 +1713,13 @@ public class Scanner implements IScanner {
case '=' : case '=' :
return newToken( return newToken(
IToken.tEQUAL, IToken.tEQUAL,
"==", "==", //$NON-NLS-1$
scannerData.getContextStack().getCurrentContext()); scannerData.getContextStack().getCurrentContext());
default : default :
ungetChar(c); ungetChar(c);
return newToken( return newToken(
IToken.tASSIGN, IToken.tASSIGN,
"=", "=", //$NON-NLS-1$
scannerData.getContextStack().getCurrentContext()); scannerData.getContextStack().getCurrentContext());
} }
case '<' : case '<' :
@ -1732,25 +1731,25 @@ public class Scanner implements IScanner {
case '=' : case '=' :
return newToken( return newToken(
IToken.tSHIFTLASSIGN, IToken.tSHIFTLASSIGN,
"<<=", "<<=", //$NON-NLS-1$
scannerData.getContextStack().getCurrentContext()); scannerData.getContextStack().getCurrentContext());
default : default :
ungetChar(c); ungetChar(c);
return newToken( return newToken(
IToken.tSHIFTL, IToken.tSHIFTL,
"<<", "<<", //$NON-NLS-1$
scannerData.getContextStack().getCurrentContext()); scannerData.getContextStack().getCurrentContext());
} }
case '=' : case '=' :
return newToken( return newToken(
IToken.tLTEQUAL, IToken.tLTEQUAL,
"<=", "<=", //$NON-NLS-1$
scannerData.getContextStack().getCurrentContext()); scannerData.getContextStack().getCurrentContext());
default : default :
ungetChar(c); ungetChar(c);
if( forInclusion ) if( forInclusion )
temporarilyReplaceDefinitionsMap(); temporarilyReplaceDefinitionsMap();
return newToken(IToken.tLT, "<", scannerData.getContextStack().getCurrentContext()); return newToken(IToken.tLT, "<", scannerData.getContextStack().getCurrentContext()); //$NON-NLS-1$
} }
case '>' : case '>' :
c = getChar(); c = getChar();
@ -1761,25 +1760,25 @@ public class Scanner implements IScanner {
case '=' : case '=' :
return newToken( return newToken(
IToken.tSHIFTRASSIGN, IToken.tSHIFTRASSIGN,
">>=", ">>=", //$NON-NLS-1$
scannerData.getContextStack().getCurrentContext()); scannerData.getContextStack().getCurrentContext());
default : default :
ungetChar(c); ungetChar(c);
return newToken( return newToken(
IToken.tSHIFTR, IToken.tSHIFTR,
">>", ">>", //$NON-NLS-1$
scannerData.getContextStack().getCurrentContext()); scannerData.getContextStack().getCurrentContext());
} }
case '=' : case '=' :
return newToken( return newToken(
IToken.tGTEQUAL, IToken.tGTEQUAL,
">=", ">=", //$NON-NLS-1$
scannerData.getContextStack().getCurrentContext()); scannerData.getContextStack().getCurrentContext());
default : default :
ungetChar(c); ungetChar(c);
if( forInclusion ) if( forInclusion )
restoreDefinitionsMap(); restoreDefinitionsMap();
return newToken(IToken.tGT, ">", scannerData.getContextStack().getCurrentContext()); return newToken(IToken.tGT, ">", scannerData.getContextStack().getCurrentContext()); //$NON-NLS-1$
} }
case '.' : case '.' :
c = getChar(); c = getChar();
@ -1790,7 +1789,7 @@ public class Scanner implements IScanner {
case '.' : case '.' :
return newToken( return newToken(
IToken.tELLIPSIS, IToken.tELLIPSIS,
"...", "...", //$NON-NLS-1$
scannerData.getContextStack().getCurrentContext()); scannerData.getContextStack().getCurrentContext());
default : default :
break; break;
@ -1799,13 +1798,13 @@ public class Scanner implements IScanner {
case '*' : case '*' :
return newToken( return newToken(
IToken.tDOTSTAR, IToken.tDOTSTAR,
".*", ".*", //$NON-NLS-1$
scannerData.getContextStack().getCurrentContext()); scannerData.getContextStack().getCurrentContext());
default : default :
ungetChar(c); ungetChar(c);
return newToken( return newToken(
IToken.tDOT, IToken.tDOT,
".", ".", //$NON-NLS-1$
scannerData.getContextStack().getCurrentContext()); scannerData.getContextStack().getCurrentContext());
} }
break; break;
@ -1823,13 +1822,13 @@ public class Scanner implements IScanner {
case '=' : case '=' :
return newToken( return newToken(
IToken.tDIVASSIGN, IToken.tDIVASSIGN,
"/=", "/=", //$NON-NLS-1$
scannerData.getContextStack().getCurrentContext()); scannerData.getContextStack().getCurrentContext());
default : default :
ungetChar(c); ungetChar(c);
return newToken( return newToken(
IToken.tDIV, IToken.tDIV,
"/", "/", //$NON-NLS-1$
scannerData.getContextStack().getCurrentContext()); scannerData.getContextStack().getCurrentContext());
} }
default : default :
@ -1872,9 +1871,9 @@ public class Scanner implements IScanner {
int completionPoint = expression.length() + 2; int completionPoint = expression.length() + 2;
IASTCompletionNode.CompletionKind kind = IASTCompletionNode.CompletionKind.MACRO_REFERENCE; IASTCompletionNode.CompletionKind kind = IASTCompletionNode.CompletionKind.MACRO_REFERENCE;
String prefix = ""; String prefix = ""; //$NON-NLS-1$
if( ! expression.trim().equals("")) if( ! expression.trim().equals("")) //$NON-NLS-1$
{ {
IScanner subScanner = ParserFactory.createScanner( new StringReader(expression), SCRATCH, EMPTY_INFO, ParserMode.QUICK_PARSE, scannerData.getLanguage(), new NullSourceElementRequestor(), new NullLogService()); IScanner subScanner = ParserFactory.createScanner( new StringReader(expression), SCRATCH, EMPTY_INFO, ParserMode.QUICK_PARSE, scannerData.getLanguage(), new NullSourceElementRequestor(), new NullLogService());
IToken lastToken = null; IToken lastToken = null;
@ -1917,7 +1916,7 @@ public class Scanner implements IScanner {
protected void handleInvalidCompletion() throws EndOfFileException protected void handleInvalidCompletion() throws EndOfFileException
{ {
throwEOF( new ASTCompletionNode( IASTCompletionNode.CompletionKind.UNREACHABLE_CODE, null, null, "", KeywordSets.getKeywords(KeywordSets.Key.EMPTY, scannerData.getLanguage()) )); throwEOF( new ASTCompletionNode( IASTCompletionNode.CompletionKind.UNREACHABLE_CODE, null, null, "", KeywordSets.getKeywords(KeywordSets.Key.EMPTY, scannerData.getLanguage()) )); //$NON-NLS-1$
} }
protected void handleCompletionOnPreprocessorDirective( String prefix ) throws EndOfFileException protected void handleCompletionOnPreprocessorDirective( String prefix ) throws EndOfFileException
@ -1982,7 +1981,7 @@ public class Scanner implements IScanner {
protected String getCurrentFile() protected String getCurrentFile()
{ {
return scannerData.getContextStack().getMostRelevantFileContext() != null ? scannerData.getContextStack().getMostRelevantFileContext().getFilename() : ""; return scannerData.getContextStack().getMostRelevantFileContext() != null ? scannerData.getContextStack().getMostRelevantFileContext().getFilename() : ""; //$NON-NLS-1$
} }
@ -2043,13 +2042,13 @@ public class Scanner implements IScanner {
return processCharacterLiteral( c, false ); return processCharacterLiteral( c, false );
case ',' : case ',' :
if (tokenImage.length() > 0) throw endOfMacroToken; if (tokenImage.length() > 0) throw endOfMacroToken;
return newToken(IToken.tCOMMA, ",", scannerData.getContextStack().getCurrentContext()); return newToken(IToken.tCOMMA, ",", scannerData.getContextStack().getCurrentContext()); //$NON-NLS-1$
case '(' : case '(' :
if (tokenImage.length() > 0) throw endOfMacroToken; if (tokenImage.length() > 0) throw endOfMacroToken;
return newToken(IToken.tLPAREN, "(", scannerData.getContextStack().getCurrentContext()); return newToken(IToken.tLPAREN, "(", scannerData.getContextStack().getCurrentContext()); //$NON-NLS-1$
case ')' : case ')' :
if (tokenImage.length() > 0) throw endOfMacroToken; if (tokenImage.length() > 0) throw endOfMacroToken;
return newToken(IToken.tRPAREN, ")", scannerData.getContextStack().getCurrentContext()); return newToken(IToken.tRPAREN, ")", scannerData.getContextStack().getCurrentContext()); //$NON-NLS-1$
case '/' : case '/' :
if (tokenImage.length() > 0) throw endOfMacroToken; if (tokenImage.length() > 0) throw endOfMacroToken;
c = getChar(); c = getChar();
@ -2265,7 +2264,7 @@ public class Scanner implements IScanner {
if( scannerData.getParserMode() == ParserMode.QUICK_PARSE ) if( scannerData.getParserMode() == ParserMode.QUICK_PARSE )
{ {
if( expression.trim().equals( "0" ) ) if( expression.trim().equals( "0" ) ) //$NON-NLS-1$
return false; return false;
return true; return true;
@ -2309,7 +2308,7 @@ public class Scanner implements IScanner {
protected void skipOverSinglelineComment() throws ScannerException, EndOfFileException { protected void skipOverSinglelineComment() throws ScannerException, EndOfFileException {
StringBuffer comment = new StringBuffer("//"); StringBuffer comment = new StringBuffer("//"); //$NON-NLS-1$
int c; int c;
loop: loop:
@ -2332,7 +2331,7 @@ public class Scanner implements IScanner {
protected boolean skipOverMultilineComment() throws ScannerException, EndOfFileException { protected boolean skipOverMultilineComment() throws ScannerException, EndOfFileException {
int state = 0; int state = 0;
boolean encounteredNewline = false; boolean encounteredNewline = false;
StringBuffer comment = new StringBuffer("/*"); StringBuffer comment = new StringBuffer("/*"); //$NON-NLS-1$
// simple state machine to handle multi-line comments // simple state machine to handle multi-line comments
// state 0 == no end of comment in site // state 0 == no end of comment in site
// state 1 == encountered *, expecting / // state 1 == encountered *, expecting /
@ -2371,7 +2370,7 @@ public class Scanner implements IScanner {
} }
protected void poundInclude( int beginningOffset, int startLine ) throws ScannerException, EndOfFileException { protected void poundInclude( int beginningOffset, int startLine ) throws ScannerException, EndOfFileException {
StringBuffer potentialErrorLine = new StringBuffer( "#include "); StringBuffer potentialErrorLine = new StringBuffer( "#include "); //$NON-NLS-1$
skipOverWhitespace(); skipOverWhitespace();
int baseOffset = lastContext.getOffset() - lastContext.undoStackSize(); int baseOffset = lastContext.getOffset() - lastContext.undoStackSize();
int nameLine = scannerData.getContextStack().getCurrentLineNumber(); int nameLine = scannerData.getContextStack().getCurrentLineNumber();
@ -2382,7 +2381,7 @@ public class Scanner implements IScanner {
int startOffset = baseOffset; int startOffset = baseOffset;
int endOffset = baseOffset; int endOffset = baseOffset;
if (! includeLine.equals("")) { if (! includeLine.equals("")) { //$NON-NLS-1$
Scanner helperScanner = new Scanner( Scanner helperScanner = new Scanner(
new StringReader(includeLine), new StringReader(includeLine),
null, null,
@ -2463,7 +2462,7 @@ public class Scanner implements IScanner {
i = i =
scannerData.getASTFactory().createInclusion( scannerData.getASTFactory().createInclusion(
f, f,
"", "", //$NON-NLS-1$
!useIncludePath, !useIncludePath,
beginningOffset, beginningOffset,
startLine, startLine,
@ -2515,7 +2514,7 @@ public class Scanner implements IScanner {
protected List tokenizeReplacementString( int beginning, String key, String replacementString, List parameterIdentifiers ) protected List tokenizeReplacementString( int beginning, String key, String replacementString, List parameterIdentifiers )
{ {
List macroReplacementTokens = new ArrayList(); List macroReplacementTokens = new ArrayList();
if( replacementString.trim().equals( "" ) ) if( replacementString.trim().equals( "" ) ) //$NON-NLS-1$
return macroReplacementTokens; return macroReplacementTokens;
IScanner helperScanner=null; IScanner helperScanner=null;
try { try {
@ -2636,7 +2635,7 @@ public class Scanner implements IScanner {
String parameters = buffer.toString(); String parameters = buffer.toString();
// replace StringTokenizer later -- not performant // replace StringTokenizer later -- not performant
StringTokenizer tokenizer = new StringTokenizer(parameters, ","); StringTokenizer tokenizer = new StringTokenizer(parameters, ","); //$NON-NLS-1$
ArrayList parameterIdentifiers = ArrayList parameterIdentifiers =
new ArrayList(tokenizer.countTokens()); new ArrayList(tokenizer.countTokens());
while (tokenizer.hasMoreTokens()) { while (tokenizer.hasMoreTokens()) {
@ -2649,7 +2648,7 @@ public class Scanner implements IScanner {
String replacementString = getRestOfPreprocessorLine(); String replacementString = getRestOfPreprocessorLine();
macroReplacementTokens = ( ! replacementString.equals( "" ) ) ? macroReplacementTokens = ( ! replacementString.equals( "" ) ) ? //$NON-NLS-1$
tokenizeReplacementString( beginning, key, replacementString, parameterIdentifiers ) : tokenizeReplacementString( beginning, key, replacementString, parameterIdentifiers ) :
EMPTY_LIST; EMPTY_LIST;
@ -2657,7 +2656,7 @@ public class Scanner implements IScanner {
fullSignature.append( key ); fullSignature.append( key );
fullSignature.append( '('); fullSignature.append( '(');
fullSignature.append( parameters ); fullSignature.append( parameters );
fullSignature.append( ") "); fullSignature.append( ") "); //$NON-NLS-1$
fullSignature.append( replacementString ); fullSignature.append( replacementString );
descriptor = new FunctionMacroDescriptor( descriptor = new FunctionMacroDescriptor(
key, key,
@ -2672,8 +2671,8 @@ public class Scanner implements IScanner {
} }
else if ((c == '\n') || (c == '\r')) else if ((c == '\n') || (c == '\r'))
{ {
checkValidMacroRedefinition(key, previousDefinition, "", beginning); checkValidMacroRedefinition(key, previousDefinition, "", beginning); //$NON-NLS-1$
addDefinition( key, "" ); addDefinition( key, "" ); //$NON-NLS-1$
} }
else if ((c == ' ') || (c == '\t') ) { else if ((c == ' ') || (c == '\t') ) {
// this is a simple definition // this is a simple definition
@ -2691,33 +2690,33 @@ public class Scanner implements IScanner {
if (c == '/') // one line comment if (c == '/') // one line comment
{ {
skipOverSinglelineComment(); skipOverSinglelineComment();
checkValidMacroRedefinition(key, previousDefinition, "", beginning); checkValidMacroRedefinition(key, previousDefinition, "", beginning); //$NON-NLS-1$
addDefinition(key, ""); addDefinition(key, ""); //$NON-NLS-1$
} else if (c == '*') // multi-line comment } else if (c == '*') // multi-line comment
{ {
if (skipOverMultilineComment()) { if (skipOverMultilineComment()) {
// we have gone over a newline // we have gone over a newline
// therefore, this symbol was defined to an empty string // therefore, this symbol was defined to an empty string
checkValidMacroRedefinition(key, previousDefinition, "", beginning); checkValidMacroRedefinition(key, previousDefinition, "", beginning); //$NON-NLS-1$
addDefinition(key, ""); addDefinition(key, ""); //$NON-NLS-1$
} else { } else {
String value = getRestOfPreprocessorLine(); String value = getRestOfPreprocessorLine();
checkValidMacroRedefinition(key, previousDefinition, "", beginning); checkValidMacroRedefinition(key, previousDefinition, "", beginning); //$NON-NLS-1$
addDefinition(key, value); addDefinition(key, value);
} }
} else { } else {
// this is not a comment // this is not a comment
// it is a bad statement // it is a bad statement
potentialErrorMessage.append( key ); potentialErrorMessage.append( key );
potentialErrorMessage.append( " /"); potentialErrorMessage.append( " /"); //$NON-NLS-1$
potentialErrorMessage.append( getRestOfPreprocessorLine() ); potentialErrorMessage.append( getRestOfPreprocessorLine() );
handleProblem( IProblem.PREPROCESSOR_INVALID_MACRO_DEFN, potentialErrorMessage.toString(), beginning, false, true ); handleProblem( IProblem.PREPROCESSOR_INVALID_MACRO_DEFN, potentialErrorMessage.toString(), beginning, false, true );
return; return;
} }
} else { } else {
potentialErrorMessage = new StringBuffer(); potentialErrorMessage = new StringBuffer();
potentialErrorMessage.append( "#define"); potentialErrorMessage.append( "#define"); //$NON-NLS-1$
potentialErrorMessage.append( key ); potentialErrorMessage.append( key );
potentialErrorMessage.append( (char)c ); potentialErrorMessage.append( (char)c );
potentialErrorMessage.append( getRestOfPreprocessorLine() ); potentialErrorMessage.append( getRestOfPreprocessorLine() );
@ -2832,7 +2831,7 @@ public class Scanner implements IScanner {
buffer.append('\"'); buffer.append('\"');
break; break;
case IToken.tLSTRING : case IToken.tLSTRING :
buffer.append( "L\""); buffer.append( "L\""); //$NON-NLS-1$
buffer.append(t.getImage()); buffer.append(t.getImage());
buffer.append('\"'); buffer.append('\"');
break; break;
@ -2992,7 +2991,7 @@ public class Scanner implements IScanner {
buffer.append('\"'); buffer.append('\"');
break; break;
case IToken.tLSTRING: case IToken.tLSTRING:
buffer.append("L\""); buffer.append("L\""); //$NON-NLS-1$
buffer.append(t.getImage()); buffer.append(t.getImage());
buffer.append('\"'); buffer.append('\"');
break; break;
@ -3021,7 +3020,7 @@ public class Scanner implements IScanner {
if( t.getType() != tPOUNDPOUND && ! pastingNext ) if( t.getType() != tPOUNDPOUND && ! pastingNext )
if (i < (numberOfTokens-1)) // Do not append to the last one if (i < (numberOfTokens-1)) // Do not append to the last one
buffer.append( " " ); buffer.append( " " ); //$NON-NLS-1$
} }
String finalString = buffer.toString(); String finalString = buffer.toString();
try try
@ -3047,7 +3046,7 @@ public class Scanner implements IScanner {
} }
else { else {
StringBuffer logMessage = new StringBuffer( "Unexpected type of MacroDescriptor stored in definitions table: " ); StringBuffer logMessage = new StringBuffer( "Unexpected type of MacroDescriptor stored in definitions table: " ); //$NON-NLS-1$
logMessage.append( expansion.getMacroType() ); logMessage.append( expansion.getMacroType() );
scannerData.getLogService().traceLog( logMessage.toString() ); scannerData.getLogService().traceLog( logMessage.toString() );
} }
@ -3068,8 +3067,8 @@ public class Scanner implements IScanner {
c = getChar(); c = getChar();
if (c != ')') if (c != ')')
{ {
handleProblem( IProblem.PREPROCESSOR_MACRO_USAGE_ERROR, "defined()", o, false, true ); handleProblem( IProblem.PREPROCESSOR_MACRO_USAGE_ERROR, "defined()", o, false, true ); //$NON-NLS-1$
return "0"; return "0"; //$NON-NLS-1$
} }
} }
else else
@ -3079,9 +3078,9 @@ public class Scanner implements IScanner {
} }
if (getDefinition(definitionIdentifier) != null) if (getDefinition(definitionIdentifier) != null)
return "1"; return "1"; //$NON-NLS-1$
return "0"; return "0"; //$NON-NLS-1$
} }
public void setThrowExceptionOnBadCharacterRead( boolean throwOnBad ){ public void setThrowExceptionOnBadCharacterRead( boolean throwOnBad ){

View file

@ -10,11 +10,14 @@
***********************************************************************/ ***********************************************************************/
package org.eclipse.cdt.internal.core.parser.scanner; package org.eclipse.cdt.internal.core.parser.scanner;
import java.text.MessageFormat;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import org.eclipse.cdt.core.parser.IProblem; import org.eclipse.cdt.core.parser.IProblem;
import org.eclipse.cdt.internal.core.parser.problem.*; import org.eclipse.cdt.internal.core.parser.ParserMessages;
import org.eclipse.cdt.internal.core.parser.problem.BaseProblemFactory;
import org.eclipse.cdt.internal.core.parser.problem.IProblemFactory;
/** /**
* @author jcamelon * @author jcamelon
@ -27,55 +30,55 @@ public class ScannerProblemFactory extends BaseProblemFactory implements IProble
errorMessages = new HashMap(); errorMessages = new HashMap();
errorMessages.put( errorMessages.put(
new Integer(IProblem.PREPROCESSOR_POUND_ERROR), new Integer(IProblem.PREPROCESSOR_POUND_ERROR),
"#error encountered with text: "); ParserMessages.getString("ScannerProblemFactory.error.preproc.error")); //$NON-NLS-1$
errorMessages.put( errorMessages.put(
new Integer(IProblem.PREPROCESSOR_INCLUSION_NOT_FOUND), new Integer(IProblem.PREPROCESSOR_INCLUSION_NOT_FOUND),
"Preprocessor Inclusion not found: "); ParserMessages.getString("ScannerProblemFactory.error.preproc.inclusionNotFound")); //$NON-NLS-1$
errorMessages.put( errorMessages.put(
new Integer(IProblem.PREPROCESSOR_DEFINITION_NOT_FOUND), new Integer(IProblem.PREPROCESSOR_DEFINITION_NOT_FOUND),
"Macro definition not found: "); ParserMessages.getString("ScannerProblemFactory.error.preproc.definitionNotFound")); //$NON-NLS-1$
errorMessages.put( errorMessages.put(
new Integer(IProblem.PREPROCESSOR_INVALID_MACRO_DEFN), new Integer(IProblem.PREPROCESSOR_INVALID_MACRO_DEFN),
"Macro definition malformed for macro: "); ParserMessages.getString("ScannerProblemFactory.error.preproc.invalidMacroDefn")); //$NON-NLS-1$
errorMessages.put( errorMessages.put(
new Integer(IProblem.PREPROCESSOR_INVALID_MACRO_REDEFN), new Integer(IProblem.PREPROCESSOR_INVALID_MACRO_REDEFN),
"Invalid macro redefinition for macro : "); ParserMessages.getString("ScannerProblemFactory.error.preproc.invalidMacroRedefn")); //$NON-NLS-1$
errorMessages.put( errorMessages.put(
new Integer(IProblem.PREPROCESSOR_UNBALANCE_CONDITION), new Integer(IProblem.PREPROCESSOR_UNBALANCE_CONDITION),
"Preprocessor Conditionals unbalanced : "); ParserMessages.getString("ScannerProblemFactory.error.preproc.unbalancedConditional")); //$NON-NLS-1$
errorMessages.put( errorMessages.put(
new Integer(IProblem.PREPROCESSOR_CONDITIONAL_EVAL_ERROR), new Integer(IProblem.PREPROCESSOR_CONDITIONAL_EVAL_ERROR),
"Expression Evaluation error for condition : "); ParserMessages.getString("ScannerProblemFactory.error.preproc.conditionalEval")); //$NON-NLS-1$
errorMessages.put( errorMessages.put(
new Integer(IProblem.PREPROCESSOR_MACRO_USAGE_ERROR), new Integer(IProblem.PREPROCESSOR_MACRO_USAGE_ERROR),
"Macro usage error for macro :"); ParserMessages.getString("ScannerProblemFactory.error.preproc.macroUsage")); //$NON-NLS-1$
errorMessages.put( errorMessages.put(
new Integer(IProblem.PREPROCESSOR_CIRCULAR_INCLUSION), new Integer(IProblem.PREPROCESSOR_CIRCULAR_INCLUSION),
"Circular inclusion for file : "); ParserMessages.getString("ScannerProblemFactory.error.preproc.circularInclusion")); //$NON-NLS-1$
errorMessages.put( errorMessages.put(
new Integer(IProblem.PREPROCESSOR_INVALID_DIRECTIVE), new Integer(IProblem.PREPROCESSOR_INVALID_DIRECTIVE),
"Invalid preprocessor directive : "); ParserMessages.getString("ScannerProblemFactory.error.preproc.invalidDirective")); //$NON-NLS-1$
errorMessages.put( errorMessages.put(
new Integer(IProblem.PREPROCESSOR_MACRO_PASTING_ERROR), new Integer(IProblem.PREPROCESSOR_MACRO_PASTING_ERROR),
"Invalid use of macro pasting in macro : "); ParserMessages.getString("ScannerProblemFactory.error.preproc.macroPasting")); //$NON-NLS-1$
errorMessages.put( errorMessages.put(
new Integer(IProblem.SCANNER_INVALID_ESCAPECHAR), new Integer(IProblem.SCANNER_INVALID_ESCAPECHAR),
"Invalid escape character encountered "); ParserMessages.getString("ScannerProblemFactory.error.scanner.invalidEscapeChar")); //$NON-NLS-1$
errorMessages.put( errorMessages.put(
new Integer(IProblem.SCANNER_UNBOUNDED_STRING), new Integer(IProblem.SCANNER_UNBOUNDED_STRING),
"Unbounded string encountered "); ParserMessages.getString("ScannerProblemFactory.error.scanner.unboundedString")); //$NON-NLS-1$
errorMessages.put( errorMessages.put(
new Integer(IProblem.SCANNER_BAD_FLOATING_POINT), new Integer(IProblem.SCANNER_BAD_FLOATING_POINT),
"Invalid floating point format encountered "); ParserMessages.getString("ScannerProblemFactory.error.scanner.badFloatingPoint")); //$NON-NLS-1$
errorMessages.put( errorMessages.put(
new Integer(IProblem.SCANNER_BAD_HEX_FORMAT), new Integer(IProblem.SCANNER_BAD_HEX_FORMAT),
"Invalid hexidecimal format encountered "); ParserMessages.getString("ScannerProblemFactory.error.scanner.badHexFormat")); //$NON-NLS-1$
errorMessages.put( errorMessages.put(
new Integer(IProblem.SCANNER_UNEXPECTED_EOF), new Integer(IProblem.SCANNER_UNEXPECTED_EOF),
"Unexpected End Of File encountered "); ParserMessages.getString("ScannerProblemFactory.error.scanner.unexpectedEOF")); //$NON-NLS-1$
errorMessages.put( errorMessages.put(
new Integer(IProblem.SCANNER_BAD_CHARACTER), new Integer(IProblem.SCANNER_BAD_CHARACTER),
"Bad character sequence encountered : "); ParserMessages.getString("ScannerProblemFactory.error.scanner.badCharacter")); //$NON-NLS-1$
} }
/* (non-Javadoc) /* (non-Javadoc)
@ -83,47 +86,46 @@ public class ScannerProblemFactory extends BaseProblemFactory implements IProble
*/ */
public String createMessage(int id, Map arguments, int lineNumber, char[] fileName) public String createMessage(int id, Map arguments, int lineNumber, char[] fileName)
{ {
StringBuffer buffer = new StringBuffer(); String message = (String) errorMessages.get( new Integer(id) );
String arg = null;
buffer.append(PROBLEM);
buffer.append(errorMessages.get(new Integer(id)));
switch (id) switch (id)
{ {
case IProblem.PREPROCESSOR_POUND_ERROR : case IProblem.PREPROCESSOR_POUND_ERROR :
buffer.append(arguments.get(IProblem.A_PREPROC_POUND_ERROR)); arg = (String) arguments.get(IProblem.A_PREPROC_POUND_ERROR);
break; break;
case IProblem.PREPROCESSOR_INCLUSION_NOT_FOUND : case IProblem.PREPROCESSOR_INCLUSION_NOT_FOUND :
buffer.append(arguments.get(IProblem.A_PREPROC_INCLUDE_FILENAME)); arg = (String) arguments.get((IProblem.A_PREPROC_INCLUDE_FILENAME));
break; break;
case IProblem.PREPROCESSOR_DEFINITION_NOT_FOUND : case IProblem.PREPROCESSOR_DEFINITION_NOT_FOUND :
buffer.append(arguments.get(IProblem.A_PREPROC_MACRO_NAME)); arg = (String) arguments.get(IProblem.A_PREPROC_MACRO_NAME);
break; break;
case IProblem.PREPROCESSOR_UNBALANCE_CONDITION : case IProblem.PREPROCESSOR_UNBALANCE_CONDITION :
buffer.append(arguments.get(IProblem.A_PREPROC_CONDITIONAL_MISMATCH)); arg = (String) arguments.get(IProblem.A_PREPROC_CONDITIONAL_MISMATCH);
break; break;
case IProblem.PREPROCESSOR_INVALID_MACRO_DEFN : case IProblem.PREPROCESSOR_INVALID_MACRO_DEFN :
buffer.append(arguments.get(IProblem.A_PREPROC_MACRO_NAME)); arg = (String) arguments.get(IProblem.A_PREPROC_MACRO_NAME);
break; break;
case IProblem.PREPROCESSOR_INVALID_DIRECTIVE : case IProblem.PREPROCESSOR_INVALID_DIRECTIVE :
buffer.append(arguments.get(IProblem.A_PREPROC_UNKNOWN_DIRECTIVE)); arg = (String) arguments.get(IProblem.A_PREPROC_UNKNOWN_DIRECTIVE);
break; break;
case IProblem.PREPROCESSOR_INVALID_MACRO_REDEFN : case IProblem.PREPROCESSOR_INVALID_MACRO_REDEFN :
buffer.append(arguments.get(IProblem.A_PREPROC_MACRO_NAME)); arg = (String) arguments.get(IProblem.A_PREPROC_MACRO_NAME);
break; break;
case IProblem.PREPROCESSOR_CONDITIONAL_EVAL_ERROR : case IProblem.PREPROCESSOR_CONDITIONAL_EVAL_ERROR :
buffer.append(arguments.get(IProblem.A_PREPROC_CONDITION)); arg = (String) arguments.get(IProblem.A_PREPROC_CONDITION);
break; break;
case IProblem.PREPROCESSOR_MACRO_USAGE_ERROR : case IProblem.PREPROCESSOR_MACRO_USAGE_ERROR :
buffer.append(arguments.get(IProblem.A_PREPROC_MACRO_NAME)); arg = (String) arguments.get(IProblem.A_PREPROC_MACRO_NAME);
break; break;
case IProblem.PREPROCESSOR_MACRO_PASTING_ERROR : case IProblem.PREPROCESSOR_MACRO_PASTING_ERROR :
buffer.append(arguments.get(IProblem.A_PREPROC_MACRO_NAME)); arg = (String) arguments.get(IProblem.A_PREPROC_MACRO_NAME);
break; break;
case IProblem.PREPROCESSOR_CIRCULAR_INCLUSION : case IProblem.PREPROCESSOR_CIRCULAR_INCLUSION :
buffer.append(arguments.get(IProblem.A_PREPROC_INCLUDE_FILENAME)); arg = (String) arguments.get(IProblem.A_PREPROC_INCLUDE_FILENAME);
break; break;
case IProblem.SCANNER_BAD_CHARACTER : case IProblem.SCANNER_BAD_CHARACTER :
buffer.append( arguments.get(IProblem.A_SCANNER_BADCHAR)); arg = (String) arguments.get(IProblem.A_SCANNER_BADCHAR);
break; break;
case IProblem.SCANNER_UNBOUNDED_STRING : case IProblem.SCANNER_UNBOUNDED_STRING :
case IProblem.SCANNER_INVALID_ESCAPECHAR : case IProblem.SCANNER_INVALID_ESCAPECHAR :
@ -135,11 +137,12 @@ public class ScannerProblemFactory extends BaseProblemFactory implements IProble
return null; return null;
} }
buffer.append( IN_FILE ); if( arg != null ){
buffer.append(fileName); message = MessageFormat.format( message, new Object [] { arg } );
buffer.append( ON_LINE ); }
buffer.append(lineNumber);
return buffer.toString(); Object [] args = { message, new String( fileName ), new Integer( lineNumber ) };
return ParserMessages.getFormattedString( PROBLEM_PATTERN, args );
} }
/* (non-Javadoc) /* (non-Javadoc)