introduce groovy-psi module

This commit is contained in:
Alexey Kudravtsev
2014-05-19 19:17:09 +04:00
parent 65b4b98a59
commit a093f0d3e8
52 changed files with 1748 additions and 1646 deletions

1
.idea/modules.xml generated
View File

@@ -90,6 +90,7 @@
<module fileurl="file://$PROJECT_DIR$/plugins/javaFX/javaFX-jps-plugin/javaFX-jps-plugin.iml" filepath="$PROJECT_DIR$/plugins/javaFX/javaFX-jps-plugin/javaFX-jps-plugin.iml" group="plugins/JavaFX" />
<module fileurl="file://$PROJECT_DIR$/java/compiler/javac2/javac2.iml" filepath="$PROJECT_DIR$/java/compiler/javac2/javac2.iml" group="java/compiler" />
<module fileurl="file://$PROJECT_DIR$/plugins/cvs/javacvs-src/javacvs-src.iml" filepath="$PROJECT_DIR$/plugins/cvs/javacvs-src/javacvs-src.iml" group="plugins/VCS/cvs" />
<module fileurl="file://$PROJECT_DIR$/plugins/groovy/groovy-psi/groovy-psi.iml" filepath="$PROJECT_DIR$/plugins/groovy/groovy-psi/groovy-psi.iml" group="plugins/Groovy" />
<module fileurl="file://$PROJECT_DIR$/plugins/groovy/jetgroovy.iml" filepath="$PROJECT_DIR$/plugins/groovy/jetgroovy.iml" group="plugins/Groovy" />
<module fileurl="file://$PROJECT_DIR$/plugins/tasks/tasks-core/jira/jira.iml" filepath="$PROJECT_DIR$/plugins/tasks/tasks-core/jira/jira.iml" group="plugins/tasks" />
<module fileurl="file://$PROJECT_DIR$/jps/jps-builders/jps-builders.iml" filepath="$PROJECT_DIR$/jps/jps-builders/jps-builders.iml" group="jps" />

View File

