}
public static void assertValidIdentifier(String name, String message, ASTNode node) {
int size = name.length();
if (size <= 0) {
throw new RuntimeParserException("Invalid " + message + ". Identifier must not be empty", node);
}
char firstCh = name.charAt(0);
if (size == 1 && firstCh == '$') {
throw new RuntimeParserException("Invalid " + message + ". Must include a letter but only found: " + name, node);
}
if (!Character.isJavaIdentifierStart(firstCh)) {
throw new RuntimeParserException("Invalid " + message + ". Must start with a letter but was: " + name, node);
}
for (int i = 1; i < size; i++) {
char ch = name.charAt(i);
if (!Character.isJavaIdentifierPart(ch)) {
throw new RuntimeParserException("Invalid " + message + ". Invalid character at position: " + (i + 1) + " of value: " + ch + " in name: " + name, node);
}
}
}