From f153ecc63fd98ac0de4c2109c38bb108fa63d900 Mon Sep 17 00:00:00 2001 From: Markus Keller Date: Fri, 8 Apr 2011 14:44:56 +0000 Subject: Bug 342295: [templates] Template variable names can only contain ASCII characters --- .../org/eclipse/jface/text/templates/TemplateTranslator.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'org.eclipse.text') diff --git a/org.eclipse.text/src/org/eclipse/jface/text/templates/TemplateTranslator.java b/org.eclipse.text/src/org/eclipse/jface/text/templates/TemplateTranslator.java index f1c6fe05dfd..8cfba7a3c52 100644 --- a/org.eclipse.text/src/org/eclipse/jface/text/templates/TemplateTranslator.java +++ b/org.eclipse.text/src/org/eclipse/jface/text/templates/TemplateTranslator.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2011 IBM Corporation and others. * All rights reserved. This program 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 @@ -41,11 +41,17 @@ import java.util.regex.Pattern; * @since 3.0 */ public class TemplateTranslator { + /** + * Regex pattern for identifier + * @since 3.7 + */ + private static final String IDENTIFIER= "(?:[\\p{javaJavaIdentifierStart}&&[^\\$]][\\p{javaJavaIdentifierPart}&&[^\\$]]*+)"; //$NON-NLS-1$ + /** * Regex pattern for qualifiedname * @since 3.4 */ - private static final String QUALIFIED_NAME= "(?:\\w++\\.)*+\\w++"; //$NON-NLS-1$ + private static final String QUALIFIED_NAME= "(?:" + IDENTIFIER + "\\.)*+" + IDENTIFIER; //$NON-NLS-1$ //$NON-NLS-2$ /** * Regex pattern for argumenttext @@ -78,7 +84,7 @@ public class TemplateTranslator { private static final Pattern ESCAPE_PATTERN= Pattern.compile( "\\$\\$|\\$\\{" + // $$|${ //$NON-NLS-1$ SPACES + - "(\\w*+)" + // variable id group (1) //$NON-NLS-1$ + "(" + IDENTIFIER + "?+)" + // variable id group (1) //$NON-NLS-1$ //$NON-NLS-2$ SPACES + "(?:" + //$NON-NLS-1$ ":" + //$NON-NLS-1$ -- cgit v1.2.3