Skip to content
This repository
Browse code

added net.sf.* plugins

darcs-hash:20050613070823-ad775-0724b43ca496104cfea36d4bf912621774d8307c.gz
  • Loading branch information...
commit 3efa6c87d8e628796179133a32e2345274ff6b0c 1 parent ab0bf03
Leif Frenzel authored June 13, 2005

Showing 156 changed files with 9,789 additions and 0 deletions. Show diff stats Hide diff stats

  1. 16  de.leiffrenzel.fp.haskell.core/src/de/leiffrenzel/fp/haskell/core/HaskellCoreException.java
  2. 125  de.leiffrenzel.fp.haskell.core/src/de/leiffrenzel/fp/haskell/core/HaskellCorePlugin.java
  3. 7  net.sf.eclipsefp.haskell.core.parser.test/.classpath
  4. 28  net.sf.eclipsefp.haskell.core.parser.test/.project
  5. 15  net.sf.eclipsefp.haskell.core.parser.test/META-INF/MANIFEST.MF
  6. 4  net.sf.eclipsefp.haskell.core.parser.test/build.properties
  7. 22  net.sf.eclipsefp.haskell.core.parser.test/src/net/sf/eclipsefp/haskell/core/parser/AllTests_PDESuite.java
  8. 102  ...sf.eclipsefp.haskell.core.parser.test/src/net/sf/eclipsefp/haskell/core/parser/CompilationUnit_PDETest.java
  9. 362  net.sf.eclipsefp.haskell.core.parser.test/src/net/sf/eclipsefp/haskell/core/parser/HaskellParser_PDETest.java
  10. 113  net.sf.eclipsefp.haskell.core.parser.test/src/net/sf/eclipsefp/haskell/core/parser/HaskellProjectTestCase.java
  11. 4  net.sf.eclipsefp.haskell.core.parser.test/src/net/sf/eclipsefp/haskell/core/parser/res/001/Main.hs
  12. 10  net.sf.eclipsefp.haskell.core.parser.test/src/net/sf/eclipsefp/haskell/core/parser/res/002/Main.hs
  13. 4  net.sf.eclipsefp.haskell.core.parser.test/src/net/sf/eclipsefp/haskell/core/parser/res/003/Main.hs
  14. 10  net.sf.eclipsefp.haskell.core.parser.test/src/net/sf/eclipsefp/haskell/core/parser/res/004/Main.hs
  15. 10  net.sf.eclipsefp.haskell.core.parser.test/src/net/sf/eclipsefp/haskell/core/parser/res/005/Main.hs
  16. 7  net.sf.eclipsefp.haskell.core.parser.test/src/net/sf/eclipsefp/haskell/core/parser/res/006/Main.hs
  17. 7  net.sf.eclipsefp.haskell.core.parser.test/src/net/sf/eclipsefp/haskell/core/parser/res/007/Main.hs
  18. 6  net.sf.eclipsefp.haskell.core.parser.test/src/net/sf/eclipsefp/haskell/core/parser/res/008/Main.hs
  19. 6  net.sf.eclipsefp.haskell.core.parser.test/src/net/sf/eclipsefp/haskell/core/parser/res/009/Main.hs
  20. 4  net.sf.eclipsefp.haskell.core.parser.test/src/net/sf/eclipsefp/haskell/core/parser/res/010/Main.hs
  21. 3  net.sf.eclipsefp.haskell.core.parser.test/src/net/sf/eclipsefp/haskell/core/parser/res/011/Main.hs
  22. 8  net.sf.eclipsefp.haskell.core.parser.test/src/net/sf/eclipsefp/haskell/core/parser/res/012/Main.hs
  23. 7  net.sf.eclipsefp.haskell.core.parser.test/src/net/sf/eclipsefp/haskell/core/parser/res/013/Main.hs
  24. 3  net.sf.eclipsefp.haskell.core.parser.test/src/net/sf/eclipsefp/haskell/core/parser/res/014/Main.hs
  25. 9  net.sf.eclipsefp.haskell.core.parser.test/src/net/sf/eclipsefp/haskell/core/parser/res/015/Main.hs
  26. 3  net.sf.eclipsefp.haskell.core.parser.test/src/net/sf/eclipsefp/haskell/core/parser/res/016/Main.hs
  27. 3  net.sf.eclipsefp.haskell.core.parser.test/src/net/sf/eclipsefp/haskell/core/parser/res/017/Main.hs
  28. 5  net.sf.eclipsefp.haskell.core.parser.test/src/net/sf/eclipsefp/haskell/core/parser/res/018/Main.hs
  29. 7  net.sf.eclipsefp.haskell.core.parser.test/src/net/sf/eclipsefp/haskell/core/parser/res/019/Main.hs
  30. 1  net.sf.eclipsefp.haskell.core.parser.test/src/net/sf/eclipsefp/haskell/core/parser/res/020/Main.hs
  31. 4  net.sf.eclipsefp.haskell.core.parser.test/src/net/sf/eclipsefp/haskell/core/parser/res/021/Main.hs
  32. 6  net.sf.eclipsefp.haskell.core.parser.test/src/net/sf/eclipsefp/haskell/core/parser/res/022/Main.hs
  33. 41  net.sf.eclipsefp.haskell.core.parser.test/src/net/sf/eclipsefp/haskell/core/parser/res/023/Main.hs
  34. 4  net.sf.eclipsefp.haskell.core.parser.test/src/net/sf/eclipsefp/haskell/core/parser/res/024/Main.hs
  35. 73  net.sf.eclipsefp.haskell.core.parser.test/src/net/sf/eclipsefp/haskell/core/parser/test/TestPlugin.java
  36. 2  net.sf.eclipsefp.haskell.core.parser.win32/.checkstyle
  37. 11  net.sf.eclipsefp.haskell.core.parser.win32/.externalToolBuilders/Build_native_parser_dll.launch
  38. 38  net.sf.eclipsefp.haskell.core.parser.win32/.project
  39. 8  net.sf.eclipsefp.haskell.core.parser.win32/INTERNAL/conf/build.bat
  40. 7  net.sf.eclipsefp.haskell.core.parser.win32/META-INF/MANIFEST.MF
  41. 6  net.sf.eclipsefp.haskell.core.parser.win32/build.properties
  42. 5  net.sf.eclipsefp.haskell.core.parser.win32/fragment.xml
  43. BIN  net.sf.eclipsefp.haskell.core.parser.win32/os/win32/x86/nativeparser.dll
  44. 690  net.sf.eclipsefp.haskell.core.parser.win32/src/ParserImpl.hs
  45. 385  net.sf.eclipsefp.haskell.core.parser.win32/src/bridge.c
  46. 182  net.sf.eclipsefp.haskell.core.parser.win32/src/marshal.h
  47. 6  net.sf.eclipsefp.haskell.core.parser/.checkstyle
  48. 7  net.sf.eclipsefp.haskell.core.parser/.classpath
  49. 2  net.sf.eclipsefp.haskell.core.parser/.options
  50. 34  net.sf.eclipsefp.haskell.core.parser/.project
  51. 312  net.sf.eclipsefp.haskell.core.parser/.settings/org.eclipse.jdt.core.prefs
  52. 11  net.sf.eclipsefp.haskell.core.parser/.settings/org.eclipse.jdt.ui.prefs
  53. 13  net.sf.eclipsefp.haskell.core.parser/META-INF/MANIFEST.MF
  54. 5  net.sf.eclipsefp.haskell.core.parser/build.properties
  55. 11  net.sf.eclipsefp.haskell.core.parser/plugin.xml
  56. 61  net.sf.eclipsefp.haskell.core.parser/src/net/sf/eclipsefp/haskell/core/parser/ClassDeclaration.java
  57. 116  net.sf.eclipsefp.haskell.core.parser/src/net/sf/eclipsefp/haskell/core/parser/CompilationUnit.java
  58. 49  net.sf.eclipsefp.haskell.core.parser/src/net/sf/eclipsefp/haskell/core/parser/Constructor.java
  59. 48  net.sf.eclipsefp.haskell.core.parser/src/net/sf/eclipsefp/haskell/core/parser/DataDeclaration.java
  60. 59  net.sf.eclipsefp.haskell.core.parser/src/net/sf/eclipsefp/haskell/core/parser/Declaration.java
  61. 29  net.sf.eclipsefp.haskell.core.parser/src/net/sf/eclipsefp/haskell/core/parser/DefaultDeclaration.java
  62. 17  net.sf.eclipsefp.haskell.core.parser/src/net/sf/eclipsefp/haskell/core/parser/ExportAbsolute.java
  63. 18  net.sf.eclipsefp.haskell.core.parser/src/net/sf/eclipsefp/haskell/core/parser/ExportModuleContent.java
  64. 52  net.sf.eclipsefp.haskell.core.parser/src/net/sf/eclipsefp/haskell/core/parser/ExportSpecification.java
  65. 17  net.sf.eclipsefp.haskell.core.parser/src/net/sf/eclipsefp/haskell/core/parser/ExportThingAll.java
  66. 37  net.sf.eclipsefp.haskell.core.parser/src/net/sf/eclipsefp/haskell/core/parser/ExportThingWith.java
  67. 49  net.sf.eclipsefp.haskell.core.parser/src/net/sf/eclipsefp/haskell/core/parser/ExportThingWithComponent.java
  68. 17  net.sf.eclipsefp.haskell.core.parser/src/net/sf/eclipsefp/haskell/core/parser/ExportVariable.java
  69. 75  net.sf.eclipsefp.haskell.core.parser/src/net/sf/eclipsefp/haskell/core/parser/FunctionBinding.java
  70. 33  net.sf.eclipsefp.haskell.core.parser/src/net/sf/eclipsefp/haskell/core/parser/IElementTypes.java
  71. 151  net.sf.eclipsefp.haskell.core.parser/src/net/sf/eclipsefp/haskell/core/parser/Import.java
  72. 17  net.sf.eclipsefp.haskell.core.parser/src/net/sf/eclipsefp/haskell/core/parser/ImportAbsolute.java
  73. 56  net.sf.eclipsefp.haskell.core.parser/src/net/sf/eclipsefp/haskell/core/parser/ImportSpecification.java
  74. 17  net.sf.eclipsefp.haskell.core.parser/src/net/sf/eclipsefp/haskell/core/parser/ImportThingAll.java
  75. 37  net.sf.eclipsefp.haskell.core.parser/src/net/sf/eclipsefp/haskell/core/parser/ImportThingWith.java
  76. 49  net.sf.eclipsefp.haskell.core.parser/src/net/sf/eclipsefp/haskell/core/parser/ImportThingWithComponent.java
  77. 17  net.sf.eclipsefp.haskell.core.parser/src/net/sf/eclipsefp/haskell/core/parser/ImportVariable.java
  78. 99  net.sf.eclipsefp.haskell.core.parser/src/net/sf/eclipsefp/haskell/core/parser/InfixDeclaration.java
  79. 17  net.sf.eclipsefp.haskell.core.parser/src/net/sf/eclipsefp/haskell/core/parser/InstanceDeclaration.java
  80. 49  net.sf.eclipsefp.haskell.core.parser/src/net/sf/eclipsefp/haskell/core/parser/Match.java
  81. 241  net.sf.eclipsefp.haskell.core.parser/src/net/sf/eclipsefp/haskell/core/parser/Module.java
  82. 179  net.sf.eclipsefp.haskell.core.parser/src/net/sf/eclipsefp/haskell/core/parser/NativeParser.java
  83. 52  net.sf.eclipsefp.haskell.core.parser/src/net/sf/eclipsefp/haskell/core/parser/NativeParserBridge.java
  84. 19  net.sf.eclipsefp.haskell.core.parser/src/net/sf/eclipsefp/haskell/core/parser/NewTypeDeclaration.java
  85. 57  net.sf.eclipsefp.haskell.core.parser/src/net/sf/eclipsefp/haskell/core/parser/ParserPlugin.java
  86. 29  net.sf.eclipsefp.haskell.core.parser/src/net/sf/eclipsefp/haskell/core/parser/PatternBinding.java
  87. 63  net.sf.eclipsefp.haskell.core.parser/src/net/sf/eclipsefp/haskell/core/parser/SourceLocation.java
  88. 18  net.sf.eclipsefp.haskell.core.parser/src/net/sf/eclipsefp/haskell/core/parser/TypeDeclaration.java
  89. 48  net.sf.eclipsefp.haskell.core.parser/src/net/sf/eclipsefp/haskell/core/parser/TypeSignature.java
  90. 6  net.sf.eclipsefp.haskell.haddock/.checkstyle
  91. 7  net.sf.eclipsefp.haskell.haddock/.classpath
  92. 2  net.sf.eclipsefp.haskell.haddock/.options
  93. 34  net.sf.eclipsefp.haskell.haddock/.project
  94. 312  net.sf.eclipsefp.haskell.haddock/.settings/org.eclipse.jdt.core.prefs
  95. 11  net.sf.eclipsefp.haskell.haddock/.settings/org.eclipse.jdt.ui.prefs
  96. 19  net.sf.eclipsefp.haskell.haddock/META-INF/MANIFEST.MF
  97. 8  net.sf.eclipsefp.haskell.haddock/build.properties
  98. BIN  net.sf.eclipsefp.haskell.haddock/icons/full/etool16/haddock.gif
  99. BIN  net.sf.eclipsefp.haskell.haddock/icons/full/wizban/haddockexport.gif
  100. 6  net.sf.eclipsefp.haskell.haddock/plugin.properties
  101. 35  net.sf.eclipsefp.haskell.haddock/plugin.xml
  102. 63  net.sf.eclipsefp.haskell.haddock/src/net/sf/eclipsefp/haskell/haddock/HaddockPlugin.java
  103. 271  net.sf.eclipsefp.haskell.haddock/src/net/sf/eclipsefp/haskell/haddock/core/HaddockInfo.java
  104. 18  net.sf.eclipsefp.haskell.haddock/src/net/sf/eclipsefp/haskell/haddock/core/HaddockUtil.java
  105. 49  net.sf.eclipsefp.haskell.haddock/src/net/sf/eclipsefp/haskell/haddock/core/IHaddockParameters.java
  106. 61  net.sf.eclipsefp.haskell.haddock/src/net/sf/eclipsefp/haskell/haddock/core/InterfaceList.java
  107. 34  net.sf.eclipsefp.haskell.haddock/src/net/sf/eclipsefp/haskell/haddock/core/InterfaceListEntry.java
  108. 12  ...clipsefp.haskell.haddock/src/net/sf/eclipsefp/haskell/haddock/core/preferences/IHaddockPreferenceNames.java
  109. 26  ....eclipsefp.haskell.haddock/src/net/sf/eclipsefp/haskell/haddock/core/preferences/PreferenceInitializer.java
  110. 27  net.sf.eclipsefp.haskell.haddock/src/net/sf/eclipsefp/haskell/haddock/ui/ShortParamDescriptions.properties
  111. 59  net.sf.eclipsefp.haskell.haddock/src/net/sf/eclipsefp/haskell/haddock/ui/UITexts.java
  112. 94  ...psefp.haskell.haddock/src/net/sf/eclipsefp/haskell/haddock/ui/configuratorpage/HaddockConfiguratorPage.java
  113. 86  ...ipsefp.haskell.haddock/src/net/sf/eclipsefp/haskell/haddock/ui/configuratorpage/HaddockExecutableProbe.java
  114. 49  net.sf.eclipsefp.haskell.haddock/src/net/sf/eclipsefp/haskell/haddock/ui/wizard/CheckBoxTreeAndListLP.java
  115. 66  net.sf.eclipsefp.haskell.haddock/src/net/sf/eclipsefp/haskell/haddock/ui/wizard/CheckboxListCP.java
  116. 705  net.sf.eclipsefp.haskell.haddock/src/net/sf/eclipsefp/haskell/haddock/ui/wizard/CheckboxTreeAndListViewer.java
  117. 138  net.sf.eclipsefp.haskell.haddock/src/net/sf/eclipsefp/haskell/haddock/ui/wizard/CheckboxTreeCP.java
  118. 119  net.sf.eclipsefp.haskell.haddock/src/net/sf/eclipsefp/haskell/haddock/ui/wizard/DialogSettingsUtil.java
  119. 90  net.sf.eclipsefp.haskell.haddock/src/net/sf/eclipsefp/haskell/haddock/ui/wizard/HaddockExportWizard.java
  120. 128  net.sf.eclipsefp.haskell.haddock/src/net/sf/eclipsefp/haskell/haddock/ui/wizard/HaddockExportWizardPage.java
  121. 203  net.sf.eclipsefp.haskell.haddock/src/net/sf/eclipsefp/haskell/haddock/ui/wizard/InterfaceListBlock.java
  122. 207  net.sf.eclipsefp.haskell.haddock/src/net/sf/eclipsefp/haskell/haddock/ui/wizard/InterfacePage.java
  123. 141  net.sf.eclipsefp.haskell.haddock/src/net/sf/eclipsefp/haskell/haddock/ui/wizard/OptionsPage.java
  124. 134  net.sf.eclipsefp.haskell.haddock/src/net/sf/eclipsefp/haskell/haddock/ui/wizard/SelectionPage.java
  125. 96  net.sf.eclipsefp.haskell.haddock/src/net/sf/eclipsefp/haskell/haddock/ui/wizard/op/GenerateDocs.java
  126. 6  net.sf.eclipsefp.haskell.hugs/.checkstyle
  127. 7  net.sf.eclipsefp.haskell.hugs/.classpath
  128. 4  net.sf.eclipsefp.haskell.hugs/.options
  129. 28  net.sf.eclipsefp.haskell.hugs/.project
  130. 312  net.sf.eclipsefp.haskell.hugs/.settings/org.eclipse.jdt.core.prefs
  131. 11  net.sf.eclipsefp.haskell.hugs/.settings/org.eclipse.jdt.ui.prefs
  132. 17  net.sf.eclipsefp.haskell.hugs/META-INF/MANIFEST.MF
  133. 8  net.sf.eclipsefp.haskell.hugs/build.properties
  134. BIN  net.sf.eclipsefp.haskell.hugs/icons/full/etool16/hugs16.gif
  135. BIN  net.sf.eclipsefp.haskell.hugs/icons/full/wizban/hugs.png
  136. 2  net.sf.eclipsefp.haskell.hugs/plugin.properties
  137. 53  net.sf.eclipsefp.haskell.hugs/plugin.xml
  138. 6  net.sf.eclipsefp.haskell.refactoring/.checkstyle
  139. 7  net.sf.eclipsefp.haskell.refactoring/.classpath
  140. 34  net.sf.eclipsefp.haskell.refactoring/.project
  141. 312  net.sf.eclipsefp.haskell.refactoring/.settings/org.eclipse.jdt.core.prefs
  142. 11  net.sf.eclipsefp.haskell.refactoring/.settings/org.eclipse.jdt.ui.prefs
  143. 21  net.sf.eclipsefp.haskell.refactoring/META-INF/MANIFEST.MF
  144. 4  net.sf.eclipsefp.haskell.refactoring/build.properties
  145. 13  net.sf.eclipsefp.haskell.refactoring/plugin.xml
  146. 125  ...clipsefp.haskell.refactoring/src/net/sf/eclipsefp/haskell/refactoring/internal/core/changes/BaseChange.java
  147. 104  ...askell.refactoring/src/net/sf/eclipsefp/haskell/refactoring/internal/core/changes/RenameResourceChange.java
  148. 23  ...kell.refactoring/src/net/sf/eclipsefp/haskell/refactoring/internal/core/refactorings/IRenameModuleInfo.java
  149. 171  ...l.refactoring/src/net/sf/eclipsefp/haskell/refactoring/internal/core/refactorings/RenameModuleDelegate.java
  150. 78  ....refactoring/src/net/sf/eclipsefp/haskell/refactoring/internal/core/refactorings/RenameModuleProcessor.java
  151. 29  ...efactoring/src/net/sf/eclipsefp/haskell/refactoring/internal/core/refactorings/RenameModuleRefactoring.java
  152. 69  ...clipsefp.haskell.refactoring/src/net/sf/eclipsefp/haskell/refactoring/internal/ui/HaskellRefactoringUI.java
  153. 91  ...clipsefp.haskell.refactoring/src/net/sf/eclipsefp/haskell/refactoring/internal/ui/actions/RenameModule.java
  154. 117  ...sefp.haskell.refactoring/src/net/sf/eclipsefp/haskell/refactoring/internal/ui/wizards/RenameModuleInfo.java
  155. 116  ...haskell.refactoring/src/net/sf/eclipsefp/haskell/refactoring/internal/ui/wizards/RenameModuleInputPage.java
  156. 28  ...fp.haskell.refactoring/src/net/sf/eclipsefp/haskell/refactoring/internal/ui/wizards/RenameModuleWizard.java
