mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-159929 # in custom File templates in WebStorm are marked as errors
This commit is contained in:
@@ -29,6 +29,12 @@ public class FileTemplateLexerTest extends LexerTestCase {
|
||||
"MACRO ('$bar')");
|
||||
}
|
||||
|
||||
public void testLiveTemplates() {
|
||||
doTest("#[[$FOO$]]#", "ESCAPE ('#[[')\n" +
|
||||
"MACRO ('$FOO$')\n" +
|
||||
"ESCAPE (']]#')");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Lexer createLexer() {
|
||||
return FileTemplateConfigurable.createDefaultLexer();
|
||||
|
||||
+17
-13
@@ -52,8 +52,8 @@ class _FileTemplateTextLexer implements FlexLexer {
|
||||
|
||||
/* The ZZ_CMAP_A table has 256 entries */
|
||||
static final char ZZ_CMAP_A[] = zzUnpackCMap(
|
||||
"\43\0\1\6\1\3\13\0\12\2\7\0\32\1\1\0\1\7\2\0\1\1\1\0\32\1\1\4\1\0\1\5\202"+
|
||||
"\0");
|
||||
"\43\0\1\6\1\3\13\0\12\2\7\0\32\1\1\10\1\7\1\11\1\0\1\1\1\0\32\1\1\4\1\0\1"+
|
||||
"\5\202\0");
|
||||
|
||||
/**
|
||||
* Translates DFA states to action switch labels.
|
||||
@@ -61,10 +61,11 @@ class _FileTemplateTextLexer implements FlexLexer {
|
||||
private static final int [] ZZ_ACTION = zzUnpackAction();
|
||||
|
||||
private static final String ZZ_ACTION_PACKED_0 =
|
||||
"\1\0\4\1\1\2\1\0\1\3\1\4\1\0\1\2";
|
||||
"\1\0\5\1\1\2\1\0\1\3\1\0\1\4\1\0"+
|
||||
"\1\2\1\0";
|
||||
|
||||
private static int [] zzUnpackAction() {
|
||||
int [] result = new int[11];
|
||||
int [] result = new int[14];
|
||||
int offset = 0;
|
||||
offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result);
|
||||
return result;
|
||||
@@ -89,11 +90,11 @@ class _FileTemplateTextLexer implements FlexLexer {
|
||||
private static final int [] ZZ_ROWMAP = zzUnpackRowMap();
|
||||
|
||||
private static final String ZZ_ROWMAP_PACKED_0 =
|
||||
"\0\0\0\10\0\20\0\30\0\40\0\50\0\60\0\30"+
|
||||
"\0\10\0\70\0\10";
|
||||
"\0\0\0\12\0\24\0\36\0\50\0\62\0\74\0\106"+
|
||||
"\0\120\0\132\0\12\0\144\0\12\0\156";
|
||||
|
||||
private static int [] zzUnpackRowMap() {
|
||||
int [] result = new int[11];
|
||||
int [] result = new int[14];
|
||||
int offset = 0;
|
||||
offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result);
|
||||
return result;
|
||||
@@ -116,12 +117,14 @@ class _FileTemplateTextLexer implements FlexLexer {
|
||||
private static final int [] ZZ_TRANS = zzUnpackTrans();
|
||||
|
||||
private static final String ZZ_TRANS_PACKED_0 =
|
||||
"\3\2\1\3\2\2\1\4\1\5\11\0\2\6\1\0"+
|
||||
"\1\7\4\0\1\10\11\0\1\11\2\0\1\11\2\0"+
|
||||
"\2\6\6\0\2\12\6\0\2\12\2\0\1\13\2\0";
|
||||
"\3\2\1\3\2\2\1\4\1\5\1\2\1\6\13\0"+
|
||||
"\2\7\1\0\1\10\6\0\1\11\6\0\1\12\4\0"+
|
||||
"\1\13\2\0\1\13\14\0\1\14\1\0\2\7\1\15"+
|
||||
"\7\0\2\16\10\0\1\11\20\0\1\13\7\0\1\13"+
|
||||
"\4\0\2\16\2\0\1\15\4\0";
|
||||
|
||||
private static int [] zzUnpackTrans() {
|
||||
int [] result = new int[64];
|
||||
int [] result = new int[120];
|
||||
int offset = 0;
|
||||
offset = zzUnpackTrans(ZZ_TRANS_PACKED_0, offset, result);
|
||||
return result;
|
||||
@@ -159,10 +162,11 @@ class _FileTemplateTextLexer implements FlexLexer {
|
||||
private static final int [] ZZ_ATTRIBUTE = zzUnpackAttribute();
|
||||
|
||||
private static final String ZZ_ATTRIBUTE_PACKED_0 =
|
||||
"\1\0\1\11\4\1\1\0\1\1\1\11\1\0\1\11";
|
||||
"\1\0\1\11\5\1\1\0\1\1\1\0\1\11\1\0"+
|
||||
"\1\11\1\0";
|
||||
|
||||
private static int [] zzUnpackAttribute() {
|
||||
int [] result = new int[11];
|
||||
int [] result = new int[14];
|
||||
int offset = 0;
|
||||
offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result);
|
||||
return result;
|
||||
|
||||
+3
-1
@@ -20,13 +20,15 @@ import com.intellij.psi.tree.IElementType;
|
||||
|
||||
ALPHA=[A-Za-z_]
|
||||
DIGIT=[0-9]
|
||||
MACRO="$"({ALPHA}|{DIGIT})+|"$""{"({ALPHA}|{DIGIT})+"}"
|
||||
MACRO="$"({ALPHA}|{DIGIT})+|"$""{"({ALPHA}|{DIGIT})+"}"|"$"({ALPHA}|{DIGIT})+"$"
|
||||
DIRECTIVE="#"{ALPHA}+
|
||||
|
||||
%%
|
||||
|
||||
<YYINITIAL> "\\#" { return FileTemplateTokenType.ESCAPE; }
|
||||
<YYINITIAL> "\\$" { return FileTemplateTokenType.ESCAPE; }
|
||||
<YYINITIAL> "#[[" { return FileTemplateTokenType.ESCAPE; }
|
||||
<YYINITIAL> "]]#" { return FileTemplateTokenType.ESCAPE; }
|
||||
<YYINITIAL> {MACRO} { return FileTemplateTokenType.MACRO; }
|
||||
<YYINITIAL> {DIRECTIVE} { return FileTemplateTokenType.DIRECTIVE; }
|
||||
<YYINITIAL> [^] { return FileTemplateTokenType.TEXT; }
|
||||
|
||||
Reference in New Issue
Block a user