From 6033d81d83272b95bf7a6e89d50cc73a0c2da883 Mon Sep 17 00:00:00 2001 From: Dmitry Trofimov Date: Fri, 13 May 2011 15:37:40 +0400 Subject: [PATCH] Django template parser: error on wrong ids in member parsing (PY-2342). --- python/src/com/jetbrains/python/PyNames.java | 7 +++++-- python/src/com/jetbrains/python/psi/PyUtil.java | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/python/src/com/jetbrains/python/PyNames.java b/python/src/com/jetbrains/python/PyNames.java index ec858b21ee73..93aedc4c3fe3 100644 --- a/python/src/com/jetbrains/python/PyNames.java +++ b/python/src/com/jetbrains/python/PyNames.java @@ -2,8 +2,11 @@ package com.jetbrains.python; import com.google.common.collect.ImmutableSet; import org.jetbrains.annotations.NonNls; +import org.jetbrains.annotations.NotNull; -import java.util.*; +import java.util.Collections; +import java.util.Map; +import java.util.TreeMap; import java.util.regex.Pattern; /** @@ -241,7 +244,7 @@ public class PyNames { * @param name what to check * @return true iff name is not reserved and is a well-formed identifier. */ - public static boolean isIdentifier(@NonNls String name) { + public static boolean isIdentifier(@NotNull @NonNls String name) { return ! isReserved(name) && IDENTIFIER_PATTERN.matcher(name).matches(); } diff --git a/python/src/com/jetbrains/python/psi/PyUtil.java b/python/src/com/jetbrains/python/psi/PyUtil.java index 0ba219a55b8d..42cf7ce1e303 100644 --- a/python/src/com/jetbrains/python/psi/PyUtil.java +++ b/python/src/com/jetbrains/python/psi/PyUtil.java @@ -664,7 +664,7 @@ public class PyUtil { return name.startsWith("__") && !name.endsWith("__"); } - public static boolean isPythonIdentifier(String name) { + public static boolean isPythonIdentifier(@NotNull String name) { return PyNames.isIdentifier(name); }