├── .gitignore ├── .idea ├── .name ├── ant.xml ├── artifacts │ └── haskell_jps_plugin_jar.xml ├── compiler.xml ├── copyright │ └── profiles_settings.xml ├── encodings.xml ├── kotlinc.xml ├── libraries │ ├── KotlinJavaRuntime.xml │ ├── commons_compress.xml │ ├── haskell_jps_plugin.xml │ ├── httpclient_4_3_6.xml │ ├── json_simple_1_1_1.xml │ └── pty4j_0_3.xml ├── misc.xml ├── modules.xml ├── runConfigurations │ ├── Remote_debug.xml │ ├── haskell.xml │ └── haskell__compile_debug_.xml ├── scopes │ └── scope_settings.xml ├── uiDesigner.xml └── vcs.xml ├── LICENSE ├── README.md ├── build.xml ├── data ├── cabalParserTests │ ├── Benchmark.cabal │ ├── Benchmark.txt │ ├── Bool.cabal │ ├── Bool.txt │ ├── ComplexCondition.cabal │ ├── ComplexCondition.txt │ ├── ComplexVersionConstraint.cabal │ ├── ComplexVersionConstraint.txt │ ├── EolComment.cabal │ ├── EolComment.txt │ ├── Executable.cabal │ ├── Executable.txt │ ├── Flag.cabal │ ├── Flag.txt │ ├── FreeForm.cabal │ ├── FreeForm.txt │ ├── FreeLine.cabal │ ├── FreeLine.txt │ ├── FullVersionConstraint.cabal │ ├── FullVersionConstraint.txt │ ├── Identifier.cabal │ ├── Identifier.txt │ ├── IfElseSection.cabal │ ├── IfElseSection.txt │ ├── InvalidField.cabal │ ├── InvalidField.txt │ ├── Library.cabal │ ├── Library.txt │ ├── ListInList.cabal │ ├── ListInList.txt │ ├── RepoSource.cabal │ ├── RepoSource.txt │ ├── SimpleBuildInfo.cabal │ ├── SimpleBuildInfo.txt │ ├── SimpleCondition.cabal │ ├── SimpleCondition.txt │ ├── SimpleOptionalCommaList.cabal │ ├── SimpleOptionalCommaList.txt │ ├── SimpleTopLevel.cabal │ ├── SimpleTopLevel.txt │ ├── SimpleVersion.cabal │ ├── SimpleVersion.txt │ ├── TestSuite.cabal │ ├── TestSuite.txt │ ├── Token.cabal │ ├── Token.txt │ ├── VersionConstraint.cabal │ └── VersionConstraint.txt ├── cppTests │ ├── CppIf.hs │ └── CppIf.txt ├── haskellParserTests │ ├── ALotIndents.hs │ ├── ALotIndents.txt │ ├── Backtracking.hs │ ├── Backtracking.txt │ ├── DataType.hs │ ├── DataType.txt │ ├── DoNotation.hs │ ├── DoNotation.txt │ ├── FBind.hs │ ├── FBind.txt │ ├── GADT.hs │ ├── GADT.txt │ ├── GCD.hs │ ├── GCD.txt │ ├── HelloWorld.hs │ ├── HelloWorld.txt │ ├── Imports.hs │ ├── Imports.txt │ ├── ImportsWithData.hs │ ├── ImportsWithData.txt │ ├── Instance.hs │ ├── Instance.txt │ ├── Maximum.hs │ ├── Maximum.txt │ ├── NoModuleKeyword.hs │ ├── NoModuleKeyword.txt │ ├── Numbers.hs │ └── Numbers.txt ├── indentTests │ ├── Braces.hs │ ├── Braces.txt │ ├── BracesIndent.hs │ ├── BracesIndent.txt │ ├── CaseInList.hs │ ├── CaseInList.txt │ ├── ClosingBrace.hs │ ├── ClosingBrace.txt │ ├── HelloWorld.hs │ ├── HelloWorld.txt │ ├── IndentInBraces.hs │ ├── IndentInBraces.txt │ ├── IndentInBracesAgain.hs │ ├── IndentInBracesAgain.txt │ ├── IndentInParenthesis.hs │ ├── IndentInParenthesis.txt │ ├── LetIn.hs │ ├── LetIn.txt │ ├── LetInSameIndent.hs │ ├── LetInSameIndent.txt │ ├── OpenBraceThenClose.hs │ ├── OpenBraceThenClose.txt │ ├── SimpleIndent.hs │ ├── SimpleIndent.txt │ ├── Tabs.hs │ ├── Tabs.txt │ ├── TwoClosingBraces.hs │ └── TwoClosingBraces.txt └── recoveryTests │ ├── Recovery.hs │ └── Recovery.txt ├── generator ├── generator.iml └── src │ └── org │ └── jetbrains │ └── generator │ ├── Generator.flex │ ├── GrammarLexer.java │ ├── GrammarParser.kt │ ├── Main.kt │ ├── ParserException.kt │ ├── ParserGenerator.kt │ ├── TextGenerator.kt │ ├── Token.kt │ ├── TokenType.java │ └── grammar │ ├── AbstractRule.kt │ ├── FakeRule.kt │ ├── Grammar.kt │ ├── Rule.kt │ ├── RuleRef.kt │ ├── TokenDescription.kt │ └── Variant.kt ├── haskell-idea.iml ├── jps-plugin ├── jps-plugin.iml └── src │ ├── META-INF │ └── services │ │ ├── org.jetbrains.jps.incremental.BuilderService │ │ └── org.jetbrains.jps.model.serialization.JpsModelSerializerExtension │ └── org │ └── jetbrains │ └── jps │ └── cabal │ ├── CabalBuilder.java │ ├── CabalBuilderService.java │ ├── CabalJspInterface.java │ ├── JpsHaskellModuleType.java │ ├── ProcessWrapper.java │ └── model │ ├── HaskellSdkType.java │ ├── JpsHaskellModelSerializerExtension.java │ ├── JpsHaskellModulePropertiesSerializer.java │ └── JpsHaskellSdkProperties.java ├── lib ├── commons-compress-1.8.jar ├── httpclient-4.3.6.jar ├── jflex-1.5.1.jar ├── json-simple-1.1.1.jar ├── os │ ├── linux │ │ ├── x86 │ │ │ └── libpty.so │ │ └── x86_64 │ │ │ └── libpty.so │ └── macosx │ │ ├── x86 │ │ └── libpty.dylib │ │ └── x86_64 │ │ └── libpty.dylib └── pty4j-0.3.jar ├── plugin ├── META-INF │ └── plugin.xml ├── gen │ └── org │ │ └── jetbrains │ │ └── grammar │ │ ├── HaskellLexerTokens.java │ │ ├── HaskellParser.java │ │ └── HaskellTokens.kt ├── haskell-plugin.iml ├── haskell.grm ├── resources │ ├── colorSchemes │ │ ├── CassiusDefault.xml │ │ ├── HamletDefault.xml │ │ ├── HaskellDefault.xml │ │ ├── HaskellDracula.xml │ │ ├── JuliusDefault.xml │ │ └── LuciusDefault.xml │ └── org │ │ └── jetbrains │ │ └── haskell │ │ └── icons │ │ ├── application.png │ │ ├── cabal.png │ │ ├── cabal13.png │ │ ├── haskell.png │ │ ├── haskell13.png │ │ ├── haskell16.png │ │ ├── haskell24.png │ │ ├── repl.png │ │ ├── update.png │ │ ├── update@2x.png │ │ └── yesod16.png ├── src │ └── org │ │ └── jetbrains │ │ ├── cabal │ │ ├── CabalApplicationComponent.kt │ │ ├── CabalConfig.kt │ │ ├── CabalFile.kt │ │ ├── CabalFileType.java │ │ ├── CabalInterface.kt │ │ ├── CabalLanguage.java │ │ ├── CabalManager.kt │ │ ├── completion │ │ │ └── CabalCompletionContributor.kt │ │ ├── export │ │ │ ├── CabalModuleBuilder.kt │ │ │ ├── CabalProjectImportBuilder.kt │ │ │ ├── CabalProjectImportProvider.kt │ │ │ ├── CabalProjectResolver.kt │ │ │ ├── CabalProjectSettingsControl.kt │ │ │ ├── CabalTaskManager.kt │ │ │ ├── ImportFromCabalControl.kt │ │ │ └── SimpleCabalStep.kt │ │ ├── highlight │ │ │ ├── CabalAnnotator.kt │ │ │ ├── CabalColorsAndFontsPage.kt │ │ │ ├── CabalHighlighter.kt │ │ │ ├── CabalHighlighterFactory.kt │ │ │ └── ErrorMessage.kt │ │ ├── parser │ │ │ ├── Cabal.flex │ │ │ ├── CabalCompositeElementType.kt │ │ │ ├── CabalConstructs.kt │ │ │ ├── CabalLexer.kt │ │ │ ├── CabalParser.kt │ │ │ ├── CabalParserDefinition.kt │ │ │ ├── CabalTokelTypes.kt │ │ │ └── _CabalLexer.java │ │ ├── psi │ │ │ ├── Benchmark.kt │ │ │ ├── BenchmarkType.kt │ │ │ ├── BoolField.kt │ │ │ ├── BuildDependsField.kt │ │ │ ├── BuildSection.kt │ │ │ ├── BuildToolsField.kt │ │ │ ├── BuildType.kt │ │ │ ├── BuildTypeField.kt │ │ │ ├── BuildableField.kt │ │ │ ├── CSourcesField.kt │ │ │ ├── CabalVersionField.kt │ │ │ ├── Checkable.kt │ │ │ ├── CompilerId.kt │ │ │ ├── ComplexVersionConstraint.kt │ │ │ ├── ConditionPart.kt │ │ │ ├── DataDirField.kt │ │ │ ├── DataFilesField.kt │ │ │ ├── EMail.kt │ │ │ ├── ElseCondition.kt │ │ │ ├── Executable.kt │ │ │ ├── ExposedField.kt │ │ │ ├── ExposedModulesField.kt │ │ │ ├── ExtensionsField.kt │ │ │ ├── ExtraLibDirsField.kt │ │ │ ├── ExtraSourceField.kt │ │ │ ├── ExtraTmpField.kt │ │ │ ├── Field.kt │ │ │ ├── FieldContainer.kt │ │ │ ├── Flag.kt │ │ │ ├── FreeForm.kt │ │ │ ├── FullCondition.kt │ │ │ ├── FullVersionConstraint.kt │ │ │ ├── HsSourceDirsField.kt │ │ │ ├── Identifier.kt │ │ │ ├── IfCondition.kt │ │ │ ├── IncludeDirsField.kt │ │ │ ├── IncludesField.kt │ │ │ ├── InstallIncludesField.kt │ │ │ ├── InvalidConditionPart.kt │ │ │ ├── InvalidField.kt │ │ │ ├── InvalidValue.kt │ │ │ ├── Language.kt │ │ │ ├── Library.kt │ │ │ ├── LicenseField.kt │ │ │ ├── LicenseFilesField.kt │ │ │ ├── MainFileField.kt │ │ │ ├── MultiValueField.kt │ │ │ ├── Name.kt │ │ │ ├── NameField.kt │ │ │ ├── Option.kt │ │ │ ├── OtherModulesField.kt │ │ │ ├── Path.kt │ │ │ ├── PathsField.kt │ │ │ ├── PkgConfigDependsField.kt │ │ │ ├── PropertyField.kt │ │ │ ├── PropertyKey.kt │ │ │ ├── PropertyValue.kt │ │ │ ├── RangedValue.kt │ │ │ ├── RepoKind.kt │ │ │ ├── RepoLocationField.kt │ │ │ ├── RepoModuleField.kt │ │ │ ├── RepoSubdirField.kt │ │ │ ├── RepoTagField.kt │ │ │ ├── RepoType.kt │ │ │ ├── Section.kt │ │ │ ├── SectionType.kt │ │ │ ├── SimpleCondition.kt │ │ │ ├── SingleValueField.kt │ │ │ ├── SourceRepo.kt │ │ │ ├── TestModuleField.kt │ │ │ ├── TestSuite.kt │ │ │ ├── TestSuiteType.kt │ │ │ ├── TestedWithField.kt │ │ │ ├── Token.kt │ │ │ ├── TypeField.kt │ │ │ ├── Url.kt │ │ │ ├── VersionConstraint.kt │ │ │ ├── VersionField.kt │ │ │ └── VersionValue.kt │ │ ├── references │ │ │ └── FilePsiReference.kt │ │ ├── settings │ │ │ ├── CabalLocalSettings.java │ │ │ ├── CabalProjectSettings.kt │ │ │ ├── CabalSettings.kt │ │ │ ├── CabalSettingsListener.kt │ │ │ └── CabalSettingsListenerImpl.java │ │ ├── tool │ │ │ ├── CabalMessageView.java │ │ │ └── CabalToolWindowFactory.kt │ │ └── util │ │ │ └── CabalConstants.kt │ │ ├── grammar │ │ ├── BaseHaskellParser.kt │ │ ├── Main.kt │ │ ├── analysis │ │ │ └── Main.kt │ │ ├── bigTest │ │ │ └── BigParserTest.kt │ │ └── dumb │ │ │ ├── LLState.kt │ │ │ ├── LazyLLParser.kt │ │ │ ├── ResultTree.kt │ │ │ ├── Rule.kt │ │ │ ├── Term.kt │ │ │ └── Variant.kt │ │ ├── haskell │ │ ├── HaskellLanguage.kt │ │ ├── HaskellProjectComponent.kt │ │ ├── HaskellViewProvider.kt │ │ ├── actions │ │ │ ├── NewHaskellFileAction.java │ │ │ └── ShowTypeAction.kt │ │ ├── comment │ │ │ └── HaskellCommenter.java │ │ ├── completion │ │ │ └── HaskellCompletionContributor.kt │ │ ├── config │ │ │ ├── HaskellConfigurable.kt │ │ │ └── HaskellSettings.java │ │ ├── debugger │ │ │ ├── DebugConsoleExecutor.kt │ │ │ ├── DebugProcessStateUpdater.kt │ │ │ ├── HaskellDebugProcess.kt │ │ │ ├── HaskellDebuggerEditorsProvider.kt │ │ │ ├── HaskellProgramRunner.kt │ │ │ ├── actions │ │ │ │ └── SwitchableAction.kt │ │ │ ├── breakpoints │ │ │ │ ├── HaskellBreakpointHandlerFactory.kt │ │ │ │ ├── HaskellExceptionBreakpointHandler.kt │ │ │ │ ├── HaskellExceptionBreakpointProperties.kt │ │ │ │ ├── HaskellExceptionBreakpointPropertiesPanel.kt │ │ │ │ ├── HaskellExceptionBreakpointType.kt │ │ │ │ ├── HaskellLineBreakpointDescription.kt │ │ │ │ ├── HaskellLineBreakpointHandler.kt │ │ │ │ ├── HaskellLineBreakpointType.kt │ │ │ │ └── SelectBreakPropertiesPanel.kt │ │ │ ├── config │ │ │ │ ├── DebuggerConfigurable.kt │ │ │ │ └── HaskellDebugSettings.kt │ │ │ ├── frames │ │ │ │ ├── ForceEvaluationAction.kt │ │ │ │ ├── HsDebugValue.kt │ │ │ │ ├── HsDebuggerEvaluator.kt │ │ │ │ ├── HsExecutionStack.kt │ │ │ │ ├── HsHistoryFrame.kt │ │ │ │ ├── HsStackFrame.kt │ │ │ │ ├── HsSuspendContext.kt │ │ │ │ ├── HsTopStackFrame.kt │ │ │ │ └── ProgramThreadInfo.kt │ │ │ ├── highlighting │ │ │ │ ├── HsDebugSessionListener.kt │ │ │ │ └── HsExecutionPointHighlighter.kt │ │ │ ├── history │ │ │ │ ├── FramesPanel.java │ │ │ │ ├── HistoryManager.kt │ │ │ │ └── HistoryTab.kt │ │ │ ├── parser │ │ │ │ ├── GHCiParser.kt │ │ │ │ ├── JSONConverter.kt │ │ │ │ └── ParsedDataTypes.kt │ │ │ ├── procdebuggers │ │ │ │ ├── GHCiDebugger.kt │ │ │ │ ├── ProcessDebugger.kt │ │ │ │ ├── QueueDebugger.kt │ │ │ │ ├── RemoteDebugger.kt │ │ │ │ ├── SimpleDebuggerImpl.kt │ │ │ │ └── utils │ │ │ │ │ ├── CommandQueue.kt │ │ │ │ │ ├── DebugRespondent.kt │ │ │ │ │ ├── DefaultRespondent.kt │ │ │ │ │ ├── InputReadinessChecker.kt │ │ │ │ │ └── RemoteDebugStreamHandler.kt │ │ │ ├── prochandlers │ │ │ │ ├── GHCiProcessHandler.kt │ │ │ │ ├── HaskellDebugProcessHandler.kt │ │ │ │ └── RemoteProcessHandler.kt │ │ │ ├── protocol │ │ │ │ ├── AbstractCommand.kt │ │ │ │ ├── BackCommand.kt │ │ │ │ ├── BreakpointListCommand.kt │ │ │ │ ├── CommandCallback.kt │ │ │ │ ├── EvalCommand.kt │ │ │ │ ├── ExpressionTypeCommand.kt │ │ │ │ ├── FlowCommand.kt │ │ │ │ ├── ForceCommand.kt │ │ │ │ ├── ForwardCommand.kt │ │ │ │ ├── HiddenCommand.kt │ │ │ │ ├── HistoryCommand.kt │ │ │ │ ├── PrintCommand.kt │ │ │ │ ├── RealTimeCommand.kt │ │ │ │ ├── RemoveBreakpointCommand.kt │ │ │ │ ├── ResumeCommand.kt │ │ │ │ ├── SetBreakpointCommand.kt │ │ │ │ ├── ShowExpressionCommand.kt │ │ │ │ ├── StepCommand.kt │ │ │ │ ├── StepIntoCommand.kt │ │ │ │ ├── StepOverCommand.kt │ │ │ │ ├── SyncCommand.kt │ │ │ │ └── TraceCommand.kt │ │ │ ├── repl │ │ │ │ └── DebugConsoleFactory.kt │ │ │ └── utils │ │ │ │ ├── HaskellUtils.kt │ │ │ │ ├── SyncObject.kt │ │ │ │ └── UIUtils.kt │ │ ├── doc │ │ │ └── HaskellQuickDocumentationProvider.kt │ │ ├── external │ │ │ ├── BuildWrapper.kt │ │ │ ├── ErrorMessage.kt │ │ │ ├── GhcMod.kt │ │ │ ├── GhcModi.kt │ │ │ ├── HaskellExternalAnnotator.kt │ │ │ ├── ScionBrowser.kt │ │ │ ├── ghcfs │ │ │ │ ├── RamFile.kt │ │ │ │ └── RamVirtualFileSystem.kt │ │ │ └── tool │ │ │ │ ├── GhcModConsole.kt │ │ │ │ └── GhcModToolWindowFactory.kt │ │ ├── fileType │ │ │ ├── HaskellFile.kt │ │ │ ├── HaskellFileType.kt │ │ │ ├── HaskellFileTypeFactory.kt │ │ │ ├── HaskellFileViewProviderFactory.kt │ │ │ └── HiFileType.kt │ │ ├── findUsages │ │ │ ├── HaskellFindUsagesProvider.kt │ │ │ └── HaskellWordsScanner.kt │ │ ├── highlight │ │ │ ├── HaskellAnnotator.kt │ │ │ ├── HaskellBraceMatcher.kt │ │ │ ├── HaskellColorsAndFontsPage.kt │ │ │ ├── HaskellHighlighter.kt │ │ │ └── HaskellHighlighterFactory.java │ │ ├── icons │ │ │ └── HaskellIcons.kt │ │ ├── module │ │ │ ├── CabalPackagesContainer.java │ │ │ ├── HaskellModuleBuilder.kt │ │ │ ├── HaskellModuleConfigEditor.kt │ │ │ ├── HaskellModuleType.kt │ │ │ └── OutputEditor.kt │ │ ├── parser │ │ │ ├── HaskellCompositeElementType.kt │ │ │ ├── HaskellParserDefinition.kt │ │ │ ├── HaskellTokenType.kt │ │ │ ├── LexerState.kt │ │ │ ├── cpp │ │ │ │ └── CPPTokens.java │ │ │ ├── lexer │ │ │ │ ├── Haskell.flex │ │ │ │ ├── HaskellLexer.kt │ │ │ │ └── _HaskellLexer.java │ │ │ ├── rules │ │ │ │ └── BaseParser.kt │ │ │ └── token │ │ │ │ └── HaskellLexerTokens.kt │ │ ├── psi │ │ │ ├── Application.kt │ │ │ ├── ApplicationType.kt │ │ │ ├── BindStatement.kt │ │ │ ├── CaseAlternative.kt │ │ │ ├── CaseExpression.kt │ │ │ ├── ClassDeclaration.kt │ │ │ ├── ConstructorDeclaration.kt │ │ │ ├── Context.kt │ │ │ ├── DataDeclaration.kt │ │ │ ├── Declaration.kt │ │ │ ├── DoExpression.kt │ │ │ ├── Expression.kt │ │ │ ├── ExpressionStatement.kt │ │ │ ├── FieldDeclaration.kt │ │ │ ├── FieldUpdate.kt │ │ │ ├── ForeignDeclaration.kt │ │ │ ├── FunctionType.kt │ │ │ ├── Guard.kt │ │ │ ├── HaskellType.kt │ │ │ ├── Import.kt │ │ │ ├── ImportAsPart.kt │ │ │ ├── InstanceDeclaration.kt │ │ │ ├── LambdaExpression.kt │ │ │ ├── LetExpression.kt │ │ │ ├── LetStatement.kt │ │ │ ├── ListType.kt │ │ │ ├── Module.kt │ │ │ ├── ModuleExports.kt │ │ │ ├── ModuleName.kt │ │ │ ├── OperatorExpression.kt │ │ │ ├── ParenthesisExpression.kt │ │ │ ├── Pattern.kt │ │ │ ├── QCon.kt │ │ │ ├── QNameExpression.kt │ │ │ ├── QVar.kt │ │ │ ├── QVarSym.kt │ │ │ ├── RightHandSide.kt │ │ │ ├── SignatureDeclaration.kt │ │ │ ├── SomeId.kt │ │ │ ├── Statement.kt │ │ │ ├── StringLiteral.kt │ │ │ ├── TupleType.kt │ │ │ ├── TypeSynonym.kt │ │ │ ├── TypeVariable.kt │ │ │ ├── UnguardedRHS.kt │ │ │ ├── UnparsedToken.kt │ │ │ ├── ValueDefinition.kt │ │ │ ├── VariableOperation.kt │ │ │ ├── WhereBindings.kt │ │ │ ├── reference │ │ │ │ ├── ConstructorReference.kt │ │ │ │ ├── ModuleReference.kt │ │ │ │ ├── SomeIdReference.kt │ │ │ │ ├── TypeReference.kt │ │ │ │ └── ValueReference.kt │ │ │ └── util │ │ │ │ └── HaskellElementFactory.kt │ │ ├── repl │ │ │ ├── HaskellConsole.java │ │ │ ├── HaskellConsoleExecuteActionHandler.java │ │ │ ├── HaskellConsoleHighlightingUtil.java │ │ │ ├── HaskellConsoleProcessHandler.java │ │ │ ├── HaskellConsoleRunner.java │ │ │ └── actions │ │ │ │ ├── HaskellConsoleActionBase.java │ │ │ │ ├── LoadHaskellFileInConsoleAction.java │ │ │ │ └── RunHaskellConsoleAction.java │ │ ├── run │ │ │ ├── ModuleComboBoxRenderer.java │ │ │ └── haskell │ │ │ │ ├── CabalRunConfiguration.java │ │ │ │ ├── CabalRunConfigurationProducer.kt │ │ │ │ ├── ConfigurationEditor.kt │ │ │ │ ├── HaskellCommandLineState.kt │ │ │ │ ├── HaskellRunConfigurationType.kt │ │ │ │ └── ProgramParamsPanel.kt │ │ ├── scope │ │ │ ├── ExpressionScope.kt │ │ │ ├── GlobalScope.kt │ │ │ ├── ImportScope.kt │ │ │ └── ModuleScope.kt │ │ ├── sdk │ │ │ ├── HaskellSdkAdditionalData.kt │ │ │ ├── HaskellSdkConfigurable.kt │ │ │ ├── HaskellSdkConfigurableForm.kt │ │ │ └── HaskellSdkType.kt │ │ ├── util │ │ │ ├── DefaultListModelWrapper.java │ │ │ ├── FileUtil.kt │ │ │ ├── GHCUtil.java │ │ │ ├── GHCVersion.kt │ │ │ ├── JComboBoxWrapper.java │ │ │ ├── LineColPosition.java │ │ │ ├── OSUtil.kt │ │ │ ├── ProcessRunner.kt │ │ │ └── UiUtil.kt │ │ └── vfs │ │ │ ├── CabalVirtualFileSystem.kt │ │ │ ├── TarGzArchive.kt │ │ │ └── TarGzFile.kt │ │ └── yesod │ │ ├── cassius │ │ ├── CassiusFile.java │ │ ├── CassiusFileType.java │ │ ├── CassiusLanguage.java │ │ └── parser │ │ │ ├── Cassius.flex │ │ │ ├── CassiusCompositeElementType.java │ │ │ ├── CassiusLexer.java │ │ │ ├── CassiusParser.java │ │ │ ├── CassiusParserDefinition.java │ │ │ ├── CassiusToken.java │ │ │ ├── CassiusTokenTypes.java │ │ │ └── _CassiusLexer.java │ │ ├── hamlet │ │ ├── HamletFile.kt │ │ ├── HamletFileType.kt │ │ ├── HamletLanguage.kt │ │ ├── completion │ │ │ └── HamletCompletionContributor.kt │ │ ├── highlight │ │ │ ├── HamletAnnotator.kt │ │ │ └── HamletColors.kt │ │ ├── parser │ │ │ ├── Hamlet.flex │ │ │ ├── HamletCompositeElementType.kt │ │ │ ├── HamletLexer.kt │ │ │ ├── HamletParser.kt │ │ │ ├── HamletParserDefinition.kt │ │ │ ├── HamletToken.kt │ │ │ ├── HamletTokenTypes.kt │ │ │ └── _HamletLexer.java │ │ └── psi │ │ │ ├── Attribute.kt │ │ │ ├── AttributeValue.kt │ │ │ ├── ColonIdentifier.kt │ │ │ ├── Comment.kt │ │ │ ├── Doctype.kt │ │ │ ├── DotIdentifier.kt │ │ │ ├── Escape.kt │ │ │ ├── Identifier.kt │ │ │ ├── Interpolation.kt │ │ │ ├── Operator.kt │ │ │ ├── SharpIdentifier.kt │ │ │ ├── String.kt │ │ │ └── Tag.kt │ │ ├── julius │ │ ├── JuliusFile.kt │ │ ├── JuliusFileType.kt │ │ ├── JuliusLanguage.kt │ │ ├── completion │ │ │ └── JuliusCompletionContributor.kt │ │ ├── highlight │ │ │ ├── JuliusAnnotator.kt │ │ │ └── JuliusColors.kt │ │ ├── parser │ │ │ ├── Julius.flex │ │ │ ├── JuliusCompositeElementType.kt │ │ │ ├── JuliusLexer.kt │ │ │ ├── JuliusParser.kt │ │ │ ├── JuliusParserDefinition.kt │ │ │ ├── JuliusToken.kt │ │ │ ├── JuliusTokenTypes.kt │ │ │ └── _JuliusLexer.java │ │ └── psi │ │ │ ├── Comment.kt │ │ │ ├── DotIdentifier.kt │ │ │ ├── Interpolation.kt │ │ │ ├── Keyword.kt │ │ │ ├── Number.kt │ │ │ └── String.kt │ │ └── lucius │ │ ├── LuciusFile.kt │ │ ├── LuciusFileType.kt │ │ ├── LuciusLanguage.kt │ │ ├── completion │ │ └── LuciusCompletionContributor.kt │ │ ├── highlight │ │ ├── LuciusAnnotator.kt │ │ └── LuciusColors.kt │ │ ├── parser │ │ ├── Lucius.flex │ │ ├── LuciusCompositeElementType.kt │ │ ├── LuciusLexer.kt │ │ ├── LuciusParser.kt │ │ ├── LuciusParserDefinition.kt │ │ ├── LuciusToken.kt │ │ ├── LuciusTokenTypes.kt │ │ └── _LuciusLexer.java │ │ └── psi │ │ ├── AtRule.kt │ │ ├── Attribute.kt │ │ ├── CCIdentifier.kt │ │ ├── ColonIdentifier.kt │ │ ├── Comment.kt │ │ ├── DotIdentifier.kt │ │ ├── Function.kt │ │ ├── Hyperlink.kt │ │ ├── Interpolation.kt │ │ ├── Number.kt │ │ ├── SharpIdentifier.kt │ │ └── String.kt ├── test │ └── org │ │ └── jetbrains │ │ ├── cabal │ │ └── parser │ │ │ └── CabalParsingTest.java │ │ └── haskell │ │ ├── debugger │ │ ├── parser │ │ │ └── GHCiParserTests.kt │ │ └── procdebuggers │ │ │ ├── DebuggerTest.kt │ │ │ ├── GHCiDebuggerTest.kt │ │ │ └── RemoteDebuggerTest.kt │ │ ├── lexer │ │ └── HaskellLexerTest.java │ │ └── parser │ │ ├── CPPTest.java │ │ ├── HaskellTest.java │ │ ├── IndentTest.java │ │ └── RecoveryTest.java └── testresources │ ├── TestMain.hs │ └── unittest.properties └── tools └── idea-flex.skeleton /.gitignore: -------------------------------------------------------------------------------- 1 | .idea/workspace.xml 2 | lib/kotlin-runtime-sources.jar 3 | lib/haskell-jps-plugin.jar 4 | haskell-ide-api/dist 5 | haskell-ide-api/.idea/workspace.xml 6 | build/* 7 | out/* 8 | -------------------------------------------------------------------------------- /.idea/.name: -------------------------------------------------------------------------------- 1 | haskell-idea-plugin -------------------------------------------------------------------------------- /.idea/ant.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/artifacts/haskell_jps_plugin_jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | $PROJECT_DIR$/lib/ 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/kotlinc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | -------------------------------------------------------------------------------- /.idea/libraries/KotlinJavaRuntime.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/commons_compress.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/libraries/haskell_jps_plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/libraries/httpclient_4_3_6.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/libraries/json_simple_1_1_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/libraries/pty4j_0_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/runConfigurations/Remote_debug.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16 | -------------------------------------------------------------------------------- /.idea/runConfigurations/haskell.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17 | -------------------------------------------------------------------------------- /.idea/runConfigurations/haskell__compile_debug_.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17 | -------------------------------------------------------------------------------- /.idea/scopes/scope_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /data/cabalParserTests/Benchmark.cabal: -------------------------------------------------------------------------------- 1 | benchmark 2 | benchmark still /!!/ name 3 | type: a 4 | 5 | 6 | benchmark name 7 | main-is: a 8 | if true 9 | other-languages: adrs -------------------------------------------------------------------------------- /data/cabalParserTests/Bool.cabal: -------------------------------------------------------------------------------- 1 | library 2 | exposed: TrUe 3 | exposed: False 4 | exposed: false -------------------------------------------------------------------------------- /data/cabalParserTests/Bool.txt: -------------------------------------------------------------------------------- 1 | FILE 2 | Library(LIBRARY) 3 | SectionType(SECTION_TYPE) 4 | PsiElement(id)('library') 5 | PsiElement(NEW_LINE_INDENT)('\n ') 6 | ExposedField(EXPOSED) 7 | PropertyKey(PROPERTY_KEY) 8 | PsiElement(id)('exposed') 9 | PsiElement(:)(':') 10 | PsiWhiteSpace(' ') 11 | PsiElement(id)('TrUe') 12 | PsiElement(NEW_LINE_INDENT)('\n ') 13 | ExposedField(EXPOSED) 14 | PropertyKey(PROPERTY_KEY) 15 | PsiElement(id)('exposed') 16 | PsiElement(:)(':') 17 | PsiWhiteSpace(' ') 18 | PsiElement(id)('False') 19 | PsiElement(NEW_LINE_INDENT)('\n ') 20 | ExposedField(EXPOSED) 21 | PropertyKey(PROPERTY_KEY) 22 | PsiElement(id)('exposed') 23 | PsiElement(:)(':') 24 | PsiWhiteSpace(' ') 25 | PsiElement(id)('false') -------------------------------------------------------------------------------- /data/cabalParserTests/ComplexCondition.cabal: -------------------------------------------------------------------------------- 1 | library 2 | if true&&true || true 3 | if (true && true) || true 4 | if !true 5 | if (((true))) 6 | if (((missing_brackets) || some 7 | if inva || 8 | id -------------------------------------------------------------------------------- /data/cabalParserTests/ComplexVersionConstraint.cabal: -------------------------------------------------------------------------------- 1 | tested-with: id >= 2 && < 1.3 2 | tested-with: id >= 2 3 | || < 1.3 4 | tested-with: id == 2.* && 5 | <=1.3.4|| 6 | ==1 7 | tested-with: id >=1.2||==1||==1.*&&>3 -------------------------------------------------------------------------------- /data/cabalParserTests/EolComment.cabal: -------------------------------------------------------------------------------- 1 | name: a 2 | -- between_fields 3 | tested-with: 4 | -- before_value 5 | a, 6 | --inside_list 7 | --some 8 | a 9 | --inside_list 10 | a 11 | executable a 12 | --after sect name 13 | other-languages: a 14 | --comm 15 | ,a 16 | 17 | --comm 18 | main-is: a 19 | 20 | -------------------------------------------------------------------------------- /data/cabalParserTests/Executable.cabal: -------------------------------------------------------------------------------- 1 | executable name 2 | main-is: a 3 | if true 4 | other-languages: adrs -------------------------------------------------------------------------------- /data/cabalParserTests/Executable.txt: -------------------------------------------------------------------------------- 1 | FILE 2 | Executable(EXECUTABLE) 3 | SectionType(SECTION_TYPE) 4 | PsiElement(id)('executable') 5 | PsiWhiteSpace(' ') 6 | Name(NAME) 7 | PsiElement(id)('name') 8 | PsiElement(NEW_LINE_INDENT)('\n ') 9 | MainFileField(MAIN_FILE) 10 | PropertyKey(PROPERTY_KEY) 11 | PsiElement(id)('main-is') 12 | PsiElement(:)(':') 13 | PsiWhiteSpace(' ') 14 | Path(PATH) 15 | PsiElement(id)('a') 16 | PsiElement(NEW_LINE_INDENT)('\n ') 17 | IfCondition(IF_CONDITION) 18 | SectionType(SECTION_TYPE) 19 | PsiElement(id)('if') 20 | PsiWhiteSpace(' ') 21 | FullCondition(FULL_CONDITION) 22 | ConditionPart(CONDITION_PART) 23 | SimpleCondition(SIMPLE_CONDITION) 24 | PsiElement(id)('true') 25 | PsiElement(NEW_LINE_INDENT)('\n ') 26 | MultiValueField(MULTI_VAL) 27 | PropertyKey(PROPERTY_KEY) 28 | PsiElement(id)('other-languages') 29 | PsiElement(:)(':') 30 | PsiWhiteSpace(' ') 31 | Language(LANGUAGE) 32 | PsiElement(id)('adrs') -------------------------------------------------------------------------------- /data/cabalParserTests/Flag.cabal: -------------------------------------------------------------------------------- 1 | flag some 2 | description: free 3 | default: true 4 | manual: true -------------------------------------------------------------------------------- /data/cabalParserTests/Flag.txt: -------------------------------------------------------------------------------- 1 | FILE 2 | Flag(FLAG) 3 | SectionType(SECTION_TYPE) 4 | PsiElement(id)('flag') 5 | PsiWhiteSpace(' ') 6 | Name(NAME) 7 | PsiElement(id)('some') 8 | PsiElement(NEW_LINE_INDENT)('\n ') 9 | SingleValueField(SINGLE_VAL) 10 | PropertyKey(PROPERTY_KEY) 11 | PsiElement(id)('description') 12 | PsiElement(:)(':') 13 | PsiWhiteSpace(' ') 14 | FreeForm(FREE_FORM) 15 | PsiElement(id)('free') 16 | PsiElement(NEW_LINE_INDENT)('\n ') 17 | BoolField(BOOL_FIELD) 18 | PropertyKey(PROPERTY_KEY) 19 | PsiElement(id)('default') 20 | PsiElement(:)(':') 21 | PsiWhiteSpace(' ') 22 | PsiElement(id)('true') 23 | PsiElement(NEW_LINE_INDENT)('\n ') 24 | BoolField(BOOL_FIELD) 25 | PropertyKey(PROPERTY_KEY) 26 | PsiElement(id)('manual') 27 | PsiElement(:)(':') 28 | PsiWhiteSpace(' ') 29 | PsiElement(id)('true') -------------------------------------------------------------------------------- /data/cabalParserTests/FreeForm.cabal: -------------------------------------------------------------------------------- 1 | stability: this is a free 1 . 345 2 | form its so 3 | free you !! cannot believe 4 | it 5 | i even ^ : can 6 | 7 | 8 | use special ;_* >= == = characters other-extensions: 9 | here 10 | author: is so brillian and bold (in many ways) 11 | i cannot & ? believe it -------------------------------------------------------------------------------- /data/cabalParserTests/FreeLine.cabal: -------------------------------------------------------------------------------- 1 | maintainer: this /&&? ultimateli free line -- +==+=+== 2 | maintainer: this is 3 | not 4 | -------------------------------------------------------------------------------- /data/cabalParserTests/FullVersionConstraint.cabal: -------------------------------------------------------------------------------- 1 | tested-with: id > 2||<=2 2 | tested-with: id -------------------------------------------------------------------------------- /data/cabalParserTests/FullVersionConstraint.txt: -------------------------------------------------------------------------------- 1 | FILE 2 | TestedWithField(TESTED_WITH) 3 | PropertyKey(PROPERTY_KEY) 4 | PsiElement(id)('tested-with') 5 | PsiElement(:)(':') 6 | PsiWhiteSpace(' ') 7 | FullVersionConstraint(FULL_CONSTRAINT) 8 | CompilerId(COMPILER) 9 | PsiElement(id)('id') 10 | PsiWhiteSpace(' ') 11 | ComplexVersionConstraint(COMPLEX_CONSTRAINT) 12 | VersionConstraint(VERSION_CONSTRAINT) 13 | PsiElement(COMPARATOR)('>') 14 | PsiWhiteSpace(' ') 15 | PsiElement(number)('2') 16 | PsiElement(LOGIC)('||') 17 | VersionConstraint(VERSION_CONSTRAINT) 18 | PsiElement(COMPARATOR)('<=') 19 | PsiElement(number)('2') 20 | PsiElement(NEW_LINE_INDENT)('\n') 21 | TestedWithField(TESTED_WITH) 22 | PropertyKey(PROPERTY_KEY) 23 | PsiElement(id)('tested-with') 24 | PsiElement(:)(':') 25 | PsiWhiteSpace(' ') 26 | FullVersionConstraint(FULL_CONSTRAINT) 27 | CompilerId(COMPILER) 28 | PsiElement(id)('id') -------------------------------------------------------------------------------- /data/cabalParserTests/Identifier.cabal: -------------------------------------------------------------------------------- 1 | build-type: valid_identi-fier123 2 | build-type: invalid/one -------------------------------------------------------------------------------- /data/cabalParserTests/Identifier.txt: -------------------------------------------------------------------------------- 1 | FILE 2 | BuildTypeField(BUILD_TYPE) 3 | PropertyKey(PROPERTY_KEY) 4 | PsiElement(id)('build-type') 5 | PsiElement(:)(':') 6 | PsiWhiteSpace(' ') 7 | BuildType(BUILD_TYPE) 8 | PsiElement(id)('valid_identi-fier123') 9 | PsiElement(NEW_LINE_INDENT)('\n') 10 | BuildTypeField(BUILD_TYPE) 11 | PropertyKey(PROPERTY_KEY) 12 | PsiElement(id)('build-type') 13 | PsiElement(:)(':') 14 | PsiWhiteSpace(' ') 15 | BuildType(BUILD_TYPE) 16 | PsiElement(id)('invalid') 17 | InvalidValue(INVALID_VALUE) 18 | PsiElement(/)('/') 19 | PsiElement(id)('one') -------------------------------------------------------------------------------- /data/cabalParserTests/IfElseSection.cabal: -------------------------------------------------------------------------------- 1 | library 2 | if true 3 | other-modules: d 4 | 5 | 6 | else 7 | other-modules: d 8 | 9 | if true 10 | other-modules: d 11 | 12 | if os(invalid) 13 | other-modules: d 14 | else 15 | other-modules: d 16 | 17 | 18 | if os(invalid) 19 | other-modules: d 20 | else 21 | other-modules: d 22 | 23 | 24 | if true 25 | if true 26 | if true 27 | other-modules: d 28 | else 29 | other-modules: d 30 | 31 | else 32 | other-modules: d -------------------------------------------------------------------------------- /data/cabalParserTests/InvalidField.cabal: -------------------------------------------------------------------------------- 1 | invalid: some 2 | value 3 | invalid ptish-ptish 4 | 5 | library 6 | other-languages: some 7 | invalid: some 8 | invalid -------------------------------------------------------------------------------- /data/cabalParserTests/Library.cabal: -------------------------------------------------------------------------------- 1 | library 2 | exposed: true 3 | exposed-modules: some 4 | if true 5 | other-languages: some -------------------------------------------------------------------------------- /data/cabalParserTests/ListInList.cabal: -------------------------------------------------------------------------------- 1 | tested-with: a <= 2 && == 1 b == 3 || ==1.2.* c == 1 && == 3 2 | 3 | library 4 | build-depends: list <= 5 && == 7, some >= 15 && == 1, other <=100 -------------------------------------------------------------------------------- /data/cabalParserTests/RepoSource.cabal: -------------------------------------------------------------------------------- 1 | source-repository this 2 | type: some 3 | source-repository head 4 | location: where 5 | source-repository this head 6 | tag: what 7 | source-repository 8 | branch: the_hell 9 | module: are_you 10 | subdir: doing_here -------------------------------------------------------------------------------- /data/cabalParserTests/SimpleCondition.cabal: -------------------------------------------------------------------------------- 1 | library 2 | if invalid() 3 | if os ( name ) 4 | if impl (c >= 1) 5 | if flag( smth ) 6 | if true 7 | if false -------------------------------------------------------------------------------- /data/cabalParserTests/SimpleOptionalCommaList.cabal: -------------------------------------------------------------------------------- 1 | library 2 | other-modules: one 3 | extra-libraries: a, a, a 4 | extra-libraries: a a a a 5 | extra-libraries: a, a, a a 6 | cpp-options: a 7 | , 8 | a 9 | , 10 | a 11 | a -------------------------------------------------------------------------------- /data/cabalParserTests/SimpleTopLevel.cabal: -------------------------------------------------------------------------------- 1 | name: Simple 2 | version: 1.0 3 | Build-Type: Simple 4 | cabal-version: >= 1.2 5 | 6 | package-url: //some_url.com/folder/ 7 | homepage: //www.vk.com 8 | license: identifier 9 | license-file: filename 10 | 11 | copyright: freeform 12 | author: freeform 13 | maintainer: address 14 | stability: freeform 15 | 16 | bug-reports: URL 17 | synopsis: freeform 18 | description: freeform 19 | category: freeform 20 | 21 | tested-with: compilerlist 22 | data-files: filenamelist 23 | data-dir: directory 24 | extra-source-files: filenamelist 25 | extra-tmp-files: filenamelist -------------------------------------------------------------------------------- /data/cabalParserTests/SimpleVersion.cabal: -------------------------------------------------------------------------------- 1 | version: 3.1.3 2 | version: 12 3 | version: 4.3-from-2014.3.2133-till-hell.3.1 4 | -------------------------------------------------------------------------------- /data/cabalParserTests/SimpleVersion.txt: -------------------------------------------------------------------------------- 1 | FILE 2 | VersionField(VERSION_PROPERTY) 3 | PropertyKey(PROPERTY_KEY) 4 | PsiElement(id)('version') 5 | PsiElement(:)(':') 6 | PsiWhiteSpace(' ') 7 | VersionValue(VERSION_VALUE) 8 | PsiElement(id)('3.1.3') 9 | PsiElement(NEW_LINE_INDENT)('\n') 10 | VersionField(VERSION_PROPERTY) 11 | PropertyKey(PROPERTY_KEY) 12 | PsiElement(id)('version') 13 | PsiElement(:)(':') 14 | PsiWhiteSpace(' ') 15 | VersionValue(VERSION_VALUE) 16 | PsiElement(number)('12') 17 | PsiElement(NEW_LINE_INDENT)('\n') 18 | VersionField(VERSION_PROPERTY) 19 | PropertyKey(PROPERTY_KEY) 20 | PsiElement(id)('version') 21 | PsiElement(:)(':') 22 | PsiWhiteSpace(' ') 23 | VersionValue(VERSION_VALUE) 24 | PsiElement(id)('4.3-from-2014.3.2133-till-hell.3.1') -------------------------------------------------------------------------------- /data/cabalParserTests/TestSuite.cabal: -------------------------------------------------------------------------------- 1 | test-suite name 2 | test-module: i_want 3 | main-is: an 4 | type: ice-cream 5 | if true 6 | ghc-options: "i'll have it" -------------------------------------------------------------------------------- /data/cabalParserTests/Token.cabal: -------------------------------------------------------------------------------- 1 | license-file: val\\.!id" token\" "@><>= 2 | homepage: inval id 3 | package-url: another 4 | invalid 5 | license-file: simple -------------------------------------------------------------------------------- /data/cabalParserTests/VersionConstraint.cabal: -------------------------------------------------------------------------------- 1 | cabal-version: == 4.3.* 2 | cabal-version: == 4.3 3 | cabal-version: > 2.6-while-dancing.6 4 | cabal-version: <2 5 | cabal-version: >= 4.2 6 | cabal-version: <=4 7 | cabal-version: <= 8 | 4-invalid -------------------------------------------------------------------------------- /data/cppTests/CppIf.hs: -------------------------------------------------------------------------------- 1 | module Main where 2 | 3 | #if MIN_VERSION_tagged(0,2,0) 4 | import Data.Proxy 5 | #endif 6 | 7 | main = putStrLn "Hello world!!!" -------------------------------------------------------------------------------- /data/haskellParserTests/ALotIndents.hs: -------------------------------------------------------------------------------- 1 | module ALotIndents where 2 | 3 | handleArguments = do 4 | mapM_ handle' args where 5 | handle' x = do 6 | let arg = x 7 | case arg of 8 | Main m -> x 9 | 10 | -------------------------------------------------------------------------------- /data/haskellParserTests/Backtracking.hs: -------------------------------------------------------------------------------- 1 | module Backtracking where 2 | 3 | fun = do (\x -> do renderWithDrawable) 4 | -------------------------------------------------------------------------------- /data/haskellParserTests/DataType.hs: -------------------------------------------------------------------------------- 1 | module Shape where 2 | 3 | data Shape = Circle Float Float Float | Rectangle Float Float Float Float deriving (Show) 4 | -------------------------------------------------------------------------------- /data/haskellParserTests/DoNotation.hs: -------------------------------------------------------------------------------- 1 | module DoNotation where 2 | 3 | listOfTuples :: [(Int,Char)] 4 | listOfTuples = do 5 | let nums = [1, 2] 6 | n <- nums 7 | ch <- ['a','b'] 8 | return (n,ch) -------------------------------------------------------------------------------- /data/haskellParserTests/FBind.hs: -------------------------------------------------------------------------------- 1 | module FBind where 2 | 3 | function = value { field1 = Val1 4 | , field2 = Val2 5 | , field3 = Val2 6 | } -------------------------------------------------------------------------------- /data/haskellParserTests/GADT.hs: -------------------------------------------------------------------------------- 1 | module GADT where 2 | 3 | data Term a where 4 | Lit :: Int -> Term Int 5 | Succ :: Term Int -> Term Int 6 | IsZero :: Term Int -> Term Bool 7 | If :: Term Bool -> Term a -> Term a -> Term a 8 | Pair :: Term a -> Term b -> Term (a,b) 9 | -------------------------------------------------------------------------------- /data/haskellParserTests/GCD.hs: -------------------------------------------------------------------------------- 1 | module HelloWorld where 2 | 3 | gcd' :: Int -> Int -> Int 4 | gcd' a b 5 | | b == 0 = a 6 | | otherwise = gcd' b (a `mod` b) -------------------------------------------------------------------------------- /data/haskellParserTests/HelloWorld.hs: -------------------------------------------------------------------------------- 1 | module HelloWorld where 2 | 3 | main :: IO () 4 | main = putStrLn "Hello world!!!" 5 | 6 | -------------------------------------------------------------------------------- /data/haskellParserTests/Imports.hs: -------------------------------------------------------------------------------- 1 | module Imports ( 2 | Block(..), parseDocstring, renderDocstring, emptyDocstring, nullDocstring, noDocs, 3 | ) where 4 | 5 | import qualified Cheapskate as C 6 | import Cheapskate.Html (renderDoc) 7 | import SomeModule (OutputAnnotation(..), TextFormatting(..), Name, Term, Err) 8 | import Data.Traversable (Traversable) -------------------------------------------------------------------------------- /data/haskellParserTests/ImportsWithData.hs: -------------------------------------------------------------------------------- 1 | module Main where 2 | 3 | import System.IO 4 | 5 | data Data = First | Second deriving (Show, Eq) 6 | 7 | -------------------------------------------------------------------------------- /data/haskellParserTests/Instance.hs: -------------------------------------------------------------------------------- 1 | module Instance where 2 | 3 | data TrafficLight = Red | Yellow | Green 4 | 5 | class Eq a where 6 | (==) :: a -> a -> Bool 7 | (/=) :: a -> a -> Bool 8 | x == y = not (x /= y) 9 | x /= y = not (x == y) 10 | 11 | instance Eq TrafficLight where 12 | Red == Red = True 13 | Green == Green = True 14 | Yellow == Yellow = True 15 | _ == _ = False -------------------------------------------------------------------------------- /data/haskellParserTests/Maximum.hs: -------------------------------------------------------------------------------- 1 | module Maximum where 2 | 3 | maximum' :: (Ord a) => [a] -> a 4 | maximum' [] = error "maximum of empty list" 5 | maximum' [x] = x 6 | maximum' (x:xs) 7 | | x > maxTail = x 8 | | otherwise = maxTail 9 | where maxTail = maximum' xs 10 | 11 | -------------------------------------------------------------------------------- /data/haskellParserTests/NoModuleKeyword.hs: -------------------------------------------------------------------------------- 1 | 2 | x :: Int 3 | x = 0 -------------------------------------------------------------------------------- /data/haskellParserTests/NoModuleKeyword.txt: -------------------------------------------------------------------------------- 1 | FILE 2 | Module(Module) 3 | SignatureDeclaration(SignatureDeclaration) 4 | QNameExpression(QNameExpression) 5 | QVar(QVar) 6 | PsiElement(VARID)('x') 7 | PsiWhiteSpace(' ') 8 | PsiElement(::)('::') 9 | PsiWhiteSpace(' ') 10 | TypeVariable(TypeVariable) 11 | PsiElement(CONID)('Int') 12 | PsiWhiteSpace('\n') 13 | ValueDefinition(ValueDefinition) 14 | QNameExpression(QNameExpression) 15 | QVar(QVar) 16 | PsiElement(VARID)('x') 17 | PsiWhiteSpace(' ') 18 | RightHandSide(RightHandSide) 19 | PsiElement(=)('=') 20 | PsiWhiteSpace(' ') 21 | PsiElement(INTEGER)('0') -------------------------------------------------------------------------------- /data/haskellParserTests/Numbers.hs: -------------------------------------------------------------------------------- 1 | module Numbers where 2 | 3 | x = -5 -------------------------------------------------------------------------------- /data/haskellParserTests/Numbers.txt: -------------------------------------------------------------------------------- 1 | FILE 2 | Module(Module) 3 | PsiElement(module)('module') 4 | PsiWhiteSpace(' ') 5 | ModuleName(ModuleName) 6 | PsiElement(CONID)('Numbers') 7 | PsiWhiteSpace(' ') 8 | PsiElement(where)('where') 9 | PsiWhiteSpace('\n') 10 | PsiWhiteSpace('\n') 11 | ValueDefinition(ValueDefinition) 12 | QNameExpression(QNameExpression) 13 | QVar(QVar) 14 | PsiElement(VARID)('x') 15 | PsiWhiteSpace(' ') 16 | RightHandSide(RightHandSide) 17 | PsiElement(=)('=') 18 | PsiWhiteSpace(' ') 19 | PsiElement(-)('-') 20 | PsiElement(INTEGER)('5') -------------------------------------------------------------------------------- /data/indentTests/Braces.hs: -------------------------------------------------------------------------------- 1 | module Braces where 2 | 3 | main = do { a; b } -------------------------------------------------------------------------------- /data/indentTests/BracesIndent.hs: -------------------------------------------------------------------------------- 1 | module Indent where 2 | 3 | init = Constructor { 4 | fieldName = Nothing 5 | } -------------------------------------------------------------------------------- /data/indentTests/CaseInList.hs: -------------------------------------------------------------------------------- 1 | module WhereCase where 2 | 3 | list = [ br | br <- breaks_, 4 | case x of Var1 -> True; _ -> False ] 5 | 6 | -------------------------------------------------------------------------------- /data/indentTests/ClosingBrace.hs: -------------------------------------------------------------------------------- 1 | module Main where 2 | 3 | main = do putStrLn "a" 4 | 5 | a = "ad" -------------------------------------------------------------------------------- /data/indentTests/HelloWorld.hs: -------------------------------------------------------------------------------- 1 | module Main where 2 | 3 | main = do putStrLn "Hello World!!!" 4 | t = 0 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /data/indentTests/IndentInBraces.hs: -------------------------------------------------------------------------------- 1 | module IndentInBraces where 2 | 3 | ctxt_lookup :: Name -> Field (Ctxt a) (Maybe a) 4 | ctxt_lookup n = Field 5 | { fget = lookupCtxtExact n 6 | , fset = \newVal -> case newVal of 7 | Just x -> addDef n x 8 | Nothing -> deleteDefExact n 9 | } 10 | 11 | maybe_default dflt = Field (fromMaybe dflt) (const . Just) 12 | -------------------------------------------------------------------------------- /data/indentTests/IndentInBracesAgain.hs: -------------------------------------------------------------------------------- 1 | module IndentInBracesAgain where 2 | 3 | f = r{ render = do make 4 | return f } -------------------------------------------------------------------------------- /data/indentTests/IndentInParenthesis.hs: -------------------------------------------------------------------------------- 1 | module Parenthesis where 2 | 3 | 4 | main = startDebugger (do 5 | modulePath <- do 6 | case (mainFile st) of 7 | Just path -> return path 8 | Nothing -> error "Main module not specified" 9 | setupContext modulePath "Main" 10 | ) 11 | -------------------------------------------------------------------------------- /data/indentTests/LetIn.hs: -------------------------------------------------------------------------------- 1 | module LetIn where 2 | 3 | main = let t = 0 in t 4 | -------------------------------------------------------------------------------- /data/indentTests/LetInSameIndent.hs: -------------------------------------------------------------------------------- 1 | module Test where 2 | 3 | t = let as = findAllUsedArgs t args in 4 | length as == length (nub as) && 5 | termsize n t < 10 6 | -------------------------------------------------------------------------------- /data/indentTests/OpenBraceThenClose.hs: -------------------------------------------------------------------------------- 1 | module OpenBraceThenClose where 2 | 3 | import Language.CSPM.AST 4 | 5 | instance Pretty Pattern where 6 | pPrint = case pattern of 7 | IntPat -> n 8 | where 9 | nestedDotPat = case unLabel of 10 | DotPat {} -> p 11 | x -> x -------------------------------------------------------------------------------- /data/indentTests/SimpleIndent.hs: -------------------------------------------------------------------------------- 1 | module SimpleIndent where 2 | 3 | main = undefined -------------------------------------------------------------------------------- /data/indentTests/SimpleIndent.txt: -------------------------------------------------------------------------------- 1 | FILE 2 | Module(Module) 3 | PsiElement(module)('module') 4 | PsiWhiteSpace(' ') 5 | ModuleName(ModuleName) 6 | PsiElement(CONID)('SimpleIndent') 7 | PsiWhiteSpace(' ') 8 | PsiElement(where)('where') 9 | PsiWhiteSpace('\n') 10 | PsiWhiteSpace('\n') 11 | ValueDefinition(ValueDefinition) 12 | QNameExpression(QNameExpression) 13 | QVar(QVar) 14 | PsiElement(VARID)('main') 15 | PsiWhiteSpace(' ') 16 | RightHandSide(RightHandSide) 17 | PsiElement(=)('=') 18 | PsiWhiteSpace(' ') 19 | QNameExpression(QNameExpression) 20 | QVar(QVar) 21 | PsiElement(VARID)('undefined') -------------------------------------------------------------------------------- /data/indentTests/Tabs.hs: -------------------------------------------------------------------------------- 1 | module TabProblem where 2 | 3 | main = do 4 | let faceGroup = MMDGroup 5 | () 6 | -------------------------------------------------------------------------------- /data/indentTests/TwoClosingBraces.hs: -------------------------------------------------------------------------------- 1 | module Main where 2 | 3 | main = do 4 | case runResult of 5 | A -> a 6 | B -> b 7 | where 8 | function :: A -> B -------------------------------------------------------------------------------- /data/recoveryTests/Recovery.hs: -------------------------------------------------------------------------------- 1 | module Recovery where 2 | 3 | test = (test "text" 4 | 5 | -- Must recover here 6 | main = putStrLn "Hello world!!!" 7 | -------------------------------------------------------------------------------- /generator/generator.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /generator/src/org/jetbrains/generator/ParserException.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.generator 2 | 3 | /** 4 | * Created by atsky on 11/7/14. 5 | */ 6 | class ParserException(token : Token?, text : String) : RuntimeException(text) -------------------------------------------------------------------------------- /generator/src/org/jetbrains/generator/TextGenerator.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.generator 2 | 3 | /** 4 | * Created by atsky on 11/7/14. 5 | */ 6 | 7 | 8 | class TextGenerator { 9 | val data : StringBuilder = StringBuilder() 10 | 11 | var indent : Int = 0 12 | 13 | 14 | fun line() { 15 | data.append("\n") 16 | } 17 | 18 | fun line(text : String) { 19 | for (k in 1..indent) { 20 | data.append(" ") 21 | } 22 | data.append(text).append("\n") 23 | } 24 | 25 | fun indent(body : TextGenerator.() -> Unit) { 26 | indent++ 27 | this.body() 28 | indent-- 29 | } 30 | 31 | override fun toString() : String{ 32 | return data.toString() 33 | } 34 | } -------------------------------------------------------------------------------- /generator/src/org/jetbrains/generator/Token.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.generator 2 | 3 | /** 4 | * Created by atsky on 11/7/14. 5 | */ 6 | class Token( 7 | val type : TokenType, 8 | val text : String 9 | ) -------------------------------------------------------------------------------- /generator/src/org/jetbrains/generator/TokenType.java: -------------------------------------------------------------------------------- 1 | package org.jetbrains.generator; 2 | 3 | /** 4 | * Created by atsky on 11/7/14. 5 | */ 6 | public enum TokenType { 7 | OBRACE, 8 | CBRACE, 9 | STRING, 10 | ID, 11 | BAD_CHARACTER, 12 | SEMICOLON, 13 | COLON, 14 | VBAR, 15 | EQUAL, 16 | BLOCK_COMMENT, 17 | EOL_COMMENT 18 | } 19 | -------------------------------------------------------------------------------- /generator/src/org/jetbrains/generator/grammar/AbstractRule.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.generator.grammar 2 | 3 | /** 4 | * Created by atsky on 11/7/14. 5 | */ 6 | open class AbstractRule(val name : String) -------------------------------------------------------------------------------- /generator/src/org/jetbrains/generator/grammar/FakeRule.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.generator.grammar 2 | 3 | /** 4 | * Created by atsky on 11/7/14. 5 | */ 6 | class FakeRule(name : String) : AbstractRule(name) -------------------------------------------------------------------------------- /generator/src/org/jetbrains/generator/grammar/Grammar.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.generator.grammar 2 | 3 | /** 4 | * Created by atsky on 11/7/14. 5 | */ 6 | class Grammar( 7 | val tokens : List, 8 | val rules : List 9 | ) -------------------------------------------------------------------------------- /generator/src/org/jetbrains/generator/grammar/Rule.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.generator.grammar 2 | 3 | /** 4 | * Created by atsky on 11/7/14. 5 | */ 6 | class Rule(name : String, val variants : List) : AbstractRule(name) { 7 | override fun toString(): String { 8 | val result = StringBuilder() 9 | result.append(name).append(" : ") 10 | for (variant in variants) { 11 | if (variant != variants[0]) { 12 | result.append(" | ") 13 | } 14 | result.append(variant) 15 | } 16 | return result.toString() 17 | } 18 | } -------------------------------------------------------------------------------- /generator/src/org/jetbrains/generator/grammar/RuleRef.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.generator.grammar 2 | 3 | /** 4 | * Created by atsky on 11/7/14. 5 | */ 6 | class RuleRef(val text : String, val isName : Boolean) { 7 | override fun toString(): String { 8 | return if (isName) text else "'" + text + "'" 9 | } 10 | 11 | override fun hashCode(): Int { 12 | return text.hashCode() + isName.hashCode() 13 | } 14 | 15 | override fun equals(other: Any?): Boolean { 16 | if (other !is RuleRef) { 17 | return false 18 | } 19 | return text == other.text && isName == other.isName 20 | } 21 | } -------------------------------------------------------------------------------- /generator/src/org/jetbrains/generator/grammar/TokenDescription.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.generator.grammar 2 | 3 | /** 4 | * Created by atsky on 11/7/14. 5 | */ 6 | class TokenDescription(val text : String, 7 | val name : String, 8 | val useText : Boolean) -------------------------------------------------------------------------------- /generator/src/org/jetbrains/generator/grammar/Variant.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.generator.grammar 2 | 3 | import java.util.TreeSet 4 | 5 | /** 6 | * Created by atsky on 11/7/14. 7 | */ 8 | abstract class Variant { 9 | abstract fun fillElements(elementSet: TreeSet) 10 | 11 | } 12 | 13 | class FinalVariant(val elementName: String?) : Variant() { 14 | override fun fillElements(elementSet: TreeSet) { 15 | if (elementName != null) { 16 | elementSet.add(elementName) 17 | } 18 | } 19 | 20 | } 21 | 22 | class NonFinalVariant(val atom: RuleRef, val next : List) : Variant() { 23 | 24 | override fun toString(): String { 25 | val result = StringBuilder() 26 | /* 27 | for (ref in atoms) { 28 | if (ref != atoms[0]) { 29 | result.append(" ") 30 | } 31 | result.append(ref) 32 | } 33 | */ 34 | return result.toString() 35 | } 36 | 37 | override fun fillElements(elementSet: TreeSet) { 38 | for (n in next) { 39 | n.fillElements(elementSet) 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /jps-plugin/jps-plugin.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /jps-plugin/src/META-INF/services/org.jetbrains.jps.incremental.BuilderService: -------------------------------------------------------------------------------- 1 | org.jetbrains.jps.cabal.CabalBuilderService -------------------------------------------------------------------------------- /jps-plugin/src/META-INF/services/org.jetbrains.jps.model.serialization.JpsModelSerializerExtension: -------------------------------------------------------------------------------- 1 | org.jetbrains.jps.cabal.model.JpsHaskellModelSerializerExtension -------------------------------------------------------------------------------- /jps-plugin/src/org/jetbrains/jps/cabal/ProcessWrapper.java: -------------------------------------------------------------------------------- 1 | package org.jetbrains.jps.cabal; 2 | 3 | import java.io.File; 4 | import java.io.IOException; 5 | import java.util.Arrays; 6 | import java.util.List; 7 | 8 | public class ProcessWrapper { 9 | private String myWorkingDirectory; 10 | 11 | ProcessWrapper(String workingDirectory) { 12 | myWorkingDirectory = workingDirectory; 13 | } 14 | 15 | 16 | public Process getProcess(List cmd) throws IOException { 17 | ProcessBuilder processBuilder = new ProcessBuilder(cmd); 18 | if (myWorkingDirectory != null) { 19 | processBuilder.directory(new File(myWorkingDirectory)); 20 | } 21 | 22 | processBuilder.redirectErrorStream(true); 23 | return processBuilder.start(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /jps-plugin/src/org/jetbrains/jps/cabal/model/JpsHaskellModulePropertiesSerializer.java: -------------------------------------------------------------------------------- 1 | package org.jetbrains.jps.cabal.model; 2 | 3 | import org.jdom.Element; 4 | import org.jetbrains.jps.cabal.JpsHaskellModuleType; 5 | import org.jetbrains.jps.model.JpsSimpleElement; 6 | import org.jetbrains.jps.model.impl.JpsSimpleElementImpl; 7 | import org.jetbrains.jps.model.serialization.module.JpsModulePropertiesSerializer; 8 | 9 | /** 10 | * @author atsky 11 | * @since 14/05/15. 12 | */ 13 | public class JpsHaskellModulePropertiesSerializer extends JpsModulePropertiesSerializer> { 14 | 15 | public JpsHaskellModulePropertiesSerializer() { 16 | super(JpsHaskellModuleType.INSTANCE, "HASKELL_MODULE", "Haskell.ModuleBuildProperties"); 17 | } 18 | 19 | @Override 20 | public JpsSimpleElement loadProperties(Element componentElement) { 21 | return new JpsSimpleElementImpl(null); 22 | } 23 | 24 | @Override 25 | public void saveProperties(JpsSimpleElement properties, Element componentElement) { 26 | 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /lib/commons-compress-1.8.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/atsky/haskell-idea-plugin/a9be4e8c41202cba50f6f9aa72eb912f1fa92b8c/lib/commons-compress-1.8.jar -------------------------------------------------------------------------------- /lib/httpclient-4.3.6.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/atsky/haskell-idea-plugin/a9be4e8c41202cba50f6f9aa72eb912f1fa92b8c/lib/httpclient-4.3.6.jar -------------------------------------------------------------------------------- /lib/jflex-1.5.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/atsky/haskell-idea-plugin/a9be4e8c41202cba50f6f9aa72eb912f1fa92b8c/lib/jflex-1.5.1.jar -------------------------------------------------------------------------------- /lib/json-simple-1.1.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/atsky/haskell-idea-plugin/a9be4e8c41202cba50f6f9aa72eb912f1fa92b8c/lib/json-simple-1.1.1.jar -------------------------------------------------------------------------------- /lib/os/linux/x86/libpty.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/atsky/haskell-idea-plugin/a9be4e8c41202cba50f6f9aa72eb912f1fa92b8c/lib/os/linux/x86/libpty.so -------------------------------------------------------------------------------- /lib/os/linux/x86_64/libpty.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/atsky/haskell-idea-plugin/a9be4e8c41202cba50f6f9aa72eb912f1fa92b8c/lib/os/linux/x86_64/libpty.so -------------------------------------------------------------------------------- /lib/os/macosx/x86/libpty.dylib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/atsky/haskell-idea-plugin/a9be4e8c41202cba50f6f9aa72eb912f1fa92b8c/lib/os/macosx/x86/libpty.dylib -------------------------------------------------------------------------------- /lib/os/macosx/x86_64/libpty.dylib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/atsky/haskell-idea-plugin/a9be4e8c41202cba50f6f9aa72eb912f1fa92b8c/lib/os/macosx/x86_64/libpty.dylib -------------------------------------------------------------------------------- /lib/pty4j-0.3.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/atsky/haskell-idea-plugin/a9be4e8c41202cba50f6f9aa72eb912f1fa92b8c/lib/pty4j-0.3.jar -------------------------------------------------------------------------------- /plugin/resources/colorSchemes/CassiusDefault.xml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/atsky/haskell-idea-plugin/a9be4e8c41202cba50f6f9aa72eb912f1fa92b8c/plugin/resources/colorSchemes/CassiusDefault.xml -------------------------------------------------------------------------------- /plugin/resources/colorSchemes/HaskellDefault.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 13 | 18 | 23 | 28 | 29 | -------------------------------------------------------------------------------- /plugin/resources/colorSchemes/HaskellDracula.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 13 | 18 | 23 | 28 | 29 | -------------------------------------------------------------------------------- /plugin/resources/colorSchemes/JuliusDefault.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 13 | 18 | 23 | 29 | -------------------------------------------------------------------------------- /plugin/resources/org/jetbrains/haskell/icons/application.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/atsky/haskell-idea-plugin/a9be4e8c41202cba50f6f9aa72eb912f1fa92b8c/plugin/resources/org/jetbrains/haskell/icons/application.png -------------------------------------------------------------------------------- /plugin/resources/org/jetbrains/haskell/icons/cabal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/atsky/haskell-idea-plugin/a9be4e8c41202cba50f6f9aa72eb912f1fa92b8c/plugin/resources/org/jetbrains/haskell/icons/cabal.png -------------------------------------------------------------------------------- /plugin/resources/org/jetbrains/haskell/icons/cabal13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/atsky/haskell-idea-plugin/a9be4e8c41202cba50f6f9aa72eb912f1fa92b8c/plugin/resources/org/jetbrains/haskell/icons/cabal13.png -------------------------------------------------------------------------------- /plugin/resources/org/jetbrains/haskell/icons/haskell.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/atsky/haskell-idea-plugin/a9be4e8c41202cba50f6f9aa72eb912f1fa92b8c/plugin/resources/org/jetbrains/haskell/icons/haskell.png -------------------------------------------------------------------------------- /plugin/resources/org/jetbrains/haskell/icons/haskell13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/atsky/haskell-idea-plugin/a9be4e8c41202cba50f6f9aa72eb912f1fa92b8c/plugin/resources/org/jetbrains/haskell/icons/haskell13.png -------------------------------------------------------------------------------- /plugin/resources/org/jetbrains/haskell/icons/haskell16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/atsky/haskell-idea-plugin/a9be4e8c41202cba50f6f9aa72eb912f1fa92b8c/plugin/resources/org/jetbrains/haskell/icons/haskell16.png -------------------------------------------------------------------------------- /plugin/resources/org/jetbrains/haskell/icons/haskell24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/atsky/haskell-idea-plugin/a9be4e8c41202cba50f6f9aa72eb912f1fa92b8c/plugin/resources/org/jetbrains/haskell/icons/haskell24.png -------------------------------------------------------------------------------- /plugin/resources/org/jetbrains/haskell/icons/repl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/atsky/haskell-idea-plugin/a9be4e8c41202cba50f6f9aa72eb912f1fa92b8c/plugin/resources/org/jetbrains/haskell/icons/repl.png -------------------------------------------------------------------------------- /plugin/resources/org/jetbrains/haskell/icons/update.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/atsky/haskell-idea-plugin/a9be4e8c41202cba50f6f9aa72eb912f1fa92b8c/plugin/resources/org/jetbrains/haskell/icons/update.png -------------------------------------------------------------------------------- /plugin/resources/org/jetbrains/haskell/icons/update@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/atsky/haskell-idea-plugin/a9be4e8c41202cba50f6f9aa72eb912f1fa92b8c/plugin/resources/org/jetbrains/haskell/icons/update@2x.png -------------------------------------------------------------------------------- /plugin/resources/org/jetbrains/haskell/icons/yesod16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/atsky/haskell-idea-plugin/a9be4e8c41202cba50f6f9aa72eb912f1fa92b8c/plugin/resources/org/jetbrains/haskell/icons/yesod16.png -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/cabal/CabalConfig.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.cabal 2 | 3 | import org.jetbrains.haskell.util.OSUtil 4 | import org.jetbrains.haskell.util.joinPath 5 | import java.io.File 6 | 7 | /** 8 | * @author Evgeny.Kurbatsky 9 | * @since 6/15/15. 10 | */ 11 | 12 | class CabalConfing { 13 | var inizialized = false 14 | var remoteRepoCache: String = joinPath(OSUtil.getCabalData(), "packages") 15 | 16 | fun read(file: File) { 17 | for (line in file.readLines()) { 18 | if (line.startsWith("--")) { 19 | continue 20 | } 21 | val chunks = line.split(": ") 22 | if (chunks.size > 0) { 23 | if (chunks[0] == "remote-repo-cache") { 24 | remoteRepoCache = chunks[1] 25 | } 26 | } 27 | } 28 | } 29 | 30 | } -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/cabal/CabalLanguage.java: -------------------------------------------------------------------------------- 1 | package org.jetbrains.cabal; 2 | 3 | import com.intellij.lang.Language; 4 | import kotlin.jvm.JvmField; 5 | 6 | public class CabalLanguage extends Language { 7 | @JvmField 8 | public static final CabalLanguage INSTANCE = new CabalLanguage(); 9 | 10 | public CabalLanguage() { 11 | super("Cabal", "text/cabal"); 12 | } 13 | } -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/cabal/export/CabalModuleBuilder.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.cabal.export 2 | 3 | import com.intellij.ide.util.projectWizard.ModuleBuilder 4 | import com.intellij.openapi.externalSystem.service.project.wizard.AbstractExternalModuleBuilder 5 | import com.intellij.openapi.module.* 6 | import com.intellij.openapi.options.ConfigurationException 7 | import com.intellij.openapi.roots.ModifiableRootModel 8 | import org.jetbrains.haskell.module.HaskellModuleType 9 | import org.jetbrains.cabal.settings.CabalProjectSettings 10 | import org.jetbrains.cabal.util.* 11 | 12 | import javax.swing.* 13 | import java.io.File 14 | import java.io.IOException 15 | 16 | class CabalModuleBuilder : AbstractExternalModuleBuilder(SYSTEM_ID, CabalProjectSettings()) { 17 | 18 | @Throws(ConfigurationException::class) 19 | override fun setupRootModel(modifiableRootModel: ModifiableRootModel?) { 20 | } 21 | 22 | override fun getModuleType(): ModuleType { 23 | return HaskellModuleType.INSTANCE 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/cabal/export/CabalProjectSettingsControl.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.cabal.export 2 | 3 | import com.intellij.openapi.externalSystem.service.settings.AbstractExternalProjectSettingsControl 4 | import com.intellij.openapi.externalSystem.util.PaintAwarePanel 5 | import com.intellij.openapi.options.ConfigurationException 6 | import org.jetbrains.cabal.settings.CabalProjectSettings 7 | 8 | 9 | class CabalProjectSettingsControl(initialSettings: CabalProjectSettings) 10 | : AbstractExternalProjectSettingsControl(initialSettings) { 11 | 12 | override fun fillExtraControls(content: PaintAwarePanel, indentLevel: Int) { } 13 | 14 | @Throws(ConfigurationException::class) 15 | override fun validate(settings: CabalProjectSettings): Boolean { 16 | return true 17 | } 18 | 19 | override fun applyExtraSettings(settings: CabalProjectSettings) { } 20 | 21 | override fun isExtraSettingModified(): Boolean = false 22 | 23 | override fun resetExtraSettings(isDefaultModuleCreation: Boolean) { } 24 | } 25 | 26 | -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/cabal/highlight/CabalHighlighterFactory.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.cabal.highlight 2 | 3 | import com.intellij.openapi.fileTypes.SingleLazyInstanceSyntaxHighlighterFactory 4 | 5 | class CabalHighlighterFactory : SingleLazyInstanceSyntaxHighlighterFactory() { 6 | 7 | override fun createHighlighter(): CabalHighlighter { 8 | return CabalHighlighter() 9 | } 10 | 11 | } -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/cabal/highlight/ErrorMessage.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.cabal.highlight 2 | 3 | import com.intellij.psi.PsiElement 4 | 5 | class ErrorMessage(errorPlace: PsiElement, errorText: String, errorType: String, isAfterNodeError: Boolean = false) { 6 | val text: String = errorText 7 | val place: PsiElement = errorPlace 8 | val severity: String = errorType 9 | val isAfterNode: Boolean = isAfterNodeError 10 | } -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/cabal/parser/CabalCompositeElementType.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.cabal.parser 2 | 3 | import com.intellij.psi.tree.IElementType 4 | import org.jetbrains.haskell.HaskellLanguage 5 | import org.jetbrains.annotations.NonNls 6 | import org.jetbrains.cabal.CabalLanguage 7 | import com.intellij.psi.PsiElement 8 | import com.intellij.lang.ASTNode 9 | 10 | class CabalCompositeElementType(val myDebugName: String, val contructor : (ASTNode) -> PsiElement) : IElementType(myDebugName, CabalLanguage.INSTANCE) { 11 | 12 | fun getDebugName(): String { 13 | return myDebugName 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/cabal/parser/CabalLexer.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.cabal.parser 2 | 3 | import com.intellij.lexer.FlexAdapter 4 | import java.io.Reader 5 | 6 | class CabalLexer : FlexAdapter(_CabalLexer((null as Reader?))) 7 | -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/cabal/psi/BenchmarkType.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.cabal.psi 2 | 3 | import com.intellij.lang.ASTNode 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement 5 | import org.jetbrains.cabal.parser.* 6 | import org.jetbrains.cabal.psi.PropertyValue 7 | 8 | class BenchmarkType(node: ASTNode) : PropertyValue(node), RangedValue { 9 | override fun getAvailableValues(): List { 10 | return BENCH_TYPE_VALS 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/cabal/psi/BoolField.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.cabal.psi 2 | 3 | import com.intellij.lang.ASTNode 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement 5 | import org.jetbrains.cabal.parser.* 6 | import org.jetbrains.cabal.psi.SingleValueField 7 | 8 | open class BoolField(node: ASTNode) : SingleValueField(node) -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/cabal/psi/BuildSection.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.cabal.psi 2 | 3 | import com.intellij.lang.ASTNode 4 | import org.jetbrains.cabal.parser.* 5 | import org.jetbrains.cabal.CabalFile 6 | import java.util.ArrayList 7 | import com.intellij.psi.util.PsiTreeUtil 8 | import com.intellij.openapi.vfs.VirtualFile 9 | import java.io.File 10 | 11 | 12 | open class BuildSection(node: ASTNode): Section(node) { 13 | 14 | private fun getFieldsValues(fieldT: Class, valueT: Class): List 15 | = getFields(fieldT).flatMap { it.getValues(valueT) } 16 | 17 | fun getHsSourceDirs(): List = getFieldsValues(HsSourceDirsField::class.java, Path::class.java) 18 | 19 | fun getIncludeDirs() : List = getFieldsValues(IncludeDirsField::class.java, Path::class.java) 20 | 21 | fun getBuildDepends(): List 22 | = getFieldsValues(BuildDependsField::class.java, FullVersionConstraint::class.java) 23 | 24 | } -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/cabal/psi/BuildToolsField.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.cabal.psi 2 | 3 | import com.intellij.lang.ASTNode 4 | import org.jetbrains.cabal.psi.MultiValueField 5 | 6 | class BuildToolsField (node: ASTNode) : MultiValueField(node) 7 | -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/cabal/psi/BuildType.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.cabal.psi 2 | 3 | import com.intellij.lang.ASTNode 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement 5 | import org.jetbrains.cabal.parser.* 6 | import org.jetbrains.cabal.psi.PropertyValue 7 | 8 | class BuildType(node: ASTNode) : PropertyValue(node), RangedValue { 9 | 10 | override fun getAvailableValues(): List { 11 | return BUILD_TYPE_VALS 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/cabal/psi/BuildTypeField.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.cabal.psi 2 | 3 | import com.intellij.lang.ASTNode 4 | import org.jetbrains.cabal.psi.SingleValueField 5 | 6 | class BuildTypeField(node: ASTNode) : SingleValueField(node) 7 | -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/cabal/psi/BuildableField.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.cabal.psi 2 | 3 | import com.intellij.lang.ASTNode 4 | import org.jetbrains.cabal.psi.BoolField 5 | 6 | class BuildableField(node: ASTNode) : BoolField(node) -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/cabal/psi/CSourcesField.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.cabal.psi 2 | 3 | import com.intellij.lang.ASTNode 4 | import com.intellij.openapi.vfs.VirtualFile 5 | import org.jetbrains.cabal.psi.MultiValueField 6 | import org.jetbrains.cabal.psi.PathsField 7 | import org.jetbrains.cabal.highlight.ErrorMessage 8 | import java.io.File 9 | 10 | class CSourcesField(node: ASTNode) : MultiValueField(node), PathsField { 11 | 12 | override fun validVirtualFile(file: VirtualFile): Boolean = !file.isDirectory 13 | } -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/cabal/psi/CabalVersionField.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.cabal.psi 2 | 3 | import com.intellij.lang.ASTNode 4 | import org.jetbrains.cabal.psi.SingleValueField 5 | import org.jetbrains.cabal.CabalInterface 6 | import org.jetbrains.cabal.highlight.ErrorMessage 7 | import java.util.ArrayList 8 | 9 | class CabalVersionField(node: ASTNode) : SingleValueField(node), Checkable { 10 | 11 | override fun check(): List { 12 | val installedCabalVersions = (CabalInterface(project).getInstalledPackagesList().firstOrNull { it.name == "Cabal" })?.availableVersions 13 | if (installedCabalVersions == null) return listOf(ErrorMessage(getValue()!!, "Cabal package is not installed", "warning")) 14 | val versionConstr = (getValue() as VersionConstraint) 15 | if (!(installedCabalVersions.map({ versionConstr.satisfyConstraint(it) }).reduce { curr, next -> curr || next })) { 16 | return listOf(ErrorMessage(versionConstr, "installed cabal's version does not satisfy this constraint", "warning")) 17 | } 18 | return listOf() 19 | } 20 | } -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/cabal/psi/Checkable.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.cabal.psi 2 | 3 | import org.jetbrains.cabal.highlight.ErrorMessage 4 | 5 | interface Checkable { 6 | fun check(): List = listOf() 7 | } -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/cabal/psi/CompilerId.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.cabal.psi 2 | 3 | import com.intellij.lang.ASTNode 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement 5 | import org.jetbrains.cabal.parser.* 6 | import org.jetbrains.cabal.highlight.ErrorMessage 7 | 8 | class CompilerId(node: ASTNode) : ASTWrapperPsiElement(node), RangedValue { 9 | override fun getAvailableValues(): List { 10 | return COMPILER_VALS 11 | } 12 | 13 | override fun check(): List { 14 | if (text!!.toLowerCase() !in getAvailableValues()) return listOf(ErrorMessage(this, "invalid compiler", "error")) 15 | return listOf() 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/cabal/psi/ConditionPart.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.cabal.psi 2 | 3 | import com.intellij.lang.ASTNode 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement 5 | import org.jetbrains.cabal.highlight.ErrorMessage 6 | 7 | class ConditionPart(node: ASTNode) : ASTWrapperPsiElement(node) { 8 | 9 | fun checkBrackets(): List { 10 | if ((this.firstChild!!.text == "(") != (this.lastChild!!.text == ")")) { 11 | return listOf(ErrorMessage(this, "close bracked missing", "error", isAfterNodeError = true)) 12 | } 13 | //return PsiTreeUtil.getChildrenOfTypeAsList(this, javaClass()) flatMap { it.checkBrackets() } 14 | return listOf() 15 | } 16 | } -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/cabal/psi/DataDirField.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.cabal.psi 2 | 3 | import com.intellij.lang.ASTNode 4 | import org.jetbrains.cabal.psi.SingleValueField 5 | import org.jetbrains.cabal.psi.PathsField 6 | import com.intellij.openapi.vfs.VirtualFile 7 | import java.io.File 8 | 9 | class DataDirField(node: ASTNode) : SingleValueField(node), PathsField { 10 | 11 | override fun isValidCompletionFile(file: VirtualFile): Boolean = file.isDirectory 12 | 13 | override fun validVirtualFile(file: VirtualFile): Boolean = file.isDirectory 14 | 15 | override fun validRelativity(path: File): Boolean = !path.isAbsolute 16 | } 17 | -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/cabal/psi/DataFilesField.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.cabal.psi 2 | 3 | import com.intellij.lang.ASTNode 4 | import org.jetbrains.cabal.psi.MultiValueField 5 | import org.jetbrains.cabal.psi.PathsField 6 | import com.intellij.openapi.vfs.VirtualFile 7 | import java.io.File 8 | 9 | class DataFilesField(node: ASTNode) : MultiValueField(node), PathsField { 10 | 11 | override fun validVirtualFile(file: VirtualFile): Boolean = !file.isDirectory 12 | 13 | override fun getSourceDirs(originalRootDir: VirtualFile): List 14 | = listOf(getCabalFile().getDataDir()?.getVirtualFile(originalRootDir) ?: originalRootDir) 15 | } -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/cabal/psi/EMail.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.cabal.psi 2 | 3 | import com.intellij.lang.ASTNode 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement 5 | import org.jetbrains.cabal.psi.Checkable 6 | import org.jetbrains.cabal.psi.PropertyValue 7 | import org.jetbrains.cabal.highlight.ErrorMessage 8 | 9 | class EMail(node: ASTNode) : PropertyValue(node), Checkable { 10 | 11 | override fun check(): List { 12 | if (!node.text.matches("^.+@.+\\..+$".toRegex())) return listOf(ErrorMessage(this, "invalid value", "error")) 13 | return listOf() 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/cabal/psi/ElseCondition.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.cabal.psi 2 | 3 | import com.intellij.lang.ASTNode 4 | import java.util.ArrayList 5 | import org.jetbrains.cabal.parser.CabalTokelTypes 6 | import org.jetbrains.cabal.highlight.ErrorMessage 7 | 8 | class ElseCondition(node: ASTNode) : Section(node) { 9 | 10 | override fun check(): List { 11 | if (getSectChildren().size == 0) listOf(ErrorMessage(getSectTypeNode(), "empty else section is not allowed", "error")) 12 | return listOf() 13 | } 14 | 15 | override fun getAvailableFieldNames(): List { 16 | var res = ArrayList() 17 | res.addAll((parent as Section).getAvailableFieldNames()) 18 | return res 19 | } 20 | 21 | override fun getSectName(): String? = null 22 | } 23 | -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/cabal/psi/ExposedField.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.cabal.psi 2 | 3 | import com.intellij.lang.ASTNode 4 | import org.jetbrains.cabal.psi.BoolField 5 | 6 | class ExposedField(node: ASTNode) : BoolField(node) 7 | -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/cabal/psi/ExposedModulesField.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.cabal.psi 2 | 3 | import com.intellij.lang.ASTNode 4 | import org.jetbrains.cabal.psi.MultiValueField 5 | 6 | class ExposedModulesField(node: ASTNode) : MultiValueField(node) 7 | -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/cabal/psi/ExtensionsField.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.cabal.psi 2 | 3 | import com.intellij.lang.ASTNode 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement 5 | import org.jetbrains.cabal.psi.MultiValueField 6 | 7 | class ExtensionsField(node: ASTNode) : MultiValueField(node) -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/cabal/psi/ExtraLibDirsField.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.cabal.psi 2 | 3 | import com.intellij.lang.ASTNode 4 | import org.jetbrains.cabal.psi.MultiValueField 5 | import org.jetbrains.cabal.psi.PathsField 6 | import com.intellij.openapi.vfs.VirtualFile 7 | 8 | class ExtraLibDirsField(node: ASTNode) : MultiValueField(node), PathsField { 9 | 10 | override fun validVirtualFile(file: VirtualFile): Boolean = file.isDirectory 11 | 12 | override fun isValidCompletionFile(file: VirtualFile): Boolean = file.isDirectory 13 | } -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/cabal/psi/ExtraSourceField.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.cabal.psi 2 | 3 | import com.intellij.lang.ASTNode 4 | import org.jetbrains.cabal.psi.MultiValueField 5 | import org.jetbrains.cabal.psi.PathsField 6 | import com.intellij.openapi.vfs.VirtualFile 7 | import org.jetbrains.cabal.highlight.ErrorMessage 8 | 9 | class ExtraSourceField(node: ASTNode) : MultiValueField(node), PathsField { 10 | 11 | override fun validVirtualFile(file: VirtualFile): Boolean = !file.isDirectory 12 | 13 | } -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/cabal/psi/ExtraTmpField.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.cabal.psi 2 | 3 | import com.intellij.lang.ASTNode 4 | import org.jetbrains.cabal.psi.MultiValueField 5 | import org.jetbrains.cabal.psi.PathsField 6 | import com.intellij.openapi.vfs.VirtualFile 7 | import org.jetbrains.cabal.highlight.ErrorMessage 8 | 9 | class ExtraTmpField(node: ASTNode) : MultiValueField(node), PathsField { 10 | 11 | override fun validVirtualFile(file: VirtualFile): Boolean = true 12 | 13 | } -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/cabal/psi/Field.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.cabal.psi 2 | 3 | import com.intellij.psi.PsiElement 4 | import com.intellij.psi.tree.IElementType 5 | import com.intellij.lang.ASTNode 6 | import com.intellij.psi.impl.source.tree.SharedImplUtil 7 | import com.intellij.extapi.psi.ASTWrapperPsiElement 8 | import org.jetbrains.cabal.CabalFile 9 | import com.intellij.openapi.vfs.VirtualFile 10 | import com.intellij.openapi.vfs.VirtualFileSystem 11 | 12 | open class Field(node: ASTNode) : ASTWrapperPsiElement(node) { 13 | 14 | fun getType(): IElementType = node.elementType 15 | 16 | fun hasName(name: String): Boolean { 17 | return firstChild!!.text!!.equals(name, ignoreCase = true) 18 | } 19 | 20 | fun getFieldName(): String { 21 | return firstChild!!.text!!.toLowerCase() 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/cabal/psi/Flag.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.cabal.psi 2 | 3 | import com.intellij.lang.ASTNode 4 | import org.jetbrains.cabal.parser.* 5 | import org.jetbrains.cabal.psi.Name 6 | import org.jetbrains.cabal.psi.Section 7 | import java.util.ArrayList 8 | 9 | class Flag(node: ASTNode) : Section(node) { 10 | 11 | override fun getAvailableFieldNames(): List { 12 | var res = ArrayList() 13 | res.addAll(FLAG_FIELDS.keys) 14 | return res 15 | } 16 | 17 | fun getFlagName(): String { 18 | val res = getSectName()?.toLowerCase() 19 | if (res == null) throw IllegalStateException() 20 | return res 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/cabal/psi/FreeForm.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.cabal.psi 2 | 3 | import com.intellij.lang.ASTNode 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement 5 | import org.jetbrains.cabal.psi.PropertyValue 6 | 7 | class FreeForm(node: ASTNode) : PropertyValue(node) 8 | -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/cabal/psi/FullCondition.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.cabal.psi 2 | 3 | import com.intellij.lang.ASTNode 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement 5 | import org.jetbrains.cabal.psi.Checkable 6 | import com.intellij.psi.util.PsiTreeUtil 7 | import org.jetbrains.cabal.parser.CabalTokelTypes 8 | import com.intellij.psi.PsiElement 9 | import com.intellij.psi.TokenType 10 | import org.jetbrains.cabal.highlight.ErrorMessage 11 | import java.util.ArrayList 12 | 13 | class FullCondition(node: ASTNode) : ASTWrapperPsiElement(node), Checkable { 14 | 15 | override fun check(): List { 16 | return PsiTreeUtil.getChildrenOfTypeAsList(this, ConditionPart::class.java).flatMap { it.checkBrackets() } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/cabal/psi/FullVersionConstraint.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.cabal.psi 2 | 3 | import com.intellij.lang.ASTNode 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement 5 | import org.jetbrains.cabal.psi.PropertyValue 6 | 7 | class FullVersionConstraint(node: ASTNode) : PropertyValue(node) { 8 | 9 | fun getBaseName() : String = firstChild!!.text!! 10 | 11 | fun getConstraint() : ComplexVersionConstraint? 12 | = (children.firstOrNull { it is ComplexVersionConstraint }) as ComplexVersionConstraint? 13 | } -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/cabal/psi/HsSourceDirsField.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.cabal.psi 2 | 3 | import com.intellij.lang.ASTNode 4 | import org.jetbrains.cabal.psi.MultiValueField 5 | import org.jetbrains.cabal.psi.PathsField 6 | import org.jetbrains.cabal.psi.Checkable 7 | import com.intellij.openapi.vfs.VirtualFile 8 | import org.jetbrains.cabal.highlight.ErrorMessage 9 | 10 | class HsSourceDirsField(node: ASTNode) : MultiValueField(node), PathsField, Checkable { 11 | 12 | override fun check(): List { 13 | if (hasName("hs-source-dir")) return listOf(ErrorMessage(getKeyNode(), "The field \"hs-source-deir\" is deprecated, please, use \"hs-source-dirs\"", "warning")) 14 | return listOf() 15 | } 16 | 17 | override fun isValidCompletionFile(file: VirtualFile): Boolean = file.isDirectory 18 | 19 | override fun validVirtualFile(file: VirtualFile): Boolean = file.isDirectory 20 | } 21 | -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/cabal/psi/Identifier.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.cabal.psi 2 | 3 | import com.intellij.lang.ASTNode 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement 5 | import org.jetbrains.cabal.psi.Checkable 6 | import org.jetbrains.cabal.psi.PropertyValue 7 | import org.jetbrains.cabal.highlight.ErrorMessage 8 | 9 | class Identifier(node: ASTNode) : PropertyValue(node), Checkable { 10 | 11 | override fun check(): List { 12 | if (!node.text.matches("^[a-zA-Z](\\w|[.-])*$".toRegex())) { 13 | return listOf(ErrorMessage(this, "invalid identifier", "error")) 14 | } 15 | return listOf() 16 | } 17 | } -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/cabal/psi/IfCondition.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.cabal.psi 2 | 3 | import com.intellij.lang.ASTNode 4 | import java.util.ArrayList 5 | import org.jetbrains.cabal.highlight.ErrorMessage 6 | 7 | class IfCondition(node: ASTNode) : Section(node) { 8 | 9 | override fun check(): List { 10 | if (getSectChildren().size == 0) listOf(ErrorMessage(getSectTypeNode(), "empty if section is not allowed", "error")) 11 | return listOf() 12 | } 13 | 14 | override fun getAvailableFieldNames(): List { 15 | var res = ArrayList() 16 | res.addAll((parent as Section).getAvailableFieldNames()) 17 | return res 18 | } 19 | 20 | override fun getSectName(): String? = null 21 | } 22 | -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/cabal/psi/IncludeDirsField.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.cabal.psi 2 | 3 | import com.intellij.lang.ASTNode 4 | import org.jetbrains.cabal.psi.MultiValueField 5 | import org.jetbrains.cabal.psi.PathsField 6 | import com.intellij.openapi.vfs.VirtualFile 7 | 8 | class IncludeDirsField(node: ASTNode) : MultiValueField(node), PathsField { 9 | 10 | override fun isValidCompletionFile(file: VirtualFile): Boolean = file.isDirectory 11 | 12 | override fun validVirtualFile(file: VirtualFile): Boolean = file.isDirectory 13 | } -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/cabal/psi/IncludesField.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.cabal.psi 2 | 3 | import org.jetbrains.cabal.psi.PathsField 4 | import org.jetbrains.cabal.psi.MultiValueField 5 | import org.jetbrains.cabal.parser.CabalTokelTypes 6 | import com.intellij.lang.ASTNode 7 | import com.intellij.openapi.vfs.VirtualFile 8 | import java.io.File 9 | import java.util.ArrayList 10 | 11 | class IncludesField(node: ASTNode) : MultiValueField(node), PathsField { 12 | 13 | override fun validVirtualFile(file: VirtualFile): Boolean = file.isDirectory 14 | 15 | override fun validRelativity(path: File): Boolean = !path.isAbsolute 16 | 17 | override fun getSourceDirs(originalRootDir: VirtualFile): List 18 | = (getParentBuildSection()!!.getIncludeDirs().map { it.getVirtualFile(originalRootDir) }).filterNotNull() 19 | } -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/cabal/psi/InstallIncludesField.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.cabal.psi 2 | 3 | import org.jetbrains.cabal.psi.PathsField 4 | import org.jetbrains.cabal.psi.MultiValueField 5 | import org.jetbrains.cabal.parser.CabalTokelTypes 6 | import com.intellij.lang.ASTNode 7 | import com.intellij.openapi.vfs.VirtualFile 8 | import java.io.File 9 | import java.util.ArrayList 10 | 11 | class InstallIncludesField(node: ASTNode) : MultiValueField(node), PathsField { 12 | 13 | override fun validVirtualFile(file: VirtualFile): Boolean = !file.isDirectory 14 | 15 | override fun validRelativity(path: File): Boolean = !path.isAbsolute 16 | 17 | override fun getSourceDirs(originalRootDir: VirtualFile): List 18 | = (getParentBuildSection()!!.getIncludeDirs().map { it.getVirtualFile(originalRootDir) }).filterNotNull() 19 | } -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/cabal/psi/InvalidConditionPart.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.cabal.psi 2 | 3 | import com.intellij.lang.ASTNode 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement 5 | import org.jetbrains.cabal.psi.Checkable 6 | import org.jetbrains.cabal.psi.InvalidValue 7 | import org.jetbrains.cabal.highlight.ErrorMessage 8 | 9 | class InvalidConditionPart(node: ASTNode) : InvalidValue(node) -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/cabal/psi/InvalidField.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.cabal.psi 2 | 3 | import com.intellij.lang.ASTNode 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement 5 | import org.jetbrains.cabal.psi.Checkable 6 | import org.jetbrains.cabal.psi.Field 7 | import org.jetbrains.cabal.highlight.ErrorMessage 8 | 9 | class InvalidField(node: ASTNode) : Field(node), Checkable { 10 | 11 | override fun check(): List { 12 | return listOf(ErrorMessage(this, "invalid field", "error")) 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/cabal/psi/InvalidValue.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.cabal.psi 2 | 3 | import com.intellij.lang.ASTNode 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement 5 | import org.jetbrains.cabal.psi.Checkable 6 | import org.jetbrains.cabal.psi.InvalidField 7 | import org.jetbrains.cabal.highlight.ErrorMessage 8 | import com.intellij.openapi.util.TextRange 9 | 10 | open class InvalidValue(node: ASTNode) : ASTWrapperPsiElement(node), Checkable { 11 | 12 | override fun check(): List { 13 | if (text!! == "") { 14 | return listOf(ErrorMessage(this, "invalid empty value", "error", isAfterNodeError = true)) 15 | } 16 | return listOf(ErrorMessage(this, "invalid value", "error")) 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/cabal/psi/Language.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.cabal.psi 2 | 3 | import com.intellij.lang.ASTNode 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement 5 | import org.jetbrains.cabal.parser.* 6 | import org.jetbrains.cabal.highlight.ErrorMessage 7 | 8 | class Language(node: ASTNode) : ASTWrapperPsiElement(node), RangedValue { 9 | override fun getAvailableValues(): List { 10 | return LANGUAGE_VALS 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/cabal/psi/Library.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.cabal.psi 2 | 3 | import com.intellij.lang.ASTNode 4 | import org.jetbrains.cabal.parser.* 5 | import java.util.ArrayList 6 | 7 | class Library(node: ASTNode) : BuildSection(node) { 8 | 9 | override fun getAvailableFieldNames(): List { 10 | var res = ArrayList() 11 | res.addAll(LIBRARY_FIELDS.keys) 12 | res.addAll(IF_ELSE) 13 | return res 14 | } 15 | 16 | override fun getSectName(): String? = null 17 | } 18 | -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/cabal/psi/LicenseField.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.cabal.psi 2 | 3 | import com.intellij.lang.ASTNode 4 | import org.jetbrains.cabal.psi.SingleValueField 5 | 6 | class LicenseField(node: ASTNode) : SingleValueField(node) 7 | -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/cabal/psi/LicenseFilesField.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.cabal.psi 2 | 3 | import com.intellij.lang.ASTNode 4 | import org.jetbrains.cabal.psi.MultiValueField 5 | import org.jetbrains.cabal.psi.PathsField 6 | import com.intellij.openapi.vfs.VirtualFile 7 | 8 | class LicenseFilesField(node: ASTNode) : MultiValueField(node), PathsField { 9 | 10 | override fun validVirtualFile(file: VirtualFile): Boolean = !file.isDirectory 11 | } -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/cabal/psi/MultiValueField.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.cabal.psi 2 | 3 | import com.intellij.lang.ASTNode 4 | import org.jetbrains.cabal.psi.Field 5 | import org.jetbrains.cabal.highlight.ErrorMessage 6 | import com.intellij.psi.impl.source.tree.SharedImplUtil 7 | import com.intellij.psi.PsiElement 8 | import com.intellij.psi.tree.IElementType 9 | import java.util.ArrayList 10 | import com.intellij.psi.util.PsiTreeUtil 11 | 12 | open class MultiValueField(node: ASTNode) : PropertyField(node) { 13 | 14 | fun getValues(valueType: Class): List { 15 | return PsiTreeUtil.getChildrenOfTypeAsList(this, valueType) 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/cabal/psi/NameField.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.cabal.psi 2 | 3 | import com.intellij.lang.ASTNode 4 | import org.jetbrains.cabal.psi.SingleValueField 5 | 6 | class NameField(node: ASTNode) : SingleValueField(node) -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/cabal/psi/Option.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.cabal.psi 2 | 3 | import com.intellij.lang.ASTNode 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement 5 | import org.jetbrains.cabal.psi.Checkable 6 | import org.jetbrains.cabal.psi.PropertyValue 7 | import org.jetbrains.cabal.highlight.ErrorMessage 8 | 9 | class Option(node: ASTNode) : PropertyValue(node), Checkable 10 | -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/cabal/psi/OtherModulesField.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.cabal.psi 2 | 3 | import com.intellij.lang.ASTNode 4 | import org.jetbrains.cabal.psi.MultiValueField 5 | 6 | class OtherModulesField(node: ASTNode) : MultiValueField(node) -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/cabal/psi/PkgConfigDependsField.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.cabal.psi 2 | 3 | import com.intellij.lang.ASTNode 4 | import org.jetbrains.cabal.psi.MultiValueField 5 | 6 | class PkgConfigDependsField(node: ASTNode) : MultiValueField(node) 7 | -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/cabal/psi/PropertyField.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.cabal.psi 2 | 3 | import com.intellij.lang.ASTNode 4 | import org.jetbrains.cabal.psi.Field 5 | import org.jetbrains.cabal.highlight.ErrorMessage 6 | import com.intellij.psi.impl.source.tree.SharedImplUtil 7 | import com.intellij.psi.PsiElement 8 | import com.intellij.psi.tree.IElementType 9 | import java.util.ArrayList 10 | import com.intellij.psi.util.PsiTreeUtil 11 | 12 | open class PropertyField(node: ASTNode) : Field(node) { 13 | 14 | fun getKeyNode(): PsiElement = firstChild!! 15 | 16 | fun getPropertyName(): String = getKeyNode().text!! 17 | } 18 | -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/cabal/psi/PropertyKey.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.cabal.psi 2 | 3 | import com.intellij.lang.ASTNode 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement 5 | 6 | class PropertyKey(node: ASTNode) : ASTWrapperPsiElement(node) -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/cabal/psi/PropertyValue.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.cabal.psi 2 | 3 | import com.intellij.extapi.psi.ASTWrapperPsiElement 4 | import com.intellij.lang.ASTNode 5 | import com.intellij.psi.PsiElement 6 | 7 | open class PropertyValue(node: ASTNode) : ASTWrapperPsiElement(node) { 8 | override fun getText(): String = node.text 9 | 10 | } -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/cabal/psi/RangedValue.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.cabal.psi 2 | 3 | import org.jetbrains.cabal.psi.Checkable 4 | import com.intellij.psi.PsiElement 5 | import org.jetbrains.cabal.highlight.ErrorMessage 6 | 7 | 8 | interface RangedValue: Checkable, PsiElement { 9 | 10 | fun getAvailableValues(): List { return listOf() } 11 | 12 | override fun check(): List { 13 | if (text!! !in getAvailableValues()) return listOf(ErrorMessage(this, "invalid field value", "error")) 14 | return listOf() 15 | } 16 | } -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/cabal/psi/RepoKind.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.cabal.psi 2 | 3 | import com.intellij.lang.ASTNode 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement 5 | import org.jetbrains.cabal.parser.* 6 | 7 | class RepoKind(node: ASTNode) : ASTWrapperPsiElement(node), RangedValue { 8 | override fun getAvailableValues(): List { 9 | return REPO_KIND_VALS 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/cabal/psi/RepoLocationField.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.cabal.psi 2 | 3 | import com.intellij.lang.ASTNode 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement 5 | import org.jetbrains.cabal.psi.SingleValueField 6 | 7 | class RepoLocationField(node: ASTNode) : SingleValueField(node) -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/cabal/psi/RepoModuleField.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.cabal.psi 2 | 3 | import com.intellij.lang.ASTNode 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement 5 | import com.intellij.psi.PsiElement 6 | import org.jetbrains.cabal.psi.SingleValueField 7 | import org.jetbrains.cabal.parser.CabalTokelTypes 8 | 9 | class RepoModuleField(node: ASTNode) : SingleValueField(node) 10 | -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/cabal/psi/RepoSubdirField.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.cabal.psi 2 | 3 | import com.intellij.lang.ASTNode 4 | import org.jetbrains.cabal.psi.SingleValueField 5 | import org.jetbrains.cabal.psi.PathsField 6 | import com.intellij.openapi.vfs.VirtualFile 7 | import java.util.ArrayList 8 | import java.io.File 9 | 10 | class RepoSubdirField(node: ASTNode) : SingleValueField(node), PathsField { 11 | 12 | override fun validVirtualFile(file: VirtualFile): Boolean = true 13 | 14 | override fun getSourceDirs(originalRootDir: VirtualFile): List = listOf() 15 | } -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/cabal/psi/RepoTagField.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.cabal.psi 2 | 3 | import com.intellij.lang.ASTNode 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement 5 | import org.jetbrains.cabal.psi.SingleValueField 6 | 7 | class RepoTagField(node: ASTNode) : SingleValueField(node) -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/cabal/psi/RepoType.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.cabal.psi 2 | 3 | import com.intellij.lang.ASTNode 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement 5 | import org.jetbrains.cabal.parser.* 6 | import org.jetbrains.cabal.psi.PropertyValue 7 | 8 | class RepoType(node: ASTNode) : PropertyValue(node), RangedValue { 9 | override fun getAvailableValues(): List { 10 | return REPO_TYPE_VALS 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/cabal/psi/SectionType.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.cabal.psi 2 | 3 | import com.intellij.extapi.psi.ASTWrapperPsiElement 4 | import com.intellij.lang.ASTNode 5 | 6 | /** 7 | * @author Evgeny.Kurbatsky 8 | */ 9 | class SectionType(node: ASTNode) : ASTWrapperPsiElement(node) -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/cabal/psi/SingleValueField.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.cabal.psi 2 | 3 | import com.intellij.lang.ASTNode 4 | import org.jetbrains.cabal.psi.Field 5 | import org.jetbrains.cabal.highlight.ErrorMessage 6 | import com.intellij.psi.impl.source.tree.SharedImplUtil 7 | import com.intellij.psi.PsiElement 8 | import com.intellij.psi.tree.IElementType 9 | import java.util.ArrayList 10 | import com.intellij.psi.util.PsiTreeUtil 11 | 12 | open class SingleValueField(node: ASTNode) : PropertyField(node) { 13 | 14 | open fun checkUniqueness(): ErrorMessage? { 15 | fun isSame(field: PsiElement) = (field is PropertyField) && (field.hasName(getFieldName())) 16 | 17 | if ((parent!!.children.filter({ isSame(it) })).size > 1) { 18 | return ErrorMessage(getKeyNode(), "duplicate field", "error") 19 | } 20 | return null 21 | } 22 | 23 | fun getValue(): PropertyValue? { 24 | return PsiTreeUtil.findChildOfType(this, PropertyValue::class.java) 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/cabal/psi/TestModuleField.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.cabal.psi 2 | 3 | import com.intellij.lang.ASTNode 4 | import org.jetbrains.cabal.parser.CabalTokelTypes 5 | import org.jetbrains.cabal.psi.SingleValueField 6 | 7 | class TestModuleField(node: ASTNode) : SingleValueField(node) 8 | -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/cabal/psi/TestSuiteType.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.cabal.psi 2 | 3 | import com.intellij.lang.ASTNode 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement 5 | import org.jetbrains.cabal.parser.* 6 | import org.jetbrains.cabal.psi.PropertyValue 7 | 8 | class TestSuiteType(node: ASTNode) : PropertyValue(node), RangedValue { 9 | override fun getAvailableValues(): List { 10 | return TS_TYPE_VALS 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/cabal/psi/TestedWithField.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.cabal.psi 2 | 3 | import com.intellij.lang.ASTNode 4 | import org.jetbrains.cabal.psi.MultiValueField 5 | 6 | class TestedWithField(node: ASTNode) : MultiValueField(node) 7 | -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/cabal/psi/Token.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.cabal.psi 2 | 3 | import com.intellij.lang.ASTNode 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement 5 | import org.jetbrains.cabal.psi.Checkable 6 | import org.jetbrains.cabal.psi.PropertyValue 7 | import org.jetbrains.cabal.highlight.ErrorMessage 8 | 9 | class Token(node: ASTNode) : PropertyValue(node), Checkable { 10 | 11 | override fun check(): List { 12 | if (!node.text.matches("^.+$".toRegex())) { 13 | return listOf(ErrorMessage(this, "invalid token", "error")) 14 | } 15 | return listOf() 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/cabal/psi/TypeField.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.cabal.psi 2 | 3 | import com.intellij.lang.ASTNode 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement 5 | import org.jetbrains.cabal.psi.SingleValueField 6 | 7 | class TypeField(node: ASTNode) : SingleValueField(node) 8 | -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/cabal/psi/Url.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.cabal.psi 2 | 3 | import com.intellij.lang.ASTNode 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement 5 | import org.jetbrains.cabal.psi.Checkable 6 | import org.jetbrains.cabal.psi.PropertyValue 7 | import org.jetbrains.cabal.highlight.ErrorMessage 8 | 9 | class Url(node: ASTNode) : PropertyValue(node), Checkable { 10 | 11 | override fun check(): List { 12 | return listOf() 13 | } 14 | 15 | } -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/cabal/psi/VersionField.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.cabal.psi 2 | 3 | import com.intellij.lang.ASTNode 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement 5 | import org.jetbrains.cabal.psi.SingleValueField 6 | 7 | class VersionField(node: ASTNode) : SingleValueField(node) 8 | -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/cabal/psi/VersionValue.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.cabal.psi 2 | 3 | import com.intellij.lang.ASTNode 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement 5 | import org.jetbrains.cabal.psi.Checkable 6 | import com.intellij.psi.PsiElement 7 | import org.jetbrains.cabal.psi.PropertyValue 8 | import org.jetbrains.cabal.highlight.ErrorMessage 9 | 10 | class VersionValue(node: ASTNode) : PropertyValue(node), Checkable { 11 | 12 | override fun check(): List { 13 | if (!this.text.matches("([0-9]+(\\-[0-9a-zA_Z]+)*\\.)*([0-9]+(\\-[0-9a-zA_Z]+)*)".toRegex())) return listOf(ErrorMessage(this, "invalid version", "error")) 14 | return listOf() 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/cabal/references/FilePsiReference.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.cabal.references 2 | 3 | import com.intellij.psi.PsiReferenceBase 4 | import com.intellij.psi.PsiElement 5 | import org.jetbrains.cabal.psi.Path 6 | import com.intellij.openapi.util.TextRange 7 | 8 | class FilePsiReference(element: T, resolveTo: PsiElement): PsiReferenceBase.Immediate(element, element.getDefaultTextRange(), resolveTo) 9 | -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/cabal/settings/CabalProjectSettings.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.cabal.settings 2 | 3 | import com.intellij.openapi.externalSystem.settings.ExternalProjectSettings 4 | 5 | class CabalProjectSettings : ExternalProjectSettings() { 6 | // 7 | // private var myCabalHome: String? = null 8 | // 9 | // public fun getCabalHome(): String? { 10 | // return myCabalHome 11 | // } 12 | // 13 | // public fun setCabalHome(cabalHome: String?) { 14 | // myCabalHome = cabalHome 15 | // } 16 | 17 | override fun clone(): ExternalProjectSettings { 18 | val result = CabalProjectSettings() 19 | copyTo(result) 20 | // result.myCabalHome = myCabalHome 21 | return result 22 | } 23 | } -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/cabal/settings/CabalSettingsListener.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.cabal.settings 2 | 3 | import com.intellij.openapi.externalSystem.settings.ExternalSystemSettingsListener 4 | import com.intellij.util.messages.Topic 5 | import org.jetbrains.cabal.settings.CabalProjectSettings 6 | 7 | 8 | interface CabalSettingsListener: ExternalSystemSettingsListener { 9 | 10 | companion object { 11 | val TOPIC: Topic = Topic.create("Cabal-specific settings", CabalSettingsListener::class.java)!! 12 | } 13 | } -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/cabal/settings/CabalSettingsListenerImpl.java: -------------------------------------------------------------------------------- 1 | package org.jetbrains.cabal.settings; 2 | 3 | import com.intellij.openapi.externalSystem.settings.ExternalSystemSettingsListenerAdapter; 4 | 5 | /** 6 | * Created by atsky on 11/8/14. 7 | */ 8 | public class CabalSettingsListenerImpl extends ExternalSystemSettingsListenerAdapter 9 | implements CabalSettingsListener { 10 | } 11 | -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/cabal/util/CabalConstants.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.cabal.util 2 | 3 | import com.intellij.openapi.externalSystem.model.ProjectSystemId 4 | 5 | 6 | val SYSTEM_ID: ProjectSystemId = ProjectSystemId("CABAL") 7 | -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/grammar/dumb/LLState.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.grammar.dumb 2 | 3 | import org.jetbrains.grammar.dumb.Rule 4 | import org.jetbrains.grammar.dumb.ResultTree 5 | import org.jetbrains.grammar.dumb.NonTerminalTree 6 | import org.jetbrains.grammar.dumb.Variant 7 | import org.jetbrains.haskell.parser.LexerState 8 | 9 | /** 10 | * Created by atsky on 23/11/14. 11 | */ 12 | abstract class ParserState { 13 | abstract fun next() : ParserState 14 | } 15 | 16 | class FinalState(val result : NonTerminalTree?) : ParserState() { 17 | override fun next(): ParserState { 18 | return this 19 | } 20 | 21 | } 22 | 23 | -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/grammar/dumb/Term.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.grammar.dumb 2 | 3 | import org.jetbrains.haskell.parser.HaskellTokenType 4 | 5 | /** 6 | * Created by atsky on 14/11/14. 7 | */ 8 | open class Term 9 | 10 | class Terminal(val tokenType: HaskellTokenType) : Term() { 11 | override fun toString(): String { 12 | return "'" + tokenType.myName + "'" 13 | } 14 | 15 | override fun equals(other: Any?): Boolean { 16 | if (other !is Terminal) { 17 | return false 18 | } 19 | return tokenType == other.tokenType 20 | } 21 | 22 | override fun hashCode() = tokenType.hashCode() 23 | 24 | } 25 | 26 | class NonTerminal(val rule: String) : Term() { 27 | override fun toString(): String { 28 | return rule 29 | } 30 | 31 | override fun equals(other: Any?): Boolean { 32 | if (other !is NonTerminal) { 33 | return false 34 | } 35 | return rule == other.rule 36 | } 37 | 38 | override fun hashCode() = rule.hashCode() 39 | 40 | 41 | } -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/HaskellLanguage.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell 2 | 3 | import com.intellij.lang.Language 4 | import com.intellij.openapi.fileTypes.SingleLazyInstanceSyntaxHighlighterFactory 5 | import com.intellij.openapi.fileTypes.SyntaxHighlighter 6 | import com.intellij.openapi.fileTypes.SyntaxHighlighterFactory 7 | import org.jetbrains.haskell.highlight.HaskellHighlighter 8 | 9 | class HaskellLanguage : Language("Haskell", "text/haskell") { 10 | 11 | companion object { 12 | val INSTANCE: HaskellLanguage = HaskellLanguage() 13 | } 14 | } -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/HaskellViewProvider.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell 2 | 3 | import com.intellij.lang.Language 4 | import com.intellij.openapi.vfs.VirtualFile 5 | import com.intellij.psi.PsiManager 6 | import com.intellij.psi.SingleRootFileViewProvider 7 | 8 | class HaskellViewProvider(manager: PsiManager, 9 | virtualFile: VirtualFile, 10 | eventSystemEnabled: Boolean, 11 | language: Language) : 12 | SingleRootFileViewProvider(manager, virtualFile, eventSystemEnabled, language) { 13 | 14 | override fun supportsIncrementalReparse(rootLanguage: Language): Boolean { 15 | return false 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/comment/HaskellCommenter.java: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.comment; 2 | 3 | import com.intellij.lang.Commenter; 4 | import org.jetbrains.annotations.Nullable; 5 | 6 | /** 7 | * @author Denys Digtiar 8 | */ 9 | public class HaskellCommenter implements Commenter { 10 | @Nullable 11 | @Override 12 | public String getLineCommentPrefix() { 13 | return "--"; 14 | } 15 | 16 | @Nullable 17 | @Override 18 | public String getBlockCommentPrefix() { 19 | return "{-"; 20 | } 21 | 22 | @Nullable 23 | @Override 24 | public String getBlockCommentSuffix() { 25 | return "-}"; 26 | } 27 | 28 | @Nullable 29 | @Override 30 | public String getCommentedBlockCommentPrefix() { 31 | return null; 32 | } 33 | 34 | @Nullable 35 | @Override 36 | public String getCommentedBlockCommentSuffix() { 37 | return null; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/debugger/DebugConsoleExecutor.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.debugger 2 | 3 | import com.intellij.execution.Executor 4 | import javax.swing.Icon 5 | import com.intellij.icons.AllIcons 6 | import org.jetbrains.annotations.NonNls 7 | 8 | class DebugConsoleExecutor : Executor() { 9 | companion object { 10 | val EXECUTOR_ID: String = "DebugConsole" 11 | } 12 | override fun getToolWindowId(): String? = "Run" 13 | override fun getToolWindowIcon(): Icon? = AllIcons.Toolwindows.ToolWindowDebugger 14 | override fun getIcon(): Icon = AllIcons.Debugger.Console 15 | override fun getDisabledIcon(): Icon? = null 16 | override fun getDescription(): String? = "Open debug REPL console" 17 | override fun getActionName(): String = "DebugConsole" 18 | override fun getId(): String = EXECUTOR_ID 19 | override fun getStartActionText(): String = "Open debug console" 20 | override fun getContextActionId(): String? = "Haskell.Debugger.OpenDebuggerConsole" 21 | override fun getHelpId(): String? = "debugging.DebugWindow" 22 | 23 | } -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/debugger/actions/SwitchableAction.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.debugger.actions 2 | 3 | import javax.swing.Icon 4 | import com.intellij.openapi.actionSystem.AnAction 5 | import com.intellij.openapi.actionSystem.AnActionEvent 6 | 7 | abstract class SwitchableAction(text: String?, description: String?, icon: Icon?) : AnAction(text, description, icon) { 8 | 9 | var enabled: Boolean = true 10 | 11 | override fun update(e: AnActionEvent?) { 12 | val p = e?.presentation 13 | p?.isEnabled = enabled 14 | } 15 | } -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/debugger/breakpoints/HaskellBreakpointHandlerFactory.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.debugger.breakpoints 2 | 3 | import com.intellij.openapi.extensions.ExtensionPointName 4 | import org.jetbrains.haskell.debugger.HaskellDebugProcess 5 | import com.intellij.xdebugger.breakpoints.XBreakpointHandler 6 | import com.intellij.xdebugger.breakpoints.XBreakpoint 7 | 8 | interface HaskellBreakpointHandlerFactory { 9 | fun createBreakpointHandler(process: HaskellDebugProcess): XBreakpointHandler> 10 | } -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/debugger/breakpoints/HaskellExceptionBreakpointHandler.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.debugger.breakpoints 2 | 3 | import com.intellij.xdebugger.breakpoints.XBreakpointHandler 4 | import com.intellij.xdebugger.breakpoints.XBreakpointProperties 5 | import com.intellij.xdebugger.breakpoints.XBreakpoint 6 | import org.jetbrains.haskell.debugger.HaskellDebugProcess 7 | 8 | /** 9 | * Created by vlad on 8/6/14. 10 | */ 11 | 12 | class HaskellExceptionBreakpointHandler(val debugProcess: HaskellDebugProcess) : 13 | XBreakpointHandler>(HaskellExceptionBreakpointType::class.java) { 14 | 15 | override fun registerBreakpoint(breakpoint: XBreakpoint) { 16 | debugProcess.addExceptionBreakpoint(breakpoint) 17 | } 18 | 19 | override fun unregisterBreakpoint(breakpoint: XBreakpoint, temporary: Boolean) { 20 | debugProcess.removeExceptionBreakpoint(breakpoint) 21 | } 22 | 23 | } -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/debugger/breakpoints/HaskellExceptionBreakpointProperties.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.debugger.breakpoints 2 | 3 | import com.intellij.xdebugger.breakpoints.XBreakpointProperties 4 | 5 | /** 6 | * Created by vlad on 8/6/14. 7 | */ 8 | 9 | class HaskellExceptionBreakpointProperties : XBreakpointProperties() { 10 | 11 | enum class ExceptionType { 12 | EXCEPTION, 13 | ERROR 14 | } 15 | 16 | class State { 17 | var exceptionType: ExceptionType = HaskellExceptionBreakpointProperties.ExceptionType.EXCEPTION 18 | } 19 | 20 | private var myState: HaskellExceptionBreakpointProperties.State = HaskellExceptionBreakpointProperties.State() 21 | 22 | override fun getState(): State { 23 | return myState 24 | } 25 | 26 | override fun loadState(state: State?) { 27 | myState = state!! 28 | } 29 | } -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/debugger/breakpoints/HaskellLineBreakpointDescription.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.debugger.breakpoints 2 | 3 | /** 4 | * Created by vlad on 8/27/14. 5 | */ 6 | 7 | data class HaskellLineBreakpointDescription(val module: String, 8 | val line: Int, 9 | val condition: String?) -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/debugger/frames/HsDebugValue.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.debugger.frames 2 | 3 | import com.intellij.xdebugger.frame.XNamedValue 4 | import com.intellij.xdebugger.frame.XValueNode 5 | import com.intellij.xdebugger.frame.XValuePlace 6 | import org.jetbrains.haskell.debugger.parser.LocalBinding 7 | 8 | /** 9 | * @author Habibullin Marat 10 | */ 11 | 12 | class HsDebugValue(val binding: LocalBinding): XNamedValue(binding.name ?: "") { 13 | override fun computePresentation(node: XValueNode, place: XValuePlace) { 14 | node.setPresentation(null, binding.typeName ?: "", binding.value ?: "", false) 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/debugger/frames/HsDebuggerEvaluator.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.debugger.frames 2 | 3 | import com.intellij.xdebugger.evaluation.XDebuggerEvaluator 4 | import com.intellij.xdebugger.XSourcePosition 5 | import org.jetbrains.haskell.debugger.procdebuggers.ProcessDebugger 6 | //import org.jetbrains.haskell.debugger.protocol.ExpressionCommand 7 | import com.intellij.xdebugger.frame.XNamedValue 8 | 9 | /** 10 | * Created by vlad on 7/23/14. 11 | */ 12 | 13 | class HsDebuggerEvaluator (val debugger: ProcessDebugger): XDebuggerEvaluator() { 14 | 15 | override fun evaluate(expression: String, callback: XDebuggerEvaluator.XEvaluationCallback, expressionPosition: XSourcePosition?) { 16 | debugger.evaluateExpression(expression, callback) 17 | } 18 | } -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/debugger/frames/HsExecutionStack.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.debugger.frames 2 | 3 | import com.intellij.xdebugger.frame.XExecutionStack 4 | import com.intellij.xdebugger.frame.XStackFrame 5 | import java.util.LinkedList 6 | import org.jetbrains.haskell.debugger.procdebuggers.ProcessDebugger 7 | 8 | /** 9 | * @author Habibullin Marat 10 | * @see XExecutionStack 11 | */ 12 | class HsExecutionStack(private val debugger: ProcessDebugger, 13 | private val threadInfo: ProgramThreadInfo) : XExecutionStack(threadInfo.name) { 14 | private val topFrame: HsStackFrame? = HsTopStackFrame(debugger, threadInfo.topFrameInfo) 15 | override fun getTopFrame(): XStackFrame? = topFrame 16 | 17 | override fun computeStackFrames(firstFrameIndex: Int, container: XExecutionStack.XStackFrameContainer?) { 18 | container?.addStackFrames(LinkedList(), true) 19 | } 20 | } -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/debugger/frames/HsSuspendContext.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.debugger.frames 2 | 3 | import com.intellij.xdebugger.frame.XSuspendContext 4 | import com.intellij.xdebugger.frame.XExecutionStack 5 | import org.jetbrains.haskell.debugger.procdebuggers.ProcessDebugger 6 | 7 | class HsSuspendContext(val debugger: ProcessDebugger, 8 | val threadInfo: ProgramThreadInfo) : XSuspendContext() { 9 | private val _activeExecutionStack: XExecutionStack = HsExecutionStack(debugger, threadInfo) 10 | override fun getActiveExecutionStack(): XExecutionStack = _activeExecutionStack 11 | 12 | /** 13 | * This method is not overrode, default implementation returns array of one element - _activeExecutionStack 14 | */ 15 | // override fun getExecutionStacks(): Array? 16 | } -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/debugger/frames/HsTopStackFrame.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.debugger.frames 2 | 3 | import org.jetbrains.haskell.debugger.parser.HsStackFrameInfo 4 | import org.jetbrains.haskell.debugger.procdebuggers.ProcessDebugger 5 | 6 | /** 7 | * Created by marat-x on 7/22/14. 8 | */ 9 | class HsTopStackFrame(debugger: ProcessDebugger, 10 | stackFrameInfo: HsStackFrameInfo) 11 | : HsStackFrame(debugger, stackFrameInfo) { 12 | 13 | override fun tryGetBindings() { 14 | // does nothing, because there is no way to get bindings if they are not set 15 | } 16 | } -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/debugger/frames/ProgramThreadInfo.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.debugger.frames 2 | 3 | import org.jetbrains.haskell.debugger.parser.HsStackFrameInfo 4 | import java.util.ArrayList 5 | 6 | class ProgramThreadInfo(val id: String?, 7 | val name: String, 8 | val topFrameInfo: HsStackFrameInfo) { 9 | 10 | enum class State { 11 | RUNNING, 12 | SUSPENDED, 13 | KILLED 14 | } 15 | 16 | var state: State = State.SUSPENDED 17 | private set 18 | } -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/debugger/procdebuggers/utils/DebugRespondent.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.debugger.procdebuggers.utils 2 | 3 | import org.jetbrains.haskell.debugger.frames.HsSuspendContext 4 | import org.jetbrains.haskell.debugger.frames.HsHistoryFrame 5 | import org.jetbrains.haskell.debugger.parser.HistoryResult 6 | import org.jetbrains.haskell.debugger.breakpoints.HaskellLineBreakpointDescription 7 | 8 | 9 | interface DebugRespondent { 10 | 11 | fun traceFinished() 12 | 13 | fun positionReached(context: HsSuspendContext) 14 | 15 | fun breakpointReached(breakpoint: HaskellLineBreakpointDescription, 16 | context: HsSuspendContext) 17 | 18 | fun exceptionReached(context: HsSuspendContext) 19 | 20 | fun breakpointRemoved() 21 | 22 | fun getBreakpointAt(module: String, line: Int): HaskellLineBreakpointDescription? 23 | 24 | fun setBreakpointNumberAt(breakpointNumber: Int, module: String, line: Int) 25 | 26 | fun resetHistoryStack() 27 | 28 | fun historyChange(currentFrame: HsHistoryFrame, history: HistoryResult?) 29 | 30 | fun getModuleByFile(filename: String): String 31 | 32 | } -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/debugger/prochandlers/GHCiProcessHandler.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.debugger.prochandlers 2 | 3 | import com.intellij.execution.process.ProcessListener 4 | 5 | class GHCiProcessHandler(process: Process) : HaskellDebugProcessHandler(process) { 6 | 7 | override fun setDebugProcessListener(listener: ProcessListener?) { 8 | addProcessListener(listener) 9 | } 10 | 11 | } -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/debugger/prochandlers/HaskellDebugProcessHandler.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.debugger.prochandlers 2 | 3 | import com.intellij.execution.process.OSProcessHandler 4 | import com.intellij.execution.process.ProcessListener 5 | 6 | abstract class HaskellDebugProcessHandler(process: Process): OSProcessHandler(process) { 7 | 8 | abstract fun setDebugProcessListener(listener: ProcessListener?) 9 | } -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/debugger/prochandlers/RemoteProcessHandler.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.debugger.prochandlers 2 | 3 | import com.intellij.execution.process.ProcessListener 4 | import org.jetbrains.haskell.debugger.prochandlers.HaskellDebugProcessHandler 5 | import org.jetbrains.haskell.debugger.procdebuggers.utils.RemoteDebugStreamHandler 6 | 7 | /** 8 | * Created by vlad on 7/30/14. 9 | */ 10 | 11 | class RemoteProcessHandler(process: Process, val streamHandler: RemoteDebugStreamHandler) : HaskellDebugProcessHandler(process) { 12 | 13 | init { 14 | streamHandler.processHandler = this 15 | } 16 | 17 | override fun setDebugProcessListener(listener: ProcessListener?) { 18 | streamHandler.listener = listener 19 | } 20 | 21 | override fun doDestroyProcess() { 22 | super.doDestroyProcess() 23 | streamHandler.stop() 24 | } 25 | } -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/debugger/protocol/CommandCallback.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.debugger.protocol 2 | 3 | import org.jetbrains.haskell.debugger.parser.ParseResult 4 | 5 | /** 6 | * Created by vlad on 7/23/14. 7 | */ 8 | 9 | abstract class CommandCallback { 10 | abstract fun execAfterParsing(result: R) 11 | 12 | open fun execBeforeSending() { 13 | } 14 | } -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/debugger/protocol/ExpressionTypeCommand.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.debugger.protocol 2 | 3 | import java.util.Deque 4 | import org.jetbrains.haskell.debugger.HaskellDebugProcess 5 | import org.jetbrains.haskell.debugger.parser.GHCiParser 6 | import org.jetbrains.haskell.debugger.parser.ParseResult 7 | import org.jetbrains.haskell.debugger.parser.ExpressionType 8 | import org.json.simple.JSONObject 9 | 10 | /** 11 | * Created by vlad on 7/23/14. 12 | */ 13 | 14 | class ExpressionTypeCommand(val expression: String, callback: CommandCallback?) 15 | : RealTimeCommand(callback) { 16 | override fun getText(): String = ":type $expression\n" 17 | 18 | override fun parseGHCiOutput(output: Deque): ExpressionType? = GHCiParser.parseExpressionType(output.first!!) 19 | 20 | override fun parseJSONOutput(output: JSONObject): ExpressionType? { 21 | throw UnsupportedOperationException() 22 | } 23 | } -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/debugger/protocol/ForwardCommand.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.debugger.protocol 2 | 3 | import org.jetbrains.haskell.debugger.parser.MoveHistResult 4 | import java.util.Deque 5 | import org.jetbrains.haskell.debugger.parser.GHCiParser 6 | import org.json.simple.JSONObject 7 | import org.jetbrains.haskell.debugger.parser.JSONConverter 8 | 9 | /** 10 | * Created by vlad on 8/4/14. 11 | */ 12 | 13 | class ForwardCommand(callback: CommandCallback?) : RealTimeCommand(callback) { 14 | override fun getText(): String = ":forward\n" 15 | 16 | override fun parseGHCiOutput(output: Deque): MoveHistResult? = GHCiParser.parseMoveHistResult(output) 17 | 18 | override fun parseJSONOutput(output: JSONObject): MoveHistResult? = 19 | if (JSONConverter.checkExceptionFromJSON(output) == null) JSONConverter.moveHistResultFromJSON(output) else null 20 | } -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/debugger/protocol/HiddenCommand.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.debugger.protocol 2 | 3 | import java.util.Deque 4 | import org.jetbrains.haskell.debugger.parser.ParseResult 5 | import org.json.simple.JSONObject 6 | 7 | /** 8 | * Created by vlad on 7/17/14. 9 | */ 10 | 11 | abstract class HiddenCommand 12 | : AbstractCommand(null) { 13 | 14 | companion object { 15 | fun createInstance(command: String): HiddenCommand { 16 | return object : HiddenCommand() { 17 | override fun getText(): String = command 18 | } 19 | } 20 | } 21 | 22 | override fun parseGHCiOutput(output: Deque): ParseResult? = null 23 | 24 | override fun parseJSONOutput(output: JSONObject): ParseResult? = null 25 | } 26 | -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/debugger/protocol/RealTimeCommand.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.debugger.protocol 2 | 3 | import org.jetbrains.haskell.debugger.parser.ParseResult 4 | 5 | /** 6 | * Created by vlad on 7/17/14. 7 | */ 8 | 9 | /** 10 | * Command like setting breakpoint 11 | */ 12 | abstract class RealTimeCommand(callback: CommandCallback?) : AbstractCommand(callback) -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/debugger/protocol/RemoveBreakpointCommand.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.debugger.protocol 2 | 3 | import java.util.Deque 4 | import org.jetbrains.haskell.debugger.parser.ParseResult 5 | import org.json.simple.JSONObject 6 | import org.jetbrains.haskell.debugger.procdebuggers.utils.DebugRespondent 7 | 8 | /** 9 | * @author Habibullin Marat 10 | */ 11 | 12 | class RemoveBreakpointCommand(val module: String?, val breakpointNumber: Int, callback: CommandCallback?) 13 | : RealTimeCommand(callback) { 14 | 15 | override fun getText(): String = ":delete ${module ?: ""} $breakpointNumber\n" 16 | 17 | override fun parseGHCiOutput(output: Deque): Nothing? = null 18 | 19 | override fun parseJSONOutput(output: JSONObject): Nothing? = null 20 | 21 | class StandardRemoveBreakpointCallback(val respondent: DebugRespondent) : CommandCallback() { 22 | override fun execAfterParsing(result: Nothing?) { 23 | respondent.breakpointRemoved() 24 | } 25 | 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/debugger/protocol/ResumeCommand.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.debugger.protocol 2 | 3 | import org.jetbrains.haskell.debugger.parser.ParseResult 4 | import org.jetbrains.haskell.debugger.frames.HsTopStackFrame 5 | import org.jetbrains.haskell.debugger.parser.HsStackFrameInfo 6 | 7 | /** 8 | * Created by vlad on 7/16/14. 9 | */ 10 | 11 | class ResumeCommand(callback: CommandCallback?) : FlowCommand(callback) { 12 | override fun getText(): String = ":continue\n" 13 | } 14 | -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/debugger/protocol/StepIntoCommand.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.debugger.protocol 2 | 3 | import org.jetbrains.haskell.debugger.parser.HsStackFrameInfo 4 | 5 | /** 6 | * Created by vlad on 7/15/14. 7 | */ 8 | 9 | class StepIntoCommand(callback: CommandCallback?) : StepCommand(callback) { 10 | 11 | override fun getText(): String = ":step\n" 12 | } 13 | -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/debugger/protocol/StepOverCommand.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.debugger.protocol 2 | 3 | import org.jetbrains.haskell.debugger.parser.HsStackFrameInfo 4 | 5 | /** 6 | * Created by vlad on 7/15/14. 7 | */ 8 | 9 | class StepOverCommand(callback: CommandCallback?) : StepCommand(callback) { 10 | override fun getText(): String = ":steplocal\n" 11 | } 12 | -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/debugger/protocol/TraceCommand.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.debugger.protocol 2 | 3 | import org.jetbrains.haskell.debugger.parser.HsStackFrameInfo 4 | 5 | /** 6 | * Created by vlad on 7/10/14. 7 | */ 8 | 9 | class TraceCommand(val function: String = "main", callback: CommandCallback?, vararg val params: String) 10 | : FlowCommand(callback) { 11 | 12 | override fun getText(): String { 13 | val builder = StringBuilder() 14 | builder.append(":trace ").append(function) 15 | for (p in params) { 16 | builder.append(' ').append(p) 17 | } 18 | builder.append('\n') 19 | return builder.toString() 20 | } 21 | 22 | } -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/debugger/repl/DebugConsoleFactory.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.debugger.repl 2 | 3 | import com.intellij.execution.impl.ConsoleViewImpl 4 | import com.intellij.openapi.project.Project 5 | import org.jetbrains.haskell.debugger.HaskellDebugProcess 6 | import org.jetbrains.haskell.debugger.prochandlers.HaskellDebugProcessHandler 7 | import com.intellij.execution.process.ProcessTerminatedListener 8 | import com.intellij.execution.process.ProcessAdapter 9 | import com.intellij.execution.process.ProcessEvent 10 | import com.intellij.execution.ui.ConsoleView 11 | import com.intellij.openapi.application.ApplicationManager 12 | 13 | 14 | object DebugConsoleFactory { 15 | fun createDebugConsole(project: Project, 16 | processHandler: HaskellDebugProcessHandler): ConsoleView { 17 | val console = ConsoleViewImpl(project, false) 18 | 19 | ProcessTerminatedListener.attach(processHandler) 20 | console.attachToProcess(processHandler) 21 | 22 | return console 23 | } 24 | } -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/external/tool/GhcModToolWindowFactory.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.external.tool 2 | 3 | import com.intellij.openapi.wm.ToolWindowFactory 4 | import com.intellij.openapi.project.Project 5 | import com.intellij.openapi.wm.ToolWindow 6 | import com.intellij.ui.content.ContentFactory 7 | import javax.swing.JComponent 8 | import javax.swing.JPanel 9 | import java.awt.BorderLayout 10 | import com.intellij.execution.impl.ConsoleViewImpl 11 | 12 | class GhcModToolWindowFactory : ToolWindowFactory { 13 | 14 | override fun createToolWindowContent(project: Project, toolWindow: ToolWindow) { 15 | val contentFactory = ContentFactory.SERVICE.getInstance() 16 | val content = contentFactory!!.createContent(createToolWindowPanel(project), "", false) 17 | toolWindow.contentManager!!.addContent(content) 18 | } 19 | 20 | private fun createToolWindowPanel(project: Project): JComponent { 21 | val panel = JPanel(BorderLayout()) 22 | val ghcMod = project.getComponent(GhcModConsole::class.java)!! 23 | panel.add(ghcMod.editor!!.component, BorderLayout.CENTER) 24 | return panel 25 | } 26 | 27 | 28 | } -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/fileType/HaskellFile.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.fileType 2 | 3 | import com.intellij.extapi.psi.PsiFileBase 4 | import com.intellij.openapi.fileTypes.FileType 5 | import com.intellij.psi.FileViewProvider 6 | import com.intellij.psi.PsiElementVisitor 7 | import org.jetbrains.haskell.HaskellLanguage 8 | import org.jetbrains.haskell.psi.ModuleName 9 | import org.jetbrains.haskell.psi.Module 10 | 11 | class HaskellFile(provider: FileViewProvider) : PsiFileBase(provider, HaskellLanguage.INSTANCE) { 12 | 13 | override fun getFileType(): FileType { 14 | return HaskellFileType.INSTANCE 15 | } 16 | 17 | override fun accept(visitor: PsiElementVisitor) { 18 | visitor.visitFile(this) 19 | } 20 | 21 | fun getModule() : Module? = findChildByClass(Module::class.java) 22 | } -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/fileType/HaskellFileType.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.fileType 2 | 3 | import com.intellij.openapi.fileTypes.LanguageFileType 4 | import com.intellij.openapi.vfs.VirtualFile 5 | import org.jetbrains.annotations.NonNls 6 | import org.jetbrains.haskell.HaskellLanguage 7 | import org.jetbrains.haskell.icons.HaskellIcons 8 | import javax.swing.* 9 | 10 | class HaskellFileType : LanguageFileType(HaskellLanguage.INSTANCE) { 11 | 12 | private var myIcon: Icon = HaskellIcons.DEFAULT 13 | 14 | override fun getName(): String = 15 | "Haskell file" 16 | 17 | override fun getDescription(): String = 18 | "Haskell file" 19 | 20 | override fun getDefaultExtension(): String = 21 | DEFAULT_EXTENSION 22 | 23 | override fun getIcon(): Icon = 24 | myIcon 25 | 26 | override fun getCharset(file: VirtualFile, content: ByteArray): String = 27 | "UTF-8" 28 | 29 | companion object { 30 | @JvmField val INSTANCE: HaskellFileType = HaskellFileType() 31 | val DEFAULT_EXTENSION: String = "hs" 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/fileType/HaskellFileTypeFactory.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.fileType 2 | 3 | import com.intellij.openapi.fileTypes.FileTypeConsumer 4 | import com.intellij.openapi.fileTypes.FileTypeFactory 5 | import org.jetbrains.cabal.CabalFileType 6 | import org.jetbrains.yesod.hamlet.HamletFileType 7 | import org.jetbrains.yesod.julius.JuliusFileType 8 | import org.jetbrains.yesod.cassius.CassiusFileType 9 | import org.jetbrains.yesod.lucius.LuciusFileType 10 | 11 | 12 | class HaskellFileTypeFactory : FileTypeFactory() { 13 | override fun createFileTypes(consumer: FileTypeConsumer) { 14 | consumer.consume(HaskellFileType.INSTANCE, HaskellFileType.DEFAULT_EXTENSION) 15 | consumer.consume(CabalFileType.INSTANCE, CabalFileType.DEFAULT_EXTENSION) 16 | consumer.consume(HamletFileType.INSTANCE, HamletFileType.DEFAULT_EXTENSION) 17 | consumer.consume(JuliusFileType.INSTANCE, JuliusFileType.DEFAULT_EXTENSION) 18 | consumer.consume(LuciusFileType.INSTANCE, LuciusFileType.DEFAULT_EXTENSION) 19 | consumer.consume(CassiusFileType.INSTANCE, CassiusFileType.DEFAULT_EXTENSION) 20 | } 21 | } -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/fileType/HaskellFileViewProviderFactory.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.fileType 2 | 3 | import com.intellij.lang.Language 4 | import com.intellij.openapi.vfs.VirtualFile 5 | import com.intellij.psi.FileViewProvider 6 | import com.intellij.psi.FileViewProviderFactory 7 | import com.intellij.psi.PsiManager 8 | import org.jetbrains.haskell.HaskellViewProvider 9 | 10 | class HaskellFileViewProviderFactory : FileViewProviderFactory { 11 | 12 | override fun createFileViewProvider(file: VirtualFile, 13 | language: Language, 14 | manager: PsiManager, 15 | eventSystemEnabled: Boolean): FileViewProvider { 16 | return HaskellViewProvider(manager, file, eventSystemEnabled, language) 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/fileType/HiFileType.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.fileType 2 | 3 | import com.intellij.openapi.fileTypes.FileType 4 | import com.intellij.openapi.vfs.VirtualFile 5 | import javax.swing.* 6 | 7 | class HiFileType : FileType { 8 | 9 | 10 | override fun getName(): String { 11 | return "Haskell interface" 12 | } 13 | 14 | override fun getDescription(): String { 15 | return "Haskell interface file" 16 | } 17 | 18 | override fun getDefaultExtension(): String { 19 | return "hi" 20 | } 21 | 22 | override fun getIcon(): Icon? { 23 | return null 24 | } 25 | 26 | override fun isBinary(): Boolean { 27 | return true 28 | } 29 | 30 | override fun isReadOnly(): Boolean { 31 | return true 32 | } 33 | 34 | override fun getCharset(file: VirtualFile, content: ByteArray): String? { 35 | return null 36 | } 37 | 38 | 39 | companion object { 40 | val INSTANCE: HiFileType = HiFileType() 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/findUsages/HaskellWordsScanner.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.findUsages 2 | 3 | import com.intellij.lang.cacheBuilder.WordsScanner 4 | import com.intellij.lang.cacheBuilder.DefaultWordsScanner 5 | import org.jetbrains.haskell.parser.lexer.HaskellLexer 6 | import com.intellij.psi.tree.TokenSet 7 | import org.jetbrains.grammar.HaskellLexerTokens 8 | import org.jetbrains.haskell.parser.token.COMMENTS 9 | 10 | /** 11 | * Created by atsky on 13/02/15. 12 | */ 13 | class HaskellWordsScanner : DefaultWordsScanner( 14 | HaskellLexer(), 15 | TokenSet.create( 16 | HaskellLexerTokens.VARID, 17 | HaskellLexerTokens.VARSYM, 18 | HaskellLexerTokens.CONID, 19 | HaskellLexerTokens.CONSYM), 20 | COMMENTS, 21 | TokenSet.create(HaskellLexerTokens.STRING)) -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/highlight/HaskellBraceMatcher.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.highlight 2 | 3 | import com.intellij.lang.BracePair 4 | import com.intellij.lang.PairedBraceMatcher 5 | import com.intellij.psi.PsiFile 6 | import com.intellij.psi.tree.IElementType 7 | import org.jetbrains.haskell.parser.lexer.* 8 | import org.jetbrains.grammar.HaskellLexerTokens 9 | 10 | class HaskellBraceMatcher : PairedBraceMatcher { 11 | 12 | override fun getPairs(): Array { 13 | return PAIRS 14 | } 15 | 16 | override fun isPairedBracesAllowedBeforeType(lbraceType: IElementType, contextType: IElementType?): Boolean { 17 | return true 18 | } 19 | 20 | override fun getCodeConstructStart(file: PsiFile?, openingBraceOffset: Int): Int { 21 | return openingBraceOffset 22 | } 23 | 24 | companion object { 25 | val PAIRS: Array = arrayOf(BracePair(HaskellLexerTokens.OPAREN, HaskellLexerTokens.CPAREN, true), 26 | BracePair(HaskellLexerTokens.OCURLY, HaskellLexerTokens.CCURLY, true), 27 | BracePair(HaskellLexerTokens.OBRACK, HaskellLexerTokens.CBRACK, true)) 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/highlight/HaskellHighlighterFactory.java: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.highlight; 2 | 3 | import com.intellij.openapi.fileTypes.SingleLazyInstanceSyntaxHighlighterFactory; 4 | import org.jetbrains.annotations.NotNull; 5 | 6 | public class HaskellHighlighterFactory extends SingleLazyInstanceSyntaxHighlighterFactory { 7 | 8 | @NotNull 9 | protected HaskellHighlighter createHighlighter() { 10 | return new HaskellHighlighter(); 11 | } 12 | 13 | } -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/icons/HaskellIcons.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.icons 2 | 3 | import com.intellij.openapi.util.IconLoader 4 | 5 | import javax.swing.* 6 | 7 | /** 8 | * @author Evgeny.Kurbatsky 9 | */ 10 | object HaskellIcons { 11 | val HASKELL_BIG: Icon = IconLoader.getIcon("/org/jetbrains/haskell/icons/haskell24.png") 12 | val HASKELL: Icon = IconLoader.getIcon("/org/jetbrains/haskell/icons/haskell16.png") 13 | val DEFAULT: Icon = IconLoader.getIcon("/org/jetbrains/haskell/icons/haskell16.png") 14 | val APPLICATION: Icon = IconLoader.getIcon("/org/jetbrains/haskell/icons/application.png") 15 | @JvmField 16 | val CABAL: Icon = IconLoader.getIcon("/org/jetbrains/haskell/icons/cabal.png") 17 | val BIG: Icon = IconLoader.getIcon("/org/jetbrains/haskell/icons/haskell.png") 18 | val UPDATE: Icon = IconLoader.getIcon("/org/jetbrains/haskell/icons/update.png") 19 | @JvmField 20 | val REPL: Icon = IconLoader.getIcon("/org/jetbrains/haskell/icons/repl.png") 21 | @JvmField 22 | val HAMLET: Icon = IconLoader.getIcon("/org/jetbrains/haskell/icons/yesod16.png") 23 | } 24 | -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/module/HaskellModuleConfigEditor.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.module 2 | 3 | import com.intellij.openapi.module.JavaModuleType 4 | import com.intellij.openapi.module.Module 5 | import com.intellij.openapi.module.ModuleConfigurationEditor 6 | import com.intellij.openapi.module.ModuleType 7 | import com.intellij.openapi.roots.ModifiableRootModel 8 | import com.intellij.openapi.roots.ui.configuration.ClasspathEditor 9 | import com.intellij.openapi.roots.ui.configuration.ContentEntriesEditor 10 | import com.intellij.openapi.roots.ui.configuration.ModuleConfigurationEditorProvider 11 | import com.intellij.openapi.roots.ui.configuration.ModuleConfigurationState 12 | import java.util.ArrayList 13 | 14 | class HaskellModuleConfigEditor : ModuleConfigurationEditorProvider { 15 | 16 | override fun createEditors(state: ModuleConfigurationState?): Array { 17 | val module = state!!.rootModel!!.module 18 | 19 | return arrayOf(ContentEntriesEditor(module.name, state), 20 | //PackagesEditor(state, module.getProject()), 21 | OutputEditor(state)) 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/module/HaskellModuleType.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.module 2 | 3 | import com.intellij.openapi.module.Module 4 | import com.intellij.openapi.module.ModuleType 5 | import org.jetbrains.haskell.fileType.HaskellFileType 6 | import org.jetbrains.haskell.icons.HaskellIcons 7 | import javax.swing.* 8 | import com.intellij.ide.util.projectWizard.ModuleBuilder 9 | 10 | class HaskellModuleType : ModuleType("HASKELL_MODULE") { 11 | 12 | override fun createModuleBuilder(): HaskellModuleBuilder { 13 | return HaskellModuleBuilder() 14 | } 15 | 16 | override fun getName(): String { 17 | return "Haskell Module" 18 | } 19 | 20 | override fun getDescription(): String { 21 | return "Haskell Module" 22 | } 23 | 24 | override fun getBigIcon(): Icon { 25 | return HaskellIcons.DEFAULT 26 | } 27 | 28 | override fun getNodeIcon(isOpened: Boolean): Icon { 29 | return HaskellFileType.INSTANCE.icon 30 | } 31 | 32 | companion object { 33 | val INSTANCE: HaskellModuleType = HaskellModuleType() 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/module/OutputEditor.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.module 2 | 3 | import com.intellij.openapi.roots.ui.configuration.BuildElementsEditor 4 | import com.intellij.openapi.roots.ui.configuration.ModuleConfigurationState 5 | import com.intellij.openapi.roots.ui.configuration.ModuleElementsEditor 6 | import org.jetbrains.annotations.Nls 7 | import javax.swing.* 8 | 9 | class OutputEditor(state: ModuleConfigurationState) : ModuleElementsEditor(state) { 10 | private val myCompilerOutputEditor: BuildElementsEditor 11 | 12 | override fun createComponentImpl(): JComponent { 13 | return myCompilerOutputEditor.createComponentImpl()!! 14 | } 15 | 16 | override fun saveData(): Unit { 17 | myCompilerOutputEditor.saveData() 18 | } 19 | 20 | override fun getDisplayName(): String { 21 | return "Paths" 22 | } 23 | 24 | override fun getHelpTopic(): String { 25 | return myCompilerOutputEditor.helpTopic!! 26 | } 27 | 28 | init { 29 | myCompilerOutputEditor = object : BuildElementsEditor(state) { 30 | 31 | 32 | } 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/parser/HaskellCompositeElementType.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.parser 2 | 3 | import com.intellij.psi.tree.IElementType 4 | import org.jetbrains.haskell.HaskellLanguage 5 | import org.jetbrains.annotations.NonNls 6 | import com.intellij.psi.PsiElement 7 | import com.intellij.lang.ASTNode 8 | 9 | 10 | open class HaskellCompositeElementType( 11 | debugName: String, 12 | val constructor : ((ASTNode)->PsiElement)? = null) : 13 | IElementType(debugName, HaskellLanguage.INSTANCE) { 14 | 15 | private val myDebugName: String = debugName 16 | 17 | 18 | open fun getDebugName(): String { 19 | return myDebugName 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/parser/HaskellTokenType.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.parser 2 | 3 | import com.intellij.psi.tree.IElementType 4 | import org.jetbrains.haskell.HaskellLanguage 5 | import org.jetbrains.annotations.NonNls 6 | import com.intellij.lang.PsiBuilder 7 | 8 | class HaskellTokenType(debugName: String) : IElementType(debugName, HaskellLanguage.INSTANCE) { 9 | val myName: String = debugName 10 | 11 | } -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/parser/cpp/CPPTokens.java: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.parser.cpp; 2 | 3 | import org.jetbrains.haskell.parser.HaskellTokenType; 4 | 5 | public interface CPPTokens { 6 | HaskellTokenType IF = new HaskellTokenType("#if"); 7 | HaskellTokenType IFDEF = new HaskellTokenType("#ifdef"); 8 | HaskellTokenType ENDIF = new HaskellTokenType("#endif"); 9 | HaskellTokenType ELSE = new HaskellTokenType("#else"); 10 | } 11 | -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/parser/lexer/HaskellLexer.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.parser.lexer 2 | 3 | import com.intellij.lexer.FlexAdapter 4 | 5 | import java.io.Reader 6 | 7 | class HaskellLexer : FlexAdapter(_HaskellLexer(null as Reader?)) 8 | -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/psi/Application.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.psi 2 | 3 | import com.intellij.lang.ASTNode 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement 5 | import com.intellij.psi.util.PsiTreeUtil 6 | 7 | /** 8 | * Created by atsky on 11/21/14. 9 | */ 10 | class Application(node: ASTNode) : Expression(node) { 11 | 12 | fun getExpressions(): List { 13 | return PsiTreeUtil.getChildrenOfTypeAsList(this, Expression::class.java) 14 | } 15 | 16 | override fun traverse(visitor: (Expression) -> Unit) { 17 | for (e in getExpressions()) { 18 | e.traverse(visitor) 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/psi/ApplicationType.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.psi 2 | 3 | import com.intellij.lang.ASTNode 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement 5 | import com.intellij.psi.util.PsiTreeUtil 6 | 7 | /** 8 | * Created by atsky on 11/21/14. 9 | */ 10 | class ApplicationType(node : ASTNode) : HaskellType(node) { 11 | fun getChildrenTypes() : List = 12 | PsiTreeUtil.getChildrenOfTypeAsList(this, HaskellType::class.java) 13 | 14 | 15 | override fun getLeftTypeVariable() : TypeVariable? { 16 | return getChildrenTypes().firstOrNull()?.getLeftTypeVariable() 17 | } 18 | 19 | } -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/psi/BindStatement.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.psi 2 | 3 | import com.intellij.extapi.psi.ASTWrapperPsiElement 4 | import com.intellij.lang.ASTNode 5 | import com.intellij.psi.util.PsiTreeUtil 6 | 7 | /** 8 | * Created by atsky on 11/21/14. 9 | */ 10 | class BindStatement(node : ASTNode) : Statement(node) { 11 | 12 | fun getExpressions() : QNameExpression? { 13 | val expressions = PsiTreeUtil.getChildrenOfTypeAsList(this, QNameExpression::class.java) 14 | return if (expressions.isEmpty()) null else expressions[0] 15 | } 16 | 17 | fun getQVar() : QVar? = 18 | getExpressions()?.getQVar() 19 | } -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/psi/CaseAlternative.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.psi 2 | 3 | import com.intellij.lang.ASTNode 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement 5 | import com.intellij.psi.util.PsiTreeUtil 6 | 7 | /** 8 | * Created by atsky on 11/21/14. 9 | */ 10 | class CaseAlternative(node : ASTNode) : ASTWrapperPsiElement(node) { 11 | fun getExpressions(): List { 12 | return PsiTreeUtil.getChildrenOfTypeAsList(this, Expression::class.java) 13 | } 14 | } -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/psi/CaseExpression.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.psi 2 | 3 | import com.intellij.lang.ASTNode 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement 5 | import com.intellij.psi.PsiElement 6 | 7 | 8 | /** 9 | * Created by atsky on 10/04/14. 10 | */ 11 | class CaseExpression(node : ASTNode) : Expression(node) { 12 | override fun traverse(visitor: (Expression) -> Unit) { 13 | } 14 | } -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/psi/ClassDeclaration.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.psi 2 | 3 | import com.intellij.lang.ASTNode 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement 5 | import com.intellij.psi.util.PsiTreeUtil 6 | 7 | /** 8 | * Created by atsky on 23/04/14. 9 | */ 10 | class ClassDeclaration(node : ASTNode) : ASTWrapperPsiElement(node) { 11 | 12 | fun getType(): HaskellType? = 13 | findChildByClass(HaskellType::class.java) 14 | } -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/psi/ConstructorDeclaration.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.psi 2 | 3 | import com.intellij.lang.ASTNode 4 | import com.intellij.psi.util.PsiTreeUtil 5 | import com.intellij.psi.PsiNamedElement 6 | import com.intellij.psi.PsiElement 7 | 8 | /** 9 | * Created by atsky on 4/11/14. 10 | */ 11 | class ConstructorDeclaration(node : ASTNode) : Declaration(node), PsiNamedElement { 12 | 13 | override fun getName(): String? = getDeclarationName() 14 | 15 | override fun setName(name: String): PsiElement? { 16 | throw UnsupportedOperationException() 17 | } 18 | 19 | fun getTypeVariable() : TypeVariable? { 20 | return findChildByClass(HaskellType::class.java)?.getLeftTypeVariable() 21 | } 22 | 23 | override fun getDeclarationName(): String? { 24 | return getTypeVariable()?.text 25 | } 26 | 27 | } -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/psi/Context.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.psi 2 | 3 | import com.intellij.extapi.psi.ASTWrapperPsiElement 4 | import com.intellij.lang.ASTNode 5 | 6 | /** 7 | * Created by atsky on 13/02/15. 8 | */ 9 | class Context(node : ASTNode) : ASTWrapperPsiElement(node) -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/psi/DataDeclaration.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.psi 2 | 3 | import com.intellij.lang.ASTNode 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement 5 | import com.intellij.psi.util.PsiTreeUtil 6 | 7 | /** 8 | * Created by atsky on 4/11/14. 9 | */ 10 | class DataDeclaration(node : ASTNode) : Declaration(node) { 11 | 12 | override fun getDeclarationName(): String? { 13 | return getNameElement()?.getNameText() 14 | } 15 | 16 | fun getNameElement(): TypeVariable? = 17 | PsiTreeUtil.getChildrenOfTypeAsList(this, TypeVariable::class.java).firstOrNull() 18 | 19 | fun getConstructorDeclarationList() : List = 20 | PsiTreeUtil.getChildrenOfTypeAsList(this, ConstructorDeclaration::class.java) 21 | 22 | 23 | } -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/psi/Declaration.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.psi 2 | 3 | import com.intellij.extapi.psi.ASTWrapperPsiElement 4 | import com.intellij.lang.ASTNode 5 | 6 | 7 | abstract class Declaration(node : ASTNode) : ASTWrapperPsiElement(node) { 8 | 9 | abstract fun getDeclarationName() : String? 10 | 11 | } -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/psi/DoExpression.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.psi 2 | 3 | import com.intellij.lang.ASTNode 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement 5 | import com.intellij.psi.PsiElement 6 | import com.intellij.psi.util.PsiTreeUtil 7 | 8 | 9 | class DoExpression(node : ASTNode) : Expression(node) { 10 | override fun traverse(visitor: (Expression) -> Unit) { 11 | visitor(this) 12 | } 13 | 14 | fun getStatementList() : List = 15 | PsiTreeUtil.getChildrenOfTypeAsList(this, Statement::class.java) 16 | } -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/psi/Expression.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.psi 2 | 3 | import com.intellij.extapi.psi.ASTWrapperPsiElement 4 | import com.intellij.lang.ASTNode 5 | import com.intellij.psi.PsiElement 6 | import com.intellij.psi.PsiFile 7 | import org.jetbrains.haskell.scope.ModuleScope 8 | 9 | /** 10 | * Created by atsky on 4/25/14. 11 | */ 12 | abstract class Expression(node : ASTNode) : ASTWrapperPsiElement(node) { 13 | abstract fun traverse(visitor : (Expression) -> Unit) 14 | } 15 | -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/psi/ExpressionStatement.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.psi 2 | 3 | import com.intellij.extapi.psi.ASTWrapperPsiElement 4 | import com.intellij.lang.ASTNode 5 | /** 6 | * Created by atsky on 11/21/14. 7 | */ 8 | class ExpressionStatement(node : ASTNode) : Statement(node) -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/psi/FieldDeclaration.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.psi 2 | 3 | import com.intellij.lang.ASTNode 4 | 5 | /** 6 | * Created by atsky on 28/11/14. 7 | */ 8 | class FieldDeclaration(node : ASTNode) : Expression(node) { 9 | override fun traverse(visitor: (Expression) -> Unit) { 10 | visitor(this) 11 | } 12 | } -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/psi/FieldUpdate.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.psi 2 | 3 | import com.intellij.lang.ASTNode 4 | 5 | /** 6 | * Created by atsky on 28/11/14. 7 | */ 8 | class FieldUpdate(node : ASTNode) : Expression(node) { 9 | override fun traverse(visitor: (Expression) -> Unit) { 10 | visitor(this) 11 | } 12 | } -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/psi/ForeignDeclaration.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.psi 2 | 3 | import com.intellij.lang.ASTNode 4 | import com.intellij.psi.util.PsiTreeUtil 5 | 6 | /** 7 | * @author Evgeny.Kurbatsky 8 | * @since 10.09.15. 9 | */ 10 | class ForeignDeclaration(node : ASTNode) : Declaration(node) { 11 | 12 | override fun getDeclarationName(): String? { 13 | return getQVar()?.text 14 | } 15 | 16 | fun getQVar(): QVar? = 17 | findChildByClass(QVar::class.java) 18 | } -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/psi/FunctionType.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.psi 2 | 3 | import com.intellij.lang.ASTNode 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement 5 | import com.intellij.psi.PsiElement 6 | 7 | 8 | /** 9 | * Created by atsky on 10/04/14. 10 | */ 11 | class FunctionType(node : ASTNode) : ASTWrapperPsiElement(node) -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/psi/Guard.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.psi 2 | 3 | import com.intellij.lang.ASTNode 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement 5 | 6 | /** 7 | * Created by atsky on 11/21/14. 8 | */ 9 | class Guard(node : ASTNode) : ASTWrapperPsiElement(node) -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/psi/HaskellType.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.psi 2 | 3 | import com.intellij.lang.ASTNode 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement 5 | 6 | open class HaskellType(node : ASTNode) : ASTWrapperPsiElement(node) { 7 | open fun getLeftTypeVariable() : TypeVariable? { 8 | return null 9 | } 10 | } -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/psi/Import.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.psi 2 | 3 | import com.intellij.lang.ASTNode 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement 5 | import com.intellij.psi.tree.TokenSet 6 | import org.jetbrains.haskell.parser.token.* 7 | import org.jetbrains.grammar.HaskellLexerTokens 8 | 9 | 10 | class Import(node : ASTNode) : ASTWrapperPsiElement(node) { 11 | 12 | fun hasHiding() : Boolean { 13 | return node.getChildren(TokenSet.create(HaskellLexerTokens.HIDING)).size > 0 14 | } 15 | 16 | fun getModuleName() : ModuleName? = 17 | findChildByClass(ModuleName::class.java) 18 | 19 | 20 | fun getModuleExports() : ModuleExports? = 21 | findChildByClass(ModuleExports::class.java) 22 | 23 | fun getImportAsPart() : ImportAsPart? = 24 | findChildByClass(ImportAsPart::class.java) 25 | 26 | fun findModule() : Module? = getModuleName()?.findModuleFile()?.getModule() 27 | } -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/psi/ImportAsPart.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.psi 2 | 3 | import com.intellij.lang.ASTNode 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement 5 | 6 | /** 7 | * Created by atsky on 6/6/14. 8 | */ 9 | class ImportAsPart(node : ASTNode) : ASTWrapperPsiElement(node) -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/psi/InstanceDeclaration.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.psi 2 | 3 | import com.intellij.lang.ASTNode 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement 5 | 6 | 7 | open class InstanceDeclaration(node : ASTNode) : ASTWrapperPsiElement(node) -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/psi/LambdaExpression.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.psi 2 | 3 | import com.intellij.lang.ASTNode 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement 5 | import com.intellij.psi.util.PsiTreeUtil 6 | 7 | /** 8 | * Created by atsky on 28/11/14. 9 | */ 10 | class LambdaExpression(node: ASTNode) : Expression(node) { 11 | 12 | fun getPatterns(): List = 13 | PsiTreeUtil.getChildrenOfTypeAsList(this, Pattern::class.java) 14 | 15 | 16 | override fun traverse(visitor: (Expression) -> Unit) { 17 | visitor(this) 18 | } 19 | } -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/psi/LetExpression.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.psi 2 | 3 | import com.intellij.lang.ASTNode 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement 5 | 6 | /** 7 | * Created by atsky on 21/04/14. 8 | */ 9 | 10 | class LetExpression(node : ASTNode) : Expression(node) { 11 | override fun traverse(visitor: (Expression) -> Unit) { 12 | visitor(this) 13 | } 14 | } -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/psi/LetStatement.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.psi 2 | 3 | import com.intellij.lang.ASTNode 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement 5 | import com.intellij.psi.util.PsiTreeUtil 6 | 7 | /** 8 | * Created by atsky on 11/21/14. 9 | */ 10 | class LetStatement(node : ASTNode) : Statement(node) { 11 | 12 | fun getQVar() : QVar? = 13 | findChildByClass(QNameExpression::class.java)?.getQVar() 14 | 15 | fun getValueDefinitions() : List = 16 | PsiTreeUtil.getChildrenOfTypeAsList(this, ValueDefinition::class.java) 17 | } -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/psi/ListType.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.psi 2 | 3 | import com.intellij.lang.ASTNode 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement 5 | 6 | /** 7 | * Created by atsky on 12/2/14. 8 | */ 9 | class ListType(node : ASTNode) : HaskellType(node) -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/psi/ModuleExports.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.psi 2 | 3 | import com.intellij.lang.ASTNode 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement 5 | import com.intellij.psi.util.PsiTreeUtil 6 | 7 | /** 8 | * Created by atsky on 4/11/14. 9 | */ 10 | class ModuleExports(node: ASTNode) : ASTWrapperPsiElement(node) -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/psi/OperatorExpression.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.psi 2 | 3 | import com.intellij.lang.ASTNode 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement 5 | import com.intellij.psi.util.PsiTreeUtil 6 | 7 | /** 8 | * Created by atsky on 28/11/14. 9 | */ 10 | class OperatorExpression(node: ASTNode) : Expression(node) { 11 | 12 | fun getExpressions(): List { 13 | return PsiTreeUtil.getChildrenOfTypeAsList(this, Expression::class.java) 14 | } 15 | 16 | override fun traverse(visitor: (Expression) -> Unit) { 17 | for (e in getExpressions()) { 18 | e.traverse(visitor) 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/psi/ParenthesisExpression.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.psi 2 | 3 | import com.intellij.lang.ASTNode 4 | 5 | /** 6 | * Created by atsky on 11/21/14. 7 | */ 8 | class ParenthesisExpression(node : ASTNode) : Expression(node) { 9 | 10 | fun getExpression(): Expression? = 11 | findChildByClass(Expression::class.java) 12 | 13 | 14 | override fun traverse(visitor: (Expression) -> Unit) { 15 | getExpression()?.traverse(visitor) 16 | } 17 | } -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/psi/Pattern.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.psi 2 | 3 | import com.intellij.lang.ASTNode 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement 5 | import com.intellij.psi.PsiReference 6 | import org.jetbrains.haskell.psi.reference.ConstructorReference 7 | 8 | /** 9 | * Created by atsky on 28/11/14. 10 | */ 11 | class Pattern(node : ASTNode) : ASTWrapperPsiElement(node) { 12 | fun getExpression(): Expression? = 13 | findChildByClass(Expression::class.java) 14 | } -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/psi/QCon.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.psi 2 | 3 | import com.intellij.lang.ASTNode 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement 5 | import com.intellij.psi.PsiReference 6 | import org.jetbrains.haskell.psi.reference.SomeIdReference 7 | import org.jetbrains.haskell.psi.reference.ConstructorReference 8 | import com.intellij.psi.PsiNamedElement 9 | import com.intellij.psi.PsiElement 10 | 11 | /** 12 | * Created by atsky on 10/04/14. 13 | */ 14 | class QCon(node : ASTNode) : ASTWrapperPsiElement(node) { 15 | 16 | override fun getReference(): PsiReference? { 17 | return ConstructorReference(this) 18 | } 19 | } -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/psi/QNameExpression.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.psi 2 | 3 | import com.intellij.extapi.psi.ASTWrapperPsiElement 4 | import com.intellij.lang.ASTNode 5 | import com.intellij.psi.PsiReference 6 | import com.intellij.psi.PsiNamedElement 7 | import com.intellij.psi.PsiElement 8 | 9 | /** 10 | * Created by atsky on 11/21/14. 11 | */ 12 | 13 | class QNameExpression(node: ASTNode) : Expression(node) { 14 | override fun traverse(visitor: (Expression) -> Unit) { 15 | visitor(this) 16 | } 17 | 18 | fun getQVar(): QVar? = 19 | findChildByClass(QVar::class.java) 20 | 21 | 22 | fun getQCon(): QCon? = 23 | findChildByClass(QCon::class.java) 24 | 25 | 26 | override fun getReference(): PsiReference? { 27 | return null 28 | } 29 | } -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/psi/QVar.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.psi 2 | 3 | import com.intellij.lang.ASTNode 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement 5 | import com.intellij.psi.PsiNamedElement 6 | import com.intellij.psi.PsiElement 7 | import com.intellij.psi.PsiReference 8 | import org.jetbrains.haskell.psi.reference.ValueReference 9 | 10 | /** 11 | * Created by atsky on 11/18/14. 12 | */ 13 | class QVar(node : ASTNode) : ASTWrapperPsiElement(node), PsiNamedElement { 14 | 15 | override fun getName(): String? { 16 | return text 17 | } 18 | 19 | override fun setName(p0: String): PsiElement? { 20 | throw UnsupportedOperationException() 21 | } 22 | 23 | override fun getReference(): PsiReference? { 24 | return ValueReference(this) 25 | } 26 | } -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/psi/QVarSym.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.psi 2 | 3 | import com.intellij.lang.ASTNode 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement 5 | 6 | /** 7 | * Created by atsky on 12/3/14. 8 | */ 9 | class QVarSym(node : ASTNode) : ASTWrapperPsiElement(node) -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/psi/RightHandSide.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.psi 2 | 3 | import com.intellij.extapi.psi.ASTWrapperPsiElement 4 | import com.intellij.lang.ASTNode 5 | 6 | /** 7 | * Created by atsky on 11/21/14. 8 | */ 9 | class RightHandSide(node : ASTNode) : ASTWrapperPsiElement(node) { 10 | fun getWhereBindings() : WhereBindings? = 11 | findChildByClass(WhereBindings::class.java) 12 | 13 | fun getLetStatement() : LetStatement? = parent?.parent as? LetStatement 14 | 15 | } -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/psi/SignatureDeclaration.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.psi 2 | 3 | import com.intellij.extapi.psi.ASTWrapperPsiElement 4 | import com.intellij.lang.ASTNode 5 | import com.intellij.psi.util.PsiTreeUtil 6 | 7 | 8 | class SignatureDeclaration(node: ASTNode) : Declaration(node) { 9 | 10 | override fun getDeclarationName(): String? { 11 | return getQNameExpression()?.text 12 | } 13 | 14 | fun getValuesList(): List { 15 | val qVar = getQNameExpression()?.getQVar() 16 | if (qVar != null) { 17 | return listOf(qVar) 18 | } 19 | return PsiTreeUtil.getChildrenOfTypeAsList(this, QVar::class.java) 20 | } 21 | 22 | fun getQNameExpression(): QNameExpression? = 23 | findChildByClass(QNameExpression::class.java) 24 | 25 | 26 | } -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/psi/SomeId.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.psi 2 | 3 | import com.intellij.lang.ASTNode 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement 5 | import com.intellij.psi.PsiReference 6 | import org.jetbrains.haskell.psi.reference.SomeIdReference 7 | 8 | 9 | class SomeId(node: ASTNode) : ASTWrapperPsiElement(node) { 10 | 11 | override fun getReference(): PsiReference? { 12 | return SomeIdReference(this) 13 | } 14 | } -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/psi/Statement.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.psi 2 | 3 | import com.intellij.lang.ASTNode 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement 5 | 6 | /** 7 | * Created by atsky on 12/5/14. 8 | */ 9 | open class Statement(node: ASTNode) : ASTWrapperPsiElement(node) -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/psi/StringLiteral.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.psi 2 | 3 | import com.intellij.extapi.psi.ASTWrapperPsiElement 4 | import com.intellij.lang.ASTNode 5 | 6 | /** 7 | * Created by atsky on 20/11/14. 8 | */ 9 | class StringLiteral(node : ASTNode) : ASTWrapperPsiElement(node) -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/psi/TupleType.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.psi 2 | 3 | import com.intellij.lang.ASTNode 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement 5 | 6 | /** 7 | * Created by atsky on 12/2/14. 8 | */ 9 | class TupleType(node : ASTNode) : HaskellType(node) -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/psi/TypeSynonym.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.psi 2 | 3 | import com.intellij.lang.ASTNode 4 | import com.intellij.psi.util.PsiTreeUtil 5 | 6 | /** 7 | * Created by atsky on 11/21/14. 8 | */ 9 | class TypeSynonym(node : ASTNode) : Declaration(node) { 10 | 11 | override fun getDeclarationName(): String? { 12 | return getNameElement()?.getNameText() 13 | } 14 | 15 | fun getNameElement(): TypeVariable? = 16 | PsiTreeUtil.getChildrenOfTypeAsList(this, TypeVariable::class.java).firstOrNull() 17 | 18 | } -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/psi/UnguardedRHS.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.psi 2 | 3 | import com.intellij.lang.ASTNode 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement 5 | 6 | /** 7 | * Created by atsky on 05/12/14. 8 | */ 9 | class UnguardedRHS(node: ASTNode) : ASTWrapperPsiElement(node) -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/psi/UnparsedToken.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.psi 2 | 3 | import com.intellij.lang.ASTNode 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement 5 | import com.intellij.psi.PsiReference 6 | import org.jetbrains.haskell.psi.reference.SomeIdReference 7 | 8 | /** 9 | * Created by atsky on 4/25/14. 10 | */ 11 | class UnparsedToken(node: ASTNode) : ASTWrapperPsiElement(node) -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/psi/ValueDefinition.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.psi 2 | 3 | import com.intellij.extapi.psi.ASTWrapperPsiElement 4 | import com.intellij.lang.ASTNode 5 | import com.intellij.psi.util.PsiTreeUtil 6 | 7 | 8 | class ValueDefinition(node : ASTNode) : ASTWrapperPsiElement(node) { 9 | fun getQNameExpression(): QNameExpression? = 10 | findChildByClass(QNameExpression::class.java) 11 | 12 | fun getExpression(): Expression? = 13 | findChildByClass(Expression::class.java) 14 | } -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/psi/VariableOperation.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.psi 2 | 3 | import com.intellij.lang.ASTNode 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement 5 | 6 | /** 7 | * Created by atsky on 12/5/14. 8 | */ 9 | class VariableOperation(node : ASTNode) : ASTWrapperPsiElement(node) -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/psi/WhereBindings.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.psi 2 | 3 | import com.intellij.lang.ASTNode 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement 5 | import com.intellij.psi.util.PsiTreeUtil 6 | 7 | /** 8 | * Created by atsky on 11/21/14. 9 | */ 10 | class WhereBindings(node : ASTNode) : ASTWrapperPsiElement(node) { 11 | fun getSignatureDeclarationsList() : List { 12 | return PsiTreeUtil.getChildrenOfTypeAsList(this, SignatureDeclaration::class.java) 13 | } 14 | 15 | fun getValueDefinitionList() : List { 16 | return PsiTreeUtil.getChildrenOfTypeAsList(this, ValueDefinition::class.java) 17 | } 18 | } -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/psi/reference/ModuleReference.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.psi.reference 2 | 3 | import com.intellij.psi.PsiReferenceBase 4 | import org.jetbrains.haskell.psi.ModuleName 5 | import com.intellij.psi.PsiElement 6 | import com.intellij.openapi.module.ModuleUtilCore 7 | import com.intellij.util.indexing.FileBasedIndex 8 | import com.intellij.psi.search.FileTypeIndex 9 | import org.jetbrains.haskell.fileType.HaskellFileType 10 | import com.intellij.openapi.vfs.VirtualFile 11 | import com.intellij.openapi.util.TextRange 12 | import com.intellij.openapi.roots.OrderEnumerator 13 | import com.intellij.openapi.roots.ModuleRootManager 14 | import com.intellij.psi.PsiManager 15 | import com.intellij.psi.PsiFile 16 | 17 | /** 18 | * Created by atsky on 4/4/14. 19 | */ 20 | 21 | class ModuleReference(moduleName : ModuleName) : PsiReferenceBase( 22 | moduleName, 23 | TextRange(0, moduleName.textRange!!.length)) { 24 | 25 | override fun resolve(): PsiFile? { 26 | return element!!.findModuleFile() 27 | } 28 | 29 | override fun getVariants(): Array = arrayOf() 30 | } -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/psi/reference/ValueReference.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.psi.reference 2 | 3 | import org.jetbrains.haskell.psi.SomeId 4 | import com.intellij.psi.PsiReferenceBase 5 | import com.intellij.openapi.util.TextRange 6 | import com.intellij.psi.PsiElement 7 | import org.jetbrains.haskell.psi.Module 8 | import org.jetbrains.haskell.psi.QNameExpression 9 | import org.jetbrains.haskell.psi.QVar 10 | import org.jetbrains.haskell.scope.ExpressionScope 11 | import org.jetbrains.haskell.psi.Expression 12 | 13 | /** 14 | * Created by atsky on 4/25/14. 15 | */ 16 | class ValueReference(val referenceExpression: QVar) : PsiReferenceBase( 17 | referenceExpression, 18 | TextRange(0, referenceExpression.textRange!!.length)) { 19 | 20 | override fun resolve(): PsiElement? { 21 | val parent = referenceExpression.parent 22 | if (parent !is Expression) { 23 | return null 24 | } 25 | return ExpressionScope(parent).getVisibleVariables().firstOrNull { 26 | it.text == value 27 | } 28 | } 29 | 30 | 31 | override fun getVariants(): Array = arrayOf() 32 | 33 | } -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/psi/util/HaskellElementFactory.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.psi.util 2 | 3 | import com.intellij.openapi.project.Project 4 | import com.intellij.psi.PsiElement 5 | import com.intellij.psi.PsiFileFactory 6 | import com.intellij.psi.PsiWhiteSpace 7 | import org.jetbrains.haskell.HaskellLanguage 8 | import org.jetbrains.haskell.fileType.HaskellFile 9 | 10 | 11 | object HaskellElementFactory { 12 | 13 | fun createExpressionFromText(project: Project, name: String): PsiElement { 14 | val fileFromText = createFileFromText(project, name) 15 | val expression = fileFromText.firstChild.firstChild.firstChild 16 | return expression.firstChild 17 | } 18 | 19 | fun createFileFromText(project: Project, text: String): HaskellFile { 20 | return PsiFileFactory.getInstance(project).createFileFromText("tmp.hs", HaskellLanguage.INSTANCE, text) as HaskellFile 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/repl/HaskellConsole.java: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.repl; 2 | 3 | import com.intellij.execution.console.LanguageConsoleImpl; 4 | import com.intellij.execution.process.ProcessHandler; 5 | import com.intellij.openapi.actionSystem.AnAction; 6 | import com.intellij.openapi.project.Project; 7 | import com.intellij.openapi.util.text.StringUtil; 8 | import com.intellij.util.ui.UIUtil; 9 | import org.jetbrains.haskell.fileType.HaskellFileType; 10 | 11 | public final class HaskellConsole extends LanguageConsoleImpl { 12 | public HaskellConsole(Project project, 13 | String title) { 14 | super(project, title, HaskellFileType.INSTANCE.getLanguage()); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/repl/HaskellConsoleHighlightingUtil.java: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.repl; 2 | 3 | 4 | import java.util.regex.Pattern; 5 | 6 | final class HaskellConsoleHighlightingUtil { 7 | 8 | private static final String ID = "\\p{Lu}[\\p{Ll}\\p{Digit}]*"; 9 | private static final String MODULE = "\\*?" + ID + "(\\." + ID + ")*"; 10 | private static final String MODULES = "(" + MODULE + "\\s*)*"; 11 | private static final String PROMPT_ARROW = ">"; 12 | static final String LINE_WITH_PROMPT = MODULES + PROMPT_ARROW + ".*"; 13 | 14 | static final Pattern GHCI_PATTERN = Pattern.compile(MODULES + PROMPT_ARROW); 15 | 16 | } 17 | -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/run/ModuleComboBoxRenderer.java: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.run; 2 | 3 | import com.intellij.openapi.module.Module; 4 | import com.intellij.ui.ListCellRendererWrapper; 5 | 6 | import javax.swing.*; 7 | 8 | public final class ModuleComboBoxRenderer extends ListCellRendererWrapper { 9 | 10 | @Override 11 | public void customize(JList list, Module value, int index, boolean selected, boolean hasFocus) { 12 | if (value == null) { 13 | setText("null"); 14 | } else { 15 | setText(value.getName()); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/run/haskell/ConfigurationEditor.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.run.haskell 2 | 3 | import com.intellij.openapi.module.Module 4 | import com.intellij.openapi.options.SettingsEditor 5 | import javax.swing.* 6 | 7 | class ConfigurationEditor(modules: Array) : SettingsEditor() { 8 | 9 | private val programParams: ProgramParamsPanel 10 | 11 | override fun applyEditorTo(s: CabalRunConfiguration) { 12 | programParams.applyTo(s) 13 | } 14 | 15 | override fun resetEditorFrom(s: CabalRunConfiguration) { 16 | programParams.reset(s) 17 | } 18 | 19 | override fun createEditor(): JComponent { 20 | return programParams 21 | } 22 | 23 | override fun disposeEditor() { 24 | } 25 | 26 | init { 27 | programParams = ProgramParamsPanel(modules) 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/util/DefaultListModelWrapper.java: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.util; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | import javax.swing.*; 6 | import java.util.Arrays; 7 | import java.util.List; 8 | 9 | /** 10 | * Created by atsky on 27/08/15. 11 | */ 12 | public class DefaultListModelWrapper { 13 | private ListModel myModel; 14 | 15 | public DefaultListModelWrapper(ListModel model) { 16 | this.myModel = model; 17 | } 18 | 19 | 20 | public List getElements() { 21 | return Arrays.asList(((DefaultListModel) myModel).toArray()); 22 | } 23 | 24 | public void removeAllElements() { 25 | ((DefaultListModel) myModel).removeAllElements(); 26 | } 27 | 28 | public void addElement(@NotNull String packageName) { 29 | ((DefaultListModel) myModel).addElement(packageName); 30 | 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/util/GHCUtil.java: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.util; 2 | 3 | import com.intellij.openapi.module.Module; 4 | import com.intellij.openapi.roots.ModuleRootManager; 5 | import com.intellij.openapi.util.SystemInfo; 6 | import com.intellij.openapi.vfs.VirtualFile; 7 | import org.jetbrains.annotations.NotNull; 8 | import org.jetbrains.annotations.Nullable; 9 | 10 | import java.io.File; 11 | import java.util.ArrayList; 12 | import java.util.List; 13 | 14 | public final class GHCUtil { 15 | 16 | public static String getCommandPath(VirtualFile ghcHome, String executable) { 17 | if (ghcHome == null) 18 | return null; 19 | VirtualFile virBin = ghcHome.findChild("bin"); 20 | if (virBin == null) 21 | return null; 22 | return new File(virBin.getPath(), executable).getAbsolutePath(); 23 | } 24 | 25 | 26 | 27 | } 28 | -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/util/JComboBoxWrapper.java: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.util; 2 | 3 | import com.intellij.openapi.module.Module; 4 | import org.jetbrains.annotations.NotNull; 5 | import org.jetbrains.haskell.run.ModuleComboBoxRenderer; 6 | 7 | import javax.swing.*; 8 | import java.awt.*; 9 | 10 | /** 11 | * Created by atsky on 27/08/15. 12 | */ 13 | public class JComboBoxWrapper { 14 | private JComboBox myComboBox; 15 | 16 | public JComboBoxWrapper(@NotNull JComboBox comboBox) { 17 | myComboBox = comboBox; 18 | } 19 | 20 | @NotNull 21 | public Object getSelectedItem() { 22 | return myComboBox.getSelectedItem(); 23 | } 24 | 25 | public void setSelectedItem(Object item) { 26 | myComboBox.setSelectedItem(item); 27 | } 28 | 29 | public void setRenderer(@NotNull ModuleComboBoxRenderer moduleComboBoxRenderer) { 30 | myComboBox.setRenderer(moduleComboBoxRenderer); 31 | } 32 | 33 | @NotNull 34 | public Component get() { 35 | return myComboBox; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/util/UiUtil.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.util 2 | 3 | import java.awt.GridBagConstraints 4 | 5 | /** 6 | * @author Evgeny.Kurbatsky 7 | */ 8 | inline fun gridBagConstraints(init : GridBagConstraints.() -> Unit) : GridBagConstraints { 9 | val result = GridBagConstraints() 10 | result.init() 11 | return result 12 | } 13 | 14 | inline fun GridBagConstraints.setConstraints(init : GridBagConstraints.() -> Unit) : GridBagConstraints { 15 | this.init() 16 | return this 17 | } -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/haskell/vfs/TarGzArchive.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.vfs 2 | 3 | import java.io.File 4 | import java.io.BufferedInputStream 5 | import java.io.InputStream 6 | import org.apache.commons.compress.compressors.gzip.GzipCompressorInputStream 7 | import org.apache.commons.compress.archivers.tar.TarArchiveInputStream 8 | import java.io.FileInputStream 9 | import java.util.ArrayList 10 | 11 | /** 12 | * Created by atsky on 12/12/14. 13 | */ 14 | class TarGzArchive(val file : File) { 15 | val filesList : List 16 | 17 | init { 18 | val bin = BufferedInputStream(FileInputStream(file)) 19 | val gzIn = GzipCompressorInputStream(bin) 20 | 21 | 22 | val tarArchiveInputStream = TarArchiveInputStream(gzIn) 23 | 24 | var file = ArrayList() 25 | 26 | while (true) { 27 | val entry = tarArchiveInputStream.nextTarEntry 28 | 29 | if (entry == null) { 30 | break 31 | } 32 | 33 | file.add(entry.name) 34 | } 35 | filesList = file 36 | bin.close() 37 | } 38 | } -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/yesod/cassius/CassiusFile.java: -------------------------------------------------------------------------------- 1 | package org.jetbrains.yesod.cassius; 2 | 3 | /** 4 | * @author Leyla H 5 | */ 6 | 7 | import com.intellij.extapi.psi.PsiFileBase; 8 | import com.intellij.lang.Language; 9 | import com.intellij.openapi.fileTypes.FileType; 10 | import com.intellij.psi.FileViewProvider; 11 | import org.jetbrains.annotations.NotNull; 12 | import org.jetbrains.yesod.cassius.CassiusFileType; 13 | import org.jetbrains.yesod.cassius.CassiusLanguage; 14 | 15 | public class CassiusFile extends PsiFileBase{ 16 | public CassiusFile(@NotNull FileViewProvider viewProvider) { 17 | super(viewProvider, CassiusLanguage.INSTANCE); 18 | } 19 | 20 | @NotNull 21 | @Override 22 | public FileType getFileType() { 23 | return CassiusFileType.INSTANCE; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/yesod/cassius/CassiusLanguage.java: -------------------------------------------------------------------------------- 1 | package org.jetbrains.yesod.cassius; 2 | 3 | /** 4 | * @author Leyla H 5 | */ 6 | 7 | import com.intellij.lang.Language; 8 | 9 | public class CassiusLanguage extends Language { 10 | public static final CassiusLanguage INSTANCE = new CassiusLanguage(); 11 | 12 | public CassiusLanguage() { 13 | super("Cassius", "text/cassius"); 14 | } 15 | } -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/yesod/cassius/parser/Cassius.flex: -------------------------------------------------------------------------------- 1 | package org.jetbrains.yesod.cassius.parser; 2 | 3 | /** 4 | * @author Leyla H 5 | */ 6 | 7 | import java.util.*; 8 | import com.intellij.lexer.*; 9 | import com.intellij.psi.*; 10 | import org.jetbrains.haskell.parser.token.*; 11 | import com.intellij.psi.tree.IElementType; 12 | 13 | %% 14 | 15 | 16 | %unicode 17 | %class _CassiusLexer 18 | %implements FlexLexer 19 | 20 | %{ 21 | 22 | %} 23 | 24 | 25 | %function advance 26 | %type IElementType 27 | 28 | 29 | DIGIT = [0-9] 30 | WHITE_SPACE_CHAR = [\ \f\t] 31 | EOL_COMMENT = {INDENT}"--"[^\n]* 32 | 33 | 34 | %% 35 | 36 | 37 | ({WHITE_SPACE_CHAR})+ { return TokenType.WHITE_SPACE; } 38 | "\n" { return CassiusTokenTypes.NEWLINE; } 39 | "." { return CassiusTokenTypes.DOT; } 40 | [A-Za-z0-9_-]+ { return CassiusTokenTypes.IDENTIFIER; } 41 | 42 | -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/yesod/cassius/parser/CassiusCompositeElementType.java: -------------------------------------------------------------------------------- 1 | package org.jetbrains.yesod.cassius.parser; 2 | 3 | import com.intellij.psi.tree.IElementType; 4 | import org.jetbrains.annotations.NonNls; 5 | import org.jetbrains.annotations.NotNull; 6 | import org.jetbrains.yesod.cassius.CassiusLanguage; 7 | 8 | /** 9 | * @author Leyla H 10 | */ 11 | 12 | public class CassiusCompositeElementType extends IElementType { 13 | 14 | String myDebugName; 15 | 16 | public CassiusCompositeElementType(@NotNull @NonNls String debugName) { 17 | super(debugName, CassiusLanguage.INSTANCE); 18 | } 19 | 20 | public String getDebugName() { 21 | return myDebugName; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/yesod/cassius/parser/CassiusLexer.java: -------------------------------------------------------------------------------- 1 | package org.jetbrains.yesod.cassius.parser; 2 | 3 | /** 4 | * @author Leyla H 5 | */ 6 | 7 | import com.intellij.lexer.FlexAdapter; 8 | 9 | import java.io.Reader; 10 | 11 | public class CassiusLexer extends FlexAdapter { 12 | public CassiusLexer() { 13 | super(new _CassiusLexer((Reader)null)); 14 | } 15 | 16 | } -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/yesod/cassius/parser/CassiusParser.java: -------------------------------------------------------------------------------- 1 | package org.jetbrains.yesod.cassius.parser; 2 | 3 | /** 4 | * @author Leyla H 5 | */ 6 | 7 | import com.intellij.lang.PsiParser; 8 | import com.intellij.psi.tree.IElementType; 9 | import com.intellij.lang.PsiBuilder; 10 | import com.intellij.lang.PsiBuilder.Marker; 11 | import com.intellij.lang.ASTNode; 12 | import org.jetbrains.annotations.NotNull; 13 | 14 | 15 | public class CassiusParser implements PsiParser { 16 | @NotNull 17 | @Override 18 | public ASTNode parse(IElementType root, PsiBuilder psiBuilder) { 19 | Marker rootmMarker = psiBuilder.mark(); 20 | parseText(psiBuilder); 21 | rootmMarker.done(root); 22 | return psiBuilder.getTreeBuilt(); 23 | } 24 | 25 | public void parseText(PsiBuilder psiBuilder) { 26 | while (!psiBuilder.eof()) { 27 | IElementType token = psiBuilder.getTokenType(); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/yesod/cassius/parser/CassiusToken.java: -------------------------------------------------------------------------------- 1 | package org.jetbrains.yesod.cassius.parser; 2 | 3 | /** 4 | * @author Leyla H 5 | */ 6 | 7 | import com.intellij.psi.tree.IElementType; 8 | import org.jetbrains.annotations.NonNls; 9 | import org.jetbrains.annotations.NotNull; 10 | 11 | import org.jetbrains.yesod.cassius.CassiusLanguage; 12 | 13 | 14 | public class CassiusToken extends IElementType { 15 | 16 | public CassiusToken(@NotNull @NonNls String debugName) { 17 | super(debugName, CassiusLanguage.INSTANCE); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/yesod/cassius/parser/CassiusTokenTypes.java: -------------------------------------------------------------------------------- 1 | package org.jetbrains.yesod.cassius.parser; 2 | 3 | /** 4 | * @author Leyla H 5 | */ 6 | 7 | import com.intellij.psi.TokenType; 8 | import com.intellij.psi.tree.IElementType; 9 | import com.intellij.psi.tree.TokenSet; 10 | 11 | public interface CassiusTokenTypes { 12 | 13 | IElementType DOT = new CassiusToken("."); 14 | IElementType IDENTIFIER = new CassiusToken("identifier"); 15 | IElementType NEWLINE = new CassiusToken("newline"); 16 | 17 | TokenSet WHITESPACES = TokenSet.create(TokenType.WHITE_SPACE); 18 | } 19 | -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/yesod/hamlet/HamletFile.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.yesod.hamlet 2 | 3 | /** 4 | * @author Leyla H 5 | */ 6 | 7 | import com.intellij.extapi.psi.PsiFileBase 8 | import com.intellij.lang.Language 9 | import com.intellij.openapi.fileTypes.FileType 10 | import com.intellij.psi.FileViewProvider 11 | 12 | class HamletFile(viewProvider: FileViewProvider) : PsiFileBase(viewProvider, HamletLanguage.INSTANCE) { 13 | 14 | override fun getFileType(): FileType { 15 | return HamletFileType.INSTANCE 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/yesod/hamlet/HamletLanguage.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.yesod.hamlet 2 | 3 | /** 4 | * @author Leyla H 5 | */ 6 | 7 | import com.intellij.lang.Language 8 | 9 | class HamletLanguage : Language("Hamlet", "text/hamlet") { 10 | companion object { 11 | val INSTANCE: HamletLanguage = HamletLanguage() 12 | } 13 | } -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/yesod/hamlet/highlight/HamletColors.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.yesod.hamlet.highlight 2 | 3 | /** 4 | * @author Leyla H 5 | */ 6 | 7 | import com.intellij.openapi.editor.colors.TextAttributesKey 8 | 9 | interface HamletColors { 10 | companion object { 11 | val OPERATOR: TextAttributesKey = TextAttributesKey.createTextAttributesKey("HAMLET_OPERATOR") 12 | val COMMENT: TextAttributesKey = TextAttributesKey.createTextAttributesKey("HAMLET_COMMENT") 13 | val ATTRIBUTE: TextAttributesKey = TextAttributesKey.createTextAttributesKey("HAMLET_ATTRIBUTE") 14 | val ATTRIBUTE_VALUE: TextAttributesKey = TextAttributesKey.createTextAttributesKey("HAMLET_ATTRIBUTE_VALUE") 15 | val STRING: TextAttributesKey = TextAttributesKey.createTextAttributesKey("HAMLET_STRING") 16 | val IDENTIFIER: TextAttributesKey = TextAttributesKey.createTextAttributesKey("HAMLET_IDENTIFIER") 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/yesod/hamlet/parser/HamletCompositeElementType.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.yesod.hamlet.parser 2 | 3 | /** 4 | * @author Leyla H 5 | */ 6 | 7 | import com.intellij.psi.tree.IElementType 8 | import org.jetbrains.annotations.NonNls 9 | import org.jetbrains.yesod.hamlet.HamletLanguage 10 | 11 | 12 | class HamletCompositeElementType(val debugName: String) : 13 | IElementType(debugName, HamletLanguage.INSTANCE) 14 | 15 | -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/yesod/hamlet/parser/HamletLexer.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.yesod.hamlet.parser 2 | 3 | /** 4 | * @author Leyla H 5 | */ 6 | 7 | import com.intellij.lexer.FlexAdapter 8 | import java.io.Reader 9 | 10 | class HamletLexer : FlexAdapter(_HamletLexer(null as Reader?)) -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/yesod/hamlet/parser/HamletToken.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.yesod.hamlet.parser 2 | 3 | /** 4 | * @author Leyla H 5 | */ 6 | 7 | import com.intellij.psi.tree.IElementType 8 | 9 | import org.jetbrains.yesod.hamlet.HamletLanguage 10 | 11 | 12 | class HamletToken(debugName: String) : IElementType(debugName, HamletLanguage.INSTANCE) 13 | -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/yesod/hamlet/psi/Attribute.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.yesod.hamlet.psi 2 | 3 | /** 4 | * @author Leyla H 5 | */ 6 | 7 | import com.intellij.extapi.psi.ASTWrapperPsiElement 8 | import com.intellij.lang.ASTNode 9 | 10 | class Attribute(node: ASTNode) : ASTWrapperPsiElement(node) -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/yesod/hamlet/psi/AttributeValue.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.yesod.hamlet.psi 2 | 3 | /** 4 | * @author Leyla H 5 | */ 6 | 7 | import com.intellij.extapi.psi.ASTWrapperPsiElement 8 | import com.intellij.lang.ASTNode 9 | 10 | class AttributeValue(node: ASTNode) : ASTWrapperPsiElement(node) -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/yesod/hamlet/psi/ColonIdentifier.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.yesod.hamlet.psi 2 | 3 | /** 4 | * @author Leyla H 5 | */ 6 | 7 | import com.intellij.extapi.psi.ASTWrapperPsiElement 8 | import com.intellij.lang.ASTNode 9 | 10 | class ColonIdentifier(node: ASTNode) : ASTWrapperPsiElement(node) -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/yesod/hamlet/psi/Comment.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.yesod.hamlet.psi 2 | 3 | /** 4 | * @author Leyla H 5 | */ 6 | 7 | import com.intellij.extapi.psi.ASTWrapperPsiElement 8 | import com.intellij.lang.ASTNode 9 | 10 | class Comment(node: ASTNode) : ASTWrapperPsiElement(node) -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/yesod/hamlet/psi/Doctype.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.yesod.hamlet.psi 2 | 3 | /** 4 | * @author Leyla H 5 | */ 6 | 7 | import com.intellij.extapi.psi.ASTWrapperPsiElement 8 | import com.intellij.lang.ASTNode 9 | 10 | class Doctype(node: ASTNode) : ASTWrapperPsiElement(node) -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/yesod/hamlet/psi/DotIdentifier.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.yesod.hamlet.psi 2 | 3 | /** 4 | * @author Leyla H 5 | */ 6 | 7 | import com.intellij.extapi.psi.ASTWrapperPsiElement 8 | import com.intellij.lang.ASTNode 9 | 10 | class DotIdentifier(node: ASTNode) : ASTWrapperPsiElement(node) 11 | -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/yesod/hamlet/psi/Escape.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.yesod.hamlet.psi 2 | 3 | /** 4 | * @author Leyla H 5 | */ 6 | 7 | import com.intellij.extapi.psi.ASTWrapperPsiElement 8 | import com.intellij.lang.ASTNode 9 | 10 | class Escape(node: ASTNode) : ASTWrapperPsiElement(node) -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/yesod/hamlet/psi/Identifier.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.yesod.hamlet.psi 2 | 3 | /** 4 | * @author Leyla H 5 | */ 6 | 7 | import com.intellij.extapi.psi.ASTWrapperPsiElement 8 | import com.intellij.lang.ASTNode 9 | 10 | class Identifier(node: ASTNode) : ASTWrapperPsiElement(node) 11 | -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/yesod/hamlet/psi/Interpolation.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.yesod.hamlet.psi 2 | 3 | /** 4 | * @author Leyla H 5 | */ 6 | 7 | import com.intellij.extapi.psi.ASTWrapperPsiElement 8 | import com.intellij.lang.ASTNode 9 | 10 | class Interpolation(node: ASTNode) : ASTWrapperPsiElement(node) -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/yesod/hamlet/psi/Operator.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.yesod.hamlet.psi 2 | 3 | /** 4 | * @author Leyla H 5 | */ 6 | 7 | import com.intellij.extapi.psi.ASTWrapperPsiElement 8 | import com.intellij.lang.ASTNode 9 | 10 | class Operator(node: ASTNode) : ASTWrapperPsiElement(node) -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/yesod/hamlet/psi/SharpIdentifier.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.yesod.hamlet.psi 2 | 3 | /** 4 | * @author Leyla H 5 | */ 6 | 7 | import com.intellij.extapi.psi.ASTWrapperPsiElement 8 | import com.intellij.lang.ASTNode 9 | 10 | class SharpIdentifier(node: ASTNode) : ASTWrapperPsiElement(node) -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/yesod/hamlet/psi/String.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.yesod.hamlet.psi 2 | 3 | /** 4 | * @author Leyla H 5 | */ 6 | 7 | import com.intellij.extapi.psi.ASTWrapperPsiElement 8 | import com.intellij.lang.ASTNode 9 | 10 | class String(node: ASTNode) : ASTWrapperPsiElement(node) 11 | -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/yesod/hamlet/psi/Tag.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.yesod.hamlet.psi 2 | 3 | /** 4 | * @author Leyla H 5 | */ 6 | 7 | import com.intellij.extapi.psi.ASTWrapperPsiElement 8 | import com.intellij.lang.ASTNode 9 | 10 | class Tag(node: ASTNode) : ASTWrapperPsiElement(node) 11 | -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/yesod/julius/JuliusFile.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.yesod.julius 2 | 3 | /** 4 | * @author Leyla H 5 | */ 6 | 7 | import com.intellij.extapi.psi.PsiFileBase 8 | import com.intellij.lang.Language 9 | import com.intellij.openapi.fileTypes.FileType 10 | import com.intellij.psi.FileViewProvider 11 | 12 | class JuliusFile(viewProvider: FileViewProvider) : PsiFileBase(viewProvider, JuliusLanguage.INSTANCE) { 13 | 14 | override fun getFileType(): FileType { 15 | return JuliusFileType.INSTANCE 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/yesod/julius/JuliusLanguage.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.yesod.julius 2 | 3 | /** 4 | * @author Leyla H 5 | */ 6 | 7 | import com.intellij.lang.Language 8 | 9 | class JuliusLanguage : Language("Julius", "text/julius") { 10 | companion object { 11 | val INSTANCE: JuliusLanguage = JuliusLanguage() 12 | } 13 | } -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/yesod/julius/highlight/JuliusColors.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.yesod.julius.highlight 2 | 3 | /** 4 | * @author Leyla H 5 | */ 6 | 7 | import com.intellij.openapi.editor.colors.TextAttributesKey 8 | 9 | interface JuliusColors { 10 | companion object { 11 | val COMMENT: TextAttributesKey = TextAttributesKey.createTextAttributesKey("JULIUS_COMMENT") 12 | val STRING: TextAttributesKey = TextAttributesKey.createTextAttributesKey("JULIUS_STRING") 13 | val DOT_IDENTIFIER: TextAttributesKey = TextAttributesKey.createTextAttributesKey("JULIUS_DOTIDENTIFIER") 14 | val NUMBER: TextAttributesKey = TextAttributesKey.createTextAttributesKey("JULIUS_NUMBER") 15 | val INTERPOLATION: TextAttributesKey = TextAttributesKey.createTextAttributesKey("JULIUS_INTERPOLATION") 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/yesod/julius/parser/JuliusCompositeElementType.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.yesod.julius.parser 2 | 3 | /** 4 | * @author Leyla H 5 | */ 6 | 7 | import com.intellij.psi.tree.IElementType 8 | import org.jetbrains.annotations.NonNls 9 | import org.jetbrains.yesod.julius.JuliusLanguage 10 | 11 | 12 | class JuliusCompositeElementType(val debugName: String) : 13 | IElementType(debugName, JuliusLanguage.INSTANCE) -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/yesod/julius/parser/JuliusLexer.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.yesod.julius.parser 2 | 3 | /** 4 | * @author Leyla H 5 | */ 6 | 7 | import com.intellij.lexer.FlexAdapter 8 | import java.io.Reader 9 | 10 | class JuliusLexer : FlexAdapter(_JuliusLexer(null as Reader?)) 11 | -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/yesod/julius/parser/JuliusToken.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.yesod.julius.parser 2 | 3 | /** 4 | * @author Leyla H 5 | */ 6 | 7 | import com.intellij.psi.tree.IElementType 8 | import org.jetbrains.annotations.NonNls 9 | 10 | import org.jetbrains.yesod.julius.JuliusLanguage 11 | 12 | 13 | class JuliusToken(debugName: String) : IElementType(debugName, JuliusLanguage.INSTANCE) 14 | -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/yesod/julius/psi/Comment.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.yesod.julius.psi 2 | 3 | /** 4 | * @author Leyla H 5 | */ 6 | 7 | import com.intellij.extapi.psi.ASTWrapperPsiElement 8 | import com.intellij.lang.ASTNode 9 | 10 | class Comment(node: ASTNode) : ASTWrapperPsiElement(node) -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/yesod/julius/psi/DotIdentifier.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.yesod.julius.psi 2 | 3 | /** 4 | * @author Leyla H 5 | */ 6 | 7 | import com.intellij.extapi.psi.ASTWrapperPsiElement 8 | import com.intellij.lang.ASTNode 9 | 10 | class DotIdentifier(node: ASTNode) : ASTWrapperPsiElement(node) -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/yesod/julius/psi/Interpolation.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.yesod.julius.psi 2 | 3 | /** 4 | * @author Leyla H 5 | */ 6 | 7 | import com.intellij.extapi.psi.ASTWrapperPsiElement 8 | import com.intellij.lang.ASTNode 9 | 10 | class Interpolation(node: ASTNode) : ASTWrapperPsiElement(node) -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/yesod/julius/psi/Keyword.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.yesod.julius.psi 2 | 3 | /** 4 | * @author Leyla H 5 | */ 6 | 7 | import com.intellij.extapi.psi.ASTWrapperPsiElement 8 | import com.intellij.lang.ASTNode 9 | 10 | class Keyword(node: ASTNode) : ASTWrapperPsiElement(node) -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/yesod/julius/psi/Number.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.yesod.julius.psi 2 | 3 | /** 4 | * @author Leyla H 5 | */ 6 | 7 | import com.intellij.extapi.psi.ASTWrapperPsiElement 8 | import com.intellij.lang.ASTNode 9 | 10 | class Number(node: ASTNode) : ASTWrapperPsiElement(node) -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/yesod/julius/psi/String.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.yesod.julius.psi 2 | 3 | /** 4 | * @author Leyla H 5 | */ 6 | 7 | import com.intellij.extapi.psi.ASTWrapperPsiElement 8 | import com.intellij.lang.ASTNode 9 | 10 | class String(node: ASTNode) : ASTWrapperPsiElement(node) -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/yesod/lucius/LuciusFile.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.yesod.lucius 2 | 3 | /** 4 | * @author Leyla H 5 | */ 6 | 7 | import com.intellij.extapi.psi.PsiFileBase 8 | import com.intellij.lang.Language 9 | import com.intellij.openapi.fileTypes.FileType 10 | import com.intellij.psi.FileViewProvider 11 | import org.jetbrains.yesod.lucius.LuciusFileType 12 | import org.jetbrains.yesod.lucius.LuciusLanguage 13 | 14 | class LuciusFile(viewProvider: FileViewProvider) : PsiFileBase(viewProvider, LuciusLanguage.INSTANCE) { 15 | 16 | override fun getFileType(): FileType { 17 | return LuciusFileType.INSTANCE 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/yesod/lucius/LuciusLanguage.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.yesod.lucius 2 | 3 | /** 4 | * @author Leyla H 5 | */ 6 | 7 | import com.intellij.lang.Language 8 | 9 | class LuciusLanguage : Language("Lucius", "text/lucius") { 10 | companion object { 11 | val INSTANCE: LuciusLanguage = LuciusLanguage() 12 | } 13 | } -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/yesod/lucius/parser/LuciusCompositeElementType.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.yesod.lucius.parser 2 | 3 | /** 4 | * @author Leyla H 5 | */ 6 | 7 | import com.intellij.psi.tree.IElementType 8 | import org.jetbrains.annotations.NonNls 9 | import org.jetbrains.yesod.lucius.LuciusLanguage 10 | 11 | 12 | class LuciusCompositeElementType(val debugName: String) : 13 | IElementType(debugName, LuciusLanguage.INSTANCE) -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/yesod/lucius/parser/LuciusLexer.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.yesod.lucius.parser 2 | 3 | /** 4 | * @author Leyla H 5 | */ 6 | 7 | import com.intellij.lexer.FlexAdapter 8 | 9 | import java.io.Reader 10 | 11 | class LuciusLexer : FlexAdapter(_LuciusLexer(null as Reader?)) -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/yesod/lucius/parser/LuciusToken.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.yesod.lucius.parser 2 | 3 | /** 4 | * @author Leyla H 5 | */ 6 | 7 | import com.intellij.psi.tree.IElementType 8 | import org.jetbrains.annotations.NonNls 9 | 10 | import org.jetbrains.yesod.lucius.LuciusLanguage 11 | 12 | 13 | class LuciusToken(debugName: String) : IElementType(debugName, LuciusLanguage.INSTANCE) 14 | -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/yesod/lucius/psi/AtRule.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.yesod.lucius.psi 2 | 3 | /** 4 | * @author Leyla H 5 | */ 6 | 7 | import com.intellij.extapi.psi.ASTWrapperPsiElement 8 | import com.intellij.lang.ASTNode 9 | 10 | class AtRule(node: ASTNode) : ASTWrapperPsiElement(node) -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/yesod/lucius/psi/Attribute.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.yesod.lucius.psi 2 | 3 | /** 4 | * @author Leyla H 5 | */ 6 | 7 | import com.intellij.extapi.psi.ASTWrapperPsiElement 8 | import com.intellij.lang.ASTNode 9 | 10 | class Attribute(node: ASTNode) : ASTWrapperPsiElement(node) -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/yesod/lucius/psi/CCIdentifier.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.yesod.lucius.psi 2 | 3 | /** 4 | * @author Leyla H 5 | */ 6 | 7 | import com.intellij.extapi.psi.ASTWrapperPsiElement 8 | import com.intellij.lang.ASTNode 9 | 10 | class CCIdentifier(node: ASTNode) : ASTWrapperPsiElement(node) -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/yesod/lucius/psi/ColonIdentifier.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.yesod.lucius.psi 2 | 3 | /** 4 | * @author Leyla H 5 | */ 6 | 7 | import com.intellij.extapi.psi.ASTWrapperPsiElement 8 | import com.intellij.lang.ASTNode 9 | 10 | class ColonIdentifier(node: ASTNode) : ASTWrapperPsiElement(node) -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/yesod/lucius/psi/Comment.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.yesod.lucius.psi 2 | 3 | /** 4 | * @author Leyla H 5 | */ 6 | 7 | import com.intellij.extapi.psi.ASTWrapperPsiElement 8 | import com.intellij.lang.ASTNode 9 | 10 | class Comment(node: ASTNode) : ASTWrapperPsiElement(node) 11 | -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/yesod/lucius/psi/DotIdentifier.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.yesod.lucius.psi 2 | 3 | /** 4 | * @author Leyla H 5 | */ 6 | 7 | import com.intellij.extapi.psi.ASTWrapperPsiElement 8 | import com.intellij.lang.ASTNode 9 | 10 | class DotIdentifier(node: ASTNode) : ASTWrapperPsiElement(node) -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/yesod/lucius/psi/Function.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.yesod.lucius.psi 2 | 3 | /** 4 | * @author Leyla H 5 | */ 6 | 7 | import com.intellij.extapi.psi.ASTWrapperPsiElement 8 | import com.intellij.lang.ASTNode 9 | 10 | class Function(node: ASTNode) : ASTWrapperPsiElement(node) -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/yesod/lucius/psi/Hyperlink.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.yesod.lucius.psi 2 | 3 | /** 4 | * @author Leyla H 5 | */ 6 | 7 | import com.intellij.extapi.psi.ASTWrapperPsiElement 8 | import com.intellij.lang.ASTNode 9 | 10 | class Hyperlink(node: ASTNode) : ASTWrapperPsiElement(node) -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/yesod/lucius/psi/Interpolation.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.yesod.lucius.psi 2 | 3 | /** 4 | * @author Leyla H 5 | */ 6 | 7 | import com.intellij.extapi.psi.ASTWrapperPsiElement 8 | import com.intellij.lang.ASTNode 9 | 10 | class Interpolation(node: ASTNode) : ASTWrapperPsiElement(node) -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/yesod/lucius/psi/Number.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.yesod.lucius.psi 2 | 3 | /** 4 | * @author Leyla H 5 | */ 6 | 7 | import com.intellij.extapi.psi.ASTWrapperPsiElement 8 | import com.intellij.lang.ASTNode 9 | 10 | class Number(node: ASTNode) : ASTWrapperPsiElement(node) -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/yesod/lucius/psi/SharpIdentifier.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.yesod.lucius.psi 2 | 3 | /** 4 | * @author Leyla H 5 | */ 6 | 7 | import com.intellij.extapi.psi.ASTWrapperPsiElement 8 | import com.intellij.lang.ASTNode 9 | 10 | class SharpIdentifier(node: ASTNode) : ASTWrapperPsiElement(node) -------------------------------------------------------------------------------- /plugin/src/org/jetbrains/yesod/lucius/psi/String.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.yesod.lucius.psi 2 | 3 | /** 4 | * @author Leyla H 5 | */ 6 | 7 | import com.intellij.extapi.psi.ASTWrapperPsiElement 8 | import com.intellij.lang.ASTNode 9 | 10 | class String(node: ASTNode) : ASTWrapperPsiElement(node) -------------------------------------------------------------------------------- /plugin/test/org/jetbrains/haskell/parser/CPPTest.java: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.parser; 2 | 3 | import com.intellij.testFramework.ParsingTestCase; 4 | 5 | public class CPPTest extends ParsingTestCase { 6 | static { 7 | System.setProperty("idea.platform.prefix", "Idea"); 8 | } 9 | 10 | public CPPTest() { 11 | super("cppTests", "hs", new HaskellParserDefinition()); 12 | } 13 | 14 | @Override 15 | protected String getTestDataPath() { 16 | return "data"; 17 | } 18 | 19 | public void testCppIf() throws Exception { doTest(true); } 20 | 21 | 22 | } 23 | -------------------------------------------------------------------------------- /plugin/test/org/jetbrains/haskell/parser/RecoveryTest.java: -------------------------------------------------------------------------------- 1 | package org.jetbrains.haskell.parser; 2 | 3 | import com.intellij.testFramework.ParsingTestCase; 4 | 5 | public class RecoveryTest extends ParsingTestCase { 6 | static { 7 | System.setProperty("idea.platform.prefix", "Idea"); 8 | } 9 | 10 | public RecoveryTest() { 11 | super("recoveryTests", "hs", new HaskellParserDefinition()); 12 | } 13 | 14 | @Override 15 | protected String getTestDataPath() { 16 | return "data"; 17 | } 18 | 19 | public void testRecovery() throws Exception { doTest(true); } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /plugin/testresources/TestMain.hs: -------------------------------------------------------------------------------- 1 | module Main where 2 | 3 | import Control.Exception 4 | 5 | qsort [] = [] 6 | qsort (a:as) = qsort left ++ [a] ++ qsort right 7 | where (left,right) = (filter (<=a) as, filter (>a) as) 8 | 9 | main :: IO () 10 | main = print $ qsort ([5, 4, 7, 2, 9, 8, 10, 3] :: [Int]) 11 | 12 | steplocaltest :: IO () 13 | steplocaltest = main 14 | 15 | uncaughtMain :: IO () 16 | uncaughtMain = main >> undefined 17 | 18 | caughtMain :: IO () 19 | caughtMain = (main >> undefined) `catch` (const $ print "caught" :: SomeException -> IO ()) 20 | 21 | expression :: Int 22 | expression = 2 + 2 * 2 23 | -------------------------------------------------------------------------------- /plugin/testresources/unittest.properties: -------------------------------------------------------------------------------- 1 | # Remote debugger path 2 | remotePath = /home/atsky/.cabal/bin/remote-debugger 3 | 4 | # GHCi path 5 | ghciPath = /usr/bin/ghci --------------------------------------------------------------------------------