parse imports in scripts
This commit is contained in:
@@ -107,6 +107,9 @@ public class JetParsing extends AbstractJetParsing {
|
||||
void parseScript() {
|
||||
PsiBuilder.Marker fileMarker = mark();
|
||||
PsiBuilder.Marker scriptMarker = mark();
|
||||
|
||||
parseImportDirectives();
|
||||
|
||||
PsiBuilder.Marker blockMarker = mark();
|
||||
|
||||
myExpressionParsing.parseStatements();
|
||||
@@ -167,10 +170,7 @@ public class JetParsing extends AbstractJetParsing {
|
||||
}
|
||||
namespaceHeader.done(NAMESPACE_HEADER);
|
||||
|
||||
// TODO: Duplicate with parsing imports in parseToplevelDeclarations
|
||||
while (at(IMPORT_KEYWORD)) {
|
||||
parseImportDirective();
|
||||
}
|
||||
parseImportDirectives();
|
||||
}
|
||||
|
||||
/* SimpleName{"."} */
|
||||
@@ -248,6 +248,13 @@ public class JetParsing extends AbstractJetParsing {
|
||||
importDirective.done(IMPORT_DIRECTIVE);
|
||||
}
|
||||
|
||||
private void parseImportDirectives() {
|
||||
// TODO: Duplicate with parsing imports in parseToplevelDeclarations
|
||||
while (at(IMPORT_KEYWORD)) {
|
||||
parseImportDirective();
|
||||
}
|
||||
}
|
||||
|
||||
private void handleUselessRename() {
|
||||
if (at(AS_KEYWORD)) {
|
||||
PsiBuilder.Marker as = mark();
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
import aaa.bbb.Ccc
|
||||
import ddd.*
|
||||
|
||||
fun foo() = 1
|
||||
@@ -0,0 +1,37 @@
|
||||
JetFile: Import.ktscript
|
||||
SCRIPT
|
||||
IMPORT_DIRECTIVE
|
||||
PsiElement(import)('import')
|
||||
PsiWhiteSpace(' ')
|
||||
DOT_QUALIFIED_EXPRESSION
|
||||
DOT_QUALIFIED_EXPRESSION
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('aaa')
|
||||
PsiElement(DOT)('.')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('bbb')
|
||||
PsiElement(DOT)('.')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('Ccc')
|
||||
PsiWhiteSpace('\n')
|
||||
IMPORT_DIRECTIVE
|
||||
PsiElement(import)('import')
|
||||
PsiWhiteSpace(' ')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('ddd')
|
||||
PsiElement(DOT)('.')
|
||||
PsiElement(MUL)('*')
|
||||
PsiWhiteSpace('\n\n')
|
||||
BLOCK
|
||||
FUN
|
||||
PsiElement(fun)('fun')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('foo')
|
||||
VALUE_PARAMETER_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(EQ)('=')
|
||||
PsiWhiteSpace(' ')
|
||||
INTEGER_CONSTANT
|
||||
PsiElement(INTEGER_LITERAL)('1')
|
||||
Reference in New Issue
Block a user