16  de.leiffrenzel.fp.haskell.core/src/de/leiffrenzel/fp/haskell/core/HaskellCoreException.java
... ...
@@ -0,0 +1,16 @@
  1
+// Copyright (c) 2003-2005 by Leif Frenzel - see http://leiffrenzel.de
  2
+package de.leiffrenzel.fp.haskell.core;
  3
+
  4
+/** <p>The common exception type for exceptions that occure in the Haskell 
  5
+  * Core classes.</p> 
  6
+  * 
  7
+  * @author Leif Frenzel
  8
+  */
  9
+public class HaskellCoreException extends Exception {
  10
+
  11
+  /** <p>constructs a new HaskellCoreException with the specified 
  12
+    * message.</p> */
  13
+  public HaskellCoreException( final String message ) {
  14
+    super( message );
  15
+  }
  16
+}
125  de.leiffrenzel.fp.haskell.core/src/de/leiffrenzel/fp/haskell/core/HaskellCorePlugin.java
... ...
@@ -0,0 +1,125 @@
  1
+// Copyright (c) 2003-2005 by Leif Frenzel - see http://leiffrenzel.de
  2
+package de.leiffrenzel.fp.haskell.core;
  3
+
  4
+import org.eclipse.core.runtime.*;
  5
+import org.osgi.framework.BundleContext;
  6
