mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
es6 regex named groups: lex names according to spec
WEB-27638, IDEA-CR-29571
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -41,7 +41,7 @@ public interface RegExpLanguageHost {
|
||||
}
|
||||
boolean supportsExtendedHexCharacter(RegExpChar regExpChar);
|
||||
|
||||
default boolean isValidGroupName(String name, @NotNull PsiElement context) {
|
||||
default boolean isValidGroupName(String name, @NotNull RegExpGroup group) {
|
||||
for (int i = 0, length = name.length(); i < length; i++) {
|
||||
final char c = name.charAt(i);
|
||||
if (!AsciiUtil.isLetterOrDigit(c) && c != '_') {
|
||||
|
||||
@@ -117,9 +117,9 @@ public final class RegExpLanguageHosts extends ClassExtension<RegExpLanguageHost
|
||||
return host.getSupportedNamedGroupTypes(context);
|
||||
}
|
||||
|
||||
public boolean isValidGroupName(String name, @Nullable final PsiElement context) {
|
||||
final RegExpLanguageHost host = findRegExpHost(context);
|
||||
return host != null && host.isValidGroupName(name, context);
|
||||
public boolean isValidGroupName(String name, @Nullable final RegExpGroup group) {
|
||||
final RegExpLanguageHost host = findRegExpHost(group);
|
||||
return host != null && host.isValidGroupName(name, group);
|
||||
}
|
||||
|
||||
public boolean supportsPerl5EmbeddedComments(@Nullable final PsiComment comment) {
|
||||
|
||||
@@ -129,7 +129,9 @@ RBRACKET="]"
|
||||
|
||||
ESCAPE="\\"
|
||||
NAME=[:letter:]([:letter:]|_|-|" "|"("|")"|[:digit:])*
|
||||
GROUP_NAME=[:letter:]([:letter:]|_|-|" "|[:digit:])*
|
||||
GROUP_NAME_START=[:letter:]|_|\$|\\
|
||||
GROUP_NAME_PART={GROUP_NAME_START}|-|" "|[:digit:]
|
||||
GROUP_NAME={GROUP_NAME_START}({GROUP_NAME_PART})*
|
||||
MYSQL_CHAR_NAME=[:letter:](-|[:letter:])*[:digit:]?
|
||||
ANY=[^]
|
||||
|
||||
|
||||
@@ -183,7 +183,7 @@ public class JavaRegExpHost implements RegExpLanguageHost {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValidGroupName(String name, @NotNull PsiElement context) {
|
||||
public boolean isValidGroupName(String name, @NotNull RegExpGroup group) {
|
||||
for (int i = 0, length = name.length(); i < length; i++) {
|
||||
final char c = name.charAt(i);
|
||||
if (!AsciiUtil.isLetterOrDigit(c)) {
|
||||
|
||||
Reference in New Issue
Block a user