Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix parsing interface as extern class #216

Merged
merged 4 commits into from
May 2, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 30 additions & 8 deletions src/common/com/intellij/plugins/haxe/lang/lexer/_HaxeLexer.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,22 @@
/* The following code was generated by JFlex 1.4.3 on 04.04.15 18:24 */
/*
* Copyright 2000-2013 JetBrains s.r.o.
* Copyright 2014-2015 AS3Boyan
* Copyright 2014-2014 Elias Ku
*
* 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.
*/

/* The following code was generated by JFlex 1.4.3 on 01.05.15 12:02 */

package com.intellij.plugins.haxe.lang.lexer;

Expand All @@ -12,8 +30,8 @@
/**
* This class is a scanner generated by
* <a href="http://www.jflex.de/">JFlex</a> 1.4.3
* on 04.04.15 18:24 from the specification file
* <tt>C:/Users/Boch/IdeaProjects/intellij-haxe-tivo/src/com/intellij/plugins/haxe/lang/lexer/haxe.flex</tt>
* on 01.05.15 12:02 from the specification file
* <tt>C:/Users/Boch/IdeaProjects/intellij-haxe/src/common/com/intellij/plugins/haxe/lang/lexer/haxe.flex</tt>
*/
public class _HaxeLexer implements FlexLexer, HaxeTokenTypes, HaxeTokenTypeSets {
/** initial size of the lookahead buffer */
Expand Down Expand Up @@ -1014,15 +1032,19 @@ public _HaxeLexer() {
}


/**
* Creates a new scanner
*
* @param in the java.io.Reader to read input from.
*/
public _HaxeLexer(java.io.Reader in) {
this.zzReader = in;
}

/**
* Creates a new scanner.
* There is also java.io.Reader version of this constructor.
*
* @param in the java.io.Inputstream to read input from.
*/
public _HaxeLexer(java.io.InputStream in) {
this(new java.io.InputStreamReader(in));
}

/**
* Unpacks the compressed character translation table.
Expand Down
8 changes: 3 additions & 5 deletions testData/parsing/haxe/declarations/class/FullOfMacro.txt
Original file line number Diff line number Diff line change
Expand Up @@ -281,11 +281,9 @@ Haxe File
PsiJavaToken:true('true')
PsiJavaToken:)(')')
PsiJavaToken:)(')')
EXTERN_OR_PRIVATE
PsiJavaToken:extern('extern')
EXTERN_OR_PRIVATE
PRIVATE_KEY_WORD
PsiJavaToken:private('private')
PsiJavaToken:extern('extern ')
PRIVATE_KEY_WORD
PsiJavaToken:private('private')
PsiJavaToken:class('class')
COMPONENT_NAME
IDENTIFIER
Expand Down
11 changes: 4 additions & 7 deletions testData/parsing/haxe/declarations/class/NativeRandom.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ Haxe File
SIMPLE_META
FINAL_META
PsiJavaToken:@:final('@:final')
EXTERN_OR_PRIVATE
PsiJavaToken:extern('extern')
PsiJavaToken:extern('extern ')
PsiJavaToken:class('class')
COMPONENT_NAME
IDENTIFIER
Expand Down Expand Up @@ -92,11 +91,9 @@ Haxe File
PsiJavaToken:}('}')
PsiJavaToken:}('}')
EXTERN_CLASS_DECLARATION
EXTERN_OR_PRIVATE
PRIVATE_KEY_WORD
PsiJavaToken:private('private')
EXTERN_OR_PRIVATE
PsiJavaToken:extern('extern')
PRIVATE_KEY_WORD
PsiJavaToken:private('private')
PsiJavaToken:extern('extern ')
PsiJavaToken:class('class')
COMPONENT_NAME
IDENTIFIER
Expand Down
1 change: 1 addition & 0 deletions testData/parsing/haxe/declarations/extern/Interface.hx
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
extern interface Simple{}
11 changes: 11 additions & 0 deletions testData/parsing/haxe/declarations/extern/Interface.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Haxe File
EXTERN_INTERFACE_DECLARATION
PsiJavaToken:extern('extern ')
PsiJavaToken:interface('interface')
COMPONENT_NAME
IDENTIFIER
PsiJavaToken:ID('Simple')
PsiJavaToken:{('{')
INTERFACE_BODY
<empty list>
PsiJavaToken:}('}')
1 change: 1 addition & 0 deletions testData/parsing/haxe/declarations/extern/Simple.hx
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
extern class Simple{}
11 changes: 11 additions & 0 deletions testData/parsing/haxe/declarations/extern/Simple.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Haxe File
EXTERN_CLASS_DECLARATION
PsiJavaToken:extern('extern ')
PsiJavaToken:class('class')
COMPONENT_NAME
IDENTIFIER
PsiJavaToken:ID('Simple')
PsiJavaToken:{('{')
EXTERN_CLASS_DECLARATION_BODY
<empty list>
PsiJavaToken:}('}')
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* Copyright 2000-2013 JetBrains s.r.o.
* Copyright 2014-2015 AS3Boyan
* Copyright 2014-2014 Elias Ku
*
* 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 com.intellij.plugins.haxe.lang.parser.declarations;

import com.intellij.plugins.haxe.lang.psi.HaxeFile;
import com.intellij.plugins.haxe.lang.psi.impl.AbstractHaxePsiClass;
import com.intellij.psi.PsiClass;
import com.intellij.psi.PsiFile;

public class ExternDeclarationTest extends DeclarationTestBase {
public ExternDeclarationTest() {
super("extern");
}

public void testSimple() throws Throwable {
doTest(true);
HaxeFile file = (HaxeFile)myFile;
assertNotNull(file);
PsiClass[] psiClasses = file.getClasses();
assertTrue(psiClasses.length == 1);
AbstractHaxePsiClass psiClass = (AbstractHaxePsiClass)psiClasses[0];
assertTrue(psiClass.isExtern());
}

public void testInterface() throws Throwable {
doTest(true);
}
}