+
  7
+import de.leiffrenzel.fp.haskell.core.compiler.CompilerManager;
  8
+import de.leiffrenzel.fp.haskell.core.halamo.Halamo;
  9
+import de.leiffrenzel.fp.haskell.core.parser.ParserManager;
  10
+import de.leiffrenzel.fp.haskell.core.preferences.ICorePreferenceNames;
  11
+
  12
+
  13
+/** The main plugin class to be used in the desktop.
  14
+  * 
  15
+  * @author The mighty PDE wizard 
  16
+  */
  17
+public class HaskellCorePlugin extends Plugin {
  18
+
  19
+  // extension points
  20
+  public static final String ID_EXT_POINT_COMPILERS = "haskellCompilers";
  21
+  public static final String ID_EXT_POINT_PARSERS   = "haskellParsers";
  22
+  
  23
+  private static HaskellCorePlugin plugin;
  24
+  
  25
+  
  26
+  public HaskellCorePlugin() {
  27
+    plugin = this;
  28
+  }
  29
+
  30
+  public void start( final BundleContext context ) throws Exception {
  31
+    super.start( context );
  32
+    
  33
+    collectCompilerInfo();
  34
+    collectParserInfo();
  35
+    try {
  36
+      // TODO temp (to register as listener)
  37
+      Halamo.getInstance().initialize();
  38
+    } catch( CoreException ex ) {
  39
+      String message =   "Serious problem: could not initialize the Haskell "
  40
+                       + "language model.";
  41
+      HaskellCorePlugin.log( message, ex );
  42
+    }
  43
+  }
  44
+  
  45
+  /** <p>returns the shared instance.</p> */
  46
+  public static HaskellCorePlugin getDefault() {
  47
+    return plugin;
  48
+  }
  49
+
  50
+  public static String getPluginId() {
  51
+    return getDefault().getBundle().getSymbolicName();
  52
+  }
  53
+
  54
+
  55
+  // logging and tracing
  56
+  //////////////////////
  57
+  
  58
+  public static void log( final String message, final int severity ) {
  59
+    String id = getPluginId();
  60
+    Status status = new Status( severity, id, IStatus.OK, message, null );
  61
+    getDefault().getLog().log( status );
  62
+  }
  63
+
  64
+  public static void log( final String message, final Throwable thr ) {
  65
+    String id = getPluginId();
  66
+    Status status = new Status( IStatus.ERROR, id, IStatus.OK, message, thr );
  67
+    getDefault().getLog().log( status );
  68
+  }
  69
+  
  70
+  public static boolean isTracing( final String optionId ) {
  71
+    String option = getPluginId() + "/trace/" + optionId;
  72
+    String value = Platform.getDebugOption( option );
  73
+    return value != null && value.equals( "true" );
  74
+  }
  75
+  
  76
+  
  77
+  // helping methods
  78
+  //////////////////
  79
+  
  80
+  /** reads compiler infos out of the extensions declared in the manifest
  81
+    * and registers them with the compiler manager.
  82
+    * 
  83
+    * All compiler management is delegated to the CompilerManager singleton.
  84
+    */ 
  85
+  private void collectCompilerInfo() {
  86
+    IConfigurationElement[] elements = getExtensions( ID_EXT_POINT_COMPILERS );
  87
+    for( int i = 0; i < elements.length; i++ ) {
  88
+      String compilerId = elements[ i ].getAttribute( "id" );
  89
+      CompilerManager.getInstance().registerCompiler( compilerId, 
  90
+                                                      elements[ i ] );
  91
+    }
  92
+    String pref = "";
  93
+    try {
  94
+      String name = ICorePreferenceNames.SELECTED_COMPILER;
  95
+      pref = getPluginPreferences().getString( name );
  96
+      CompilerManager.getInstance().selectCompiler( pref );
  97
+    } catch ( Exception ex ) {
  98
+      String msg = "Problem when selecting compiler '" + pref + "'.";
  99
+      HaskellCorePlugin.log( msg, ex );
  100
+    }
  101
+  }
  102
+
  103
+  private void collectParserInfo() {
  104
+    IConfigurationElement[] elements = getExtensions( ID_EXT_POINT_PARSERS );
  105
+    for( int i = 0; i < elements.length; i++ ) {
  106
+      try {
  107
+        String parserId = elements[ i ].getAttribute( "id" );
  108
+        if( parserId == null ) {
  109
+          String msg =   "Haskell parser declaration is missing id attribute "
  110
+                       + "and will be ignored.";
  111
+          log( msg, null ); 
  112
+        } else {
  113
+          ParserManager.getInstance().registerParser( parserId, elements[ i ] );
  114
+        }
  115
+      } catch( final CoreException ex ) {
  116
+        getLog().log( ex.getStatus() );
  117
+      }
  118
+    }
  119
+  }  
  120
+  
  121
+  private IConfigurationElement[] getExtensions( final String key ) {
  122
+    IExtensionRegistry registry = Platform.getExtensionRegistry();
  123
+    return registry.getConfigurationElementsFor( getPluginId(), key );
  124
+  }
  125
+}
7  net.sf.eclipsefp.haskell.core.parser.test/.classpath
... ...
@@ -0,0 +1,7 @@
  1
