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

bug #165205 - error parser messages externalized

This commit is contained in:
Norbert Pltt 2006-12-14 13:18:08 +00:00
parent c106203a8f
commit 59b83a92e1
5 changed files with 85 additions and 16 deletions

View file

@ -8,6 +8,7 @@
* Contributors:
* IBM Corporation - initial API and implementation
* James Blackburn - Patch for PR 85264
* Norbert Ploett (Siemens AG) - externalized strings
*******************************************************************************/
package org.eclipse.cdt.internal.errorparsers;
@ -20,20 +21,20 @@ import org.eclipse.cdt.core.IMarkerGenerator;
public class GCCErrorParser extends AbstractErrorParser {
private static final Pattern[] varPatterns = {
Pattern.compile("'(.*)' undeclared"),
Pattern.compile("'(.*)' defined but not used"),
Pattern.compile("conflicting types for '(.*)'"),
Pattern.compile("parse error before '(.*)'")
Pattern.compile(Messages.GCCErrorParser_varPattern_undeclared),
Pattern.compile(Messages.GCCErrorParser_varPattern_defdNotUsed),
Pattern.compile(Messages.GCCErrorParser_varPattern_conflictTypes),
Pattern.compile(Messages.GCCErrorParser_varPattern_parseError)
};
private static final ErrorPattern[] patterns = {
// The following are skipped
new ErrorPattern("\\(Each undeclared identifier is reported only once"),
new ErrorPattern("for each function it appears in.\\)"),
new ErrorPattern(": note:"),
new ErrorPattern("instantiated from here"),
new ErrorPattern(Messages.GCCErrorParser_skip_UndeclaredOnlyOnce),
new ErrorPattern(Messages.GCCErrorParser_skip_forEachFunction),
new ErrorPattern(Messages.GCCErrorParser_skip_note),
new ErrorPattern(Messages.GCCErrorParser_sikp_instantiatedFromHere),
// The following are not...
new ErrorPattern("(.*?):([0-9]+):([0-9]+:)? ((.*?[Ww]arning)?.*)", 1, 2, 4, 0, 0) {
new ErrorPattern(Messages.GCCErrorParser_Warnings, 1, 2, 4, 0, 0) {
public String getVarName(Matcher matcher) {
String desc = getDesc(matcher);
Matcher varMatcher = null;

View file

@ -7,7 +7,8 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
* Norbert Ploett (Siemens AG) - externalized strings
*******************************************************************************/
package org.eclipse.cdt.internal.errorparsers;
@ -18,9 +19,9 @@ import org.eclipse.cdt.core.IMarkerGenerator;
public class GLDErrorParser extends AbstractErrorParser {
private static final ErrorPattern[] patterns = {
new ErrorPattern("(.*)\\(\\.text\\+.*\\): (.*)", 1, 0, 2, 0, IMarkerGenerator.SEVERITY_ERROR_RESOURCE), //$NON-NLS-1
new ErrorPattern("ld(\\.exe)?: ([Ww]arning .*)", 2, IMarkerGenerator.SEVERITY_WARNING), //$NON-NLS-1
new ErrorPattern("ld(\\.exe)?: (.*)", 0, IMarkerGenerator.SEVERITY_ERROR_RESOURCE) { //$NON-NLS-1
new ErrorPattern(Messages.GLDErrorParser_error_text, 1, 0, 2, 0, IMarkerGenerator.SEVERITY_ERROR_RESOURCE), //$NON-NLS-1
new ErrorPattern(Messages.GLDErrorParser_warning_general, 2, IMarkerGenerator.SEVERITY_WARNING), //$NON-NLS-1
new ErrorPattern(Messages.GLDErrorParser_error_general, 0, IMarkerGenerator.SEVERITY_ERROR_RESOURCE) { //$NON-NLS-1
public String getDesc(Matcher matcher) {
// add in the name of the link command to give it some context
StringBuffer buff = new StringBuffer();

View file

@ -7,6 +7,7 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
* Norbert Ploett (Siemens AG) - externalized strings
*******************************************************************************/
package org.eclipse.cdt.internal.errorparsers;
@ -20,7 +21,7 @@ import org.eclipse.core.runtime.Path;
public class MakeErrorParser extends AbstractErrorParser {
private static final ErrorPattern[] patterns = {
new ErrorPattern("make\\[(.*)\\]: Entering directory `(.*)'", 0, 0) { //$NON-NLS-1
new ErrorPattern(Messages.MakeErrorParser_error_entering, 0, 0) { //$NON-NLS-1
protected boolean recordError(Matcher matcher, ErrorParserManager eoParser) {
int level;
try {
@ -41,13 +42,13 @@ public class MakeErrorParser extends AbstractErrorParser {
return true;
}
},
new ErrorPattern("make\\[.*\\]: Leaving directory", 0, 0) { //$NON-NLS-1
new ErrorPattern(Messages.MakeErrorParser_error_leaving, 0, 0) { //$NON-NLS-1
protected boolean recordError(Matcher matcher, ErrorParserManager eoParser) {
eoParser.popDirectory();
return true;
}
},
new ErrorPattern("(make: \\*\\*\\* \\[.*\\] Error .*)", 1, IMarkerGenerator.SEVERITY_ERROR_RESOURCE) { //$NON-NLS-1
new ErrorPattern(Messages.MakeErrorParser_error_general, 1, IMarkerGenerator.SEVERITY_ERROR_RESOURCE) { //$NON-NLS-1
protected boolean recordError(Matcher matcher, ErrorParserManager eoParser) {
if (!eoParser.hasErrors())
super.recordError(matcher, eoParser);

View file

@ -0,0 +1,41 @@
/*******************************************************************************
* Copyright (c) 2006 Siemens AG.
* All rights reserved. This content and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Norbert Ploett - Initial implementation
*******************************************************************************/
package org.eclipse.cdt.internal.errorparsers;
import org.eclipse.osgi.util.NLS;
public class Messages extends NLS {
private static final String BUNDLE_NAME = "org.eclipse.cdt.internal.errorparsers.messages"; //$NON-NLS-1$
public static String GCCErrorParser_sikp_instantiatedFromHere;
public static String GCCErrorParser_skip_forEachFunction;
public static String GCCErrorParser_skip_note;
public static String GCCErrorParser_skip_UndeclaredOnlyOnce;
public static String GCCErrorParser_varPattern_conflictTypes;
public static String GCCErrorParser_varPattern_defdNotUsed;
public static String GCCErrorParser_varPattern_parseError;
public static String GCCErrorParser_varPattern_undeclared;
public static String GCCErrorParser_Warnings;
public static String GLDErrorParser_error_general;
public static String GLDErrorParser_error_text;
public static String GLDErrorParser_warning_general;
public static String MakeErrorParser_error_entering;
public static String MakeErrorParser_error_general;
public static String MakeErrorParser_error_leaving;
static {
// initialize resource bundle
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
}
private Messages() {
}
}

View file

@ -0,0 +1,25 @@
###############################################################################
# Copyright (c) 2006 Siemens AG.
# All rights reserved. This content and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
# http://www.eclipse.org/legal/epl-v10.html
#
# Contributors:
# Norbert Ploett - Initial implementation
###############################################################################
GCCErrorParser_varPattern_undeclared='(.*)' undeclared
GCCErrorParser_varPattern_defdNotUsed='(.*)' defined but not used
GCCErrorParser_varPattern_conflictTypes=conflicting types for '(.*)'
GCCErrorParser_varPattern_parseError=parse error before '(.*)'
GCCErrorParser_skip_UndeclaredOnlyOnce=\\(Each undeclared identifier is reported only once
GCCErrorParser_skip_forEachFunction=for each function it appears in.\\)
GCCErrorParser_skip_note=: note:
GCCErrorParser_sikp_instantiatedFromHere=instantiated from here
GCCErrorParser_Warnings=(.*?):([0-9]+):([0-9]+:)? ((.*?[Ww]arning)?.*)
GLDErrorParser_error_text=(.*)\\(\\.text\\+.*\\): (.*)
GLDErrorParser_warning_general=ld(\\.exe)?: ([Ww]arning .*)
GLDErrorParser_error_general=ld(\\.exe)?: (.*)
MakeErrorParser_error_entering=make\\[(.*)\\]: Entering directory `(.*)'
MakeErrorParser_error_leaving=make\\[.*\\]: Leaving directory
MakeErrorParser_error_general=(make: \\*\\*\\* \\[.*\\] Error .*)