diff --git a/src/common/com/intellij/plugins/haxe/lang/lexer/_HaxeLexer.java b/src/common/com/intellij/plugins/haxe/lang/lexer/_HaxeLexer.java index 2c88dc48e..24d47a170 100644 --- a/src/common/com/intellij/plugins/haxe/lang/lexer/_HaxeLexer.java +++ b/src/common/com/intellij/plugins/haxe/lang/lexer/_HaxeLexer.java @@ -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; @@ -12,8 +30,8 @@ /** * This class is a scanner generated by * JFlex 1.4.3 - * on 04.04.15 18:24 from the specification file - * C:/Users/Boch/IdeaProjects/intellij-haxe-tivo/src/com/intellij/plugins/haxe/lang/lexer/haxe.flex + * on 01.05.15 12:02 from the specification file + * C:/Users/Boch/IdeaProjects/intellij-haxe/src/common/com/intellij/plugins/haxe/lang/lexer/haxe.flex */ public class _HaxeLexer implements FlexLexer, HaxeTokenTypes, HaxeTokenTypeSets { /** initial size of the lookahead buffer */ @@ -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. diff --git a/testData/parsing/haxe/declarations/class/FullOfMacro.txt b/testData/parsing/haxe/declarations/class/FullOfMacro.txt index 497afedef..1c44db69e 100644 --- a/testData/parsing/haxe/declarations/class/FullOfMacro.txt +++ b/testData/parsing/haxe/declarations/class/FullOfMacro.txt @@ -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 diff --git a/testData/parsing/haxe/declarations/class/NativeRandom.txt b/testData/parsing/haxe/declarations/class/NativeRandom.txt index ab8d49f76..e370e50bd 100644 --- a/testData/parsing/haxe/declarations/class/NativeRandom.txt +++ b/testData/parsing/haxe/declarations/class/NativeRandom.txt @@ -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 @@ -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 diff --git a/testData/parsing/haxe/declarations/extern/Interface.hx b/testData/parsing/haxe/declarations/extern/Interface.hx new file mode 100644 index 000000000..0e62e599d --- /dev/null +++ b/testData/parsing/haxe/declarations/extern/Interface.hx @@ -0,0 +1 @@ +extern interface Simple{} diff --git a/testData/parsing/haxe/declarations/extern/Interface.txt b/testData/parsing/haxe/declarations/extern/Interface.txt new file mode 100644 index 000000000..1826c2866 --- /dev/null +++ b/testData/parsing/haxe/declarations/extern/Interface.txt @@ -0,0 +1,11 @@ +Haxe File + EXTERN_INTERFACE_DECLARATION + PsiJavaToken:extern('extern ') + PsiJavaToken:interface('interface') + COMPONENT_NAME + IDENTIFIER + PsiJavaToken:ID('Simple') + PsiJavaToken:{('{') + INTERFACE_BODY + + PsiJavaToken:}('}') \ No newline at end of file diff --git a/testData/parsing/haxe/declarations/extern/Simple.hx b/testData/parsing/haxe/declarations/extern/Simple.hx new file mode 100644 index 000000000..324e50834 --- /dev/null +++ b/testData/parsing/haxe/declarations/extern/Simple.hx @@ -0,0 +1 @@ +extern class Simple{} diff --git a/testData/parsing/haxe/declarations/extern/Simple.txt b/testData/parsing/haxe/declarations/extern/Simple.txt new file mode 100644 index 000000000..754cd6101 --- /dev/null +++ b/testData/parsing/haxe/declarations/extern/Simple.txt @@ -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 + + PsiJavaToken:}('}') \ No newline at end of file diff --git a/testSrc/com/intellij/plugins/haxe/lang/parser/declarations/ExternDeclarationTest.java b/testSrc/com/intellij/plugins/haxe/lang/parser/declarations/ExternDeclarationTest.java new file mode 100644 index 000000000..a6d886943 --- /dev/null +++ b/testSrc/com/intellij/plugins/haxe/lang/parser/declarations/ExternDeclarationTest.java @@ -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); + } +}