+<?xml version="1.0" encoding="UTF-8"?>
  2
+<classpath>
  3
+	<classpathentry kind="src" path="src"/>
  4
+	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
  5
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
  6
+	<classpathentry kind="output" path="bin"/>
  7
+</classpath>
28  net.sf.eclipsefp.haskell.core.parser.test/.project
... ...
@@ -0,0 +1,28 @@
  1
+<?xml version="1.0" encoding="UTF-8"?>
  2
+<projectDescription>
  3
+	<name>net.sf.eclipsefp.haskell.core.parser.test</name>
  4
+	<comment></comment>
  5
+	<projects>
  6
+	</projects>
  7
+	<buildSpec>
  8
+		<buildCommand>
  9
+			<name>org.eclipse.jdt.core.javabuilder</name>
  10
+			<arguments>
  11
+			</arguments>
  12
+		</buildCommand>
  13
+		<buildCommand>
  14
+			<name>org.eclipse.pde.ManifestBuilder</name>
  15
+			<arguments>
  16
+			</arguments>
  17
+		</buildCommand>
  18
+		<buildCommand>
  19
+			<name>org.eclipse.pde.SchemaBuilder</name>
  20
+			<arguments>
  21
+			</arguments>
  22
+		</buildCommand>
  23
+	</buildSpec>
  24
+	<natures>
  25
+		<nature>org.eclipse.pde.PluginNature</nature>
  26
+		<nature>org.eclipse.jdt.core.javanature</nature>
  27
+	</natures>
  28
+</projectDescription>
15  net.sf.eclipsefp.haskell.core.parser.test/META-INF/MANIFEST.MF
... ...
@@ -0,0 +1,15 @@
  1
+Manifest-Version: 1.0
  2
+Bundle-ManifestVersion: 2
  3
+Bundle-Name: Parser Tests
  4
+Bundle-SymbolicName: net.sf.eclipsefp.haskell.core.parser.test; singleton:=true
  5
+Bundle-Version: 0.8.0
  6
+Bundle-ClassPath: haskellcoreparsertest.jar
  7
+Bundle-Activator: net.sf.eclipsefp.haskell.core.parser.test.TestPlugin
  8
+Bundle-Vendor: eclipsefp.sourcefourge.net
  9
+Bundle-Localization: plugin
  10
+Require-Bundle: de.leiffrenzel.fp.haskell.core,
  11
+ net.sf.eclipsefp.haskell.core.parser,
  12
+ org.eclipse.core.resources,
  13
+ org.eclipse.core.runtime,
  14
+ org.junit
  15
+Eclipse-AutoStart: true
4  net.sf.eclipsefp.haskell.core.parser.test/build.properties
... ...
@@ -0,0 +1,4 @@
  1
+source.haskellcoreparsertest.jar = src/
  2
+output.haskellcoreparsertest.jar = bin/
  3
+bin.includes = META-INF/,\
  4
+               haskellcoreparsertest.jar
22  net.sf.eclipsefp.haskell.core.parser.test/src/net/sf/eclipsefp/haskell/core/parser/AllTests_PDESuite.java
... ...
@@ -0,0 +1,22 @@
  1
+// Copyright (c) 2004-2005 by Leif Frenzel
  2
+// See http://leiffrenzel.de
  3
+package net.sf.eclipsefp.haskell.core.parser;
  4
+
  5
+import junit.framework.TestCase;
  6
+import junit.framework.TestSuite;
  7
+
  8
+/** <p>collects all test cases in this plugin.</p>
  9
+  *
  10
+  * @author Leif Frenzel
  11
+  */
  12
+public class AllTests_PDESuite extends TestCase {
  13
+
  14
+  public static TestSuite suite() {
  15
+    TestSuite result = new TestSuite();
  16
+    
  17
+    result.addTestSuite( CompilationUnit_PDETest.class );
  18
+    result.addTestSuite( HaskellParser_PDETest.class );
  19
+    
  20
+    return result;
  21
+  }
  22
+}
102  ...eclipsefp.haskell.core.parser.test/src/net/sf/eclipsefp/haskell/core/parser/CompilationUnit_PDETest.java
... ...
@@ -0,0 +1,102 @@
  1
+// Copyright (c) 2004-2005 by Leif Frenzel
  2
+// See http://leiffrenzel.de
  3
+package net.sf.eclipsefp.haskell.core.parser;
  4
+
  5
+import org.eclipse.core.resources.IFile;
  6
+
  7
+import de.leiffrenzel.fp.haskell.core.halamo.*;
  8
+import de.leiffrenzel.fp.haskell.core.parser.IHaskellParser;
  9
+import de.leiffrenzel.fp.haskell.core.parser.ParserManager;
  10
