From b34b8c861011153558302a243b7e550fa70644d0 Mon Sep 17 00:00:00 2001 From: Bas Leijdekkers Date: Thu, 19 May 2016 14:19:39 +0200 Subject: [PATCH] regex: allow ruby named group calls (\g) (RUBY-8357) --- RegExpSupport/gen/org/intellij/lang/regexp/_RegExLexer.java | 2 +- RegExpSupport/src/org/intellij/lang/regexp/regexp-lexer.flex | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/RegExpSupport/gen/org/intellij/lang/regexp/_RegExLexer.java b/RegExpSupport/gen/org/intellij/lang/regexp/_RegExLexer.java index bcfa569b192c..03a8f0924148 100644 --- a/RegExpSupport/gen/org/intellij/lang/regexp/_RegExLexer.java +++ b/RegExpSupport/gen/org/intellij/lang/regexp/_RegExLexer.java @@ -62,7 +62,7 @@ class _RegExLexer implements FlexLexer { "\1\65\1\20\1\0\1\26\1\26\1\35\1\33\1\43\1\41\1\27"+ "\1\50\1\36\2\13\1\55\1\55\1\55\1\13\1\40\1\42\1\31"+ "\1\32\2\13\1\31\1\31\1\31\1\13\1\30\1\10\1\12\1\11"+ - "\1\16\1\14\1\0\1\25\1\26\1\34\1\33\1\25\1\25\1\13"+ + "\1\16\1\14\1\0\1\25\1\26\1\34\1\33\1\25\1\25\1\51"+ "\1\50\1\36\1\13\1\51\2\13\1\24\1\13\1\37\1\13\1\24"+ "\1\31\1\24\1\45\1\31\1\31\1\44\1\13\1\27\1\6\1\23"+ "\1\7\7\0\1\60\44\0\1\13\12\0\1\13\4\0\1\13\5\0"+ diff --git a/RegExpSupport/src/org/intellij/lang/regexp/regexp-lexer.flex b/RegExpSupport/src/org/intellij/lang/regexp/regexp-lexer.flex index b498a2ebe420..95388f7e7b02 100644 --- a/RegExpSupport/src/org/intellij/lang/regexp/regexp-lexer.flex +++ b/RegExpSupport/src/org/intellij/lang/regexp/regexp-lexer.flex @@ -177,6 +177,8 @@ HEX_CHAR=[0-9a-fA-F] {ESCAPE} [hH] { return (allowHexDigitClass || allowHorizontalWhitespaceClass ? RegExpTT.CHAR_CLASS : StringEscapesTokenTypes.INVALID_CHARACTER_ESCAPE_TOKEN); } {ESCAPE} "k<" { yybegin(NAMED_GROUP); return RegExpTT.RUBY_NAMED_GROUP_REF; } {ESCAPE} "k'" { yybegin(QUOTED_NAMED_GROUP); return RegExpTT.RUBY_QUOTED_NAMED_GROUP_REF; } +{ESCAPE} "g<" { yybegin(NAMED_GROUP); return RegExpTT.RUBY_NAMED_GROUP_REF; } +{ESCAPE} "g'" { yybegin(QUOTED_NAMED_GROUP); return RegExpTT.RUBY_QUOTED_NAMED_GROUP_REF; } {ESCAPE} [:letter:] { return StringEscapesTokenTypes.INVALID_CHARACTER_ESCAPE_TOKEN; } {ESCAPE} [\n\b\t\r\f ] { return commentMode ? RegExpTT.CHARACTER : RegExpTT.REDUNDANT_ESCAPE; }