From bb0227870704537864067207d6c2dc9decdc720d Mon Sep 17 00:00:00 2001 From: peter Date: Sun, 11 Mar 2012 16:53:04 +0400 Subject: [PATCH] more special keyword characters (IDEA-82441) --- .../ide/highlighter/custom/tokens/KeywordParser.java | 2 +- .../ide/highlighter/custom/CustomFileTypeLexerTest.groovy | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/ide/highlighter/custom/tokens/KeywordParser.java b/platform/lang-impl/src/com/intellij/ide/highlighter/custom/tokens/KeywordParser.java index 239a3501b392..5de6e92ed7b6 100644 --- a/platform/lang-impl/src/com/intellij/ide/highlighter/custom/tokens/KeywordParser.java +++ b/platform/lang-impl/src/com/intellij/ide/highlighter/custom/tokens/KeywordParser.java @@ -66,7 +66,7 @@ public class KeywordParser extends TokenParser { word = word.replace("\\", "\\\\"); for (int i = 0; i < word.length(); i++) { char ch = word.charAt(i); - if ("-*+?$%^.()".indexOf(ch) >= 0) esc.append('\\'); + if ("-*+?$%^.(){}[]|".indexOf(ch) >= 0) esc.append('\\'); esc.append(ch); } word = esc.toString(); diff --git a/platform/platform-tests/testSrc/com/intellij/ide/highlighter/custom/CustomFileTypeLexerTest.groovy b/platform/platform-tests/testSrc/com/intellij/ide/highlighter/custom/CustomFileTypeLexerTest.groovy index b7333a184b5a..724b240c7256 100644 --- a/platform/platform-tests/testSrc/com/intellij/ide/highlighter/custom/CustomFileTypeLexerTest.groovy +++ b/platform/platform-tests/testSrc/com/intellij/ide/highlighter/custom/CustomFileTypeLexerTest.groovy @@ -306,7 +306,8 @@ CHARACTER (')') table.addKeyword1("b-c") table.addKeyword2("d#") table.addKeyword2("e") - doTest table, 'a* b-c d# e-', '''\ + table.addKeyword2("foo{}") + doTest table, 'a* b-c d# e- e foo{}', '''\ KEYWORD_1 ('a*') WHITESPACE (' ') KEYWORD_1 ('b-c') @@ -314,6 +315,10 @@ WHITESPACE (' ') KEYWORD_2 ('d#') WHITESPACE (' ') IDENTIFIER ('e-') +WHITESPACE (' ') +KEYWORD_2 ('e') +WHITESPACE (' ') +KEYWORD_2 ('foo{}') ''' }