+
  11
+
  12
+/** <p>tests for compilation units (src location support).</p>
  13
+  *
  14
+  * @author Leif Frenzel
  15
+  */
  16
+public class CompilationUnit_PDETest extends HaskellProjectTestCase {
  17
+
  18
+  public void testEmptyCU() throws Exception {
  19
+    // an empty compilation unit has an implicit Main module at position 0,0
  20
+    // (apart from leading comment lines like in the target file, which makes
  21
+    // it in this case position 1,0 )
  22
+    ICompilationUnit cu = loadCU( "020" );
  23
+    ISourceLocation sl1 = cu.getNextLocation( new SourceLocation( 0, 0 ) );
  24
+    assertTrue( sl1 != null );
  25
+    assertEquals( 1, sl1.getLine() );
  26
+    assertEquals( 0, sl1.getColumn() );    
  27
+    ISourceLocation sl2 = cu.getNextLocation( new SourceLocation( 3, 3 ) );
  28
+    assertTrue( sl2 == null );
  29
+  }
  30
+  
  31
+  public void testSingleSrcLoc() throws Exception {
  32
+    ICompilationUnit cu = loadCU( "021" );
  33
+    ISourceLocation sl1 = cu.getNextLocation( new SourceLocation( 0, 0 ) );
  34
+    assertTrue( sl1 != null );
  35
+    assertEquals( 1, sl1.getLine() );
  36
+    assertEquals( 0, sl1.getColumn() );
  37
+    
  38
+    ISourceLocation sl2 = cu.getNextLocation( new SourceLocation( 3, 3 ) );
  39
+    assertTrue( sl2 == null );
  40
+  }
  41
+
  42
+  public void testTwoSrcLocs() throws Exception {
  43
+    ICompilationUnit cu = loadCU( "022" );
  44
+    ISourceLocation sl1 = cu.getNextLocation( new SourceLocation( 0, 0 ) );
  45
+    assertTrue( sl1 != null );
  46
+    assertEquals( 1, sl1.getLine() );
  47
+    assertEquals( 0, sl1.getColumn() );
  48
+    
  49
+    ISourceLocation sl2 = cu.getNextLocation( new SourceLocation( 3, 3 ) );
  50
+    assertTrue( sl2 != null );
  51
+    assertEquals( 5, sl2.getLine() );
  52
+    assertEquals( 0, sl2.getColumn() );
  53
+    
  54
+    ISourceLocation sl3 = cu.getNextLocation( new SourceLocation( 6, 3 ) );
  55
+    assertTrue( sl3 == null );
  56
+  }
  57
+
  58
+  public void testLotsOfLocs() throws Exception {
  59
+    ICompilationUnit cu = loadCU( "023" );
  60
+    ISourceLocation sl1 = cu.getNextLocation( new SourceLocation( 0, 0 ) );
  61
+    assertEquals( 1, sl1.getLine() );
  62
+    assertEquals( 0, sl1.getColumn() );
  63
+
  64
+    ISourceLocation sl2 = cu.getNextLocation( sl1 );
  65
+    assertEquals( 5, sl2.getLine() );
  66
+    assertEquals( 0, sl2.getColumn() );
  67
+    
  68
+    ISourceLocation sl3 = cu.getNextLocation( sl2 );
  69
+    assertEquals( 6, sl3.getLine() );
  70
+    assertEquals( 0, sl3.getColumn() );
  71
+    
  72
+    ISourceLocation sl4 = cu.getNextLocation( sl3 );
  73
+    assertEquals( 7, sl4.getLine() );
  74
+    assertEquals( 0, sl4.getColumn() );
  75
+    
  76
+    ISourceLocation sl5 = cu.getNextLocation( sl4 );
  77
+    assertEquals( 9, sl5.getLine() );
  78
+    assertEquals( 0, sl5.getColumn() );
  79
+    
  80
+    ISourceLocation sl6 = cu.getNextLocation( sl5 );
  81
+    assertEquals( 12, sl6.getLine() );
  82
+    assertEquals( 0, sl6.getColumn() );
  83
+    
  84
+    ISourceLocation sl7 = cu.getNextLocation( new SourceLocation( 39, 3 )  );
  85
+    assertEquals( 40, sl7.getLine() );
  86
+    assertEquals( 0, sl7.getColumn() );
  87
+    
  88
+    ISourceLocation sl8 = cu.getNextLocation( sl7  );
  89
+    assertTrue( sl8 == null );
  90
+  }
  91
+  
  92
+  // helping methods
  93
+  //////////////////
  94
+  
  95
+  private ICompilationUnit loadCU( final String name ) throws Exception {
  96
+    importSourceFile( "Main.hs", name, "Main.hs" );
  97
+    IFile file = getProject().getFile( "src/Main.hs" );
  98
+    assertTrue( file.exists() );
  99
+    IHaskellParser parser = ParserManager.getInstance().getParser();
  100
+    return parser.parse( file );
  101
+  }
  102
+}
362  ...f.eclipsefp.haskell.core.parser.test/src/net/sf/eclipsefp/haskell/core/parser/HaskellParser_PDETest.java
... ...
@@ -0,0 +1,362 @@
  1
+// Copyright (c) 2004-2005 by Leif Frenzel
  2
+// See http://leiffrenzel.de
  3
+package net.sf.eclipsefp.haskell.core.parser;
  4
+
  5
+import org.eclipse.core.resources.IFile;
  6
+import org.eclipse.core.runtime.CoreException;
  7
+
  8
+import de.leiffrenzel.fp.haskell.core.halamo.*;
  9
+import de.leiffrenzel.fp.haskell.core.parser.IHaskellParser;
  10
+import de.leiffrenzel.fp.haskell.core.parser.ParserManager;
  11
+
  12
+
  13
+/** <p>tests for the Haskell parser.</p>
  14
+  *
  15
+  * @author Leif Frenzel
  16
+  */
  17
