Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Keller2011-04-08 14:44:56 +0000
committerMarkus Keller2011-04-08 14:44:56 +0000
commitf153ecc63fd98ac0de4c2109c38bb108fa63d900 (patch)
tree9ebd93030a0da59c3576198876ac38fc272400ed /org.eclipse.text
parent9d09c3fbac71e02660d12373e75d5fd1bc5b56b2 (diff)
downloadeclipse.platform.text-f153ecc63fd98ac0de4c2109c38bb108fa63d900.tar.gz
eclipse.platform.text-f153ecc63fd98ac0de4c2109c38bb108fa63d900.tar.xz
eclipse.platform.text-f153ecc63fd98ac0de4c2109c38bb108fa63d900.zip
Bug 342295: [templates] Template variable names can only contain ASCII characters
Diffstat (limited to 'org.eclipse.text')
-rw-r--r--org.eclipse.text/src/org/eclipse/jface/text/templates/TemplateTranslator.java12
1 files changed, 9 insertions, 3 deletions
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 f1c6fe05d..8cfba7a3c 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
@@ -42,10 +42,16 @@ import java.util.regex.Pattern;
*/
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$

Back to the top