List of usage examples for org.eclipse.jdt.internal.compiler.parser ScannerHelper isJavaIdentifierStart
public static boolean isJavaIdentifierStart(char c)
From source file:com.codenvy.ide.ext.java.server.core.search.SearchPattern.java
License:Open Source License
private static boolean validateCamelCasePattern(String stringPattern) { if (stringPattern == null) return true; // verify sting pattern validity int length = stringPattern.length(); boolean validCamelCase = true; boolean lowerCamelCase = false; int uppercase = 0; for (int i = 0; i < length && validCamelCase; i++) { char ch = stringPattern.charAt(i); validCamelCase = i == 0 ? ScannerHelper.isJavaIdentifierStart(ch) : ScannerHelper.isJavaIdentifierPart(ch); // at least one uppercase character is need in CamelCase pattern // (see bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=136313) if (ScannerHelper.isUpperCase(ch)) uppercase++;//from w w w . ja v a2 s .c o m if (i == 0) lowerCamelCase = uppercase == 0; } if (validCamelCase) { validCamelCase = lowerCamelCase ? uppercase > 0 : uppercase > 1; } return validCamelCase; }
From source file:com.codenvy.ide.ext.java.server.internal.core.BinaryMethod.java
License:Open Source License
private boolean isOpenParenForMethod(String javaDoc, String methodName, int index) { /*//ww w . j a v a 2 s.com * Annotations can have parameters associated with them, so we need to validate that this parameter list is * actually for the method. Determine this by scanning backwards from where the paren was seen, skipping over * HTML tags to find the identifier that precedes the paren, and then matching that identifier against the * method's name. */ boolean scanningTag = false; int endIndex = 0; while (--index > methodName.length()) { char previousChar = javaDoc.charAt(index); if (endIndex > 0) { if (!ScannerHelper.isJavaIdentifierPart(previousChar) || !ScannerHelper.isJavaIdentifierStart(previousChar)) return methodName.equals(javaDoc.substring(index + 1, endIndex)); } else if (!scanningTag) { if (previousChar == '>') scanningTag = true; else if (ScannerHelper.isJavaIdentifierPart(previousChar) || ScannerHelper.isJavaIdentifierStart(previousChar)) endIndex = index + 1; } else if (previousChar == '<') // We are only matching angle brackets here, without any other validation of the tags. scanningTag = false; } return false; }