+public class HaskellParser_PDETest extends HaskellProjectTestCase {
  18
+
  19
+  public void testSimpleRead() throws Exception {
  20
+    importSourceFile( "Main.hs", "001", "Main.hs" );
  21
+    IFile file = getProject().getFile( "src/Main.hs" );
  22
+    assertTrue( file.exists() );
  23
+    
  24
+    IHaskellParser parser = ParserManager.getInstance().getParser();
  25
+    ICompilationUnit cu = parser.parse( file );
  26
+    assertTrue( cu != null );
  27
+    
  28
+    IModule[] modules = cu.getModules();
  29
+    assertTrue( modules.length == 1 );
  30
+    assertEquals( "Main", modules[ 0 ].getName() );
  31
+    ISourceLocation srcLoc = modules[ 0 ].getSourceLocation();
  32
+    assertEquals( 1, srcLoc.getLine() );
  33
+    assertEquals( 0, srcLoc.getColumn() );
  34
+  }
  35
+  
  36
+  public void testReadImports() throws Exception {
  37
+    IModule module = loadMainModule( "002" );
  38
+    IImport[] imports = module.getImports();
  39
+    assertTrue ( imports != null );
  40
+    assertEquals( 4, imports.length );
  41
+    
  42
+    assertEquals( "Foreign", imports[ 0 ].getImportedElement() );
  43
+    assertEquals( 3, imports[ 0 ].getSourceLocation().getLine() );
  44
+    assertEquals( 0, imports[ 0 ].getSourceLocation().getColumn() );
  45
+
  46
+    assertEquals( "Language.Haskell.Parser", imports[ 1 ].getImportedElement() );
  47
+    assertEquals( 4, imports[ 1 ].getSourceLocation().getLine() );
  48
+    assertEquals( 0, imports[ 1 ].getSourceLocation().getColumn() );
  49
+
  50
+    assertEquals( "Language.Haskell.Syntax", imports[ 2 ].getImportedElement() );
  51
+    assertEquals( 5, imports[ 2 ].getSourceLocation().getLine() );
  52
+    assertEquals( 0, imports[ 2 ].getSourceLocation().getColumn() );
  53
+    
  54
+    assertEquals( "CString", imports[ 3 ].getImportedElement() );
  55
+    assertEquals( 7, imports[ 3 ].getSourceLocation().getLine() );
  56
+    assertEquals( 0, imports[ 3 ].getSourceLocation().getColumn() );
  57
+  }
  58
+  
  59
+  public void testError() throws Exception {
  60
+    importSourceFile( "Main.hs", "003", "Main.hs" );
  61
+    IFile file = getProject().getFile( "src/Main.hs" );
  62
+    assertTrue( file.exists() );
  63
+
  64
+    IHaskellParser parser = ParserManager.getInstance().getParser();
  65
+    boolean exceptionOccured = false;
  66
+    try {
  67
+      ICompilationUnit cu = parser.parse( file );
  68
+    } catch( CoreException cex ) {
  69
+      exceptionOccured = true;
  70
+    }
  71
+    assertTrue( exceptionOccured );
  72
+  }
  73
+  
  74
+  public void testSimpleDecls() throws Exception {
  75
+    IModule module = loadMainModule( "004" );
  76
+    IImport[] imports = module.getImports();
  77
+    assertEquals( 1, imports.length );
  78
+    
  79
+    IDeclaration[] decls = module.getDeclarations();
  80
+    assertEquals( 4, decls.length );
  81
+  }
  82
+  
  83
+  public void testTypeSignatures() throws Exception {
  84
+    IModule module = loadMainModule( "005" );
  85
+    IDeclaration[] decls = module.getDeclarations();
  86
+    assertEquals( 4, decls.length );
  87
+    
  88
+    ITypeSignature ts1 = ( ITypeSignature )decls[ 0 ];
  89
+    assertEquals( 1, ts1.getIdentifiers().length );
  90
+    assertEquals( "idf1", ts1.getIdentifiers()[ 0 ] );
  91
+
  92
+    IFunctionBinding fb1 = ( IFunctionBinding )decls[ 1 ];
  93
+    assertEquals( 1, fb1.getMatches().length );
  94
+    IMatch match = fb1.getMatches()[ 0 ];
  95
+    assertEquals( "idf1", match.getName() );
  96
+    assertEquals( 6, match.getSourceLocation().getLine() );
  97
+    assertEquals( 0, match.getSourceLocation().getColumn() );
  98
+    
  99
+    ITypeSignature ts2 = ( ITypeSignature )decls[ 2 ];
  100
+    assertEquals( 2, ts2.getIdentifiers().length );
  101
+    assertEquals( "idf2", ts2.getIdentifiers()[ 0 ] );
  102
+    assertEquals( "idf3", ts2.getIdentifiers()[ 1 ] );
  103
+
  104
+    IPatternBinding pb1 = ( IPatternBinding )decls[ 3 ];
  105
+    assertEquals( 9, pb1.getSourceLocation().getLine() );
  106
+    assertEquals( 0, pb1.getSourceLocation().getColumn() );
  107
+  }
  108
+  
  109
+  public void testSimpleExports() throws Exception {
  110
+    IModule module = loadMainModule( "006" );
  111
+    IExportSpecification[] exports = module.getExportSpecifications();
  112
+    assertEquals( 2, exports.length );
  113
+    
  114
+    IExportVariable exportVar = ( IExportVariable )exports[ 0 ];
  115
+    assertEquals( "idf1", exportVar.getName() );
  116
+    IExportAbsolute exportAbs = ( IExportAbsolute )exports[ 1 ];
  117
+    assertEquals( "Bla", exportAbs.getName() );
  118
+  }
  119
+  
  120
+  public void testMoreExports() throws Exception {
  121
+    IModule module = loadMainModule( "007" );
  122
+    IExportSpecification[] exports = module.getExportSpecifications();
  123
+    assertEquals( 2, exports.length );
  124
+    
  125
+    IExportVariable exportVar = ( IExportVariable )exports[ 0 ];
  126
+    assertEquals( "idf1", exportVar.getName() );
  127
+
  128
+    IExportModuleContent emc = ( IExportModuleContent )exports[ 1 ];
  129
+    assertEquals( "Bla", emc.getName() );
  130
+  }
  131
+
  132
+  public void testExportWildcard() throws Exception {
  133
+    IModule module = loadMainModule( "008" );
  134
+    IExportSpecification[] exports = module.getExportSpecifications();
  135
+    assertEquals( 1, exports.length );
  136
+    IExportThingAll exportTA = ( IExportThingAll )exports[ 0 ];
  137
+    assertEquals( "Blubb", exportTA.getName() );
  138
+  }
  139
+
  140
+  public void testExportList() throws Exception {
  141
+    IModule module = loadMainModule( "009" );
  142
+    IExportSpecification[] exports = module.getExportSpecifications();
  143
+    assertEquals( 1, exports.length );
  144
+    IExportThingWith exportTW = ( IExportThingWith )exports[ 0 ];
  145
+    assertEquals( "Blubb", exportTW.getName() );
  146
+    
  147
+    IExportThingWithComponent[] names = exportTW.getComponents();
  148
+    assertEquals( 2, names.length );
  149
+    assertEquals( "Blabb", names[ 0 ].getName() );
  150
+    assertEquals( "Bloob", names[ 1 ].getName() );
  151
+  }
  152
+  
  153
+  public void testImportWithoutHiding() throws Exception {
  154
+    IModule module = loadMainModule( "010" );
  155
+    IImport[] imports = module.getImports();
  156
+    assertEquals( 2, imports.length );
  157
+    
  158
+    IImport imp1 = imports[ 0 ];
  159
+    assertEquals( 0, imp1.getImportSpecifications().length );
  160
+    assertEquals( "Bla", imp1.getImportedElement() );
  161
+
  162
+    IImport imp2 = imports[ 1 ];
  163
+    assertEquals( "Data.List", imp2.getImportedElement() );
  164
+
  165
+    IImportSpecification[] impSpecs = imp2.getImportSpecifications();
  166
+    assertEquals( 5, impSpecs.length );
  167
+    assertTrue( impSpecs[ 0 ].getImport() == imports[ 1 ] );
  168
+    assertEquals( "unzip4", impSpecs[ 1 ].getName() );
  169
+    assertEquals( "unzip6", impSpecs[ 3 ].getName() );
  170
+    assertFalse( imports[ 1 ].isHiding() );
  171
+  }
  172
+
  173
+  public void testImportWithHiding() throws Exception {
  174
+    IModule module = loadMainModule( "011" );
  175
+    IImport[] imports = module.getImports();
  176
+    assertEquals( 1, imports.length );
  177
+
  178
+    IImport imp = imports[ 0 ];
  179
+    assertEquals( "Prelude", imp.getImportedElement() );
  180
+
  181
+    IImportSpecification[] impSpecs = imp.getImportSpecifications();
  182
+    assertEquals( 2, impSpecs.length );
  183
+    assertTrue( impSpecs[ 0 ].getImport() == imports[ 0 ] );
  184
+    assertEquals( "max", impSpecs[ 0 ].getName() );
  185
+    assertEquals( "min", impSpecs[ 1 ].getName() );
  186
+    assertTrue( imports[ 0 ].isHiding() );
  187
+  }
  188
+
  189
+  public void testClassDecl() throws Exception {
  190
+    IModule module = loadMainModule( "012" );
  191
+    IDeclaration[] decls = module.getDeclarations();
  192
+    assertEquals( 2, decls.length );
  193
+    
  194
+    IClassDeclaration classDecl = ( IClassDeclaration )decls[ 0 ];
  195
+    assertEquals( "Hash", classDecl.getName() );
  196
+    
  197
+    IClassDeclaration classDecl2 = ( IClassDeclaration )decls[ 1 ];
  198
+    assertEquals( "Visible", classDecl2.getName() );
  199
+    ITypeSignature[] signatures = classDecl2.getTypeSignatures();
  200
+    assertEquals( 2, signatures.length );
  201
+    assertEquals( "toString", signatures[ 0 ].getIdentifiers()[ 0 ] );
  202
+    assertEquals( "size", signatures[ 1 ].getIdentifiers()[ 0 ] );
  203
+  }
  204
+
  205
+  public void testInstanceDecl() throws Exception {
  206
+    IModule module = loadMainModule( "013" );
  207
+    IDeclaration[] decls = module.getDeclarations();
  208
+    assertEquals( 1, decls.length );
  209
+
  210
+    IInstanceDeclaration decl = ( IInstanceDeclaration )decls[ 0 ];
  211
+    assertEquals( "Visible", decl.getName() );
  212
+    assertEquals( 2, decl.getSourceLocation().getLine() );
  213
+    assertEquals( 0, decl.getSourceLocation().getColumn() );
  214
+  }
  215
+
  216
+  public void testDefaultDecl() throws Exception {
  217
+    IModule module = loadMainModule( "014" );
  218
+    IDeclaration[] decls = module.getDeclarations();
  219
+    assertEquals( 1, decls.length );
  220
+    IDefaultDeclaration decl = ( IDefaultDeclaration )decls[ 0 ];
  221
+    assertEquals( "default declaration", decl.getName() );
  222
+    assertEquals( 2, decl.getSourceLocation().getLine() );
  223
+    assertEquals( 0, decl.getSourceLocation().getColumn() );
  224
+  }
  225
+
  226
+  public void testInfixDecl() throws Exception {
  227
+    IModule module = loadMainModule( "015" );
  228
+    IDeclaration[] decls = module.getDeclarations();
  229
+    assertEquals( 5, decls.length );
  230
+    
  231
+    IInfixDeclaration decl = ( IInfixDeclaration )decls[ 0 ];
  232
+    assertEquals( 5, decl.getPrecedenceLevel() );
  233
+    assertEquals( IInfixDeclaration.ASSOC_NONE, decl.getAssociativity() );
  234
+    assertEquals( 1, decl.getOperators().length );
  235
+    assertEquals( "op1", decl.getOperators()[ 0 ] );
  236
+    
  237
+    IInfixDeclaration decl1 = ( IInfixDeclaration )decls[ 1 ];
  238
+    assertEquals( 1, decl1.getPrecedenceLevel() );
  239
+    assertEquals( IInfixDeclaration.ASSOC_RIGHT, decl1.getAssociativity() );
  240
+    assertEquals( 1, decl1.getOperators().length );
  241
+    assertEquals( "op2", decl1.getOperators()[ 0 ] );
  242
+    
  243
+    IInfixDeclaration decl2 = ( IInfixDeclaration )decls[ 2 ];
  244
+    assertEquals( 5, decl2.getPrecedenceLevel() );
  245
+    assertEquals( IInfixDeclaration.ASSOC_LEFT, decl2.getAssociativity() );
  246
+    assertEquals( 1, decl2.getOperators().length );
  247
+    assertEquals( "op2", decl2.getOperators()[ 0 ] );
  248
+    
  249
+    IInfixDeclaration decl3 = ( IInfixDeclaration )decls[ 3 ];
  250
+    assertEquals( 5, decl3.getPrecedenceLevel() );
  251
+    assertEquals( IInfixDeclaration.ASSOC_NONE, decl3.getAssociativity() );
  252
+    assertEquals( 2, decl3.getOperators().length );
  253
+    assertEquals( "op1", decl3.getOperators()[ 0 ] );
  254
+    assertEquals( "op2", decl3.getOperators()[ 1 ] );
  255
+    
  256
+    IInfixDeclaration decl4 = ( IInfixDeclaration )decls[ 4 ];
  257
+    assertEquals( 0, decl4.getPrecedenceLevel() );
  258
+    assertEquals( IInfixDeclaration.ASSOC_LEFT, decl4.getAssociativity() );
  259
+    assertEquals( 3, decl4.getOperators().length );
  260
+    assertEquals( "op1", decl4.getOperators()[ 0 ] );
  261
+    assertEquals( "+", decl4.getOperators()[ 1 ] );
  262
+    assertEquals( "opx", decl4.getOperators()[ 2 ] );
  263
+  }
  264
+
  265
+  public void testTypeDecl() throws Exception {
  266
+    IModule module = loadMainModule( "016" );
  267
+    assertEquals( 1, module.getDeclarations().length );
  268
+    ITypeDeclaration decl = ( ITypeDeclaration )module.getDeclarations()[ 0 ];
  269
+    assertEquals( "Rec", decl.getName() );
  270
+    assertEquals( 2, decl.getSourceLocation().getLine() );
  271
+    assertEquals( 0, decl.getSourceLocation().getColumn() );
  272
+  }
  273
+  
  274
+  public void testNewTypeDecl() throws Exception {
  275
+    IModule module = loadMainModule( "017" );
  276
+    assertEquals( 1, module.getDeclarations().length );
  277
+    IDeclaration declaration = module.getDeclarations()[ 0 ];
  278
+    INewTypeDeclaration decl = ( INewTypeDeclaration )declaration;
  279
+    assertEquals( "Age", decl.getName() );
  280
+    assertEquals( 2, decl.getSourceLocation().getLine() );
  281
+    assertEquals( 0, decl.getSourceLocation().getColumn() );
  282
+  }
  283
+
  284
+  public void testDataDecl() throws Exception {
  285
+    IModule module = loadMainModule( "018" );
  286
+    assertEquals( 2, module.getDeclarations().length );
  287
+    
  288
+    IDataDeclaration decl = ( IDataDeclaration )module.getDeclarations()[ 0 ];
  289
+    assertEquals( "Set", decl.getName() );
  290
+    assertEquals( 2, decl.getSourceLocation().getLine() );
  291
+    assertEquals( 0, decl.getSourceLocation().getColumn() );
  292
+    assertEquals( 2, decl.getConstructors().length );
  293
+    
  294
+    IConstructor const0 = decl.getConstructors()[ 0 ];
  295
+    assertEquals( "NilSet", const0.getName() );
  296
+    assertEquals( 2, const0.getSourceLocation().getLine() );
  297
+    assertEquals( 21, const0.getSourceLocation().getColumn() );
  298
+    
  299
+    IConstructor const1 = decl.getConstructors()[ 1 ];
  300
+    assertEquals( "ConsSet", const1.getName() );
  301
+    assertEquals( 2, const1.getSourceLocation().getLine() );
  302
+    assertEquals( 30, const1.getSourceLocation().getColumn() );
  303
+    
  304
+    IDataDeclaration decl1 = ( IDataDeclaration )module.getDeclarations()[ 1 ];
  305
+    assertEquals( "Temp", decl1.getName() );
  306
+    assertEquals( 4, decl1.getSourceLocation().getLine() );
  307
+    assertEquals( 0, decl1.getSourceLocation().getColumn() );
  308
+    assertEquals( 2, decl1.getConstructors().length );
  309
+
  310
+    IConstructor const2 = decl1.getConstructors()[ 0 ];
  311
+    assertEquals( "Cold", const2.getName() );
  312
+    assertEquals( 4, const2.getSourceLocation().getLine() );
  313
+    assertEquals( 12, const2.getSourceLocation().getColumn() );
  314
+
  315
+    IConstructor const3 = decl1.getConstructors()[ 1 ];
  316
+    assertEquals( "Hot", const3.getName() );
  317
+    assertEquals( 4, const3.getSourceLocation().getLine() );
  318
+    assertEquals( 19, const3.getSourceLocation().getColumn() );
  319
+  }
  320
+
  321
+  public void testFunctionBinding() throws Exception {
  322
+    IModule module = loadMainModule( "019" );
  323
+    IDeclaration[] decls = module.getDeclarations();
  324
+    assertEquals( 2, decls.length );
  325
+    
  326
+    IFunctionBinding fb1 = ( IFunctionBinding )decls[ 1 ];
  327
+    assertEquals( 4, fb1.getSourceLocation().getLine() );
  328
+    assertEquals( 0, fb1.getSourceLocation().getColumn() );
  329
+    
  330
+    assertEquals( 3, fb1.getMatches().length );
  331
+    IMatch match = fb1.getMatches()[ 0 ];
  332
+    assertEquals( "bla", match.getName() );
  333
+    assertEquals( 4, match.getSourceLocation().getLine() );
  334
+    assertEquals( 0, match.getSourceLocation().getColumn() );
  335
+  }
  336
+  
  337
+  public void testRealWorldCrash() throws Exception {
  338
+    IModule module = loadMainModule( "024" );
  339
+    IDeclaration[] decls = module.getDeclarations();
  340
+    assertEquals( 1, decls.length );
  341
+    
  342
+    IClassDeclaration classDecl = ( IClassDeclaration )decls[ 0 ];
  343
+    assertEquals( "A", classDecl.getName() );
  344
+    
  345
+    ITypeSignature[] signatures = classDecl.getTypeSignatures();
  346
+    assertEquals( 1, signatures.length );
  347
+    assertEquals( "dummy", signatures[ 0 ].getIdentifiers()[ 0 ] );
  348
+  }
  349
+  
  350
+  
  351
+  // helping methods
  352
+  //////////////////
  353
+  
  354
+  private IModule loadMainModule( final String name ) throws Exception {
  355
+    importSourceFile( "Main.hs", name, "Main.hs" );
  356
+    IFile file = getProject().getFile( "src/Main.hs" );
  357
+    assertTrue( file.exists() );
  358
+    IHaskellParser parser = ParserManager.getInstance().getParser();
  359
+    ICompilationUnit cu = parser.parse( file );
  360
+    return cu.getModules()[ 0 ];
  361
+  }
  362
+}
113  ....eclipsefp.haskell.core.parser.test/src/net/sf/eclipsefp/haskell/core/parser/HaskellProjectTestCase.java
... ...
@@ -0,0 +1,113 @@
  1
