IDEA-194238 Custom file types comments conflicting

This commit is contained in:
peter
2018-06-20 09:12:22 +02:00
parent 017e3e4781
commit d60040d2ea
2 changed files with 11 additions and 3 deletions
@@ -62,12 +62,12 @@ public final class CustomFileTypeLexer extends AbstractCustomLexer {
ArrayList<TokenParser> tokenParsers = new ArrayList<>();
tokenParsers.add(new WhitespaceParser());
if (lineCommentParser != null) {
tokenParsers.add(lineCommentParser);
}
if (multilineCommentParser != null) {
tokenParsers.add(multilineCommentParser);
}
if (lineCommentParser != null) {
tokenParsers.add(lineCommentParser);
}
tokenParsers.add(keywordParser);
tokenParsers.add(quotedStringParser);
tokenParsers.add(quotedStringParser2);
@@ -272,6 +272,14 @@ MULTI_LINE_COMMENT ('/* a\\n *bc */')
doTest createJavaSyntaxTable(), "//", 'LINE_COMMENT (\'//\')\n'
}
void "test block comment start overrides line comment start"() {
def table = new SyntaxTable()
table.lineComment = '#'
table.startComment = '#{'
table.endComment = '}#'
doTest table, "#{ \nblock\n #}", 'MULTI_LINE_COMMENT (\'#{ \\nblock\\n #}\')\n'
}
void testEmpty() {
doTest createJavaSyntaxTable(), "", ''
}