@@ -450,6 +450,7 @@ public def layoutCommunityPlugins(String home) {
module("jetgroovy") {
exclude(name: "standardDsls/**")
}
module("groovy-psi")
}
//layout of groovy jars must be consistent with GroovyBuilder.getGroovyRtRoot method
jar("groovy-jps-plugin.jar") {

View File

@@ -1,7 +1,6 @@
/* The following code was generated by JFlex 1.4.3 on 4/26/14 2:10 PM */
/*
* Copyright 2000-2008 JetBrains s.r.o.
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -15,20 +14,22 @@
* limitations under the License.
*/
/* The following code was generated by JFlex 1.4.3 on 19.05.14 19:07 */
package org.jetbrains.plugins.groovy.lang.groovydoc.lexer;
import com.intellij.lexer.FlexLexer;
import com.intellij.psi.tree.IElementType;
import com.intellij.psi.TokenType;
import com.intellij.psi.tree.IElementType;
/**
* This class is a scanner generated by
* <a href="http://www.jflex.de/">JFlex</a> 1.4.3
* on 4/26/14 2:10 PM from the specification file
* <tt>/Users/ignatov/src/ultimate/tools/lexer/../../community/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/groovydoc/lexer/gdoc.flex</tt>
* on 19.05.14 19:07 from the specification file
* <tt>C:/Work/Idea/tools/lexer/../../community/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/groovydoc/lexer/gdoc.flex</tt>
*/
public class _GroovyDocLexer implements FlexLexer, GroovyDocTokenTypes, TokenType {
public class _GroovyDocLexer implements FlexLexer {
/** initial size of the lookahead buffer */
private static final int ZZ_BUFFERSIZE = 16384;
@@ -63,64 +64,84 @@ public class _GroovyDocLexer implements FlexLexer, GroovyDocTokenTypes, TokenTyp
"\12\3\1\5\1\0\1\22\1\0\1\23\1\0\1\15\32\4\1\10"+
"\1\0\1\10\1\0\1\4\1\0\1\17\13\4\1\21\2\4\1\16"+
"\1\4\1\20\10\4\1\24\1\0\1\25\44\0\4\4\4\0\1\4"+
"\12\0\1\4\4\0\1\4\5\0\27\4\1\0\37\4\1\0\u013f\4"+
"\31\0\162\4\4\0\14\4\16\0\5\4\11\0\1\4\213\0\1\4"+
"\13\0\1\4\1\0\3\4\1\0\1\4\1\0\24\4\1\0\54\4"+
"\1\0\46\4\1\0\5\4\4\0\202\4\10\0\105\4\1\0\46\4"+
"\2\0\2\4\6\0\20\4\41\0\46\4\2\0\1\4\7\0\47\4"+
"\110\0\33\4\5\0\3\4\56\0\32\4\5\0\13\4\43\0\2\4"+
"\1\0\143\4\1\0\1\4\17\0\2\4\7\0\2\4\12\0\3\4"+
"\2\0\1\4\20\0\1\4\1\0\36\4\35\0\3\4\60\0\46\4"+
"\13\0\1\4\u0152\0\66\4\3\0\1\4\22\0\1\4\7\0\12\4"+
"\43\0\10\4\2\0\2\4\2\0\26\4\1\0\7\4\1\0\1\4"+
"\3\0\4\4\3\0\1\4\36\0\2\4\1\0\3\4\16\0\4\4"+
"\21\0\6\4\4\0\2\4\2\0\26\4\1\0\7\4\1\0\2\4"+
"\1\0\2\4\1\0\2\4\37\0\4\4\1\0\1\4\23\0\3\4"+
"\20\0\11\4\1\0\3\4\1\0\26\4\1\0\7\4\1\0\2\4"+
"\1\0\5\4\3\0\1\4\22\0\1\4\17\0\2\4\17\0\1\4"+
"\23\0\10\4\2\0\2\4\2\0\26\4\1\0\7\4\1\0\2\4"+
"\1\0\5\4\3\0\1\4\36\0\2\4\1\0\3\4\17\0\1\4"+
"\21\0\1\4\1\0\6\4\3\0\3\4\1\0\4\4\3\0\2\4"+
"\1\0\1\4\1\0\2\4\3\0\2\4\3\0\3\4\3\0\10\4"+
"\1\0\3\4\77\0\1\4\13\0\10\4\1\0\3\4\1\0\27\4"+
"\1\0\12\4\1\0\5\4\46\0\2\4\43\0\10\4\1\0\3\4"+
"\1\0\27\4\1\0\12\4\1\0\5\4\3\0\1\4\40\0\1\4"+
"\1\0\2\4\43\0\10\4\1\0\3\4\1\0\27\4\1\0\20\4"+
"\46\0\2\4\43\0\22\4\3\0\30\4\1\0\11\4\1\0\1\4"+
"\2\0\7\4\72\0\60\4\1\0\2\4\13\0\10\4\72\0\2\4"+
"\1\0\1\4\2\0\2\4\1\0\1\4\2\0\1\4\6\0\4\4"+
"\1\0\7\4\1\0\3\4\1\0\1\4\1\0\1\4\2\0\2\4"+
"\1\0\4\4\1\0\2\4\11\0\1\4\2\0\5\4\1\0\1\4"+
"\25\0\2\4\42\0\1\4\77\0\10\4\1\0\42\4\35\0\4\4"+
"\164\0\42\4\1\0\5\4\1\0\2\4\45\0\6\4\112\0\46\4"+
"\12\0\51\4\7\0\132\4\5\0\104\4\5\0\122\4\6\0\7\4"+
"\1\0\77\4\1\0\1\4\1\0\4\4\2\0\7\4\1\0\1\4"+
"\1\0\4\4\2\0\47\4\1\0\1\4\1\0\4\4\2\0\37\4"+
"\1\0\1\4\1\0\4\4\2\0\7\4\1\0\1\4\1\0\4\4"+
"\2\0\7\4\1\0\7\4\1\0\27\4\1\0\37\4\1\0\1\4"+
"\1\0\4\4\2\0\7\4\1\0\47\4\1\0\23\4\105\0\125\4"+
"\14\0\u026c\4\2\0\10\4\12\0\32\4\5\0\113\4\3\0\3\4"+
"\17\0\15\4\1\0\4\4\16\0\22\4\16\0\22\4\16\0\15\4"+
"\1\0\3\4\17\0\64\4\43\0\1\4\3\0\2\4\103\0\130\4"+
"\10\0\51\4\127\0\35\4\63\0\36\4\2\0\5\4\u038b\0\154\4"+
"\224\0\234\4\4\0\132\4\6\0\26\4\2\0\6\4\2\0\46\4"+
"\2\0\6\4\2\0\10\4\1\0\1\4\1\0\1\4\1\0\1\4"+
"\1\0\37\4\2\0\65\4\1\0\7\4\1\0\1\4\3\0\3\4"+
"\1\0\7\4\3\0\4\4\2\0\6\4\4\0\15\4\5\0\3\4"+
"\1\0\7\4\102\0\2\4\23\0\1\4\34\0\1\4\15\0\1\4"+
"\40\0\22\4\120\0\1\4\4\0\1\4\2\0\12\4\1\0\1\4"+
"\3\0\5\4\6\0\1\4\1\0\1\4\1\0\1\4\1\0\4\4"+
"\1\0\3\4\1\0\7\4\3\0\3\4\5\0\5\4\26\0\44\4"+
"\u0e81\0\3\4\31\0\11\4\7\0\5\4\2\0\5\4\4\0\126\4"+
"\6\0\3\4\1\0\137\4\5\0\50\4\4\0\136\4\21\0\30\4"+
"\70\0\20\4\u0200\0\u19b6\4\112\0\u51a6\4\132\0\u048d\4\u0773\0\u2ba4\4"+
"\u215c\0\u012e\4\2\0\73\4\225\0\7\4\14\0\5\4\5\0\1\4"+
"\1\0\12\4\1\0\15\4\1\0\5\4\1\0\1\4\1\0\2\4"+
"\1\0\2\4\1\0\154\4\41\0\u016b\4\22\0\100\4\2\0\66\4"+
"\50\0\15\4\66\0\2\4\30\0\3\4\31\0\1\4\6\0\5\4"+
"\1\0\207\4\7\0\1\4\34\0\32\4\4\0\1\4\1\0\32\4"+
"\12\0\132\4\3\0\6\4\2\0\6\4\2\0\6\4\2\0\3\4"+
"\3\0\2\4\3\0\2\4\31\0";
"\12\0\1\4\4\0\1\4\5\0\27\4\1\0\37\4\1\0\u01ca\4"+
"\4\0\14\4\16\0\5\4\7\0\1\4\1\0\1\4\201\0\5\4"+
"\1\0\2\4\2\0\4\4\10\0\1\4\1\0\3\4\1\0\1\4"+
"\1\0\24\4\1\0\123\4\1\0\213\4\10\0\236\4\11\0\46\4"+
"\2\0\1\4\7\0\47\4\7\0\1\4\100\0\33\4\5\0\3\4"+
"\30\0\1\4\24\0\53\4\43\0\2\4\1\0\143\4\1\0\1\4"+
"\17\0\2\4\7\0\2\4\12\0\3\4\2\0\1\4\20\0\1\4"+
"\1\0\36\4\35\0\131\4\13\0\1\4\30\0\41\4\11\0\2\4"+
"\4\0\1\4\5\0\26\4\4\0\1\4\11\0\1\4\3\0\1\4"+
"\27\0\31\4\107\0\1\4\1\0\13\4\127\0\66\4\3\0\1\4"+
"\22\0\1\4\7\0\12\4\17\0\7\4\1\0\7\4\5\0\10\4"+
"\2\0\2\4\2\0\26\4\1\0\7\4\1\0\1\4\3\0\4\4"+
"\3\0\1\4\20\0\1\4\15\0\2\4\1\0\3\4\16\0\4\4"+
"\7\0\1\4\11\0\6\4\4\0\2\4\2\0\26\4\1\0\7\4"+
"\1\0\2\4\1\0\2\4\1\0\2\4\37\0\4\4\1\0\1\4"+
"\23\0\3\4\20\0\11\4\1\0\3\4\1\0\26\4\1\0\7\4"+
"\1\0\2\4\1\0\5\4\3\0\1\4\22\0\1\4\17\0\2\4"+
"\17\0\1\4\23\0\10\4\2\0\2\4\2\0\26\4\1\0\7\4"+
"\1\0\2\4\1\0\5\4\3\0\1\4\36\0\2\4\1\0\3\4"+
"\17\0\1\4\21\0\1\4\1\0\6\4\3\0\3\4\1\0\4\4"+
"\3\0\2\4\1\0\1\4\1\0\2\4\3\0\2\4\3\0\3\4"+
"\3\0\14\4\26\0\1\4\50\0\1\4\13\0\10\4\1\0\3\4"+
"\1\0\27\4\1\0\12\4\1\0\5\4\3\0\1\4\32\0\2\4"+
"\6\0\2\4\43\0\10\4\1\0\3\4\1\0\27\4\1\0\12\4"+
"\1\0\5\4\3\0\1\4\40\0\1\4\1\0\2\4\17\0\2\4"+
"\22\0\10\4\1\0\3\4\1\0\51\4\2\0\1\4\20\0\1\4"+
"\21\0\2\4\30\0\6\4\5\0\22\4\3\0\30\4\1\0\11\4"+
"\1\0\1\4\2\0\7\4\72\0\60\4\1\0\2\4\13\0\10\4"+
"\72\0\2\4\1\0\1\4\2\0\2\4\1\0\1\4\2\0\1\4"+
"\6\0\4\4\1\0\7\4\1\0\3\4\1\0\1\4\1\0\1\4"+
"\2\0\2\4\1\0\4\4\1\0\2\4\11\0\1\4\2\0\5\4"+
"\1\0\1\4\25\0\4\4\40\0\1\4\77\0\10\4\1\0\44\4"+
"\33\0\5\4\163\0\53\4\24\0\1\4\20\0\6\4\4\0\4\4"+
"\3\0\1\4\3\0\2\4\7\0\3\4\4\0\15\4\14\0\1\4"+
"\21\0\46\4\1\0\1\4\5\0\1\4\2\0\53\4\1\0\u014d\4"+
"\1\0\4\4\2\0\7\4\1\0\1\4\1\0\4\4\2\0\51\4"+
"\1\0\4\4\2\0\41\4\1\0\4\4\2\0\7\4\1\0\1\4"+
"\1\0\4\4\2\0\17\4\1\0\71\4\1\0\4\4\2\0\103\4"+
"\45\0\20\4\20\0\125\4\14\0\u026c\4\2\0\21\4\1\0\32\4"+
"\5\0\113\4\3\0\3\4\17\0\15\4\1\0\4\4\16\0\22\4"+
"\16\0\22\4\16\0\15\4\1\0\3\4\17\0\64\4\43\0\1\4"+
"\3\0\2\4\103\0\130\4\10\0\51\4\1\0\1\4\5\0\106\4"+
"\12\0\35\4\63\0\36\4\2\0\5\4\13\0\54\4\25\0\7\4"+
"\70\0\27\4\11\0\65\4\122\0\1\4\135\0\57\4\21\0\7\4"+
"\67\0\36\4\15\0\2\4\12\0\54\4\32\0\44\4\51\0\3\4"+
"\12\0\44\4\153\0\4\4\1\0\4\4\3\0\2\4\11\0\300\4"+
"\100\0\u0116\4\2\0\6\4\2\0\46\4\2\0\6\4\2\0\10\4"+
"\1\0\1\4\1\0\1\4\1\0\1\4\1\0\37\4\2\0\65\4"+
"\1\0\7\4\1\0\1\4\3\0\3\4\1\0\7\4\3\0\4\4"+
"\2\0\6\4\4\0\15\4\5\0\3\4\1\0\7\4\102\0\2\4"+
"\23\0\1\4\34\0\1\4\15\0\1\4\20\0\15\4\3\0\33\4"+
"\107\0\1\4\4\0\1\4\2\0\12\4\1\0\1\4\3\0\5\4"+
"\6\0\1\4\1\0\1\4\1\0\1\4\1\0\4\4\1\0\13\4"+
"\2\0\4\4\5\0\5\4\4\0\1\4\21\0\51\4\u0a77\0\57\4"+
"\1\0\57\4\1\0\205\4\6\0\4\4\3\0\2\4\14\0\46\4"+
"\1\0\1\4\5\0\1\4\2\0\70\4\7\0\1\4\20\0\27\4"+
"\11\0\7\4\1\0\7\4\1\0\7\4\1\0\7\4\1\0\7\4"+
"\1\0\7\4\1\0\7\4\1\0\7\4\120\0\1\4\u01d5\0\3\4"+
"\31\0\11\4\7\0\5\4\2\0\5\4\4\0\126\4\6\0\3\4"+
"\1\0\132\4\1\0\4\4\5\0\51\4\3\0\136\4\21\0\33\4"+
"\65\0\20\4\u0200\0\u19b6\4\112\0\u51cd\4\63\0\u048d\4\103\0\56\4"+
"\2\0\u010d\4\3\0\20\4\12\0\2\4\24\0\57\4\20\0\31\4"+
"\10\0\120\4\47\0\11\4\2\0\147\4\2\0\4\4\1\0\4\4"+
"\14\0\13\4\115\0\12\4\1\0\3\4\1\0\4\4\1\0\27\4"+
"\25\0\1\4\7\0\64\4\16\0\62\4\76\0\6\4\3\0\1\4"+
"\16\0\34\4\12\0\27\4\31\0\35\4\7\0\57\4\34\0\1\4"+
"\60\0\51\4\27\0\3\4\1\0\10\4\24\0\27\4\3\0\1\4"+
"\5\0\60\4\1\0\1\4\3\0\2\4\2\0\5\4\2\0\1\4"+
"\1\0\1\4\30\0\3\4\2\0\13\4\7\0\3\4\14\0\6\4"+
"\2\0\6\4\2\0\6\4\11\0\7\4\1\0\7\4\221\0\43\4"+
"\35\0\u2ba4\4\14\0\27\4\4\0\61\4\u2104\0\u016e\4\2\0\152\4"+
"\46\0\7\4\14\0\5\4\5\0\1\4\1\0\12\4\1\0\15\4"+
"\1\0\5\4\1\0\1\4\1\0\2\4\1\0\2\4\1\0\154\4"+
"\41\0\u016b\4\22\0\100\4\2\0\66\4\50\0\15\4\66\0\2\4"+
"\30\0\3\4\31\0\1\4\6\0\5\4\1\0\207\4\7\0\1\4"+
"\34\0\32\4\4\0\1\4\1\0\32\4\13\0\131\4\3\0\6\4"+
"\2\0\6\4\2\0\6\4\2\0\3\4\3\0\2\4\3\0\2\4"+
"\31\0";
/**
* Translates characters to character classes
@@ -362,7 +383,7 @@ public class _GroovyDocLexer implements FlexLexer, GroovyDocTokenTypes, TokenTyp
char [] map = new char[0x10000];
int i = 0; /* index in packed string */
int j = 0; /* index in unpacked array */
while (i < 1250) {
while (i < 1642) {
int count = packed.charAt(i++);
char value = packed.charAt(i++);
do map[j++] = value; while (--count > 0);
@@ -584,6 +605,70 @@ public class _GroovyDocLexer implements FlexLexer, GroovyDocTokenTypes, TokenTyp
zzMarkedPos = zzMarkedPosL;
switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) {
case 6:
{ return GroovyDocTokenTypes.mGDOC_COMMENT_DATA;
}
case 21: break;
case 13:
{ return GroovyDocTokenTypes.mGDOC_TAG_VALUE_COMMA;
}
case 22: break;
case 12:
{ return GroovyDocTokenTypes.mGDOC_TAG_VALUE_SHARP_TOKEN;
}
case 23: break;
case 16:
{ yybegin(COMMENT_DATA);
return GroovyDocTokenTypes.mGDOC_TAG_VALUE_GT;
}
case 24: break;
case 4:
{ if (checkAhead('@')){
yybegin(INLINE_TAG_NAME);
}
else{
yybegin(COMMENT_DATA);
}
return GroovyDocTokenTypes.mGDOC_INLINE_TAG_START;
}
case 25: break;
case 1:
{ return GroovyDocTokenTypes.mGDOC_COMMENT_BAD_CHARACTER;
}
case 26: break;
case 15:
{ yybegin(DOC_TAG_VALUE);
return GroovyDocTokenTypes.mGDOC_TAG_VALUE_RPAREN;
}
case 27: break;
case 14:
{ yybegin(DOC_TAG_VALUE_IN_LTGT);
return GroovyDocTokenTypes.mGDOC_TAG_VALUE_LT;
}
case 28: break;
case 8:
{ yybegin(DOC_TAG_VALUE);
return TokenType.WHITE_SPACE;
}
case 29: break;
case 9:
{ yybegin(COMMENT_DATA);
return TokenType.WHITE_SPACE;
}
case 30: break;
case 17:
{ return GroovyDocTokenTypes.mGDOC_COMMENT_END;
}
case 31: break;
case 11:
{ yybegin(DOC_TAG_VALUE_IN_PAREN);
return GroovyDocTokenTypes.mGDOC_TAG_VALUE_LPAREN;
}
case 32: break;
case 3:
{ return TokenType.WHITE_SPACE;
}
case 33: break;
case 7:
{ if (checkAhead('<') || checkAhead('\"')) {
yybegin(COMMENT_DATA);
@@ -594,100 +679,36 @@ public class _GroovyDocLexer implements FlexLexer, GroovyDocTokenTypes, TokenTyp
else {
yybegin(DOC_TAG_VALUE);
}
return WHITE_SPACE;
}
case 21: break;
case 9:
{ yybegin(COMMENT_DATA);
return WHITE_SPACE;
}
case 22: break;
case 15:
{ yybegin(DOC_TAG_VALUE);
return mGDOC_TAG_VALUE_RPAREN;
}
case 23: break;
case 19:
{ yybegin(COMMENT_DATA_START);
return mGDOC_COMMENT_START;
}
case 24: break;
case 4:
{ if (checkAhead('@')){
yybegin(INLINE_TAG_NAME);
}
else{
yybegin(COMMENT_DATA);
}
return mGDOC_INLINE_TAG_START;
}
case 25: break;
case 14:
{ yybegin(DOC_TAG_VALUE_IN_LTGT);
return mGDOC_TAG_VALUE_LT;
}
case 26: break;
case 1:
{ return mGDOC_COMMENT_BAD_CHARACTER;
}
case 27: break;
case 2:
{ yybegin(COMMENT_DATA);
return mGDOC_COMMENT_DATA;
}
case 28: break;
case 18:
{ yybegin(TAG_DOC_SPACE);
return mGDOC_TAG_NAME;
}
case 29: break;
case 6:
{ return mGDOC_COMMENT_DATA;
}
case 30: break;
case 8:
{ yybegin(DOC_TAG_VALUE);
return WHITE_SPACE;
}
case 31: break;
case 3:
{ return WHITE_SPACE;
}
case 32: break;
case 11:
{ yybegin(DOC_TAG_VALUE_IN_PAREN);
return mGDOC_TAG_VALUE_LPAREN;
}
case 33: break;
case 16:
{ yybegin(COMMENT_DATA);
return mGDOC_TAG_VALUE_GT;
return TokenType.WHITE_SPACE;
}
case 34: break;
case 5:
{ yybegin(COMMENT_DATA);
return mGDOC_INLINE_TAG_END;
case 19:
{ yybegin(COMMENT_DATA_START);
return GroovyDocTokenTypes.mGDOC_COMMENT_START;
}
case 35: break;
case 17:
{ return mGDOC_COMMENT_END;
}
case 36: break;
case 10:
{ return mGDOC_TAG_VALUE_TOKEN;
}
case 37: break;
case 20:
{ yybegin(PARAM_TAG_SPACE);
return mGDOC_TAG_NAME;
return GroovyDocTokenTypes.mGDOC_TAG_NAME;
}
case 36: break;
case 18:
{ yybegin(TAG_DOC_SPACE);
return GroovyDocTokenTypes.mGDOC_TAG_NAME;
}
case 37: break;
case 5:
{ yybegin(COMMENT_DATA);
return GroovyDocTokenTypes.mGDOC_INLINE_TAG_END;
}
case 38: break;
case 13:
{ return mGDOC_TAG_VALUE_COMMA;
case 2:
{ yybegin(COMMENT_DATA);
return GroovyDocTokenTypes.mGDOC_COMMENT_DATA;
}
case 39: break;
case 12:
{ return mGDOC_TAG_VALUE_SHARP_TOKEN;
case 10:
{ return GroovyDocTokenTypes.mGDOC_TAG_VALUE_TOKEN;
}
case 40: break;
default:

View File

@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="groovy_rt" />
<orderEntry type="library" exported="" name="Groovy" level="project" />
<orderEntry type="library" name="Guava" level="project" />
<orderEntry type="module" module-name="testFramework-java" scope="TEST" />
<orderEntry type="module" module-name="junit" scope="TEST" />
<orderEntry type="module" module-name="java-indexing-api" />
<orderEntry type="module" module-name="properties-psi-api" />
<orderEntry type="module" module-name="java-psi-impl" />
<orderEntry type="module" module-name="core-impl" />
<orderEntry type="module" module-name="extensions" />
<orderEntry type="module" module-name="annotations" />
<orderEntry type="module" module-name="xml-psi-impl" />
<orderEntry type="module" module-name="editor-ui-ex" />
<orderEntry type="module" module-name="java-analysis-impl" />
</component>
</module>

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,7 +24,7 @@ import com.intellij.lang.Language;
* @author ilyas
*/
public class GroovyLanguage extends Language {
public static final GroovyLanguage INSTANCE = new GroovyLanguage();
public GroovyLanguage() {
super("Groovy");
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2000-2013 JetBrains s.r.o.
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -221,4 +221,4 @@ public class DefaultHighlighter {
private DefaultHighlighter() {
}
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2000-2013 JetBrains s.r.o.
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2000-2013 JetBrains s.r.o.
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2000-2013 JetBrains s.r.o.
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,8 +15,8 @@
*/
package org.jetbrains.plugins.groovy.highlighter;
import com.intellij.diagnostic.LogMessageEx;
import com.intellij.lexer.LexerBase;
import com.intellij.openapi.diagnostic.Attachment;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.StringEscapesTokenTypes;
@@ -45,7 +45,7 @@ public abstract class GroovyStringLexerBase extends LexerBase {
@Override
public void start(@NotNull CharSequence buffer, int startOffset, int endOffset, int initialState) {
if (buffer.length() < endOffset) {
LogMessageEx.error(LOG, "buffer Length: " + buffer.length() + ", endOffset: " + endOffset, buffer.toString());
LOG.error("buffer Length: " + buffer.length() + ", endOffset: " + endOffset, new Attachment("",buffer.toString()));
}
myBuffer = buffer;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@@ -17,7 +17,7 @@
package org.jetbrains.plugins.groovy.lang.groovydoc.lexer;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.plugins.groovy.GroovyFileType;
import org.jetbrains.plugins.groovy.GroovyLanguage;
/**
* @author ilyas
@@ -27,11 +27,11 @@ public class GroovyDocElementTypeImpl extends GroovyDocElementType {
private String debugName = null;
public GroovyDocElementTypeImpl(@NonNls String debugName) {
super(debugName, GroovyFileType.GROOVY_LANGUAGE);
super(debugName, GroovyLanguage.INSTANCE);
this.debugName = debugName;
}
public String toString() {
return debugName;
}
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@@ -17,10 +17,10 @@
package org.jetbrains.plugins.groovy.lang.lexer;
import com.intellij.lang.ASTNode;
import com.intellij.psi.PsiElement;
import com.intellij.psi.tree.IElementType;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.plugins.groovy.GroovyFileType;
import org.jetbrains.plugins.groovy.lang.psi.GroovyPsiElement;
import org.jetbrains.plugins.groovy.GroovyLanguage;
/**
* Main classdef for Groovy element types, such as lexems or AST nodes
@@ -37,7 +37,7 @@ public class GroovyElementType extends IElementType {
}
public GroovyElementType(String debugName, boolean boundToLeft) {
super(debugName, GroovyFileType.GROOVY_LANGUAGE);
super(debugName, GroovyLanguage.INSTANCE);
myDebugName = debugName;
myLeftBound = boundToLeft;
}
@@ -56,6 +56,7 @@ public class GroovyElementType extends IElementType {
super(debugName);
}
public abstract GroovyPsiElement createPsi(@NotNull ASTNode node);
@NotNull
public abstract PsiElement createPsi(@NotNull ASTNode node);
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,14 +17,13 @@
package org.jetbrains.plugins.groovy.lang.lexer;
import com.intellij.psi.tree.IElementType;
import org.jetbrains.plugins.groovy.lang.groovydoc.parser.GroovyDocElementTypes;
/**
* Interface that contains all tokens returned by GroovyLexer
*
* @author ilyas
*/
public interface GroovyTokenTypes extends GroovyDocElementTypes {
public interface GroovyTokenTypes {
/**
* Wrong token. Use for debug needs

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2000-2013 JetBrains s.r.o.
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@@ -0,0 +1,24 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.plugins.groovy.lang.psi;
import com.intellij.psi.PsiClass;
/**
* @author peter
*/
public interface GrClassSubstitution extends PsiClass {
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2000-2013 JetBrains s.r.o.
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2000-2013 JetBrains s.r.o.
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2000-2010 JetBrains s.r.o.
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@@ -37,6 +37,7 @@
<orderEntry type="module" module-name="groovy-jps-plugin" />
<orderEntry type="module" module-name="ByteCodeViewer" />
<orderEntry type="module" module-name="properties-psi-api" />
<orderEntry type="module" module-name="groovy-psi" exported="" />
</component>
</module>

View File

@@ -33,8 +33,7 @@ import java.util.Map;
/**
* @author ilyas
*/
public class GroovyDocSyntaxHighlighter extends SyntaxHighlighterBase implements GroovyDocTokenTypes {
public class GroovyDocSyntaxHighlighter extends SyntaxHighlighterBase {
private static final Map<IElementType, TextAttributesKey> ATTRIBUTES = new HashMap<IElementType, TextAttributesKey>();
private static final IElementType mGDOC_COMMENT_CONTENT = new GroovyDocElementTypeImpl("GDOC_COMMENT_CONTENT");
@@ -44,11 +43,11 @@ public class GroovyDocSyntaxHighlighter extends SyntaxHighlighterBase implements
return new GroovyDocHighlightingLexer();
}
static final TokenSet tGDOC_COMMENT_TAGS = TokenSet.create(
mGDOC_TAG_NAME
private static final TokenSet tGDOC_COMMENT_TAGS = TokenSet.create(
GroovyDocTokenTypes.mGDOC_TAG_NAME
);
static final TokenSet tGDOC_COMMENT_CONTENT = TokenSet.create(
private static final TokenSet tGDOC_COMMENT_CONTENT = TokenSet.create(
mGDOC_COMMENT_CONTENT
);
@@ -68,7 +67,7 @@ public class GroovyDocSyntaxHighlighter extends SyntaxHighlighterBase implements
private static class GroovyDocHighlightingLexer extends GroovyDocLexer {
@Override
public IElementType getTokenType() {
return super.getTokenType() == mGDOC_TAG_NAME ? mGDOC_TAG_NAME : super.getTokenType();
return super.getTokenType() == GroovyDocTokenTypes.mGDOC_TAG_NAME ? GroovyDocTokenTypes.mGDOC_TAG_NAME : super.getTokenType();
}
}
}

View File

@@ -31,10 +31,10 @@ import java.io.IOException;
/**
* @author ilyas
*/
public class GroovyDocLexer extends MergingLexerAdapter implements GroovyDocTokenTypes {
public class GroovyDocLexer extends MergingLexerAdapter {
private static final TokenSet TOKENS_TO_MERGE = TokenSet.create(
mGDOC_COMMENT_DATA,
GroovyDocTokenTypes.mGDOC_COMMENT_DATA,
TokenType.WHITE_SPACE
);
@@ -42,23 +42,23 @@ public class GroovyDocLexer extends MergingLexerAdapter implements GroovyDocToke
super(new LookAheadLexer(new AsteriskStripperLexer(new _GroovyDocLexer())) {
@Override
protected void lookAhead(Lexer baseLexer) {
if (baseLexer.getTokenType() == mGDOC_INLINE_TAG_END) {
advanceAs(baseLexer, mGDOC_COMMENT_DATA);
if (baseLexer.getTokenType() == GroovyDocTokenTypes.mGDOC_INLINE_TAG_END) {
advanceAs(baseLexer, GroovyDocTokenTypes.mGDOC_COMMENT_DATA);
return;
}
if (baseLexer.getTokenType() == mGDOC_INLINE_TAG_START) {
if (baseLexer.getTokenType() == GroovyDocTokenTypes.mGDOC_INLINE_TAG_START) {
int depth = 0;
while (true) {
IElementType type = baseLexer.getTokenType();
if (type == null) {
break;
}
if (type == mGDOC_INLINE_TAG_START) {
if (type == GroovyDocTokenTypes.mGDOC_INLINE_TAG_START) {
depth++;
}
advanceLexer(baseLexer);
if (type == mGDOC_INLINE_TAG_END) {
if (type == GroovyDocTokenTypes.mGDOC_INLINE_TAG_END) {
depth--;
}
if (depth == 0) {
@@ -166,7 +166,7 @@ public class GroovyDocLexer extends MergingLexerAdapter implements GroovyDocToke
myInLeadingSpace = true;
if (myBufferIndex < myTokenEndOffset) {
myTokenType = mGDOC_ASTERISKS;
myTokenType = GroovyDocTokenTypes.mGDOC_ASTERISKS;
return;
}
}
@@ -191,7 +191,7 @@ public class GroovyDocLexer extends MergingLexerAdapter implements GroovyDocToke
if (myBufferIndex < myTokenEndOffset) {
myTokenType = lf || state == _GroovyDocLexer.PARAM_TAG_SPACE || state == _GroovyDocLexer.TAG_DOC_SPACE || state == _GroovyDocLexer.INLINE_TAG_NAME || state == _GroovyDocLexer.DOC_TAG_VALUE_IN_PAREN
? TokenType.WHITE_SPACE
: mGDOC_COMMENT_DATA;
: GroovyDocTokenTypes.mGDOC_COMMENT_DATA;
return;
}

View File

@@ -16,13 +16,13 @@
package org.jetbrains.plugins.groovy.lang.groovydoc.lexer;
import com.intellij.lexer.FlexLexer;
import com.intellij.psi.tree.IElementType;
import com.intellij.psi.TokenType;
import com.intellij.psi.tree.IElementType;
%%
%class _GroovyDocLexer
%implements FlexLexer, GroovyDocTokenTypes, TokenType
%implements FlexLexer
%unicode
%public
@@ -78,31 +78,31 @@ IDENTIFIER={ALPHA}({ALPHA}|{DIGIT}|[":.-"])*
%%
<YYINITIAL> "/**" { yybegin(COMMENT_DATA_START);
return mGDOC_COMMENT_START; }
<COMMENT_DATA_START> {WHITE_DOC_SPACE_CHAR}+ { return WHITE_SPACE; }
<COMMENT_DATA> {WHITE_DOC_SPACE_NO_NL}+ { return mGDOC_COMMENT_DATA; }
<COMMENT_DATA> [\n\r]+{WHITE_DOC_SPACE_CHAR}* { return WHITE_SPACE; }
return GroovyDocTokenTypes.mGDOC_COMMENT_START; }
<COMMENT_DATA_START> {WHITE_DOC_SPACE_CHAR}+ { return TokenType.WHITE_SPACE; }
<COMMENT_DATA> {WHITE_DOC_SPACE_NO_NL}+ { return GroovyDocTokenTypes.mGDOC_COMMENT_DATA; }
<COMMENT_DATA> [\n\r]+{WHITE_DOC_SPACE_CHAR}* { return TokenType.WHITE_SPACE; }
<DOC_TAG_VALUE> {WHITE_DOC_SPACE_CHAR}+ { yybegin(COMMENT_DATA);
return WHITE_SPACE; }
<DOC_TAG_VALUE, DOC_TAG_VALUE_IN_PAREN> ({ALPHA}|[_0-9\."$"\[\]])+ { return mGDOC_TAG_VALUE_TOKEN; }
return TokenType.WHITE_SPACE; }
<DOC_TAG_VALUE, DOC_TAG_VALUE_IN_PAREN> ({ALPHA}|[_0-9\."$"\[\]])+ { return GroovyDocTokenTypes.mGDOC_TAG_VALUE_TOKEN; }
<DOC_TAG_VALUE> [\(] { yybegin(DOC_TAG_VALUE_IN_PAREN);
return mGDOC_TAG_VALUE_LPAREN; }
return GroovyDocTokenTypes.mGDOC_TAG_VALUE_LPAREN; }
<DOC_TAG_VALUE_IN_PAREN> [\)] { yybegin(DOC_TAG_VALUE);
return mGDOC_TAG_VALUE_RPAREN; }
<DOC_TAG_VALUE> [#] { return mGDOC_TAG_VALUE_SHARP_TOKEN; }
<DOC_TAG_VALUE, DOC_TAG_VALUE_IN_PAREN> [,] { return mGDOC_TAG_VALUE_COMMA; }
<DOC_TAG_VALUE_IN_PAREN> {WHITE_DOC_SPACE_CHAR}+ { return WHITE_SPACE; }
return GroovyDocTokenTypes.mGDOC_TAG_VALUE_RPAREN; }
<DOC_TAG_VALUE> [#] { return GroovyDocTokenTypes.mGDOC_TAG_VALUE_SHARP_TOKEN; }
<DOC_TAG_VALUE, DOC_TAG_VALUE_IN_PAREN> [,] { return GroovyDocTokenTypes.mGDOC_TAG_VALUE_COMMA; }
<DOC_TAG_VALUE_IN_PAREN> {WHITE_DOC_SPACE_CHAR}+ { return TokenType.WHITE_SPACE; }
<INLINE_TAG_NAME, COMMENT_DATA_START> "@param" { yybegin(PARAM_TAG_SPACE);
return mGDOC_TAG_NAME; }
return GroovyDocTokenTypes.mGDOC_TAG_NAME; }
<PARAM_TAG_SPACE> {WHITE_DOC_SPACE_CHAR}+ { yybegin(DOC_TAG_VALUE);
return WHITE_SPACE;}
return TokenType.WHITE_SPACE;}
<DOC_TAG_VALUE> [\<] { yybegin(DOC_TAG_VALUE_IN_LTGT);
return mGDOC_TAG_VALUE_LT; }
<DOC_TAG_VALUE_IN_LTGT> {IDENTIFIER} { return mGDOC_TAG_VALUE_TOKEN; }
return GroovyDocTokenTypes.mGDOC_TAG_VALUE_LT; }
<DOC_TAG_VALUE_IN_LTGT> {IDENTIFIER} { return GroovyDocTokenTypes.mGDOC_TAG_VALUE_TOKEN; }
<DOC_TAG_VALUE_IN_LTGT> [\>] { yybegin(COMMENT_DATA);
return mGDOC_TAG_VALUE_GT; }
return GroovyDocTokenTypes.mGDOC_TAG_VALUE_GT; }
<COMMENT_DATA_START, COMMENT_DATA> "{" { if (checkAhead('@')){
yybegin(INLINE_TAG_NAME);
@@ -110,19 +110,19 @@ IDENTIFIER={ALPHA}({ALPHA}|{DIGIT}|[":.-"])*
else{
yybegin(COMMENT_DATA);
}
return mGDOC_INLINE_TAG_START;
return GroovyDocTokenTypes.mGDOC_INLINE_TAG_START;
}
<INLINE_TAG_NAME> "@"{IDENTIFIER} { yybegin(TAG_DOC_SPACE);
return mGDOC_TAG_NAME; }
return GroovyDocTokenTypes.mGDOC_TAG_NAME; }
<COMMENT_DATA_START, COMMENT_DATA, TAG_DOC_SPACE, DOC_TAG_VALUE> "}" { yybegin(COMMENT_DATA);
return mGDOC_INLINE_TAG_END; }
return GroovyDocTokenTypes.mGDOC_INLINE_TAG_END; }
<COMMENT_DATA_START, COMMENT_DATA, DOC_TAG_VALUE> . { yybegin(COMMENT_DATA);
return mGDOC_COMMENT_DATA; }
return GroovyDocTokenTypes.mGDOC_COMMENT_DATA; }
<COMMENT_DATA_START> "@"{IDENTIFIER} { yybegin(TAG_DOC_SPACE);
return mGDOC_TAG_NAME; }
return GroovyDocTokenTypes.mGDOC_TAG_NAME; }
<TAG_DOC_SPACE> {WHITE_DOC_SPACE_CHAR}+ { if (checkAhead('<') || checkAhead('\"')) {
yybegin(COMMENT_DATA);
}
@@ -132,8 +132,8 @@ IDENTIFIER={ALPHA}({ALPHA}|{DIGIT}|[":.-"])*
else {
yybegin(DOC_TAG_VALUE);
}
return WHITE_SPACE;
return TokenType.WHITE_SPACE;
}
"*"+"/" { return mGDOC_COMMENT_END; }
[^] { return mGDOC_COMMENT_BAD_CHARACTER; }
"*"+"/" { return GroovyDocTokenTypes.mGDOC_COMMENT_END; }
[^] { return GroovyDocTokenTypes.mGDOC_COMMENT_BAD_CHARACTER; }

View File

@@ -25,6 +25,7 @@ import com.intellij.psi.util.PsiUtilCore;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.plugins.groovy.lang.groovydoc.lexer.GroovyDocTokenTypes;
import org.jetbrains.plugins.groovy.lang.groovydoc.parser.GroovyDocElementTypes;
import org.jetbrains.plugins.groovy.lang.groovydoc.psi.api.GrDocComment;
import org.jetbrains.plugins.groovy.lang.groovydoc.psi.api.GrDocCommentOwner;
@@ -114,7 +115,7 @@ public class GrDocCommentImpl extends LazyParseablePsiElement implements GroovyD
if (node == null) continue;
final IElementType i = node.getElementType();
if (i == GDOC_TAG) break;
if (i != mGDOC_COMMENT_START && i != mGDOC_COMMENT_END && i != mGDOC_ASTERISKS) {
if (i != GroovyDocTokenTypes.mGDOC_COMMENT_START && i != GroovyDocTokenTypes.mGDOC_COMMENT_END && i != GroovyDocTokenTypes.mGDOC_ASTERISKS) {
array.add(child);
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2000-2010 JetBrains s.r.o.
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,6 +18,7 @@ package org.jetbrains.plugins.groovy.lang.parser.parsing.auxiliary;
import com.intellij.lang.PsiBuilder;
import org.jetbrains.plugins.groovy.GroovyBundle;
import org.jetbrains.plugins.groovy.lang.lexer.GroovyTokenTypes;
import org.jetbrains.plugins.groovy.lang.parser.GroovyElementTypes;
import org.jetbrains.plugins.groovy.lang.parser.GroovyParser;
import org.jetbrains.plugins.groovy.lang.parser.parsing.statements.expressions.AssignmentExpression;
@@ -28,8 +29,8 @@ import org.jetbrains.plugins.groovy.lang.parser.parsing.util.ParserUtils;
*/
public class VariableInitializer implements GroovyElementTypes {
public static void parse(PsiBuilder builder, GroovyParser parser) {
if (ParserUtils.getToken(builder, mASSIGN)) {
ParserUtils.getToken(builder, mNLS);
if (ParserUtils.getToken(builder, GroovyTokenTypes.mASSIGN)) {
ParserUtils.getToken(builder, GroovyTokenTypes.mNLS);
if (!AssignmentExpression.parse(builder, parser, true)) {
builder.error(GroovyBundle.message("expression.expected"));
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2000-2013 JetBrains s.r.o.
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,6 +18,7 @@ package org.jetbrains.plugins.groovy.lang.parser.parsing.auxiliary.annotations;
import com.intellij.lang.PsiBuilder;
import org.jetbrains.plugins.groovy.GroovyBundle;
import org.jetbrains.plugins.groovy.lang.lexer.GroovyTokenTypes;
import org.jetbrains.plugins.groovy.lang.lexer.TokenSets;
import org.jetbrains.plugins.groovy.lang.parser.GroovyElementTypes;
import org.jetbrains.plugins.groovy.lang.parser.GroovyParser;
@@ -38,23 +39,23 @@ public class AnnotationArguments implements GroovyElementTypes {
public static void parse(PsiBuilder builder, GroovyParser parser) {
PsiBuilder.Marker annArgs = builder.mark();
if (!ParserUtils.getToken(builder, mLPAREN)) {
if (!ParserUtils.getToken(builder, GroovyTokenTypes.mLPAREN)) {
annArgs.done(ANNOTATION_ARGUMENTS);
return;
}
if (builder.getTokenType() != mRPAREN) {
if (builder.getTokenType() != GroovyTokenTypes.mRPAREN) {
parsePairs(builder, parser);
}
ParserUtils.getToken(builder, mNLS);
ParserUtils.getToken(builder, mRPAREN, GroovyBundle.message("rparen.expected"));
ParserUtils.getToken(builder, GroovyTokenTypes.mNLS);
ParserUtils.getToken(builder, GroovyTokenTypes.mRPAREN, GroovyBundle.message("rparen.expected"));
annArgs.done(ANNOTATION_ARGUMENTS);
}
private static boolean checkIdentAndAssign(PsiBuilder builder) {
final PsiBuilder.Marker marker = builder.mark();
boolean result = ParserUtils.getToken(builder, TokenSets.CODE_REFERENCE_ELEMENT_NAME_TOKENS) && ParserUtils.getToken(builder, mASSIGN);
boolean result = ParserUtils.getToken(builder, TokenSets.CODE_REFERENCE_ELEMENT_NAME_TOKENS) && ParserUtils.getToken(builder, GroovyTokenTypes.mASSIGN);
marker.rollbackTo();
return result;
}
@@ -64,24 +65,24 @@ public class AnnotationArguments implements GroovyElementTypes {
*/
public static boolean parseAnnotationMemberValueInitializer(PsiBuilder builder, GroovyParser parser) {
if (builder.getTokenType() == mAT) {
if (builder.getTokenType() == GroovyTokenTypes.mAT) {
return Annotation.parse(builder, parser);
}
else if (builder.getTokenType() == mLBRACK) {
else if (builder.getTokenType() == GroovyTokenTypes.mLBRACK) {
PsiBuilder.Marker marker = builder.mark();
ParserUtils.getToken(builder, mLBRACK);
ParserUtils.getToken(builder, GroovyTokenTypes.mLBRACK);
while (parseAnnotationMemberValueInitializer(builder, parser)) {
if (builder.eof() || builder.getTokenType() == mRBRACK) break;
ParserUtils.getToken(builder, mCOMMA, GroovyBundle.message("comma.expected"));
if (builder.eof() || builder.getTokenType() == GroovyTokenTypes.mRBRACK) break;
ParserUtils.getToken(builder, GroovyTokenTypes.mCOMMA, GroovyBundle.message("comma.expected"));
}
ParserUtils.getToken(builder, mRBRACK, GroovyBundle.message("rbrack.expected"));
ParserUtils.getToken(builder, GroovyTokenTypes.mRBRACK, GroovyBundle.message("rbrack.expected"));
marker.done(ANNOTATION_ARRAY_INITIALIZER);
return true;
}
//check
return ConditionalExpression.parse(builder, parser) && !ParserUtils.getToken(builder, mASSIGN);
return ConditionalExpression.parse(builder, parser) && !ParserUtils.getToken(builder, GroovyTokenTypes.mASSIGN);
}
/*
@@ -96,8 +97,8 @@ public class AnnotationArguments implements GroovyElementTypes {
return false;
}
while (ParserUtils.getToken(builder, mCOMMA)) {
ParserUtils.getToken(builder, mNLS);
while (ParserUtils.getToken(builder, GroovyTokenTypes.mCOMMA)) {
ParserUtils.getToken(builder, GroovyTokenTypes.mNLS);
parsePair(builder, parser);
}
@@ -116,10 +117,10 @@ public class AnnotationArguments implements GroovyElementTypes {
final PsiBuilder.Marker lfMarker;
if (checkIdentAndAssign(builder)) {
ParserUtils.getToken(builder, TokenSets.CODE_REFERENCE_ELEMENT_NAME_TOKENS);
ParserUtils.getToken(builder, mASSIGN);
ParserUtils.getToken(builder, GroovyTokenTypes.mASSIGN);
lfMarker = builder.mark();
ParserUtils.getToken(builder, mNLS);
ParserUtils.getToken(builder, GroovyTokenTypes.mNLS);
}
else {
lfMarker = null;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,6 +20,7 @@ import com.intellij.lang.PsiBuilder;
import com.intellij.psi.tree.TokenSet;
import org.jetbrains.plugins.groovy.GroovyBundle;
import org.jetbrains.plugins.groovy.lang.lexer.GroovyElementType;
import org.jetbrains.plugins.groovy.lang.lexer.GroovyTokenTypes;
import org.jetbrains.plugins.groovy.lang.parser.GroovyElementTypes;
import org.jetbrains.plugins.groovy.lang.parser.GroovyParser;
import org.jetbrains.plugins.groovy.lang.parser.parsing.statements.expressions.AssignmentExpression;
@@ -31,29 +32,29 @@ import org.jetbrains.plugins.groovy.lang.parser.parsing.util.ParserUtils;
*/
public class BranchStatement implements GroovyElementTypes {
public static final TokenSet BRANCH_KEYWORDS = TokenSet.create(kRETURN,
kBREAK,
kCONTINUE,
kTHROW,
kRETURN,
kASSERT);
public static final TokenSet BRANCH_KEYWORDS = TokenSet.create(GroovyTokenTypes.kRETURN,
GroovyTokenTypes.kBREAK,
GroovyTokenTypes.kCONTINUE,
GroovyTokenTypes.kTHROW,
GroovyTokenTypes.kRETURN,
GroovyTokenTypes.kASSERT);
public static boolean parse(PsiBuilder builder, GroovyParser parser) {
if (kTHROW.equals(builder.getTokenType())) {
if (GroovyTokenTypes.kTHROW.equals(builder.getTokenType())) {
throwParse(builder, parser);
return true;
}
if (kASSERT.equals(builder.getTokenType())) {
if (GroovyTokenTypes.kASSERT.equals(builder.getTokenType())) {
assertParse(builder, parser);
return true;
}
if (kRETURN.equals(builder.getTokenType())) {
if (GroovyTokenTypes.kRETURN.equals(builder.getTokenType())) {
returnParse(builder, parser);
return true;
}
if (kBREAK.equals(builder.getTokenType()) ||
kCONTINUE.equals(builder.getTokenType())) {
if (GroovyTokenTypes.kBREAK.equals(builder.getTokenType()) ||
GroovyTokenTypes.kCONTINUE.equals(builder.getTokenType())) {
breakOrContinueParse(builder);
return true;
}
@@ -69,7 +70,7 @@ public class BranchStatement implements GroovyElementTypes {
*/
private static void returnParse(PsiBuilder builder, GroovyParser parser) {
PsiBuilder.Marker marker = builder.mark();
ParserUtils.getToken(builder, kRETURN);
ParserUtils.getToken(builder, GroovyTokenTypes.kRETURN);
AssignmentExpression.parse(builder, parser);
marker.done(RETURN_STATEMENT);
}
@@ -82,7 +83,7 @@ public class BranchStatement implements GroovyElementTypes {
*/
private static void throwParse(PsiBuilder builder, GroovyParser parser) {
PsiBuilder.Marker marker = builder.mark();
ParserUtils.getToken(builder, kTHROW);
ParserUtils.getToken(builder, GroovyTokenTypes.kTHROW);
if (!AssignmentExpression.parse(builder, parser)) {
builder.error(GroovyBundle.message("expression.expected"));
}
@@ -97,14 +98,14 @@ public class BranchStatement implements GroovyElementTypes {
*/
private static void assertParse(PsiBuilder builder, GroovyParser parser) {
PsiBuilder.Marker marker = builder.mark();
ParserUtils.getToken(builder, kASSERT);
ParserUtils.getToken(builder, GroovyTokenTypes.kASSERT);
if (!ConditionalExpression.parse(builder, parser)) {
builder.error(GroovyBundle.message("expression.expected"));
}
if (ParserUtils.lookAhead(builder, mCOLON) || mCOMMA.equals(builder.getTokenType())) {
if (ParserUtils.lookAhead(builder, GroovyTokenTypes.mCOLON) || GroovyTokenTypes.mCOMMA.equals(builder.getTokenType())) {
builder.advanceLexer();
ParserUtils.getToken(builder, mNLS);
ParserUtils.getToken(builder, GroovyTokenTypes.mNLS);
if (!AssignmentExpression.parse(builder, parser)) {
builder.error(GroovyBundle.message("expression.expected"));
}
@@ -120,11 +121,11 @@ public class BranchStatement implements GroovyElementTypes {
*/
private static void breakOrContinueParse(PsiBuilder builder) {
PsiBuilder.Marker marker = builder.mark();
GroovyElementType result = kBREAK.equals(builder.getTokenType()) ? BREAK_STATEMENT : CONTINUE_STATEMENT;
GroovyElementType result = GroovyTokenTypes.kBREAK.equals(builder.getTokenType()) ? BREAK_STATEMENT : CONTINUE_STATEMENT;
builder.advanceLexer();
ParserUtils.getToken(builder, mIDENT);
ParserUtils.getToken(builder, GroovyTokenTypes.mIDENT);
marker.done(result);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2000-2013 JetBrains s.r.o.
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,6 +20,7 @@ import com.intellij.lang.PsiBuilder;
import com.intellij.psi.tree.IElementType;
import com.intellij.psi.tree.TokenSet;
import org.jetbrains.plugins.groovy.GroovyBundle;
import org.jetbrains.plugins.groovy.lang.lexer.GroovyTokenTypes;
import org.jetbrains.plugins.groovy.lang.parser.GroovyElementTypes;
import org.jetbrains.plugins.groovy.lang.parser.GroovyParser;
import org.jetbrains.plugins.groovy.lang.parser.parsing.statements.expressions.AssignmentExpression;
@@ -31,30 +32,30 @@ import org.jetbrains.plugins.groovy.lang.parser.parsing.util.ParserUtils;
*/
public class SwitchStatement implements GroovyElementTypes {
public static final TokenSet SKIP_SET = TokenSet.create(kCASE, kDEFAULT, mRCURLY);
public static final TokenSet SKIP_SET = TokenSet.create(GroovyTokenTypes.kCASE, GroovyTokenTypes.kDEFAULT, GroovyTokenTypes.mRCURLY);
public static void parseSwitch(PsiBuilder builder, GroovyParser parser) {
PsiBuilder.Marker marker = builder.mark();
ParserUtils.getToken(builder, kSWITCH);
ParserUtils.getToken(builder, GroovyTokenTypes.kSWITCH);
if (!ParserUtils.getToken(builder, mLPAREN, GroovyBundle.message("lparen.expected"))) {
if (!ParserUtils.getToken(builder, GroovyTokenTypes.mLPAREN, GroovyBundle.message("lparen.expected"))) {
marker.done(SWITCH_STATEMENT);
return;
}
if (!ExpressionStatement.argParse(builder, parser)) {
builder.error(GroovyBundle.message("expression.expected"));
}
ParserUtils.getToken(builder, mNLS);
ParserUtils.getToken(builder, GroovyTokenTypes.mNLS);
if (!ParserUtils.getToken(builder, mRPAREN, GroovyBundle.message("rparen.expected"))) {
if (!ParserUtils.getToken(builder, GroovyTokenTypes.mRPAREN, GroovyBundle.message("rparen.expected"))) {
builder.error(GroovyBundle.message("rparen.expected"));
marker.done(SWITCH_STATEMENT);
return;
}
PsiBuilder.Marker warn = builder.mark();
ParserUtils.getToken(builder, mNLS);
ParserUtils.getToken(builder, GroovyTokenTypes.mNLS);
if (!mLCURLY.equals(builder.getTokenType())) {
if (!GroovyTokenTypes.mLCURLY.equals(builder.getTokenType())) {
warn.rollbackTo();
builder.error(GroovyBundle.message("case.block.expected"));
marker.done(SWITCH_STATEMENT);
@@ -66,10 +67,10 @@ public class SwitchStatement implements GroovyElementTypes {
}
private static void parseCaseBlock(PsiBuilder builder, GroovyParser parser) {
ParserUtils.getToken(builder, mLCURLY);
ParserUtils.getToken(builder, mNLS);
ParserUtils.getToken(builder, GroovyTokenTypes.mLCURLY);
ParserUtils.getToken(builder, GroovyTokenTypes.mNLS);
while (!ParserUtils.getToken(builder, mRCURLY)) {
while (!ParserUtils.getToken(builder, GroovyTokenTypes.mRCURLY)) {
if (builder.getTokenType() != kCASE && builder.getTokenType() != kDEFAULT) {
builder.error("case, default or } expected");
ParserUtils.skipCountingBraces(builder, SKIP_SET);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2000-2013 JetBrains s.r.o.
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,6 +18,7 @@ package org.jetbrains.plugins.groovy.lang.parser.parsing.statements;
import com.intellij.lang.PsiBuilder;
import org.jetbrains.plugins.groovy.GroovyBundle;
import org.jetbrains.plugins.groovy.lang.lexer.GroovyTokenTypes;
import org.jetbrains.plugins.groovy.lang.parser.GroovyElementTypes;
import org.jetbrains.plugins.groovy.lang.parser.GroovyParser;
import org.jetbrains.plugins.groovy.lang.parser.parsing.statements.blocks.OpenOrClosableBlock;
@@ -32,9 +33,9 @@ public class SynchronizedStatement implements GroovyElementTypes {
PsiBuilder.Marker marker = builder.mark();
ParserUtils.getToken(builder, kSYNCHRONIZED);
ParserUtils.getToken(builder, GroovyTokenTypes.kSYNCHRONIZED);
if (!ParserUtils.getToken(builder, mLPAREN, GroovyBundle.message("lparen.expected"))) {
if (!ParserUtils.getToken(builder, GroovyTokenTypes.mLPAREN, GroovyBundle.message("lparen.expected"))) {
marker.drop();
return false;
}
@@ -43,16 +44,16 @@ public class SynchronizedStatement implements GroovyElementTypes {
builder.error(GroovyBundle.message("expression.expected"));
}
ParserUtils.getToken(builder, mNLS);
if (!ParserUtils.getToken(builder, mRPAREN, GroovyBundle.message("rparen.expected"))) {
ParserUtils.getToken(builder, GroovyTokenTypes.mNLS);
if (!ParserUtils.getToken(builder, GroovyTokenTypes.mRPAREN, GroovyBundle.message("rparen.expected"))) {
marker.done(SYNCHRONIZED_STATEMENT);
return true;
}
PsiBuilder.Marker warn = builder.mark();
ParserUtils.getToken(builder, mNLS);
ParserUtils.getToken(builder, GroovyTokenTypes.mNLS);
if (mLCURLY.equals(builder.getTokenType()) && !OpenOrClosableBlock.parseOpenBlock(builder, parser)) {
if (GroovyTokenTypes.mLCURLY.equals(builder.getTokenType()) && !OpenOrClosableBlock.parseOpenBlock(builder, parser)) {
warn.rollbackTo();
builder.error(GroovyBundle.message("block.expression.expected"));
} else {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2000-2013 JetBrains s.r.o.
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,6 +18,7 @@ package org.jetbrains.plugins.groovy.lang.parser.parsing.statements;
import com.intellij.lang.PsiBuilder;
import org.jetbrains.plugins.groovy.GroovyBundle;
import org.jetbrains.plugins.groovy.lang.lexer.GroovyTokenTypes;
import org.jetbrains.plugins.groovy.lang.parser.GroovyElementTypes;
import org.jetbrains.plugins.groovy.lang.parser.GroovyParser;
import org.jetbrains.plugins.groovy.lang.parser.parsing.auxiliary.parameters.ParameterDeclaration;
@@ -33,9 +34,9 @@ public class TryCatchStatement implements GroovyElementTypes {
public static boolean parse(PsiBuilder builder, GroovyParser parser) {
PsiBuilder.Marker marker = builder.mark();
ParserUtils.getToken(builder, kTRY);
ParserUtils.getToken(builder, GroovyTokenTypes.kTRY);
PsiBuilder.Marker warn = builder.mark();
ParserUtils.getToken(builder, mNLS);
ParserUtils.getToken(builder, GroovyTokenTypes.mNLS);
if (!OpenOrClosableBlock.parseOpenBlock(builder, parser)) {
warn.rollbackTo();
builder.error(GroovyBundle.message("lcurly.expected"));
@@ -44,19 +45,19 @@ public class TryCatchStatement implements GroovyElementTypes {
}
warn.drop();
ParserUtils.getToken(builder, mNLS);
if (!(builder.getTokenType() == kCATCH) &&
!(builder.getTokenType() == kFINALLY)) {
ParserUtils.getToken(builder, GroovyTokenTypes.mNLS);
if (!(builder.getTokenType() == GroovyTokenTypes.kCATCH) &&
!(builder.getTokenType() == GroovyTokenTypes.kFINALLY)) {
builder.error(GroovyBundle.message("catch.or.finally.expected"));
marker.done(TRY_BLOCK_STATEMENT);
return true;
}
if (kCATCH.equals(builder.getTokenType())) {
if (GroovyTokenTypes.kCATCH.equals(builder.getTokenType())) {
parseHandlers(builder, parser);
}
if (kFINALLY.equals(builder.getTokenType()) || ParserUtils.lookAhead(builder, mNLS, kFINALLY)) {
if (GroovyTokenTypes.kFINALLY.equals(builder.getTokenType()) || ParserUtils.lookAhead(builder, GroovyTokenTypes.mNLS, GroovyTokenTypes.kFINALLY)) {
parseFinally(builder, parser);
}
@@ -65,13 +66,13 @@ public class TryCatchStatement implements GroovyElementTypes {
}
private static void parseFinally(PsiBuilder builder, GroovyParser parser) {
ParserUtils.getToken(builder, mNLS);
ParserUtils.getToken(builder, GroovyTokenTypes.mNLS);
PsiBuilder.Marker finallyMarker = builder.mark();
ParserUtils.getToken(builder, kFINALLY);
ParserUtils.getToken(builder, mNLS);
ParserUtils.getToken(builder, GroovyTokenTypes.kFINALLY);
ParserUtils.getToken(builder, GroovyTokenTypes.mNLS);
PsiBuilder.Marker warn = builder.mark();
if (mLCURLY.equals(builder.getTokenType()) && OpenOrClosableBlock.parseOpenBlock(builder, parser)) {
if (GroovyTokenTypes.mLCURLY.equals(builder.getTokenType()) && OpenOrClosableBlock.parseOpenBlock(builder, parser)) {
warn.drop();
}
else {
@@ -88,8 +89,8 @@ public class TryCatchStatement implements GroovyElementTypes {
*/
private static void parseHandlers(PsiBuilder builder, GroovyParser parser) {
PsiBuilder.Marker catchMarker = builder.mark();
ParserUtils.getToken(builder, kCATCH);
if (!ParserUtils.getToken(builder, mLPAREN, GroovyBundle.message("lparen.expected"))) {
ParserUtils.getToken(builder, GroovyTokenTypes.kCATCH);
if (!ParserUtils.getToken(builder, GroovyTokenTypes.mLPAREN, GroovyBundle.message("lparen.expected"))) {
catchMarker.done(CATCH_CLAUSE);
return;
}
@@ -99,14 +100,14 @@ public class TryCatchStatement implements GroovyElementTypes {
}
if (!ParserUtils.getToken(builder, mRPAREN, GroovyBundle.message("rparen.expected"))) {
if (!ParserUtils.getToken(builder, GroovyTokenTypes.mRPAREN, GroovyBundle.message("rparen.expected"))) {
catchMarker.done(CATCH_CLAUSE);
return;
}
PsiBuilder.Marker warn = builder.mark();
ParserUtils.getToken(builder, mNLS);
if (!mLCURLY.equals(builder.getTokenType()) || !OpenOrClosableBlock.parseOpenBlock(builder, parser)) {
ParserUtils.getToken(builder, GroovyTokenTypes.mNLS);
if (!GroovyTokenTypes.mLCURLY.equals(builder.getTokenType()) || !OpenOrClosableBlock.parseOpenBlock(builder, parser)) {
warn.rollbackTo();
builder.error(GroovyBundle.message("lcurly.expected"));
}
@@ -116,9 +117,9 @@ public class TryCatchStatement implements GroovyElementTypes {
catchMarker.done(CATCH_CLAUSE);
if (builder.getTokenType() == kCATCH ||
ParserUtils.lookAhead(builder, mNLS, kCATCH)) {
ParserUtils.getToken(builder, mNLS);
if (builder.getTokenType() == GroovyTokenTypes.kCATCH ||
ParserUtils.lookAhead(builder, GroovyTokenTypes.mNLS, GroovyTokenTypes.kCATCH)) {
ParserUtils.getToken(builder, GroovyTokenTypes.mNLS);
parseHandlers(builder, parser);
}
}

View File

@@ -18,6 +18,7 @@ package org.jetbrains.plugins.groovy.lang.parser.parsing.statements;
import com.intellij.lang.PsiBuilder;
import com.intellij.psi.tree.IElementType;
import org.jetbrains.plugins.groovy.GroovyBundle;
import org.jetbrains.plugins.groovy.lang.lexer.GroovyTokenTypes;
import org.jetbrains.plugins.groovy.lang.parser.GroovyElementTypes;
import org.jetbrains.plugins.groovy.lang.parser.parsing.types.TypeSpec;
import org.jetbrains.plugins.groovy.lang.parser.parsing.util.ParserUtils;
@@ -41,14 +42,14 @@ public class TupleParse {
}
public static PsiBuilder.Marker parseTuple(PsiBuilder builder, IElementType componentType, boolean acceptType) {
if (builder.getTokenType() != GroovyElementTypes.mLPAREN) return null;
if (builder.getTokenType() != GroovyTokenTypes.mLPAREN) return null;
final PsiBuilder.Marker marker = builder.mark();
builder.advanceLexer();
int count = 0;
do {
//skip unnecessary commas
while (ParserUtils.getToken(builder, GroovyElementTypes.mCOMMA)) {
while (ParserUtils.getToken(builder, GroovyTokenTypes.mCOMMA)) {
count++;
builder.error(GroovyBundle.message("identifier.expected"));
}
@@ -57,7 +58,7 @@ public class TupleParse {
//parse modifiers for definitions
PsiBuilder.Marker typeMarker = builder.mark();
TypeSpec.parse(builder);
if (builder.getTokenType() != GroovyElementTypes.mIDENT) {
if (builder.getTokenType() != GroovyTokenTypes.mIDENT) {
typeMarker.rollbackTo();
}
else {
@@ -66,7 +67,7 @@ public class TupleParse {
}
PsiBuilder.Marker componentMarker = builder.mark();
if (!ParserUtils.getToken(builder, GroovyElementTypes.mIDENT)) {
if (!ParserUtils.getToken(builder, GroovyTokenTypes.mIDENT)) {
builder.error(GroovyBundle.message("identifier.expected"));
componentMarker.drop();
}
@@ -75,9 +76,9 @@ public class TupleParse {
count++;
}
}
while (ParserUtils.getToken(builder, GroovyElementTypes.mCOMMA));
while (ParserUtils.getToken(builder, GroovyTokenTypes.mCOMMA));
if (ParserUtils.getToken(builder, GroovyElementTypes.mRPAREN)) {
if (ParserUtils.getToken(builder, GroovyTokenTypes.mRPAREN)) {
return marker;
}
else if (count > 0) { //accept tuple if there was at least one comma or parsed tuple element inside it

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2000-2013 JetBrains s.r.o.
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,6 +19,7 @@ package org.jetbrains.plugins.groovy.lang.parser.parsing.statements.blocks;
import com.intellij.lang.PsiBuilder;
import com.intellij.psi.tree.IElementType;
import org.jetbrains.plugins.groovy.GroovyBundle;
import org.jetbrains.plugins.groovy.lang.lexer.GroovyTokenTypes;
import org.jetbrains.plugins.groovy.lang.parser.GroovyElementTypes;
import org.jetbrains.plugins.groovy.lang.parser.GroovyParser;
import org.jetbrains.plugins.groovy.lang.parser.parsing.auxiliary.parameters.ParameterList;
@@ -30,7 +31,7 @@ import org.jetbrains.plugins.groovy.lang.parser.parsing.util.ParserUtils;
public class OpenOrClosableBlock implements GroovyElementTypes {
public static boolean parseOpenBlock(PsiBuilder builder, GroovyParser parser) {
if (builder.getTokenType() != mLCURLY) {
if (builder.getTokenType() != GroovyTokenTypes.mLCURLY) {
return false;
}
@@ -46,20 +47,20 @@ public class OpenOrClosableBlock implements GroovyElementTypes {
public static void parseOpenBlockDeep(PsiBuilder builder, GroovyParser parser) {
PsiBuilder.Marker marker = builder.mark();
builder.advanceLexer();
ParserUtils.getToken(builder, mNLS);
ParserUtils.getToken(builder, GroovyTokenTypes.mNLS);
parser.parseBlockBody(builder);
if (!builder.eof() && builder.getTokenType() != mRCURLY) {
if (!builder.eof() && builder.getTokenType() != GroovyTokenTypes.mRCURLY) {
builder.error(GroovyBundle.message("statement.expected"));
ParserUtils.skipCountingBraces(builder, GroovyParser.RCURLY_ONLY);
}
ParserUtils.getToken(builder, mRCURLY, GroovyBundle.message("rcurly.expected"));
ParserUtils.getToken(builder, GroovyTokenTypes.mRCURLY, GroovyBundle.message("rcurly.expected"));
marker.done(OPEN_BLOCK);
}
public static IElementType parseClosableBlock(PsiBuilder builder, GroovyParser parser) {
assert builder.getTokenType() == mLCURLY : builder.getTokenType();
assert builder.getTokenType() == GroovyTokenTypes.mLCURLY : builder.getTokenType();
if (parser.parseDeep()) {
parseClosableBlockDeep(builder, parser);
} else {
@@ -77,9 +78,9 @@ public class OpenOrClosableBlock implements GroovyElementTypes {
break;
}
if (tokenType == mLCURLY) {
if (tokenType == GroovyTokenTypes.mLCURLY) {
braceCount++;
} else if (tokenType == mRCURLY) {
} else if (tokenType == GroovyTokenTypes.mRCURLY) {
braceCount--;
}
builder.advanceLexer();
@@ -91,21 +92,21 @@ public class OpenOrClosableBlock implements GroovyElementTypes {
}
public static void parseClosableBlockDeep(PsiBuilder builder, GroovyParser parser) {
assert builder.getTokenType() == mLCURLY : builder.getTokenType();
assert builder.getTokenType() == GroovyTokenTypes.mLCURLY : builder.getTokenType();
PsiBuilder.Marker marker = builder.mark();
builder.advanceLexer();
ParserUtils.getToken(builder, mNLS);
ParserUtils.getToken(builder, GroovyTokenTypes.mNLS);
closableBlockParamsOpt(builder, parser);
parser.parseBlockBody(builder);
ParserUtils.getToken(builder, mRCURLY, GroovyBundle.message("rcurly.expected"));
ParserUtils.getToken(builder, GroovyTokenTypes.mRCURLY, GroovyBundle.message("rcurly.expected"));
marker.done(CLOSABLE_BLOCK);
}
private static void closableBlockParamsOpt(PsiBuilder builder, GroovyParser parser) {
ParameterList.parse(builder, mCLOSABLE_BLOCK_OP, parser);
ParserUtils.getToken(builder, mNLS);
ParserUtils.getToken(builder, mCLOSABLE_BLOCK_OP);
ParameterList.parse(builder, GroovyTokenTypes.mCLOSABLE_BLOCK_OP, parser);
ParserUtils.getToken(builder, GroovyTokenTypes.mNLS);
ParserUtils.getToken(builder, GroovyTokenTypes.mCLOSABLE_BLOCK_OP);
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2000-2013 JetBrains s.r.o.
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,6 +19,7 @@ package org.jetbrains.plugins.groovy.lang.parser.parsing.statements.expressions;
import com.intellij.lang.PsiBuilder;
import com.intellij.lang.PsiBuilder.Marker;
import org.jetbrains.plugins.groovy.GroovyBundle;
import org.jetbrains.plugins.groovy.lang.lexer.GroovyTokenTypes;
import org.jetbrains.plugins.groovy.lang.lexer.TokenSets;
import org.jetbrains.plugins.groovy.lang.parser.GroovyElementTypes;
import org.jetbrains.plugins.groovy.lang.parser.GroovyParser;
@@ -37,10 +38,10 @@ public class AssignmentExpression implements GroovyElementTypes {
public static boolean parse(PsiBuilder builder, GroovyParser parser, boolean comExprAllowed) {
Marker marker = builder.mark();
final boolean isTuple = ParserUtils.lookAhead(builder, mLPAREN, mIDENT, mCOMMA);
final boolean isTuple = ParserUtils.lookAhead(builder, GroovyTokenTypes.mLPAREN, GroovyTokenTypes.mIDENT, GroovyTokenTypes.mCOMMA);
if (parseSide(builder, parser, isTuple,comExprAllowed)) {
if (ParserUtils.getToken(builder, TokenSets.ASSIGNMENTS)) {
ParserUtils.getToken(builder, mNLS);
ParserUtils.getToken(builder, GroovyTokenTypes.mNLS);
if (!parse(builder, parser, comExprAllowed)) {
builder.error(GroovyBundle.message("expression.expected"));
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2000-2010 JetBrains s.r.o.
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,6 +18,7 @@ package org.jetbrains.plugins.groovy.lang.parser.parsing.statements.expressions.
import com.intellij.lang.PsiBuilder;
import org.jetbrains.plugins.groovy.GroovyBundle;
import org.jetbrains.plugins.groovy.lang.lexer.GroovyTokenTypes;
import org.jetbrains.plugins.groovy.lang.parser.GroovyElementTypes;
import org.jetbrains.plugins.groovy.lang.parser.GroovyParser;
import org.jetbrains.plugins.groovy.lang.parser.parsing.statements.expressions.ExpressionStatement;
@@ -31,8 +32,8 @@ public class CommandArguments implements GroovyElementTypes {
public static boolean parseCommandArguments(PsiBuilder builder, GroovyParser parser) {
PsiBuilder.Marker marker = builder.mark();
if (commandArgParse(builder, parser)) {
while (ParserUtils.getToken(builder, mCOMMA)) {
ParserUtils.getToken(builder, mNLS);
while (ParserUtils.getToken(builder, GroovyTokenTypes.mCOMMA)) {
ParserUtils.getToken(builder, GroovyTokenTypes.mNLS);
if (!commandArgParse(builder, parser)) {
builder.error(GroovyBundle.message("expression.expected"));
break;
@@ -49,8 +50,8 @@ public class CommandArguments implements GroovyElementTypes {
private static boolean commandArgParse(PsiBuilder builder, GroovyParser parser) {
PsiBuilder.Marker commandMarker = builder.mark();
if (ArgumentList.argumentLabelStartCheck(builder, parser)) {
ParserUtils.getToken(builder, mCOLON, GroovyBundle.message("colon.expected"));
ParserUtils.getToken(builder, mNLS);
ParserUtils.getToken(builder, GroovyTokenTypes.mCOLON, GroovyBundle.message("colon.expected"));
ParserUtils.getToken(builder, GroovyTokenTypes.mNLS);
if (!ExpressionStatement.argParse(builder, parser)) {
builder.error(GroovyBundle.message("expression.expected"));
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,6 +20,7 @@ import com.intellij.lang.PsiBuilder;
import com.intellij.psi.tree.TokenSet;
import org.jetbrains.plugins.groovy.GroovyBundle;
import org.jetbrains.plugins.groovy.lang.lexer.GroovyElementType;
import org.jetbrains.plugins.groovy.lang.lexer.GroovyTokenTypes;
import org.jetbrains.plugins.groovy.lang.parser.GroovyElementTypes;
import org.jetbrains.plugins.groovy.lang.parser.GroovyParser;
import org.jetbrains.plugins.groovy.lang.parser.parsing.util.ParserUtils;
@@ -31,8 +32,8 @@ import org.jetbrains.plugins.groovy.lang.parser.parsing.statements.expressions.B
public class ShiftExpression implements GroovyElementTypes {
private static final TokenSet RANGES = TokenSet.create(
mRANGE_EXCLUSIVE,
mRANGE_INCLUSIVE
GroovyTokenTypes.mRANGE_EXCLUSIVE,
GroovyTokenTypes.mRANGE_INCLUSIVE
);
public static boolean parse(PsiBuilder builder, GroovyParser parser) {
@@ -44,7 +45,7 @@ public class ShiftExpression implements GroovyElementTypes {
if (!shiftOrRange.equals(WRONGWAY)) {
if (ParserUtils.getToken(builder, RANGES) ||
getCompositeSign(builder)) {
ParserUtils.getToken(builder, mNLS);
ParserUtils.getToken(builder, GroovyTokenTypes.mNLS);
if (!BinaryExpression.ADDITIVE.parseBinary(builder, parser)) {
builder.error(GroovyBundle.message("expression.expected"));
}
@@ -74,7 +75,7 @@ public class ShiftExpression implements GroovyElementTypes {
* For composite shift operators like >>>
*/
private static boolean getCompositeSign(PsiBuilder builder) {
if (ParserUtils.lookAhead(builder, mGT, mGT, mGT)) {
if (ParserUtils.lookAhead(builder, GroovyTokenTypes.mGT, GroovyTokenTypes.mGT, GroovyTokenTypes.mGT)) {
PsiBuilder.Marker marker = builder.mark();
for (int i = 0; i < 3; i++) {
builder.getTokenText(); //todo[peter] remove look-ahead assertion
@@ -83,7 +84,7 @@ public class ShiftExpression implements GroovyElementTypes {
marker.done(COMPOSITE_TRIPLE_SHIFT_SIGN);
return true;
}
else if (ParserUtils.lookAhead(builder, mLT, mLT)) {
else if (ParserUtils.lookAhead(builder, GroovyTokenTypes.mLT, GroovyTokenTypes.mLT)) {
PsiBuilder.Marker marker = builder.mark();
for (int i = 0; i < 2; i++) {
builder.getTokenText(); //todo[peter] remove look-ahead assertion
@@ -92,7 +93,7 @@ public class ShiftExpression implements GroovyElementTypes {
marker.done(COMPOSITE_LSHIFT_SIGN);
return true;
}
else if (ParserUtils.lookAhead(builder, mGT, mGT)) {
else if (ParserUtils.lookAhead(builder, GroovyTokenTypes.mGT, GroovyTokenTypes.mGT)) {
PsiBuilder.Marker marker = builder.mark();
for (int i = 0; i < 2; i++) {
builder.getTokenText(); //todo[peter] remove look-ahead assertion
@@ -120,7 +121,7 @@ public class ShiftExpression implements GroovyElementTypes {
private static void subParse(PsiBuilder builder, PsiBuilder.Marker marker, GroovyElementType shiftOrRange, GroovyParser parser) {
ParserUtils.getToken(builder, RANGES);
ParserUtils.getToken(builder, mNLS);
ParserUtils.getToken(builder, GroovyTokenTypes.mNLS);
if (!BinaryExpression.ADDITIVE.parseBinary(builder, parser)) {
builder.error(GroovyBundle.message("expression.expected"));
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,6 +19,7 @@ package org.jetbrains.plugins.groovy.lang.parser.parsing.statements.expressions.
import com.intellij.lang.PsiBuilder;
import org.jetbrains.plugins.groovy.GroovyBundle;
import org.jetbrains.plugins.groovy.lang.lexer.GroovyElementType;
import org.jetbrains.plugins.groovy.lang.lexer.GroovyTokenTypes;
import org.jetbrains.plugins.groovy.lang.parser.GroovyElementTypes;
import org.jetbrains.plugins.groovy.lang.parser.GroovyParser;
import org.jetbrains.plugins.groovy.lang.parser.parsing.statements.expressions.arguments.ArgumentList;
@@ -31,19 +32,19 @@ public class ListOrMapConstructorExpression implements GroovyElementTypes {
public static GroovyElementType parse(PsiBuilder builder, GroovyParser parser) {
PsiBuilder.Marker marker = builder.mark();
if (!ParserUtils.getToken(builder, mLBRACK, GroovyBundle.message("lbrack.expected"))) {
if (!ParserUtils.getToken(builder, GroovyTokenTypes.mLBRACK, GroovyBundle.message("lbrack.expected"))) {
marker.drop();
return WRONGWAY;
}
if (ParserUtils.getToken(builder, mRBRACK)) {
if (ParserUtils.getToken(builder, GroovyTokenTypes.mRBRACK)) {
marker.done(LIST_OR_MAP);
return LIST_OR_MAP;
} else if (ParserUtils.getToken(builder, mCOLON)) {
ParserUtils.getToken(builder, mRBRACK, GroovyBundle.message("rbrack.expected"));
} else if (ParserUtils.getToken(builder, GroovyTokenTypes.mCOLON)) {
ParserUtils.getToken(builder, GroovyTokenTypes.mRBRACK, GroovyBundle.message("rbrack.expected"));
} else {
ArgumentList.parseArgumentList(builder, mRBRACK, parser);
ParserUtils.getToken(builder, mNLS);
ParserUtils.getToken(builder, mRBRACK, GroovyBundle.message("rbrack.expected"));
ArgumentList.parseArgumentList(builder, GroovyTokenTypes.mRBRACK, parser);
ParserUtils.getToken(builder, GroovyTokenTypes.mNLS);
ParserUtils.getToken(builder, GroovyTokenTypes.mRBRACK, GroovyBundle.message("rbrack.expected"));
}
marker.done(LIST_OR_MAP);

View File

@@ -18,6 +18,7 @@ package org.jetbrains.plugins.groovy.lang.parser.parsing.statements.imports;
import com.intellij.lang.PsiBuilder;
import org.jetbrains.plugins.groovy.GroovyBundle;
import org.jetbrains.plugins.groovy.lang.lexer.GroovyTokenTypes;
import org.jetbrains.plugins.groovy.lang.lexer.TokenSets;
import org.jetbrains.plugins.groovy.lang.parser.GroovyElementTypes;
import org.jetbrains.plugins.groovy.lang.parser.parsing.statements.typeDefinitions.ReferenceElement;
@@ -40,16 +41,16 @@ public class ImportReference implements GroovyElementTypes {
return false;
}
if (ParserUtils.getToken(builder, mDOT)) {
ParserUtils.getToken(builder, mNLS);
if (!ParserUtils.getToken(builder, mSTAR)) {
if (ParserUtils.getToken(builder, GroovyTokenTypes.mDOT)) {
ParserUtils.getToken(builder, GroovyTokenTypes.mNLS);
if (!ParserUtils.getToken(builder, GroovyTokenTypes.mSTAR)) {
builder.error(GroovyBundle.message("identifier.expected"));
}
}
if (ParserUtils.getToken(builder, kAS)) {
ParserUtils.getToken(builder, mNLS);
if (!ParserUtils.getToken(builder, mIDENT)) {
if (ParserUtils.getToken(builder, GroovyTokenTypes.kAS)) {
ParserUtils.getToken(builder, GroovyTokenTypes.mNLS);
if (!ParserUtils.getToken(builder, GroovyTokenTypes.mIDENT)) {
builder.error(GroovyBundle.message("identifier.expected"));
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,6 +19,7 @@ package org.jetbrains.plugins.groovy.lang.parser.parsing.statements.imports;
import com.intellij.lang.PsiBuilder;
import com.intellij.lang.PsiBuilder.Marker;
import org.jetbrains.plugins.groovy.GroovyBundle;
import org.jetbrains.plugins.groovy.lang.lexer.GroovyTokenTypes;
import org.jetbrains.plugins.groovy.lang.parser.GroovyElementTypes;
import org.jetbrains.plugins.groovy.lang.parser.GroovyParser;
import org.jetbrains.plugins.groovy.lang.parser.parsing.auxiliary.modifiers.Modifiers;
@@ -36,7 +37,7 @@ public class ImportStatement implements GroovyElementTypes {
Modifiers.parse(builder, parser);
if (!kIMPORT.equals(builder.getTokenType())) {
if (!GroovyTokenTypes.kIMPORT.equals(builder.getTokenType())) {
impMarker.rollbackTo();
return false;
}
@@ -47,8 +48,8 @@ public class ImportStatement implements GroovyElementTypes {
}
public static void parseAfterModifiers(PsiBuilder builder) {
ParserUtils.getToken(builder, kIMPORT, GroovyBundle.message("import.keyword.expected"));
ParserUtils.getToken(builder, kSTATIC);
ParserUtils.getToken(builder, GroovyTokenTypes.kIMPORT, GroovyBundle.message("import.keyword.expected"));
ParserUtils.getToken(builder, GroovyTokenTypes.kSTATIC);
if (!ImportReference.parse(builder)) {
builder.error(GroovyBundle.message("import.identifier.expected"));
}

View File

@@ -1,9 +0,0 @@
package org.jetbrains.plugins.groovy.lang.psi;
import com.intellij.psi.PsiClass;
/**
* @author peter
*/
public interface GrClassSubstitution extends PsiClass {
}

View File

@@ -31,6 +31,7 @@ import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.plugins.groovy.config.GroovyConfigUtils;
import org.jetbrains.plugins.groovy.lang.lexer.GroovyTokenTypes;
import org.jetbrains.plugins.groovy.lang.lexer.TokenSets;
import org.jetbrains.plugins.groovy.lang.parser.GroovyElementTypes;
import org.jetbrains.plugins.groovy.lang.psi.GroovyElementVisitor;
@@ -103,19 +104,19 @@ public class GrModifierListImpl extends GrStubElementBase<GrModifierListStub> im
PRIORITY.put(GrModifier.VOLATILE, 3);
PRIORITY.put(GrModifier.DEF, 4);
NAME_TO_MODIFIER_ELEMENT_TYPE.put(GrModifier.PUBLIC, GroovyElementTypes.kPUBLIC);
NAME_TO_MODIFIER_ELEMENT_TYPE.put(GrModifier.ABSTRACT, GroovyElementTypes.kABSTRACT);
NAME_TO_MODIFIER_ELEMENT_TYPE.put(GrModifier.NATIVE, GroovyElementTypes.kNATIVE);
NAME_TO_MODIFIER_ELEMENT_TYPE.put(GrModifier.PRIVATE, GroovyElementTypes.kPRIVATE);
NAME_TO_MODIFIER_ELEMENT_TYPE.put(GrModifier.PROTECTED, GroovyElementTypes.kPROTECTED);
NAME_TO_MODIFIER_ELEMENT_TYPE.put(GrModifier.SYNCHRONIZED, GroovyElementTypes.kSYNCHRONIZED);
NAME_TO_MODIFIER_ELEMENT_TYPE.put(GrModifier.STRICTFP, GroovyElementTypes.kSTRICTFP);
NAME_TO_MODIFIER_ELEMENT_TYPE.put(GrModifier.STATIC, GroovyElementTypes.kSTATIC);
NAME_TO_MODIFIER_ELEMENT_TYPE.put(GrModifier.FINAL, GroovyElementTypes.kFINAL);
NAME_TO_MODIFIER_ELEMENT_TYPE.put(GrModifier.TRANSIENT, GroovyElementTypes.kTRANSIENT);
NAME_TO_MODIFIER_ELEMENT_TYPE.put(GrModifier.NATIVE, GroovyElementTypes.kNATIVE);
NAME_TO_MODIFIER_ELEMENT_TYPE.put(GrModifier.DEF, GroovyElementTypes.kDEF);
NAME_TO_MODIFIER_ELEMENT_TYPE.put(GrModifier.VOLATILE, GroovyElementTypes.kVOLATILE);
NAME_TO_MODIFIER_ELEMENT_TYPE.put(GrModifier.PUBLIC, GroovyTokenTypes.kPUBLIC);
NAME_TO_MODIFIER_ELEMENT_TYPE.put(GrModifier.ABSTRACT, GroovyTokenTypes.kABSTRACT);
NAME_TO_MODIFIER_ELEMENT_TYPE.put(GrModifier.NATIVE, GroovyTokenTypes.kNATIVE);
NAME_TO_MODIFIER_ELEMENT_TYPE.put(GrModifier.PRIVATE, GroovyTokenTypes.kPRIVATE);
NAME_TO_MODIFIER_ELEMENT_TYPE.put(GrModifier.PROTECTED, GroovyTokenTypes.kPROTECTED);
NAME_TO_MODIFIER_ELEMENT_TYPE.put(GrModifier.SYNCHRONIZED, GroovyTokenTypes.kSYNCHRONIZED);
NAME_TO_MODIFIER_ELEMENT_TYPE.put(GrModifier.STRICTFP, GroovyTokenTypes.kSTRICTFP);
NAME_TO_MODIFIER_ELEMENT_TYPE.put(GrModifier.STATIC, GroovyTokenTypes.kSTATIC);
NAME_TO_MODIFIER_ELEMENT_TYPE.put(GrModifier.FINAL, GroovyTokenTypes.kFINAL);
NAME_TO_MODIFIER_ELEMENT_TYPE.put(GrModifier.TRANSIENT, GroovyTokenTypes.kTRANSIENT);
NAME_TO_MODIFIER_ELEMENT_TYPE.put(GrModifier.NATIVE, GroovyTokenTypes.kNATIVE);
NAME_TO_MODIFIER_ELEMENT_TYPE.put(GrModifier.DEF, GroovyTokenTypes.kDEF);
NAME_TO_MODIFIER_ELEMENT_TYPE.put(GrModifier.VOLATILE, GroovyTokenTypes.kVOLATILE);
}
private static final String[] VISIBILITY_MODIFIERS = {GrModifier.PUBLIC, GrModifier.PROTECTED, GrModifier.PRIVATE};

View File

@@ -21,7 +21,7 @@ import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiReference;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.plugins.groovy.lang.parser.GroovyElementTypes;
import org.jetbrains.plugins.groovy.lang.lexer.GroovyTokenTypes;
import org.jetbrains.plugins.groovy.lang.psi.api.statements.branch.GrFlowInterruptingStatement;
import org.jetbrains.plugins.groovy.lang.psi.impl.GroovyPsiElementImpl;
import org.jetbrains.plugins.groovy.lang.psi.impl.auxiliary.GrLabelReference;
@@ -37,7 +37,7 @@ public abstract class GrFlowInterruptingStatementImpl extends GroovyPsiElementIm
@Override
@Nullable
public PsiElement getLabelIdentifier() {
return findChildByType(GroovyElementTypes.mIDENT);
return findChildByType(GroovyTokenTypes.mIDENT);
}
@Override