+// Copyright (c) 2004-2005 by Leif Frenzel
  2
+// See http://leiffrenzel.de
  3
+package net.sf.eclipsefp.haskell.core.parser;
  4
+
  5
+import java.io.ByteArrayInputStream;
  6
+import java.io.InputStream;
  7
+
  8
+import junit.framework.TestCase;
  9
+
  10
+import org.eclipse.core.resources.*;
  11
+import org.eclipse.core.runtime.*;
  12
+
  13
+import de.leiffrenzel.fp.haskell.core.project.*;
  14
+
  15
+/** <p>the super class for test cases that run on a Haskell project.</p>
  16
+  *
  17
+  * @author Leif Frenzel
  18
+  */
  19
+public abstract class HaskellProjectTestCase extends TestCase {
  20
+
  21
+  private IProject project;
  22
+  
  23
+  protected IProject getProject() {
  24
+    return project;
  25
+  }
  26
+  
  27
+  protected void importSourceFile( final String fileName, 
  28
+                                   final String resFolder, 
  29
+                                   final String resName ) throws Exception {
  30
+    IHaskellProject hsProject = HaskellProjectManager.get( project );
  31
+    IPath path = hsProject.getSourcePath().append( fileName );
  32
+    IFile newFile = project.getFile( path );
  33
+    newFile.create( getStream( resFolder, resName, this ), true, null );
  34
+  }
  35
+  
  36
+  
  37
+  // interface methods of TestCase
  38
+  ////////////////////////////////
  39
+  
  40
+  protected void setUp() throws Exception {
  41
+    IWorkspaceRunnable op = new IWorkspaceRunnable() {
  42
+      public void run( final IProgressMonitor monitor ) throws CoreException {
  43
+        IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
  44
+        project = root.getProject( "TestProject-1" );
  45
+        project.create( null );
  46
+        project.open( null );
  47
+        
  48
+        setHaskellNature();
  49
+        createDefaultDescriptor();
  50
+        createDefaultFolders();
  51
+      }
  52
+    };
  53
+    ResourcesPlugin.getWorkspace().run( op, null, 0, null );
  54
+  }
  55
+  
  56
+  protected void tearDown() throws Exception {
  57
+    project.delete( true, null );
  58
+  }
  59
+  
  60
+  
  61
+  // helping methods
  62
+  //////////////////
  63
+  
  64
+  private void setHaskellNature() throws CoreException {
  65
+    IProjectDescription description = project.getDescription();
  66
+    description.setNatureIds( new String[] { HaskellNature.NATURE_ID } );
  67
+    project.setDescription( description, null );
  68
+  }
  69
+  
  70
+  public void createDefaultDescriptor() throws CoreException {
  71
+    String name = HaskellProjectManager.HASKELL_PROJECT_DESCRIPTOR;
  72
+    IFile file = project.getFile( name );
  73
+    String contents = HaskellProjectManager.createDescriptorContent( "src",
  74
+                                                                     "out",
  75
+                                                                     "bin",
  76
+                                                                     "x.exe" );
  77
+    writeFile( contents, file );
  78
+  }
  79
+  
  80
+  private void writeFile( final String input, 
  81
+                          final IFile newFile ) throws CoreException {
  82
+    InputStream is = new ByteArrayInputStream( input.getBytes() );
  83
+    newFile.create( is, true, null );
  84
+  }
  85
+  
  86
+  private void createDefaultFolders() throws CoreException {
  87
+    IHaskellProject hsProject = HaskellProjectManager.get( project );
  88
+    createFolder( hsProject.getSourcePath() );
  89
+    createFolder( hsProject.getBinPath() );
  90
+    createFolder( hsProject.getOutputPath() );
  91
+  }
  92
+  
  93
+  private void createFolder( final IPath folderPath ) throws CoreException {
  94
+    IFolder folder = project.getFolder( folderPath );
  95
+    folder.create( true, true, null );
  96
+  }
  97
+  
  98
+  private String constructName( final String folder, 
  99
+                                final String name,
  100
+                                final Object context ) {
  101
+    Package pack = context.getClass().getPackage();
  102
+    String packageName = pack.getName().replace( '.', '/' ) + "/res/";
  103
+    return packageName + folder + "/" + name;
  104
+  }
  105
+  
  106
+  private InputStream getStream( final String folder, 
  107
+                                 final String name,
  108
+                                 final Object context ) {
  109
+    String resourceName = constructName( folder, name, context );
  110
+    ClassLoader classLoader = context.getClass().getClassLoader();
  111
+    return classLoader.getResourceAsStream( resourceName );
  112
+  }
  113
+}
4  net.sf.eclipsefp.haskell.core.parser.test/src/net/sf/eclipsefp/haskell/core/parser/res/001/Main.hs
... ...
@@ -0,0 +1,4 @@
  1
+-- testing module for a simple case
  2
+module Main where
  3
+
  4
+main = print 42
10  net.sf.eclipsefp.haskell.core.parser.test/src/net/sf/eclipsefp/haskell/core/parser/res/002/Main.hs
... ...
@@ -0,0 +1,10 @@
  1
+-- testing module for a simple case
  2
+module Main where
  3
+
  4
+import Foreign
  5
+import Language.Haskell.Parser
  6
+import Language.Haskell.Syntax
  7
+
  8
+import CString
  9
+
  10
+main = print 42
4  net.sf.eclipsefp.haskell.core.parser.test/src/net/sf/eclipsefp/haskell/core/parser/res/003/Main.hs
... ...
@@ -0,0 +1,4 @@
  1
+-- testing module for an error case
  2
+modu le Main where
  3
+
  4
+main = print 42
10  net.sf.eclipsefp.haskell.core.parser.test/src/net/sf/eclipsefp/haskell/core/parser/res/004/Main.hs
... ...
@@ -0,0 +1,10 @@
  1
+-- testing module with some declarations
  2
+module Main where
  3
+
  4
+import Bla
  5
+
  6
+sabber :: Int -> Int
  7
+sabber n = n + 42
  8
+
  9
+laber :: Int
  10
+laber = 42
10  net.sf.eclipsefp.haskell.core.parser.test/src/net/sf/eclipsefp/haskell/core/parser/res/005/Main.hs
... ...
@@ -0,0 +1,10 @@
  1
+-- testing module with some declarations
  2
+module Main where
  3
+
  4
+import Bla
  5
+
  6
+idf1 :: Int -> Int
  7
+idf1 n = n + 42
</