[SCM] Lisaac eclipse plugin branch, master, updated. a72571f805c203ff87686bc23d5818d7bc65d53b

Damien Bouvarel dams.bouvarel at wanadoo.fr
Wed Mar 25 18:02:42 UTC 2009


The following commit has been merged in the master branch:
commit a72571f805c203ff87686bc23d5818d7bc65d53b
Author: Damien Bouvarel <dams.bouvarel at wanadoo.fr>
Date:   Wed Mar 25 15:36:25 2009 +0100

    update completion + prototype hover

diff --git a/README b/README
index e0cabc1..ff243be 100644
--- a/README
+++ b/README
@@ -1,5 +1,7 @@
    ------------------------------------
-        Lisaac Eclipse plugin.          ** Unstable version **
+        Lisaac Eclipse plugin.     
+           
+        ** Unstable version **
    ------------------------------------
 
 How to get started?
@@ -18,7 +20,7 @@ How to get started?
     - Import the 'eclipse' project (File->Import then select 'Existing Projects into Workspace').
     
     - First Run : open META-INF/MANIFEST.MF and click on the link 'Launch an Eclipse application'.
-    - Other Run :   Green toolbar button  Run->EclipseApplication or Run->Run As->EclipseApplication
+    - Other Run :   Green toolbar button  Run or Run->Run As->EclipseApplication
     
     - Install git plugin:  Help->Software Updates, in Available software tab click 'Add site...' and enter update site: http://www.jgit.org/update-site/  check 'Release Build' and click 'Install'.
     - Right-click on project in navigator view,  select Team->Share Project, then select 'Git'.
@@ -36,34 +38,34 @@ Quick Start into Source Code.
       -----------------------
       
    - META-INF/MANIFEST.MF               Main file for Plugin general settings -  edit within eclipse only.
-   - plugin.xml                                    Define Extensions Points that the plugin implements - edit within eclipse only.
-   - build.properties                           Define Plugin classpath for compilation - edit within eclipse only.
+   - plugin.xml                         Define Extensions Points that the plugin implements - edit within eclipse only.
+   - build.properties                   Define Plugin classpath for compilation - edit within eclipse only.
    
    - .project & .classpath & .settings  Eclipse files associated with the project - you may erase or replace them.       
    
-   - src/                                               Java implementation.
-   - help/                                             Help files used inside lisaac plugin, html doc (Help->Help contents) and sheetcheats (Help->Cheat Sheets...)
-   - icons/                                            Icons used in lisaac plugin.
-   - bin/                                               Java binary files (removed in git repository) This is automatically placed in jar file while releasing.
+   - src/                               Java implementation.
+   - help/                              Help files used inside lisaac plugin, html doc (Help->Help contents) and sheetcheats (Help->Cheat Sheets...)
+   - icons/                             Icons used in lisaac plugin.
+   - bin/                               Java binary files (removed in git repository) This is automatically placed in jar file while releasing.
    
    * Java Packages overview
      -------------------------------
      
-     - lisaac/                                         Main package, contain plugin activator, LisaacPlugin.java, this object follows plugin lifecycle.
-     - lisaac/actions                              Plugin menus actions, which implements IActionDelegate interface.
-     - lisaac/builder                              Incremental project builder - Handle calls to create & update Lisaac Models for each lisaac project.
-     - lisaac/editors                              Lisaac and Lip Editor. Handle syntax coloring, completion, hyperlinks...
-     - lisaac/launch                               Interface to call Lisaac Compiler and lisaac tools - Manage Lisaac Run Configuration (Run->Run configurations...)
-     - lisaac/model                                Manage and Parse Lisaac Models - Used by completion, colorer, hyperlinks, run...
-     - lisaac/model/items                      Parsing element of lisaac syntax tree. 
-     - lisaac/model/lip                           Parsing element of lip syntax tree. 
-     - lisaac/model/types                      Parsing types of lisaac syntax tree.
-     - lisaac/outline                              Elements displayed in Lisaac Outline view.
-     - lisaac/perspectives                     Define Lisaac Perspective.
-     - lisaac/preferences                      Add menus to Window->Preferences Menu in Lisaac section. 
-     - lisaac/properties                         Add menus to right-click Properties Menu for lisaac resources.
-     - lisaac/views                                Define Lisaac Views, Console, Outline view, ...
-     - lisaac/wizards                             Define Lisaac Wizards, New Lisaac Project, New Prototype, ...
+     - lisaac/                          Main package, contain plugin activator, LisaacPlugin.java, this object follows plugin lifecycle.
+     - lisaac/actions                   Plugin menus actions, which implements IActionDelegate interface.
+     - lisaac/builder                   Incremental project builder - Handle calls to create & update Lisaac Models for each lisaac project.
+     - lisaac/editors                   Lisaac and Lip Editor. Handle syntax coloring, completion, hyperlinks...
+     - lisaac/launch                    Interface to call Lisaac Compiler and lisaac tools - Manage Lisaac Run Configuration (Run->Run configurations...)
+     - lisaac/model                     Manage and Parse Lisaac Models - Used by completion, colorer, hyperlinks, run...
+     - lisaac/model/items               Parsing element of lisaac syntax tree. 
+     - lisaac/model/lip                 Parsing element of lip syntax tree. 
+     - lisaac/model/types               Parsing types of lisaac syntax tree.
+     - lisaac/outline                   Elements displayed in Lisaac Outline view.
+     - lisaac/perspectives              Define Lisaac Perspective.
+     - lisaac/preferences               Add menus to Window->Preferences Menu in Lisaac section. 
+     - lisaac/properties                Add menus to right-click Properties Menu for lisaac resources.
+     - lisaac/views                     Define Lisaac Views, Console, Outline view, ...
+     - lisaac/wizards                   Define Lisaac Wizards, New Lisaac Project, New Prototype, ...
     
     
      more to come...
@@ -76,6 +78,7 @@ Quick Start into Source Code.
      - Ctrl+click to explore Eclipse Java classes.
      - Think at java search and java refactoring.
      - use TODO tag and open task view (Window->Show View).
+     - 'Help->Help Contents' select 'Platform Plugin Developer Guide->Programmer's Guide'
      - when a file is 'Out of Sync' select 'Refresh' Menu in eclipse navigator.
      - Delete your eclipse .metadata (in workspace root) when its getting too big.
      - Project->Clean  when eclipse get confused.
diff --git a/plugin.xml b/plugin.xml
index 0d2cc72..856c0e6 100644
--- a/plugin.xml
+++ b/plugin.xml
@@ -1,235 +1,235 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.2"?>
-<plugin>
-
-   <extension
-         id="lisaacProblem"
-         name="Lisaac Problem"
-         point="org.eclipse.core.resources.markers">
-      <super
-            type="org.eclipse.core.resources.problemmarker">
-      </super>
-      <persistent
-            value="true">
-      </persistent>
-   </extension>
-   <extension
-         point="org.eclipse.ui.editors">
-      <editor
-            name="Lisaac Editor"
-            extensions="li"
-            icon="icons/sample.gif"
-            contributorClass="org.eclipse.ui.texteditor.BasicTextEditorActionContributor"
-            class="org.eclipse.lisaac.editors.LisaacEditor"
-            id="org.eclipse.lisaac.editors.LisaacEditor">
-      </editor>
-      <editor
-            class="org.eclipse.lisaac.editors.LipEditor"
-            contributorClass="org.eclipse.ui.texteditor.BasicTextEditorActionContributor"
-            default="false"
-            extensions="lip"
-            icon="icons/releng_gears.gif"
-            id="org.eclipse.lisaac.editors.LipEditor"
-            name="Lip Editor">
-      </editor>
-   </extension>
-   <extension
-         point="org.eclipse.ui.handlers">
-      <handler
-            commandId="org.eclipse.lisaac.commands.sampleCommand"
-            class="org.eclipse.lisaac.handlers.SampleHandler">
-      </handler>
-   </extension>
-   <extension
-         point="org.eclipse.help.toc">
-      <toc
-            file="help/toc.xml">
-      </toc>
-      <toc
-            file="help/testToc.xml"
-            primary="true">
-      </toc>
-   </extension>
-   <extension
-         point="org.eclipse.ui.perspectives">
-      <perspective
-            name="Lisaac Perspective"
-            icon="icons/releng_gears.gif"
-            class="org.eclipse.lisaac.perspectives.LisaacPerspective"
-            id="org.eclipse.lisaac.perspectives.LisaacPerspective">
-      </perspective>
-   </extension>
-   <extension
-         point="org.eclipse.ui.preferencePages">
-      <page
-            name="Lisaac Preferences"
-            class="org.eclipse.lisaac.preferences.LisaacPreferencePage"
-            id="org.eclipse.lisaac.preferences.LisaacPreferencePage">
-      </page>
-   </extension>
-   <extension
-         point="org.eclipse.core.runtime.preferences">
-      <initializer
-            class="org.eclipse.lisaac.preferences.PreferenceInitializer">
-      </initializer>
-   </extension>
-   <extension
-         point="org.eclipse.ui.propertyPages">
-      <page
-            class="org.eclipse.lisaac.properties.LisaacPropertyPage"
-            id="org.eclipse.lisaac.properties.lisaacPropertyPage"
-            name="Lisaac File Property"
-            nameFilter="*.li"
-            objectClass="org.eclipse.core.resources.IFile">
-      </page>
-      <page
-            class="org.eclipse.lisaac.properties.LisaacProjectPropertyPage"
-            id="org.eclipse.lisaac.properties.projectPropertyPage"
-            name="Lisaac Compiler"
-            objectClass="org.eclipse.core.resources.IProject">
-      </page>
-   </extension>
-   <extension
-         id="org.eclipse.lisaac.newWizard"
-         name="Lisaac Project Wizard"
-         point="org.eclipse.ui.newWizards">
-      <category
-            id="Lisaac"
-            name="Lisaac">
-      </category>
-      <wizard
-            canFinishEarly="false"
-            category="Lisaac"
-            class="org.eclipse.lisaac.wizards.NewProjectWizard"
-            finalPerspective="org.eclipse.lisaac.perspectives.LisaacPerspective"
-            hasPages="true"
-            icon="icons/sample.gif"
-            id="org.eclipse.lisaac.wizard"
-            name="Lisaac Project"
-            project="true">
-      </wizard>
-      <wizard
-            canFinishEarly="false"
-            category="Lisaac"
-            class="org.eclipse.lisaac.wizards.NewPrototypeWizard"
-            hasPages="true"
-            icon="icons/lisaac-file.png"
-            id="org.eclipse.lisaac.prototype"
-            name="Lisaac Prototype"
-            project="false">
-      </wizard>
-   </extension>
-   <extension
-         id="builder"
-         name="Lisaac Builder"
-         point="org.eclipse.core.resources.builders">
-      <builder
-            callOnEmptyDelta="false"
-            hasNature="true"
-            isConfigurable="false">
-         <run
-               class="org.eclipse.lisaac.builder.LisaacBuilder">
-         </run>
-      </builder>
-   </extension>
-   <extension
-         id="lisaac"
-         name="Lisaac Nature"
-         point="org.eclipse.core.resources.natures">
-      <runtime>
-         <run
-               class="org.eclipse.lisaac.builder.LisaacNature">
-         </run>
-      </runtime>
-      <builder
-            id="org.lisaac.builder">
-      </builder>
-   </extension>
-   <extension
-         point="org.eclipse.ui.console.consoleFactories">
-      <consoleFactory
-            class="org.eclipse.lisaac.views.ConsoleFactory"
-            label="Lisaac Console">
-      </consoleFactory>
-   </extension>
-   <extension
-         point="org.eclipse.debug.core.launchConfigurationTypes">
-      <launchConfigurationType
-            delegate="org.eclipse.lisaac.launch.LaunchConfiguration"
-            id="org.eclipse.lisaac.launchConfiguration"
-            modes="run"
-            name="Lisaac Application"
-            public="true">
-      </launchConfigurationType>
-   </extension>
-   <extension
-         point="org.eclipse.debug.ui.launchConfigurationTabGroups">
-      <launchConfigurationTabGroup
-            class="org.eclipse.lisaac.launch.LaunchConfigurationTabGroup"
-            id="org.eclipse.lisaac.LaunchConfigurationTabGroup"
-            type="org.eclipse.lisaac.launchConfiguration">
-      </launchConfigurationTabGroup>
-   </extension>
-   <extension
-         point="org.eclipse.ui.actionSets">
-      <actionSet
-            description="Lisaac Source Tools"
-            id="org.eclipse.lisaac.source"
-            label="Source"
-            visible="true">
-         <menu
-               id="org.eclipse.lisaac.sourcemenu"
-               label="Source">
-            <groupMarker
-                  name="indent">
-            </groupMarker>
-         </menu>
-         <action
-               class="org.eclipse.lisaac.actions.IndentAction"
-               definitionId="org.eclipse.lisaac.cmd1"
-               id="org.eclipse.lisaac.indentaction"
-               label="Correct Indentation"
-               menubarPath="org.eclipse.lisaac.sourcemenu/indent">
-         </action>
-      </actionSet>
-   </extension>
-   <extension
-         point="org.eclipse.ui.commands">
-      <command
-            categoryId="org.eclipse.lisaac.commands"
-            id="org.eclipse.lisaac.cmd1"
-            name="Indentation">
-      </command>
-      <category
-            id="org.eclipse.lisaac.commands"
-            name="Lisaac Command">
-      </category>
-   </extension>
-   <extension
-         point="org.eclipse.ui.bindings">
-      <key
-            commandId="org.eclipse.lisaac.cmd1"
-            contextId="org.eclipse.ui.textEditorScope"
-            schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
-            sequence="F2">
-      </key>
-   </extension>
-   <extension
-         point="org.eclipse.ui.cheatsheets.cheatSheetContent">
-      <category
-            id="org.eclipse.lisaac.cheatsheet"
-            name="Lisaac Development">
-      </category>
-      <cheatsheet
-            category="org.eclipse.lisaac.cheatsheet"
-            composite="false"
-            contentFile="help/sheet1_HelloWorld.xml"
-            id="org.eclipse.lisaac.cheatsheet1"
-            name="Lisaac HelloWorld">
-         <description>
-            Create a &quot;Hello World&quot; Lisaac application from scratch.
-         </description>
-      </cheatsheet>
-   </extension>
-
-</plugin>
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+
+   <extension
+         id="lisaacProblem"
+         name="Lisaac Problem"
+         point="org.eclipse.core.resources.markers">
+      <super
+            type="org.eclipse.core.resources.problemmarker">
+      </super>
+      <persistent
+            value="true">
+      </persistent>
+   </extension>
+   <extension
+         point="org.eclipse.ui.editors">
+      <editor
+            name="Lisaac Editor"
+            extensions="li"
+            icon="icons/sample.gif"
+            contributorClass="org.eclipse.ui.texteditor.BasicTextEditorActionContributor"
+            class="org.eclipse.lisaac.editors.LisaacEditor"
+            id="org.eclipse.lisaac.editors.LisaacEditor">
+      </editor>
+      <editor
+            class="org.eclipse.lisaac.editors.LipEditor"
+            contributorClass="org.eclipse.ui.texteditor.BasicTextEditorActionContributor"
+            default="false"
+            extensions="lip"
+            icon="icons/releng_gears.gif"
+            id="org.eclipse.lisaac.editors.LipEditor"
+            name="Lip Editor">
+      </editor>
+   </extension>
+   <extension
+         point="org.eclipse.ui.handlers">
+      <handler
+            commandId="org.eclipse.lisaac.commands.sampleCommand"
+            class="org.eclipse.lisaac.handlers.SampleHandler">
+      </handler>
+   </extension>
+   <extension
+         point="org.eclipse.help.toc">
+      <toc
+            file="help/toc.xml">
+      </toc>
+      <toc
+            file="help/testToc.xml"
+            primary="true">
+      </toc>
+   </extension>
+   <extension
+         point="org.eclipse.ui.perspectives">
+      <perspective
+            name="Lisaac Perspective"
+            icon="icons/releng_gears.gif"
+            class="org.eclipse.lisaac.perspectives.LisaacPerspective"
+            id="org.eclipse.lisaac.perspectives.LisaacPerspective">
+      </perspective>
+   </extension>
+   <extension
+         point="org.eclipse.ui.preferencePages">
+      <page
+            name="Lisaac Preferences"
+            class="org.eclipse.lisaac.preferences.LisaacPreferencePage"
+            id="org.eclipse.lisaac.preferences.LisaacPreferencePage">
+      </page>
+   </extension>
+   <extension
+         point="org.eclipse.core.runtime.preferences">
+      <initializer
+            class="org.eclipse.lisaac.preferences.PreferenceInitializer">
+      </initializer>
+   </extension>
+   <extension
+         point="org.eclipse.ui.propertyPages">
+      <page
+            class="org.eclipse.lisaac.properties.LisaacPropertyPage"
+            id="org.eclipse.lisaac.properties.lisaacPropertyPage"
+            name="Lisaac File Property"
+            nameFilter="*.li"
+            objectClass="org.eclipse.core.resources.IFile">
+      </page>
+      <page
+            class="org.eclipse.lisaac.properties.LisaacProjectPropertyPage"
+            id="org.eclipse.lisaac.properties.projectPropertyPage"
+            name="Lisaac Compiler"
+            objectClass="org.eclipse.core.resources.IProject">
+      </page>
+   </extension>
+   <extension
+         id="org.eclipse.lisaac.newWizard"
+         name="Lisaac Project Wizard"
+         point="org.eclipse.ui.newWizards">
+      <category
+            id="Lisaac"
+            name="Lisaac">
+      </category>
+      <wizard
+            canFinishEarly="false"
+            category="Lisaac"
+            class="org.eclipse.lisaac.wizards.NewProjectWizard"
+            finalPerspective="org.eclipse.lisaac.perspectives.LisaacPerspective"
+            hasPages="true"
+            icon="icons/sample.gif"
+            id="org.eclipse.lisaac.wizard"
+            name="Lisaac Project"
+            project="true">
+      </wizard>
+      <wizard
+            canFinishEarly="false"
+            category="Lisaac"
+            class="org.eclipse.lisaac.wizards.NewPrototypeWizard"
+            hasPages="true"
+            icon="icons/lisaac-file.png"
+            id="org.eclipse.lisaac.prototype"
+            name="Lisaac Prototype"
+            project="false">
+      </wizard>
+   </extension>
+   <extension
+         id="builder"
+         name="Lisaac Builder"
+         point="org.eclipse.core.resources.builders">
+      <builder
+            callOnEmptyDelta="false"
+            hasNature="true"
+            isConfigurable="false">
+         <run
+               class="org.eclipse.lisaac.builder.LisaacBuilder">
+         </run>
+      </builder>
+   </extension>
+   <extension
+         id="lisaac"
+         name="Lisaac Nature"
+         point="org.eclipse.core.resources.natures">
+      <runtime>
+         <run
+               class="org.eclipse.lisaac.builder.LisaacNature">
+         </run>
+      </runtime>
+      <builder
+            id="org.lisaac.builder">
+      </builder>
+   </extension>
+   <extension
+         point="org.eclipse.ui.console.consoleFactories">
+      <consoleFactory
+            class="org.eclipse.lisaac.views.ConsoleFactory"
+            label="Lisaac Console">
+      </consoleFactory>
+   </extension>
+   <extension
+         point="org.eclipse.debug.core.launchConfigurationTypes">
+      <launchConfigurationType
+            delegate="org.eclipse.lisaac.launch.LaunchConfiguration"
+            id="org.eclipse.lisaac.launchConfiguration"
+            modes="run"
+            name="Lisaac Application"
+            public="true">
+      </launchConfigurationType>
+   </extension>
+   <extension
+         point="org.eclipse.debug.ui.launchConfigurationTabGroups">
+      <launchConfigurationTabGroup
+            class="org.eclipse.lisaac.launch.LaunchConfigurationTabGroup"
+            id="org.eclipse.lisaac.LaunchConfigurationTabGroup"
+            type="org.eclipse.lisaac.launchConfiguration">
+      </launchConfigurationTabGroup>
+   </extension>
+   <extension
+         point="org.eclipse.ui.actionSets">
+      <actionSet
+            description="Lisaac Source Tools"
+            id="org.eclipse.lisaac.source"
+            label="Source"
+            visible="true">
+         <menu
+               id="org.eclipse.lisaac.sourcemenu"
+               label="Source">
+            <groupMarker
+                  name="indent">
+            </groupMarker>
+         </menu>
+         <action
+               class="org.eclipse.lisaac.actions.IndentAction"
+               definitionId="org.eclipse.lisaac.cmd1"
+               id="org.eclipse.lisaac.indentaction"
+               label="Correct Indentation"
+               menubarPath="org.eclipse.lisaac.sourcemenu/indent">
+         </action>
+      </actionSet>
+   </extension>
+   <extension
+         point="org.eclipse.ui.commands">
+      <command
+            categoryId="org.eclipse.lisaac.commands"
+            id="org.eclipse.lisaac.cmd1"
+            name="Indentation">
+      </command>
+      <category
+            id="org.eclipse.lisaac.commands"
+            name="Lisaac Command">
+      </category>
+   </extension>
+   <extension
+         point="org.eclipse.ui.bindings">
+      <key
+            commandId="org.eclipse.lisaac.cmd1"
+            contextId="org.eclipse.ui.textEditorScope"
+            schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
+            sequence="F2">
+      </key>
+   </extension>
+   <extension
+         point="org.eclipse.ui.cheatsheets.cheatSheetContent">
+      <category
+            id="org.eclipse.lisaac.cheatsheet"
+            name="Lisaac Development">
+      </category>
+      <cheatsheet
+            category="org.eclipse.lisaac.cheatsheet"
+            composite="false"
+            contentFile="help/sheet1_HelloWorld.xml"
+            id="org.eclipse.lisaac.cheatsheet1"
+            name="Lisaac HelloWorld">
+         <description>
+            Create a &quot;Hello World&quot; Lisaac application from scratch.
+         </description>
+      </cheatsheet>
+   </extension>
+
+</plugin>
diff --git a/src/org/eclipse/lisaac/editors/AbstractLisaacEditor.java b/src/org/eclipse/lisaac/editors/AbstractLisaacEditor.java
index f92c2f5..ed8a636 100644
--- a/src/org/eclipse/lisaac/editors/AbstractLisaacEditor.java
+++ b/src/org/eclipse/lisaac/editors/AbstractLisaacEditor.java
@@ -1,133 +1,133 @@
-package org.eclipse.lisaac.editors;
-
-import java.util.ListResourceBundle;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.ITextViewerExtension2;
-import org.eclipse.jface.text.source.ISourceViewer;
-import org.eclipse.lisaac.model.LisaacModel;
-import org.eclipse.lisaac.views.LisaacOutlineView;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.editors.text.TextEditor;
-import org.eclipse.ui.part.FileEditorInput;
-import org.eclipse.ui.texteditor.ContentAssistAction;
-import org.eclipse.ui.texteditor.ITextEditorActionDefinitionIds;
-import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
-
-/**
- * Main class for the Lisaac editor
- * @author Damien Bouvarel
- */
-public class AbstractLisaacEditor extends TextEditor {
-
-	private ColorManager colorManager;
-
-	 /** the outline view. */
-    private LisaacOutlineView outlineView;
-	
-	public AbstractLisaacEditor() {
-		super();
-		colorManager = new ColorManager();
-
-		setSourceViewerConfiguration(new LisaacConfiguration(colorManager));
-		setDocumentProvider(new LisaacDocumentProvider());
-	}
-	
-	public IDocument getDocument() {
-		return getDocumentProvider().getDocument(getEditorInput());
-	}
-
-	public void dispose() {
-		colorManager.dispose();
-		super.dispose();
-	}
-
-	public static class MyResources extends ListResourceBundle {
-        public Object[][] getContents() {
-            return contents;
-        }
-
-        static final Object[][] contents = { { "CorrectionAssist", "CorrectionAssist" }, { "ContentAssistProposal", "ContentAssistProposal" }, { "TemplateProposals", "TemplateProposals" }, };
-    }
-	
-	protected void createActions() {
-		super.createActions();
-	
-		MyResources ressources = new MyResources();
-		
-		Action action = new ContentAssistAction(ressources, "ContentAssistProposal.", this); //$NON-NLS-1$
-		String id = ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS;
-		action.setActionDefinitionId(id);
-		setAction("ContentAssistProposal", action); 
-		markAsStateDependentAction("ContentAssistProposal", true);
-	}
-	
-	public void doSave(IProgressMonitor progressMonitor) {
-		super.doSave(progressMonitor);
-		
-		LisaacModel model = LisaacModel.getModel(getProject());
-		if (model != null) {
-			model.buildAll(); 
-		}
-	}
-	/**
-	 * Redraw whole text presentation of the editor
-	 */
-	public void refreshPresentation() {
-		refreshPresentation(0, getDocument().getLength());
-	}
-	/**
-	 * Redraw region of text presentation of the editor
-	 * @param offset redraw region offset
-	 * @param length redraw region length
-	 */
-	public void refreshPresentation(int offset, int length) {
-		ISourceViewer viewer = getSourceViewer();
-		if (viewer instanceof ITextViewerExtension2) {
-			ITextViewerExtension2 ext = (ITextViewerExtension2) viewer;
-			ext.invalidateTextPresentation(offset, length);
-		}
-	}
-	
-	 /**
-     * @return the project for the file that's being edited (or null if not available)
-     */
-    public IProject getProject() {
-        IEditorInput editorInput = this.getEditorInput();
-        if (editorInput instanceof FileEditorInput) {
-            IFile file = (IFile) ((FileEditorInput) editorInput).getAdapter(IFile.class);
-            return file.getProject();
-        }
-        return null;
-    }
-    
-    /**
-     * @return the file name for the file that's being edited (or null if not available)
-     */
-    public String getFileName() {
-        IEditorInput editorInput = this.getEditorInput();
-        if (editorInput instanceof FileEditorInput) {
-            IFile file = (IFile) ((FileEditorInput) editorInput).getAdapter(IFile.class);
-            return file.getName();
-        }
-        return null;
-    }
-    
-    /**
-     * @see AbstractTextEditor#getAdapter(java.lang.Class)
-     */
-	public Object getAdapter(Class required) {
-        if (IContentOutlinePage.class.equals(required)) {
-            if (outlineView == null) {
-                outlineView = new LisaacOutlineView(getDocumentProvider(), this);
-            }
-            return outlineView;
-         } else {
-             return super.getAdapter(required);
-         }
-    }
-}
+package org.eclipse.lisaac.editors;
+
+import java.util.ListResourceBundle;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.ITextViewerExtension2;
+import org.eclipse.jface.text.source.ISourceViewer;
+import org.eclipse.lisaac.model.LisaacModel;
+import org.eclipse.lisaac.views.LisaacOutlineView;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.editors.text.TextEditor;
+import org.eclipse.ui.part.FileEditorInput;
+import org.eclipse.ui.texteditor.ContentAssistAction;
+import org.eclipse.ui.texteditor.ITextEditorActionDefinitionIds;
+import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
+
+/**
+ * Main class for the Lisaac editor
+ * @author Damien Bouvarel
+ */
+public class AbstractLisaacEditor extends TextEditor {
+
+	private ColorManager colorManager;
+
+	 /** the outline view. */
+    private LisaacOutlineView outlineView;
+	
+	public AbstractLisaacEditor() {
+		super();
+		colorManager = new ColorManager();
+
+		setSourceViewerConfiguration(new LisaacConfiguration(colorManager,this));
+		setDocumentProvider(new LisaacDocumentProvider());
+	}
+	
+	public IDocument getDocument() {
+		return getDocumentProvider().getDocument(getEditorInput());
+	}
+
+	public void dispose() {
+		colorManager.dispose();
+		super.dispose();
+	}
+
+	public static class MyResources extends ListResourceBundle {
+        public Object[][] getContents() {
+            return contents;
+        }
+
+        static final Object[][] contents = { { "CorrectionAssist", "CorrectionAssist" }, { "ContentAssistProposal", "ContentAssistProposal" }, { "TemplateProposals", "TemplateProposals" }, };
+    }
+	
+	protected void createActions() {
+		super.createActions();
+	
+		MyResources ressources = new MyResources();
+		
+		Action action = new ContentAssistAction(ressources, "ContentAssistProposal.", this); //$NON-NLS-1$
+		String id = ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS;
+		action.setActionDefinitionId(id);
+		setAction("ContentAssistProposal", action); 
+		markAsStateDependentAction("ContentAssistProposal", true);
+	}
+	
+	public void doSave(IProgressMonitor progressMonitor) {
+		super.doSave(progressMonitor);
+		
+		LisaacModel model = LisaacModel.getModel(getProject());
+		if (model != null) {
+			model.buildAll(); 
+		}
+	}
+	/**
+	 * Redraw whole text presentation of the editor
+	 */
+	public void refreshPresentation() {
+		refreshPresentation(0, getDocument().getLength());
+	}
+	/**
+	 * Redraw region of text presentation of the editor
+	 * @param offset redraw region offset
+	 * @param length redraw region length
+	 */
+	public void refreshPresentation(int offset, int length) {
+		ISourceViewer viewer = getSourceViewer();
+		if (viewer instanceof ITextViewerExtension2) {
+			ITextViewerExtension2 ext = (ITextViewerExtension2) viewer;
+			ext.invalidateTextPresentation(offset, length);
+		}
+	}
+	
+	 /**
+     * @return the project for the file that's being edited (or null if not available)
+     */
+    public IProject getProject() {
+        IEditorInput editorInput = this.getEditorInput();
+        if (editorInput instanceof FileEditorInput) {
+            IFile file = (IFile) ((FileEditorInput) editorInput).getAdapter(IFile.class);
+            return file.getProject();
+        }
+        return null;
+    }
+    
+    /**
+     * @return the file name for the file that's being edited (or null if not available)
+     */
+    public String getFileName() {
+        IEditorInput editorInput = this.getEditorInput();
+        if (editorInput instanceof FileEditorInput) {
+            IFile file = (IFile) ((FileEditorInput) editorInput).getAdapter(IFile.class);
+            return file.getName();
+        }
+        return null;
+    }
+    
+    /**
+     * @see AbstractTextEditor#getAdapter(java.lang.Class)
+     */
+	public Object getAdapter(Class required) {
+        if (IContentOutlinePage.class.equals(required)) {
+            if (outlineView == null) {
+                outlineView = new LisaacOutlineView(getDocumentProvider(), this);
+            }
+            return outlineView;
+         } else {
+             return super.getAdapter(required);
+         }
+    }
+}
diff --git a/src/org/eclipse/lisaac/editors/LisaacCompletionProcessor.java b/src/org/eclipse/lisaac/editors/LisaacCompletionProcessor.java
index dee94b3..eea28e0 100644
--- a/src/org/eclipse/lisaac/editors/LisaacCompletionProcessor.java
+++ b/src/org/eclipse/lisaac/editors/LisaacCompletionProcessor.java
@@ -1,140 +1,140 @@
-package org.eclipse.lisaac.editors;
-
-import java.util.ArrayList;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.ITextViewer;
-import org.eclipse.jface.text.contentassist.CompletionProposal;
-import org.eclipse.jface.text.contentassist.ICompletionProposal;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.text.contentassist.IContextInformation;
-import org.eclipse.jface.text.contentassist.IContextInformationValidator;
-import org.eclipse.lisaac.LisaacPlugin;
-import org.eclipse.lisaac.builder.ILisaacErrorHandler;
-import org.eclipse.lisaac.model.LisaacCompletionParser;
-import org.eclipse.lisaac.model.LisaacModel;
-import org.eclipse.lisaac.model.LisaacParser;
-import org.eclipse.lisaac.model.Position;
-import org.eclipse.lisaac.model.items.ICode;
-import org.eclipse.lisaac.model.items.Prototype;
-import org.eclipse.lisaac.model.types.IType;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchWindow;
-
-
-public class LisaacCompletionProcessor implements IContentAssistProcessor {
-
-	private final IContextInformation[] NO_CONTEXTS = new IContextInformation[0];
-	private final char[] PROPOSAL_ACTIVATION_CHARS = new char[] { '.', '('};
-	private ICompletionProposal[] NO_COMPLETIONS = new ICompletionProposal[0];
-
-
-	public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int offset) {
-		try {
-			IDocument document = viewer.getDocument();
-			ArrayList<CompletionProposal> result = new ArrayList<CompletionProposal>();
-
-			//
-			computeLisaacCompletion(document, offset, result);
-			//
-			String prefix = lastWord(document, offset);
-
-			if (prefix.startsWith("Sec")) {
-				result.add(new CompletionProposal("Section",3,4,3));
-			}
-
-			return (ICompletionProposal[]) result.toArray(new ICompletionProposal[result.size()]);
-		} catch (Exception e) {
-			// ... log the exception ...
-			return NO_COMPLETIONS;
-		}
-
-	}
-
-	private void computeLisaacCompletion(IDocument document, int baseOffset, 
-			ArrayList<CompletionProposal> proposals) {
-		int bracketLevel=0;
-		//
-		// Rewind to '('  ';' '['
-		//
-		try {
-			int pos = baseOffset-1;
-			while (pos > 0) {
-				char c = document.getChar(pos);
-				if (c == ';') {
-					break;
-				}
-				if (c == '(' || c == '[') {
-					if (bracketLevel == 0) {
-						break;
-					}
-					bracketLevel--;
-				}
-				if (c == ')' || c == ']') {
-					bracketLevel++;
-				}
-				pos--;
-			}
-			if (pos > 0) {
-				//
-				// compute lisaac expression type
-				//
-				String contents = document.get(pos+1, baseOffset-1 - pos);
-
-				LisaacCompletionParser parser = new LisaacCompletionParser(contents);
-				parser.parseCompletions(pos+1, baseOffset, proposals);
-			}
-		} catch (BadLocationException e) {
-		} catch (CoreException e) {
-			// TODO Auto-generated catch block
-			e.printStackTrace();
-		}
-	}
-
-	
-
-	private String lastWord(IDocument doc, int offset) {
-		try {
-			for (int n = offset-1; n >= 0; n--) {
-				char c = doc.getChar(n);
-				if (!Character.isJavaIdentifierPart(c))
-					return doc.get(n + 1, offset-n-1);
-			}
-		} catch (BadLocationException e) {
-			// ... log the exception ...
-		}
-		return "";
-	}
-
-
-	public IContextInformation[] computeContextInformation(ITextViewer viewer,
-			int offset) {
-		return NO_CONTEXTS;
-	}
-
-
-	public char[] getCompletionProposalAutoActivationCharacters() {
-		return PROPOSAL_ACTIVATION_CHARS;
-	}
-
-
-	public char[] getContextInformationAutoActivationCharacters() {
-		return null;
-	}
-
-	public IContextInformationValidator getContextInformationValidator() {
-		return null;
-	}
-
-	public String getErrorMessage() {
-		return "Lisaac Completion error";
-	}
-
-}
+package org.eclipse.lisaac.editors;
+
+import java.util.ArrayList;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.ITextViewer;
+import org.eclipse.jface.text.contentassist.CompletionProposal;
+import org.eclipse.jface.text.contentassist.ICompletionProposal;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.text.contentassist.IContextInformation;
+import org.eclipse.jface.text.contentassist.IContextInformationValidator;
+import org.eclipse.lisaac.LisaacPlugin;
+import org.eclipse.lisaac.builder.ILisaacErrorHandler;
+import org.eclipse.lisaac.model.LisaacCompletionParser;
+import org.eclipse.lisaac.model.LisaacModel;
+import org.eclipse.lisaac.model.LisaacParser;
+import org.eclipse.lisaac.model.Position;
+import org.eclipse.lisaac.model.items.ICode;
+import org.eclipse.lisaac.model.items.Prototype;
+import org.eclipse.lisaac.model.types.IType;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.IWorkbenchWindow;
+
+
+public class LisaacCompletionProcessor implements IContentAssistProcessor {
+
+	private final IContextInformation[] NO_CONTEXTS = new IContextInformation[0];
+	private final char[] PROPOSAL_ACTIVATION_CHARS = new char[] { '.', '('};
+	private ICompletionProposal[] NO_COMPLETIONS = new ICompletionProposal[0];
+
+
+	public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int offset) {
+		try {
+			IDocument document = viewer.getDocument();
+			ArrayList<CompletionProposal> result = new ArrayList<CompletionProposal>();
+
+			//
+			computeLisaacCompletion(document, offset, result);
+			//
+			String prefix = lastWord(document, offset);
+
+			if (prefix.startsWith("Sec")) {
+				result.add(new CompletionProposal("Section",3,4,3));
+			}
+
+			return (ICompletionProposal[]) result.toArray(new ICompletionProposal[result.size()]);
+		} catch (Exception e) {
+			// ... log the exception ...
+			return NO_COMPLETIONS;
+		}
+
+	}
+
+	private void computeLisaacCompletion(IDocument document, int baseOffset, 
+			ArrayList<CompletionProposal> proposals) {
+		int bracketLevel=0;
+		//
+		// Rewind to '('  ';' '['
+		//
+		try {
+			int pos = baseOffset-1;
+			while (pos > 0) {
+				char c = document.getChar(pos);
+				if (c == ';') {
+					break;
+				}
+				if (c == '(' || c == '[') {
+					if (bracketLevel == 0) {
+						break;
+					}
+					bracketLevel--;
+				}
+				if (c == ')' || c == ']') {
+					bracketLevel++;
+				}
+				pos--;
+			}
+			if (pos > 0) {
+				//
+				// compute lisaac expression type
+				//
+				String contents = document.get(pos+1, baseOffset-1 - pos);
+
+				LisaacCompletionParser parser = new LisaacCompletionParser(contents);
+				parser.parseCompletions(pos+1, baseOffset, proposals);
+			}
+		} catch (BadLocationException e) {
+		} catch (CoreException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+	}
+
+	
+
+	private String lastWord(IDocument doc, int offset) {
+		try {
+			for (int n = offset-1; n >= 0; n--) {
+				char c = doc.getChar(n);
+				if (!Character.isJavaIdentifierPart(c))
+					return doc.get(n + 1, offset-n-1);
+			}
+		} catch (BadLocationException e) {
+			// ... log the exception ...
+		}
+		return "";
+	}
+
+
+	public IContextInformation[] computeContextInformation(ITextViewer viewer,
+			int offset) {
+		return NO_CONTEXTS;
+	}
+
+
+	public char[] getCompletionProposalAutoActivationCharacters() {
+		return PROPOSAL_ACTIVATION_CHARS;
+	}
+
+
+	public char[] getContextInformationAutoActivationCharacters() {
+		return null;
+	}
+
+	public IContextInformationValidator getContextInformationValidator() {
+		return null;
+	}
+
+	public String getErrorMessage() {
+		return "Lisaac Completion error";
+	}
+
+}
diff --git a/src/org/eclipse/lisaac/editors/LisaacConfiguration.java b/src/org/eclipse/lisaac/editors/LisaacConfiguration.java
index a9f26b1..bc61bf2 100644
--- a/src/org/eclipse/lisaac/editors/LisaacConfiguration.java
+++ b/src/org/eclipse/lisaac/editors/LisaacConfiguration.java
@@ -1,9 +1,11 @@
 package org.eclipse.lisaac.editors;
 
+import org.eclipse.core.resources.IProject;
 import org.eclipse.jface.text.DefaultIndentLineAutoEditStrategy;
 import org.eclipse.jface.text.IAutoEditStrategy;
 import org.eclipse.jface.text.IDocument;
 import org.eclipse.jface.text.ITextDoubleClickStrategy;
+import org.eclipse.jface.text.ITextHover;
 import org.eclipse.jface.text.TextAttribute;
 import org.eclipse.jface.text.contentassist.ContentAssistant;
 import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
@@ -15,6 +17,10 @@ import org.eclipse.jface.text.presentation.PresentationReconciler;
 import org.eclipse.jface.text.rules.Token;
 import org.eclipse.jface.text.source.ISourceViewer;
 import org.eclipse.jface.text.source.SourceViewerConfiguration;
+import org.eclipse.lisaac.LisaacPlugin;
+import org.eclipse.lisaac.model.LisaacModel;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.IWorkbenchWindow;
 
 /**
  * Manage the configuration of syntax coloration for lisaac documents.
@@ -25,9 +31,13 @@ public class LisaacConfiguration extends SourceViewerConfiguration {
 	private ColorManager colorManager;
 
 	private ContentAssistant contentAssistant = null;
+	private ITextHover textHover = null;
 	
-	public LisaacConfiguration(ColorManager colorManager) {
+	private AbstractLisaacEditor editor;
+	
+	public LisaacConfiguration(ColorManager colorManager, AbstractLisaacEditor editor) {
 		this.colorManager = colorManager;
+		this.editor = editor;
 	}
 	public String[] getConfiguredContentTypes(ISourceViewer sourceViewer) {
 		return new String[] {
@@ -56,8 +66,11 @@ public class LisaacConfiguration extends SourceViewerConfiguration {
 			contentAssistant = new ContentAssistant();
 			IContentAssistProcessor cap = new LisaacCompletionProcessor();
 			contentAssistant.setContentAssistProcessor(cap, IDocument.DEFAULT_CONTENT_TYPE);
-		//	contentAssistant.setInformationControlCreator(getInformationControlCreator(sourceViewer));
-			
+			//
+			contentAssistant.setRepeatedInvocationMode(true);
+			contentAssistant.setStatusLineVisible(true);
+			contentAssistant.setStatusMessage("Lisaac Completion");
+			//
 			contentAssistant.enableAutoActivation(true);
 			contentAssistant.setAutoActivationDelay(500);
 			contentAssistant.setProposalPopupOrientation(IContentAssistant.PROPOSAL_OVERLAY);
@@ -65,6 +78,19 @@ public class LisaacConfiguration extends SourceViewerConfiguration {
         return contentAssistant;
 	}
 	
+	public ITextHover getTextHover(ISourceViewer sourceViewer, String contentType) {
+		if (textHover != null) {
+			return textHover;
+		}
+		if (editor != null) {
+			IProject project = editor.getProject();
+	
+			LisaacModel model = LisaacModel.getModel(project);
+			textHover = new LisaacTextHover(model);
+		}
+		return textHover;
+	}
+	
 	/**
      * @see SourceViewerConfiguration#getAutoEditStrategies(ISourceViewer, String)
      */
diff --git a/src/org/eclipse/lisaac/editors/LisaacHyperLinkDetector.java b/src/org/eclipse/lisaac/editors/LisaacHyperLinkDetector.java
index a65f116..ebad956 100644
--- a/src/org/eclipse/lisaac/editors/LisaacHyperLinkDetector.java
+++ b/src/org/eclipse/lisaac/editors/LisaacHyperLinkDetector.java
@@ -1,62 +1,62 @@
-package org.eclipse.lisaac.editors;
-
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.ITextViewer;
-import org.eclipse.jface.text.Region;
-import org.eclipse.jface.text.hyperlink.AbstractHyperlinkDetector;
-import org.eclipse.jface.text.hyperlink.IHyperlink;
-
-
-public class LisaacHyperLinkDetector extends AbstractHyperlinkDetector {
-
-	public IHyperlink[] detectHyperlinks(ITextViewer textViewer,
-			IRegion region, boolean canShowMultipleHyperlinks) {
-
-		if (region == null || textViewer == null)
-			return null;
-
-		IDocument document= textViewer.getDocument();
-		if (document == null)
-			return null;
-
-		try {
-			int offset= region.getOffset();
-			
-			IRegion wordRegion = selectWord(document, offset);
-			String prototypeString = document.get(wordRegion.getOffset(), wordRegion.getLength());
-			
-			return new IHyperlink[] {new PrototypeHyperLink(wordRegion, prototypeString)};
-
-		} catch (BadLocationException e) {
-			return null;
-		}
-	}
-
-	protected IRegion selectWord(IDocument doc, int caretPos) throws BadLocationException {
-		int startPos, endPos;
-
-		int pos = caretPos;
-		char c;
-
-		while (pos >= 0) {
-			c = doc.getChar(pos);
-			if (!Character.isJavaIdentifierPart(c))
-				break;
-			--pos;
-		}
-		startPos = pos+1;
-		pos = caretPos;
-		int length = doc.getLength();
-		
-		while (pos < length) {
-			c = doc.getChar(pos);
-			if (!Character.isJavaIdentifierPart(c))
-				break;
-			++pos;
-		}
-		endPos = pos;
-		return new Region(startPos, endPos - startPos);
-	}
-}
+package org.eclipse.lisaac.editors;
+
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.IRegion;
+import org.eclipse.jface.text.ITextViewer;
+import org.eclipse.jface.text.Region;
+import org.eclipse.jface.text.hyperlink.AbstractHyperlinkDetector;
+import org.eclipse.jface.text.hyperlink.IHyperlink;
+
+
+public class LisaacHyperLinkDetector extends AbstractHyperlinkDetector {
+
+	public IHyperlink[] detectHyperlinks(ITextViewer textViewer,
+			IRegion region, boolean canShowMultipleHyperlinks) {
+
+		if (region == null || textViewer == null)
+			return null;
+
+		IDocument document= textViewer.getDocument();
+		if (document == null)
+			return null;
+
+		try {
+			int offset= region.getOffset();
+			
+			IRegion wordRegion = selectWord(document, offset);
+			String prototypeString = document.get(wordRegion.getOffset(), wordRegion.getLength());
+			
+			return new IHyperlink[] {new PrototypeHyperLink(wordRegion, prototypeString)};
+
+		} catch (BadLocationException e) {
+			return null;
+		}
+	}
+
+	protected IRegion selectWord(IDocument doc, int caretPos) throws BadLocationException {
+		int startPos, endPos;
+
+		int pos = caretPos;
+		char c;
+
+		while (pos >= 0) {
+			c = doc.getChar(pos);
+			if (!Character.isJavaIdentifierPart(c))
+				break;
+			--pos;
+		}
+		startPos = pos+1;
+		pos = caretPos;
+		int length = doc.getLength();
+		
+		while (pos < length) {
+			c = doc.getChar(pos);
+			if (!Character.isJavaIdentifierPart(c))
+				break;
+			++pos;
+		}
+		endPos = pos;
+		return new Region(startPos, endPos - startPos);
+	}
+}
diff --git a/src/org/eclipse/lisaac/editors/LisaacScanner.java b/src/org/eclipse/lisaac/editors/LisaacScanner.java
index 6528940..70127a6 100644
--- a/src/org/eclipse/lisaac/editors/LisaacScanner.java
+++ b/src/org/eclipse/lisaac/editors/LisaacScanner.java
@@ -1,322 +1,340 @@
-package org.eclipse.lisaac.editors;
-
-import org.eclipse.jface.text.*;
-import org.eclipse.jface.text.rules.*;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.RGB;
-
-class LisaacWhitespaceDetector implements IWhitespaceDetector {
-	public boolean isWhitespace(char c) {
-		return (c == ' ' || c == '\t' || c == '\n' || c == '\r');
-		// return c.isWhitespace();
-	}
-}
-
-class LisaacPrototypeDetector implements IWordDetector {
-	public boolean isWordPart(char c) {
-		return (Character.isLetter(c) && Character.isUpperCase(c))
-		|| Character.isDigit(c) || c == '_';
-	}
-
-	public boolean isWordStart(char c) {
-		return (Character.isLetter(c) && Character.isUpperCase(c)) || c == '_';
-	}
-}
-
-class LisaacNumberDetector implements IWordDetector {
-	public boolean isWordPart(char c) {
-		return Character.isLetterOrDigit(c);
-	}
-
-	public boolean isWordStart(char c) {
-		return Character.isDigit(c);
-	}
-}
-
-class LisaacKeywordDetector implements IWordDetector {
-	public boolean isWordPart(char c) {
-		return Character.isLetter(c) && Character.isLowerCase(c);
-	}
-
-	public boolean isWordStart(char c) {
-		return Character.isLetter(c) && Character.isUpperCase(c);
-	}
-}
-
-class LisaacWordDetector implements IWordDetector {
-	public boolean isWordPart(char c) {
-		return (Character.isLetter(c) && Character.isLowerCase(c))
-		|| Character.isDigit(c) || c == '_';
-	}
-
-	public boolean isWordStart(char c) {
-		return (Character.isLetter(c) && Character.isLowerCase(c)) || c == '_';
-	}
-}
-
-/**
- * Lisaac code scanner.<br>
- * Scan a range of a document into tokens, the scanner is used by the repairer
- * to create the text presentation.
- */
-public class LisaacScanner extends RuleBasedScanner {
-	private ColorManager manager;
-
-	private static String[] keywords = new String[] { "Section", "Public",
-		"Private", "Inherit", "Header", "Insert", "Mapping", "Interrupt",
-		"External", "Directory", 
-		"Expanded", "Strict",
-		"Left", "Right",
-		"Self",};
-
-	// Lisaac tokens
-	private IToken stringToken;
-	private IToken characterToken;
-	private IToken numberToken;
-	private IToken prototypeToken;
-	private IToken prototypeStyleToken;
-	private IToken keywordToken;
-	private IToken localVariableToken;
-	private IToken operatorToken;
-	private IToken externalToken;
-	private IToken undefinedToken;
-
-	private TextAttribute getAttribute(RGB rgb) {
-		return new TextAttribute(manager.getColor(rgb));
-	}
-
-	/*// italic, bold, etc..
-	 * private TextAttribute getAttributeSpecial(RGB rgb, int font) { return new
-	 * TextAttribute(manager.getColor(rgb),null, font); }
-	 */
-
-	/**
-	 * Creates a new Lisaac scanner.
-	 */
-	public LisaacScanner(ColorManager manager) {
-		this.manager = manager;
-		/*
-		 * Create lisaac tokens.
-		 */
-
-		stringToken = new Token(getAttribute(ILisaacColor.STRING));
-		characterToken = new Token(getAttribute(ILisaacColor.CHARACTER));
-		numberToken = new Token(getAttribute(ILisaacColor.NUMBER));
-		prototypeToken = new Token(getAttribute(ILisaacColor.PROTOTYPE));
-		prototypeStyleToken = new Token(
-				getAttribute(ILisaacColor.PROTOTYPE_STYLE));
-		keywordToken = new Token(getAttribute(ILisaacColor.KEYWORD));
-		localVariableToken = new Token(getAttribute(ILisaacColor.DEFAULT));
-		operatorToken = new Token(getAttribute(ILisaacColor.OPERATOR));
-		externalToken = new Token(new TextAttribute(manager
-				.getColor(ILisaacColor.DEFAULT), manager
-				.getColor(ILisaacColor.EXTERNAL), SWT.NORMAL));
-		undefinedToken = new Token(getAttribute(ILisaacColor.UNDEFINED));
-
-		/*
-		 * Create basic lisaac rules.
-		 */
-		IRule[] rules = new IRule[8];
-
-		// Add rule for processing strings
-		rules[0] = new SingleLineRule("\"", "\"", stringToken, '\0', true);// double
-		// quotes
-		rules[1] = new SingleLineRule("'", "'", characterToken, '\0', true);// simple
-		// quotes
-
-		// Add generic whitespace rule.
-		rules[2] = new WhitespaceRule(new LisaacWhitespaceDetector());
-
-		// keywords rule
-		WordRule wr = new WordRule(new LisaacKeywordDetector(), Token.UNDEFINED);
-		for (int i = 0; i < keywords.length; i++) {
-			wr.addWord(keywords[i], keywordToken);
-		}
-		rules[3] = wr;
-
-		// prototype rule
-		rules[4] = new WordRule(new LisaacPrototypeDetector(), prototypeToken);
-
-		// simple lisaac word rule
-		//rules[5] = new WordRule(new LisaacWordDetector(), undefinedToken);
-		rules[5] = new LisaacWordRule(new LisaacWordDetector(), undefinedToken, localVariableToken);
-
-		// lisaac external
-		rules[6] = new SingleLineRule("`", "`", externalToken, '\0', true);// back
-		// quotes
-
-		// number rule
-		rules[7] = new WordRule(new LisaacNumberDetector(), numberToken);
-
-		// add basic rules
-		setRules(rules);
-	}
-
-	/*
-	 * @see ITokenScanner#nextToken()
-	 */
-	public IToken nextToken() {
-
-		fTokenOffset = fOffset;
-		fColumn = UNDEFINED;
-
-		//
-		// Lisaac scan
-		//
-
-		// start processing basic rules first
-		if (fRules != null) {
-			for (int i = 0; i < fRules.length; i++) {
-				IToken token = (fRules[i].evaluate(this));
-				if (!token.isUndefined())
-					return token;
-			}
-		}
-
-		// none of the basic rules fired
-		char c = (char) read();
-		if (c != ICharacterScanner.EOF) {
-			if (c == '+' || c == '-') {
-				if (getColumn() == 3) {// slot style
-					return prototypeStyleToken;
-				}
-				if (detectLocalSlot()) { // local slot style
-					return prototypeStyleToken;
-				}
-				return operatorToken;// arithmetic + or -
-			}
-			if (c == '<') {// list affect
-				c = (char) read();
-				if (c == '-') {
-					return fDefaultReturnToken;
-				} else {
-					unread();
-					return operatorToken;
-				}
-			}
-			if (c == ':') {// slot affect
-				c = (char) read();
-				if (c != '=') {
-					unread();
-					if (detectBlockType()) {
-						return prototypeToken;
-					}
-				}
-				return fDefaultReturnToken;
-			}
-			if (c == '?') {// ?= affect
-				c = (char) read();
-				if (c == '=') {
-					return fDefaultReturnToken;
-				}
-				unread();
-				return operatorToken;
-			}
-			if (c == '*' || c == '/' || c == '&' || c == '$' || c == '|'
-				|| c == '>' || c == '=' || c == '!' || c == '~' || c == '@'
-					|| c == '#' || c == '^') {
-				return operatorToken;
-			}
-			if (c == '{' || c == '}') {
-				return operatorToken;
-			}
-		}
-
-		unread();
-		//
-		// End of Lisaac scan
-		//
-
-		if (read() == EOF)
-			return Token.EOF;
-		return fDefaultReturnToken;
-	}
-
-	private boolean readIndentifier() {
-		char c;
-		int i = 0;
-
-		do {
-			c = (char) read();
-			i++;
-		} while (c != ICharacterScanner.EOF
-				&& (Character.isLetterOrDigit(c) || c == '_'));
-		unread();
-
-		return i > 1;
-	}
-
-	private void readSpace() {
-		char c;
-
-		do {
-			c = (char) read();
-		} while (c != ICharacterScanner.EOF && Character.isWhitespace(c));
-		unread();
-	}
-
-	private boolean detectLocalSlot() {
-		int oldOffset = fOffset;
-		boolean result = false;
-
-		readSpace();
-		while (readIndentifier()) {
-			readSpace();
-			char c = (char) read();
-			if (c == ICharacterScanner.EOF)
-				break;
-
-			if (c == ':') {
-				result = true;
-				break;
-			}
-			if (c != ',')
-				break;
-
-			readSpace();
-		}
-		fOffset = oldOffset;// unread all
-		fColumn = UNDEFINED;
-		return result;
-	}
-
-	private boolean detectBlockType() {
-		int oldOffset = fOffset;
-		boolean result = false;
-
-		readSpace();
-		char c = (char) read();
-		if (c != ICharacterScanner.EOF && c == '{') {
-			int level = 1;
-			do {
-				c = (char) read();
-				if (c != ICharacterScanner.EOF) {
-					if (c == '{') {
-						level++;
-					} else if (c == '}') {
-						level--;
-												
-					} else if (c == '\n' || c == '\r') {
-						break; // no multiline type
-						
-					} else if (((int)c) == 65535) {
-						break;  // bug!
-					}
-				}
-			} while (c != ICharacterScanner.EOF && level != 0);
-			
-			if (level == 0) {
-				result = true;
-			}
-		} 
-		if (! result) {
-			fOffset = oldOffset;// unread all
-			fColumn = UNDEFINED;
-		}
-		return result;
-	}
-
-	public int getOffset() {
-		return fOffset;
-	}
-}
+package org.eclipse.lisaac.editors;
+
+import org.eclipse.jface.text.*;
+import org.eclipse.jface.text.rules.*;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.RGB;
+
+class LisaacWhitespaceDetector implements IWhitespaceDetector {
+	public boolean isWhitespace(char c) {
+		return (c == ' ' || c == '\t' || c == '\n' || c == '\r');
+		// return c.isWhitespace();
+	}
+}
+
+class LisaacPrototypeDetector implements IWordDetector {
+	public boolean isWordPart(char c) {
+		return (Character.isLetter(c) && Character.isUpperCase(c))
+		|| Character.isDigit(c) || c == '_';
+	}
+
+	public boolean isWordStart(char c) {
+		return (Character.isLetter(c) && Character.isUpperCase(c)) || c == '_';
+	}
+}
+
+class LisaacNumberDetector implements IWordDetector {
+	public boolean isWordPart(char c) {
+		return Character.isLetterOrDigit(c);
+	}
+
+	public boolean isWordStart(char c) {
+		return Character.isDigit(c);
+	}
+}
+
+class LisaacKeywordDetector implements IWordDetector {
+	public boolean isWordPart(char c) {
+		return Character.isLetter(c) && Character.isLowerCase(c);
+	}
+
+	public boolean isWordStart(char c) {
+		return Character.isLetter(c) && Character.isUpperCase(c);
+	}
+}
+
+class LisaacWordDetector implements IWordDetector {
+	public boolean isWordPart(char c) {
+		return (Character.isLetter(c) && Character.isLowerCase(c))
+		|| Character.isDigit(c) || c == '_';
+	}
+
+	public boolean isWordStart(char c) {
+		return (Character.isLetter(c) && Character.isLowerCase(c)) || c == '_';
+	}
+}
+
+/**
+ * Lisaac code scanner.<br>
+ * Scan a range of a document into tokens, the scanner is used by the repairer
+ * to create the text presentation.
+ */
+public class LisaacScanner extends RuleBasedScanner {
+	private ColorManager manager;
+
+	private static String[] keywords = new String[] { "Section", "Public",
+		"Private", "Inherit", "Header", "Insert", "Mapping", "Interrupt",
+		"External", "Directory", 
+		"Expanded", "Strict",
+		"Left", "Right",
+		"Self",};
+
+	// Lisaac tokens
+	private IToken stringToken;
+	private IToken characterToken;
+	private IToken numberToken;
+	private IToken prototypeToken;
+	private IToken prototypeStyleToken;
+	private IToken keywordToken;
+	private IToken localVariableToken;
+	private IToken operatorToken;
+	private IToken externalToken;
+	private IToken undefinedToken;
+
+	private TextAttribute getAttribute(RGB rgb) {
+		return new TextAttribute(manager.getColor(rgb));
+	}
+
+	/*// italic, bold, etc..
+	 * private TextAttribute getAttributeSpecial(RGB rgb, int font) { return new
+	 * TextAttribute(manager.getColor(rgb),null, font); }
+	 */
+
+	/**
+	 * Creates a new Lisaac scanner.
+	 */
+	public LisaacScanner(ColorManager manager) {
+		this.manager = manager;
+		/*
+		 * Create lisaac tokens.
+		 */
+
+		stringToken = new Token(getAttribute(ILisaacColor.STRING));
+		characterToken = new Token(getAttribute(ILisaacColor.CHARACTER));
+		numberToken = new Token(getAttribute(ILisaacColor.NUMBER));
+		prototypeToken = new Token(getAttribute(ILisaacColor.PROTOTYPE));
+		prototypeStyleToken = new Token(
+				getAttribute(ILisaacColor.PROTOTYPE_STYLE));
+		keywordToken = new Token(getAttribute(ILisaacColor.KEYWORD));
+		localVariableToken = new Token(getAttribute(ILisaacColor.DEFAULT));
+		operatorToken = new Token(getAttribute(ILisaacColor.OPERATOR));
+		externalToken = new Token(new TextAttribute(manager
+				.getColor(ILisaacColor.DEFAULT), manager
+				.getColor(ILisaacColor.EXTERNAL), SWT.NORMAL));
+		undefinedToken = new Token(getAttribute(ILisaacColor.UNDEFINED));
+
+		/*
+		 * Create basic lisaac rules.
+		 */
+		IRule[] rules = new IRule[8];
+
+		// Add rule for processing strings
+		rules[0] = new SingleLineRule("\"", "\"", stringToken, '\0', true);// double
+		// quotes
+		rules[1] = new SingleLineRule("'", "'", characterToken, '\0', true);// simple
+		// quotes
+
+		// Add generic whitespace rule.
+		rules[2] = new WhitespaceRule(new LisaacWhitespaceDetector());
+
+		// keywords rule
+		WordRule wr = new WordRule(new LisaacKeywordDetector(), Token.UNDEFINED);
+		for (int i = 0; i < keywords.length; i++) {
+			wr.addWord(keywords[i], keywordToken);
+		}
+		rules[3] = wr;
+
+		// prototype rule
+		rules[4] = new WordRule(new LisaacPrototypeDetector(), prototypeToken);
+
+		// simple lisaac word rule
+		//rules[5] = new WordRule(new LisaacWordDetector(), undefinedToken);
+		rules[5] = new LisaacWordRule(new LisaacWordDetector(), undefinedToken, localVariableToken);
+
+		// lisaac external
+		rules[6] = new SingleLineRule("`", "`", externalToken, '\0', true);// back
+		// quotes
+
+		// number rule
+		rules[7] = new WordRule(new LisaacNumberDetector(), numberToken);
+
+		// add basic rules
+		setRules(rules);
+	}
+
+	/*
+	 * @see ITokenScanner#nextToken()
+	 */
+	public IToken nextToken() {
+
+		fTokenOffset = fOffset;
+		fColumn = UNDEFINED;
+
+		//
+		// Lisaac scan
+		//
+
+		// start processing basic rules first
+		if (fRules != null) {
+			for (int i = 0; i < fRules.length; i++) {
+				IToken token = (fRules[i].evaluate(this));
+				if (!token.isUndefined())
+					return token;
+			}
+		}
+
+		// none of the basic rules fired
+		char c = (char) read();
+		if (c != ICharacterScanner.EOF) {
+			if (c == '+' || c == '-') {
+				if (getColumn() == 3) {// slot style
+					return prototypeStyleToken;
+				}
+				if (detectLocalSlot()) { // local slot style
+					return prototypeStyleToken;
+				}
+				return operatorToken;// arithmetic + or -
+			}
+			if (c == '<') {// list affect
+				c = (char) read();
+				if (c == '-') {
+					return fDefaultReturnToken;
+				} else {
+					unread();
+					return operatorToken;
+				}
+			}
+			if (c == ':') {// slot affect
+				c = (char) read();
+				if (c != '=') {
+					unread();
+					if (detectBlockType()) {
+						return prototypeToken;
+					}
+				}
+				return fDefaultReturnToken;
+			}
+			if (c == '?') {// ?= affect
+				c = (char) read();
+				if (c == '=') {
+					return fDefaultReturnToken;
+				}
+				unread();
+				return operatorToken;
+			}
+			if (c == '*' || c == '/' || c == '&' || c == '$' || c == '|'
+				|| c == '>' || c == '=' || c == '!' || c == '~' || c == '@'
+					|| c == '#' || c == '^') {
+				return operatorToken;
+			}
+			if (c == '{' || c == '}') {
+				return operatorToken;
+			}
+		}
+
+		unread();
+		//
+		// End of Lisaac scan
+		//
+
+		if (read() == EOF)
+			return Token.EOF;
+		return fDefaultReturnToken;
+	}
+
+	private boolean readIndentifier() {
+		char c;
+		int i = 0;
+
+		do {
+			c = (char) read();
+			i++;
+		} while (c != ICharacterScanner.EOF
+				&& (Character.isLetterOrDigit(c) || c == '_'));
+		unread();
+
+		return i > 1;
+	}
+
+	private void readSpace() {
+		char c;
+
+		do {
+			c = (char) read();
+		} while (c != ICharacterScanner.EOF && Character.isWhitespace(c));
+		unread();
+	}
+
+	private boolean detectLocalSlot() {
+		int oldOffset = fOffset;
+		boolean result = false;
+
+		readSpace();
+		while (readIndentifier()) {
+			readSpace();
+			char c = (char) read();
+			if (c == ICharacterScanner.EOF)
+				break;
+
+			if (c == ':') {
+				result = true;
+				break;
+			}
+			if (c != ',')
+				break;
+
+			readSpace();
+		}
+		fOffset = oldOffset;// unread all
+		fColumn = UNDEFINED;
+		return result;
+	}
+
+	private boolean detectBlockType() {
+		int oldOffset = fOffset;
+		boolean result = false;
+
+		readSpace();
+		char c = (char) read();
+		if (c != ICharacterScanner.EOF && c == '{') {
+			int level = 1;
+			do {
+				c = (char) read();
+				if (c != ICharacterScanner.EOF) {
+					if (c == '{') {
+						level++;
+					} else if (c == '}') {
+						level--;
+
+					} else if (c == '\n' || c == '\r') {
+						break; // no multiline type
+
+					} else if (((int)c) == 65535) {
+						break;  // bug!
+					}
+				}
+			} while (c != ICharacterScanner.EOF && level != 0);
+
+			if (level == 0) {
+				result = true;
+			}
+		} 
+		if (! result) {
+			fOffset = oldOffset;// unread all
+			fColumn = UNDEFINED;
+		}
+		return result;
+	}
+
+	public int getOffset() {
+		return fOffset;
+	}
+
+	public static boolean isPrototypeIdentifier(String word) {
+		return detectKeyword(word, new LisaacPrototypeDetector());
+	}
+
+	private static boolean detectKeyword(String word, IWordDetector detector) {
+		int i = 0;
+		char c;
+		
+		if (word.length() > 0 && detector.isWordStart(word.charAt(0))) {
+			i = 1;
+			do {
+				c = word.charAt(i);
+				i++;
+			} while (i < word.length() && detector.isWordPart(c));
+		}
+		return i == word.length();
+	}
+}
diff --git a/src/org/eclipse/lisaac/editors/LisaacTextHover.java b/src/org/eclipse/lisaac/editors/LisaacTextHover.java
new file mode 100644
index 0000000..b7ec6a8
--- /dev/null
+++ b/src/org/eclipse/lisaac/editors/LisaacTextHover.java
@@ -0,0 +1,95 @@
+package org.eclipse.lisaac.editors;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jface.internal.text.html.HTMLTextPresenter;
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.DefaultInformationControl;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.IInformationControl;
+import org.eclipse.jface.text.IInformationControlCreator;
+import org.eclipse.jface.text.IRegion;
+import org.eclipse.jface.text.ITextHover;
+import org.eclipse.jface.text.ITextHoverExtension;
+import org.eclipse.jface.text.ITextViewer;
+import org.eclipse.jface.text.Region;
+import org.eclipse.lisaac.model.LisaacCompletionParser;
+import org.eclipse.lisaac.model.LisaacModel;
+import org.eclipse.lisaac.model.items.Prototype;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.editors.text.EditorsUI;
+
+public class LisaacTextHover implements ITextHover, ITextHoverExtension {
+
+	protected LisaacModel model;
+	
+	
+	public LisaacTextHover(LisaacModel model) {
+		super();
+		this.model = model;
+	}
+
+	public String getHoverInfo(ITextViewer textViewer, IRegion hoverRegion) {
+		try {
+			String text = textViewer.getDocument().get(hoverRegion.getOffset(), hoverRegion.getLength());
+			if (LisaacScanner.isPrototypeIdentifier(text)) {
+				// get prototype info
+			
+				Prototype prototype = LisaacCompletionParser.findPrototype(text, model);
+				if (prototype != null) {
+					return "<I>Prototype : </I> "+prototype.getHoverInformation();
+				}
+			}
+		} catch (BadLocationException e) {
+		} catch (CoreException e) {
+		}		
+		return null;
+	}
+
+
+	public IRegion getHoverRegion(ITextViewer textViewer, int offset) {
+		try {
+			return selectWord(textViewer.getDocument(), offset);
+		} catch (BadLocationException e) {
+		}
+		return new Region(offset, 0);
+	}
+
+
+	/*
+     * @see org.eclipse.jface.text.ITextHoverExtension#getHoverControlCreator()
+     */
+    public IInformationControlCreator getHoverControlCreator() {
+        return new IInformationControlCreator() {
+            public IInformationControl createInformationControl(Shell parent) {
+                return new DefaultInformationControl(parent, "", new HTMLTextPresenter());
+            }
+        };
+    }
+	
+	protected IRegion selectWord(IDocument doc, int caretPos) throws BadLocationException {
+		int startPos, endPos;
+
+		int pos = caretPos;
+		char c;
+
+		while (pos >= 0) {
+			c = doc.getChar(pos);
+			if (!Character.isJavaIdentifierPart(c))
+				break;
+			--pos;
+		}
+		startPos = pos+1;
+		pos = caretPos;
+		int length = doc.getLength();
+
+		while (pos < length) {
+			c = doc.getChar(pos);
+			if (!Character.isJavaIdentifierPart(c))
+				break;
+			++pos;
+		}
+		endPos = pos;
+		return new Region(startPos, endPos - startPos);
+	}
+}
diff --git a/src/org/eclipse/lisaac/launch/LisaacCompiler.java b/src/org/eclipse/lisaac/launch/LisaacCompiler.java
index f693ddb..a002f63 100644
--- a/src/org/eclipse/lisaac/launch/LisaacCompiler.java
+++ b/src/org/eclipse/lisaac/launch/LisaacCompiler.java
@@ -1,86 +1,83 @@
-package org.eclipse.lisaac.launch;
-
-import java.io.InputStream;
-import java.util.ArrayList;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-
-public class LisaacCompiler {
-	
-	protected String inputFile;
-	protected String lipFile;
-
-	protected ArrayList<String> options;
-	
-	public LisaacCompiler(String inputFile, String lipFile) {
-		super();
-		this.inputFile = inputFile;
-		this.lipFile = lipFile;
-	}
-
-	public LisaacCompiler(String inputFile) {
-		this.inputFile = inputFile;
-	}
-
-	
-	public boolean launchInConsole(IProject project, IProgressMonitor monitor) throws CoreException {
-		IContainer src = project.getFolder("src");
-		if (src != null) {
-			return LisaacLauncher.executeCommandInConsole(monitor, src, this.toCommandLineArray());
-		}
-		return LisaacLauncher.executeCommandInConsole(monitor, project, this.toCommandLineArray());
-	}
-	
-	public Process launch(IProject project, IProgressMonitor monitor) throws CoreException {
-		IContainer src = project.getFolder("src");
-		if (src != null) {
-			return LisaacLauncher.executeCommand(monitor, src, this.toCommandLineArray());
-		}
-		return LisaacLauncher.executeCommand(monitor, project, this.toCommandLineArray());
-	}
-	
-	public String[] toCommandLineArray() {
-		ArrayList<String> cmd = new ArrayList<String>();
-		
-		cmd.add("lisaac ");
-		if (lipFile != null) {
-			cmd.add(lipFile);
-		}
-		if (inputFile != null) {
-			cmd.add(inputFile);
-		}
-		if (options != null) {
-			cmd.addAll(options);
-		}
-		
-		System.out.println("\n\n============>> "+toCommandLine());
-		
-		return cmd.toArray(new String[cmd.size()]);
-	}
-	
-	public String toCommandLine() {
-		StringBuffer result = new StringBuffer("lisaac ");
-		if (lipFile != null) {
-			result.append(lipFile);
-		}
-		if (inputFile != null) {
-			result.append(" "+inputFile);
-		}
-		if (options != null) {
-			for (int i=0; i<options.size(); i++) {
-				result.append(" "+options.get(i));
-			}
-		}
-		return result.toString();
-	}
-
-	public void addOption(String option) {
-		if (options == null) {
-			options = new ArrayList<String>();
-		}
-		options.add(option);
-	}
-}
+package org.eclipse.lisaac.launch;
+
+import java.io.InputStream;
+import java.util.ArrayList;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+
+public class LisaacCompiler {
+	
+	protected String inputFile;
+	protected String lipFile;
+
+	protected ArrayList<String> options;
+	
+	public LisaacCompiler(String inputFile, String lipFile) {
+		super();
+		this.inputFile = inputFile;
+		this.lipFile = lipFile;
+	}
+
+	public LisaacCompiler(String inputFile) {
+		this.inputFile = inputFile;
+	}
+
+	
+	public boolean launchInConsole(IProject project, IProgressMonitor monitor) throws CoreException {
+		IContainer src = project.getFolder("src");
+		if (src != null) {
+			return LisaacLauncher.executeCommandInConsole(monitor, src, this.toCommandLineArray());
+		}
+		return LisaacLauncher.executeCommandInConsole(monitor, project, this.toCommandLineArray());
+	}
+	
+	public Process launch(IProject project, IProgressMonitor monitor) throws CoreException {
+		IContainer src = project.getFolder("src");
+		if (src != null) {
+			return LisaacLauncher.executeCommand(monitor, src, this.toCommandLineArray());
+		}
+		return LisaacLauncher.executeCommand(monitor, project, this.toCommandLineArray());
+	}
+	
+	public String[] toCommandLineArray() {
+		ArrayList<String> cmd = new ArrayList<String>();
+		
+		cmd.add("lisaac ");
+		if (lipFile != null) {
+			cmd.add(lipFile);
+		}
+		if (inputFile != null) {
+			cmd.add(inputFile);
+		}
+		if (options != null) {
+			cmd.addAll(options);
+		}
+		return cmd.toArray(new String[cmd.size()]);
+	}
+	
+	public String toCommandLine() {
+		StringBuffer result = new StringBuffer("lisaac ");
+		if (lipFile != null) {
+			result.append(lipFile);
+		}
+		if (inputFile != null) {
+			result.append(" "+inputFile);
+		}
+		if (options != null) {
+			for (int i=0; i<options.size(); i++) {
+				result.append(" "+options.get(i));
+			}
+		}
+		return result.toString();
+	}
+
+	public void addOption(String option) {
+		if (options == null) {
+			options = new ArrayList<String>();
+		}
+		options.add(option);
+	}
+}
diff --git a/src/org/eclipse/lisaac/model/AliasString.java b/src/org/eclipse/lisaac/model/AliasString.java
index df65f8c..13a016e 100644
--- a/src/org/eclipse/lisaac/model/AliasString.java
+++ b/src/org/eclipse/lisaac/model/AliasString.java
@@ -1,82 +1,83 @@
-package org.eclipse.lisaac.model;
-
-import java.util.HashSet;
-
-public class AliasString {
-	private HashSet<String> list;
-	
-	public AliasString() {
-		list = new HashSet<String>();
-		
-		// add model string constants
-		list.add(ILisaacModel.section_header); 
-		list.add(ILisaacModel.section_inherit);
-		list.add(ILisaacModel.section_insert);
-		list.add(ILisaacModel.section_public);
-		list.add(ILisaacModel.section_private);
-		list.add(ILisaacModel.section_interrupt);
-		list.add(ILisaacModel.section_mapping);
-		list.add(ILisaacModel.section_directory);
-		list.add(ILisaacModel.section_external);
-		
-		list.add(ILisaacModel.keyword_section);
-		list.add(ILisaacModel.keyword_right);
-		list.add(ILisaacModel.keyword_left);
-		list.add(ILisaacModel.keyword_ldots);
-		list.add(ILisaacModel.keyword_old);
-		list.add(ILisaacModel.keyword_expanded);  
-		list.add(ILisaacModel.keyword_strict);  
-		list.add(ILisaacModel.keyword_result);
-		
-		list.add(ILisaacModel.symbol_affect_immediate);
-		list.add(ILisaacModel.symbol_affect_cast);
-		list.add(ILisaacModel.symbol_affect_code);
-		list.add(ILisaacModel.symbol_auto_export);
-		list.add(ILisaacModel.symbol_equal);
-		list.add(ILisaacModel.symbol_not_equal);
-		list.add(ILisaacModel.symbol_great);
-		list.add(ILisaacModel.symbol_great_equal);
-		list.add(ILisaacModel.symbol_less);
-		list.add(ILisaacModel.symbol_less_equal);
-		
-		list.add(ILisaacModel.slot_name);
-		list.add(ILisaacModel.slot_export);
-		list.add(ILisaacModel.slot_import);
-		list.add(ILisaacModel.slot_external);
-		list.add(ILisaacModel.slot_default);
-		list.add(ILisaacModel.slot_type);
-		list.add(ILisaacModel.slot_version);
-		list.add(ILisaacModel.slot_date);
-		list.add(ILisaacModel.slot_comment);
-		list.add(ILisaacModel.slot_author);
-		list.add(ILisaacModel.slot_bibliography);
-		list.add(ILisaacModel.slot_language);
-		list.add(ILisaacModel.slot_copyright);
-		list.add(ILisaacModel.slot_bug_report);
-		
-		list.add(ILisaacModel.prototype_true);
-		list.add(ILisaacModel.prototype_false);
-		list.add(ILisaacModel.prototype_self);
-		list.add(ILisaacModel.prototype_string);
-		list.add(ILisaacModel.prototype_integer);
-		list.add(ILisaacModel.prototype_real);
-		list.add(ILisaacModel.prototype_boolean);
-		list.add(ILisaacModel.prototype_character);
-		
-		list.add(ILisaacModel.variable_null);
-		list.add(ILisaacModel.variable_void);
-		list.add(ILisaacModel.variable_self);
-		
-		// lip
-		list.add(ILisaacModel.slot_if);
-		list.add(ILisaacModel.slot_else);
-		list.add(ILisaacModel.slot_print);
-	}
-	
-	public String get (String str) {
-		if (! list.contains(str)) {
-			list.add(str);
-		}
-		return str;
-	}
-}
+package org.eclipse.lisaac.model;
+
+import java.util.HashSet;
+
+public class AliasString {
+	private HashSet<String> list;
+	
+	public AliasString() {
+		list = new HashSet<String>();
+		
+		// add model string constants
+		list.add(ILisaacModel.section_header); 
+		list.add(ILisaacModel.section_inherit);
+		list.add(ILisaacModel.section_insert);
+		list.add(ILisaacModel.section_public);
+		list.add(ILisaacModel.section_private);
+		list.add(ILisaacModel.section_interrupt);
+		list.add(ILisaacModel.section_mapping);
+		list.add(ILisaacModel.section_directory);
+		list.add(ILisaacModel.section_external);
+		
+		list.add(ILisaacModel.keyword_section);
+		list.add(ILisaacModel.keyword_right);
+		list.add(ILisaacModel.keyword_left);
+		list.add(ILisaacModel.keyword_ldots);
+		list.add(ILisaacModel.keyword_old);
+		list.add(ILisaacModel.keyword_expanded);  
+		list.add(ILisaacModel.keyword_strict);  
+		list.add(ILisaacModel.keyword_result);
+		
+		list.add(ILisaacModel.symbol_affect_immediate);
+		list.add(ILisaacModel.symbol_affect_cast);
+		list.add(ILisaacModel.symbol_affect_code);
+		list.add(ILisaacModel.symbol_auto_export);
+		list.add(ILisaacModel.symbol_equal);
+		list.add(ILisaacModel.symbol_not_equal);
+		list.add(ILisaacModel.symbol_great);
+		list.add(ILisaacModel.symbol_great_equal);
+		list.add(ILisaacModel.symbol_less);
+		list.add(ILisaacModel.symbol_less_equal);
+		
+		list.add(ILisaacModel.slot_name);
+		list.add(ILisaacModel.slot_export);
+		list.add(ILisaacModel.slot_import);
+		list.add(ILisaacModel.slot_external);
+		list.add(ILisaacModel.slot_default);
+		list.add(ILisaacModel.slot_type);
+		list.add(ILisaacModel.slot_version);
+		list.add(ILisaacModel.slot_date);
+		list.add(ILisaacModel.slot_comment);
+		list.add(ILisaacModel.slot_author);
+		list.add(ILisaacModel.slot_bibliography);
+		list.add(ILisaacModel.slot_language);
+		list.add(ILisaacModel.slot_copyright);
+		list.add(ILisaacModel.slot_bug_report);
+		
+		list.add(ILisaacModel.prototype_true);
+		list.add(ILisaacModel.prototype_false);
+		list.add(ILisaacModel.prototype_self);
+		list.add(ILisaacModel.prototype_string);
+		list.add(ILisaacModel.prototype_integer);
+		list.add(ILisaacModel.prototype_real);
+		list.add(ILisaacModel.prototype_boolean);
+		list.add(ILisaacModel.prototype_character);
+		list.add(ILisaacModel.prototype_block);
+		
+		list.add(ILisaacModel.variable_null);
+		list.add(ILisaacModel.variable_void);
+		list.add(ILisaacModel.variable_self);
+		
+		// lip
+		list.add(ILisaacModel.slot_if);
+		list.add(ILisaacModel.slot_else);
+		list.add(ILisaacModel.slot_print);
+	}
+	
+	public String get (String str) {
+		if (! list.contains(str)) {
+			list.add(str);
+		}
+		return str;
+	}
+}
diff --git a/src/org/eclipse/lisaac/model/ILisaacModel.java b/src/org/eclipse/lisaac/model/ILisaacModel.java
index 14e72e9..c333598 100644
--- a/src/org/eclipse/lisaac/model/ILisaacModel.java
+++ b/src/org/eclipse/lisaac/model/ILisaacModel.java
@@ -1,82 +1,83 @@
-package org.eclipse.lisaac.model;
-
-import org.eclipse.lisaac.builder.ILisaacErrorHandler;
-import org.eclipse.lisaac.model.lip.LIP;
-
-public interface ILisaacModel {
-
-	final String inherit_shared             = "Shared";
-	final String inherit_shared_expanded    = "Shared Expanded";
-	final String inherit_nonshared          = "Non Shared";
-	final String inherit_nonshared_expanded = "Non Shared Expanded";
-	
-	//
-	final String keyword_section  = "Section";
-	final String keyword_right    = "Right";
-	final String keyword_left     = "Left";
-	final String keyword_ldots    = "...";
-	final String keyword_old      = "Old";
-	final String keyword_expanded = "Expanded";  
-	final String keyword_strict   = "Strict";  
-	final String keyword_result   = "Result";
-	
-	final String symbol_affect_immediate = ":=";
-	final String symbol_affect_cast      = "?=";
-	final String symbol_affect_code      = "<-";
-	final String symbol_auto_export      = "->";
-	final String symbol_auto_import      = symbol_affect_code;
-	final String symbol_equal            = "=";
-	final String symbol_not_equal        = "!=";
-	final String symbol_great            = ">";
-	final String symbol_great_equal      = ">=";
-	final String symbol_less             = "<";
-	final String symbol_less_equal       = "<=";
-	
-	final String section_header     = "Header";
-	final String section_inherit    = "Inherit";
-	final String section_insert     = "Insert";
-	final String section_public     = "Public";
-	final String section_private    = "Private";
-	final String section_interrupt  = "Interrupt";
-	final String section_mapping    = "Mapping";
-	final String section_directory  = "Directory";
-	final String section_external   = "External";
-	
-	final String slot_name         = "name";
-	final String slot_export       = "export";
-	final String slot_import       = "import";
-	final String slot_external     = "external";
-	final String slot_default      = "default";
-	final String slot_type         = "type";
-	final String slot_version      = "version";
-	final String slot_date         = "date";
-	final String slot_comment      = "comment";
-	final String slot_author       = "author";
-	final String slot_bibliography = "bibliography";
-	final String slot_language     = "language";
-	final String slot_copyright    = "copyright";
-	final String slot_bug_report   = "bug_report";
-	
-	final String  prototype_true            = "TRUE";
-	final String  prototype_false           = "FALSE";
-	final String  prototype_self            = "SELF";
-	final String  prototype_string          = "STRING";
-	final String  prototype_integer         = "INTEGER";
-	final String  prototype_real            = "REAL";
-	final String  prototype_boolean         = "BOOLEAN";
-	final String  prototype_character       = "CHARACTER";
-	
-	final String variable_null          = "NULL";
-	final String variable_void          = "VOID";
-	final String variable_self          = "Self";
-	
-	// lip
-	final String slot_if    = "if";
-	final String slot_else  = "else";
-	final String slot_print = "print";
-	
-	ILisaacErrorHandler getReporter();
-	AliasString getAliasString();
-	LisaacParser getParser();
-	LIP getLipCode(); 
-}
+package org.eclipse.lisaac.model;
+
+import org.eclipse.lisaac.builder.ILisaacErrorHandler;
+import org.eclipse.lisaac.model.lip.LIP;
+
+public interface ILisaacModel {
+
+	final String inherit_shared             = "Shared";
+	final String inherit_shared_expanded    = "Shared Expanded";
+	final String inherit_nonshared          = "Non Shared";
+	final String inherit_nonshared_expanded = "Non Shared Expanded";
+	
+	//
+	final String keyword_section  = "Section";
+	final String keyword_right    = "Right";
+	final String keyword_left     = "Left";
+	final String keyword_ldots    = "...";
+	final String keyword_old      = "Old";
+	final String keyword_expanded = "Expanded";  
+	final String keyword_strict   = "Strict";  
+	final String keyword_result   = "Result";
+	
+	final String symbol_affect_immediate = ":=";
+	final String symbol_affect_cast      = "?=";
+	final String symbol_affect_code      = "<-";
+	final String symbol_auto_export      = "->";
+	final String symbol_auto_import      = symbol_affect_code;
+	final String symbol_equal            = "=";
+	final String symbol_not_equal        = "!=";
+	final String symbol_great            = ">";
+	final String symbol_great_equal      = ">=";
+	final String symbol_less             = "<";
+	final String symbol_less_equal       = "<=";
+	
+	final String section_header     = "Header";
+	final String section_inherit    = "Inherit";
+	final String section_insert     = "Insert";
+	final String section_public     = "Public";
+	final String section_private    = "Private";
+	final String section_interrupt  = "Interrupt";
+	final String section_mapping    = "Mapping";
+	final String section_directory  = "Directory";
+	final String section_external   = "External";
+	
+	final String slot_name         = "name";
+	final String slot_export       = "export";
+	final String slot_import       = "import";
+	final String slot_external     = "external";
+	final String slot_default      = "default";
+	final String slot_type         = "type";
+	final String slot_version      = "version";
+	final String slot_date         = "date";
+	final String slot_comment      = "comment";
+	final String slot_author       = "author";
+	final String slot_bibliography = "bibliography";
+	final String slot_language     = "language";
+	final String slot_copyright    = "copyright";
+	final String slot_bug_report   = "bug_report";
+	
+	final String  prototype_true            = "TRUE";
+	final String  prototype_false           = "FALSE";
+	final String  prototype_self            = "SELF";
+	final String  prototype_string          = "STRING";
+	final String  prototype_integer         = "INTEGER";
+	final String  prototype_real            = "REAL";
+	final String  prototype_boolean         = "BOOLEAN";
+	final String  prototype_character       = "CHARACTER";
+	final String  prototype_block           = "BLOCK";
+	
+	final String variable_null          = "NULL";
+	final String variable_void          = "VOID";
+	final String variable_self          = "Self";
+	
+	// lip
+	final String slot_if    = "if";
+	final String slot_else  = "else";
+	final String slot_print = "print";
+	
+	ILisaacErrorHandler getReporter();
+	AliasString getAliasString();
+	LisaacParser getParser();
+	LIP getLipCode(); 
+}
diff --git a/src/org/eclipse/lisaac/model/LisaacCompletionParser.java b/src/org/eclipse/lisaac/model/LisaacCompletionParser.java
index 0f7b4ed..552a9e6 100644
--- a/src/org/eclipse/lisaac/model/LisaacCompletionParser.java
+++ b/src/org/eclipse/lisaac/model/LisaacCompletionParser.java
@@ -1,141 +1,179 @@
-package org.eclipse.lisaac.model;
-
-
-import java.util.ArrayList;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jface.text.contentassist.CompletionProposal;
-import org.eclipse.lisaac.LisaacPlugin;
-import org.eclipse.lisaac.builder.ILisaacErrorHandler;
-import org.eclipse.lisaac.editors.LisaacEditor;
-import org.eclipse.lisaac.model.items.ICode;
-import org.eclipse.lisaac.model.items.ITMRead;
-import org.eclipse.lisaac.model.items.Prototype;
-import org.eclipse.lisaac.model.items.Slot;
-import org.eclipse.lisaac.model.types.IType;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchWindow;
-
-public class LisaacCompletionParser extends LisaacParser {
-
-	protected Prototype currentPrototype;
-	protected Slot currentSlot;
-	
-	public LisaacCompletionParser(String contents) {
-		super(contents);
-	}
-
-	/**
-	 * Get the lisaac completions at baseOffset
-	 * @param startOffset start offset for completion parsing
-	 * @param baseOffset completion offset 
-	 * @param proposals list of proposals to be filled  
-	 * @throws CoreException
-	 */
-	public void parseCompletions(int startOffset, int baseOffset, ArrayList<CompletionProposal> proposals)
-	throws CoreException {
-		IType type;
-		
-		currentPrototype = LisaacModel.getCurrentPrototype();
-		currentSlot = currentPrototype.getSlot(startOffset);
-		
-		ICode code = readExpr();
-		if (code != null) {
-			if (currentSlot != null) {
-				type = code.getType(currentSlot);
-			} else {
-				type = code.getType(currentSlot);
-			}
-			if (type != null) {
-				currentPrototype = findPrototype(type.toString());
-				if (currentPrototype != null) {
-					currentPrototype.getSlotProposals(proposals, baseOffset, 0);
-				} 
-				proposals.add(new CompletionProposal(""+type,baseOffset,0,0));
-			}
-		}
-	}
-	
-	//++ EXPR_MESSAGE -> EXPR_BASE { '.' SEND_MSG }
-	protected ICode readExprMessage() {
-
-		ICode result = readExprBase();
-		if (result != null) {
-			while (readCharacter('.')) {
-				ICode lastResult = result;
-				result = readSendMsg(result);
-				if (result == null) {
-					return lastResult;
-				}
-				// update source of completion
-				IType type = lastResult.getType(currentSlot);
-				if (type != null) {
-					try {
-						currentPrototype = findPrototype(type.toString());
-					} catch(CoreException e) {
-						return null;
-					}
-					if (currentPrototype == null) {
-						return null;
-					}
-					if (result instanceof ITMRead) {
-						currentSlot = currentPrototype.getSlot(((ITMRead) result).getName());
-					} else {
-						currentSlot = null;
-					}
-				}
-			}
-		}
-		return result;
-	}
-
-	/**
-	 * Find and parse a lisaac prototype according to its name.
-	 */
-	private Prototype findPrototype(String prototypeName) throws CoreException {
-		IProject project = null;
-		Prototype result = null;
-
-		IWorkbenchWindow w = LisaacPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow();
-		IWorkbenchPart part = w.getPartService().getActivePart();
-		if (part instanceof LisaacEditor) {
-			project = ((LisaacEditor)part).getProject();
-		}
-		if (project != null) {
-			LisaacModel model = LisaacModel.getModel(project);
-
-			Prototype prototype = model.getPrototype(prototypeName);
-			if (prototype != null) {
-				// prototype is already cached
-				return prototype;	
-			}
-
-			// cache new prototype
-			String prototypePath = model.getPathManager().getFullPath(prototypeName);
-			if (prototypePath != null) {
-				IPath location = new Path(prototypePath);
-
-				IFile file = project.getFile(location.lastSegment());
-				if (! file.isAccessible()) {
-					file.createLink(location, IResource.REPLACE, null);
-				}
-				result = model.parsePrototype(prototypeName, file.getContents(), new ILisaacErrorHandler() {
-					public void fatalError(String msg, Position position) {				
-					}
-					public void semanticError(String msg, Position position) {					
-					}
-					public void syntaxError(String msg, Position position) {			
-					}
-					public void warning(String msg, Position position) {
-					}
-				});
-			}
-		}
-		return result;
-	}
-}
+package org.eclipse.lisaac.model;
+
+
+import java.util.ArrayList;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jface.text.contentassist.CompletionProposal;
+import org.eclipse.lisaac.LisaacPlugin;
+import org.eclipse.lisaac.builder.ILisaacErrorHandler;
+import org.eclipse.lisaac.editors.LisaacEditor;
+import org.eclipse.lisaac.model.items.ICode;
+import org.eclipse.lisaac.model.items.ITMRead;
+import org.eclipse.lisaac.model.items.Prototype;
+import org.eclipse.lisaac.model.items.Slot;
+import org.eclipse.lisaac.model.types.IType;
+import org.eclipse.lisaac.model.types.TypeSimple;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.IWorkbenchWindow;
+
+public class LisaacCompletionParser extends LisaacParser {
+
+	protected Prototype currentPrototype;
+	protected Slot currentSlot;
+
+	public LisaacCompletionParser(String contents) {
+		super(contents);
+	}
+
+	/**
+	 * Get the lisaac completions at baseOffset
+	 * @param startOffset start offset for completion parsing
+	 * @param baseOffset completion offset 
+	 * @param proposals list of proposals to be filled  
+	 * @throws CoreException
+	 */
+	public void parseCompletions(int startOffset, int baseOffset, ArrayList<CompletionProposal> proposals)
+	throws CoreException {
+		IType type;
+
+		currentPrototype = LisaacModel.getCurrentPrototype();
+		currentSlot = currentPrototype.getSlot(startOffset);
+
+		ICode code = readExpr();
+		if (code != null) {
+			type = code.getType(currentSlot, currentPrototype);
+			if (type != null && currentPrototype != null) {
+				//if (! type.equals(TypeSimple.getTypeSelf())) {
+				if ("SELF".compareTo(type.toString()) != 0) {
+					currentPrototype = findPrototype(type.toString());
+				}
+				currentPrototype.getSlotProposals(proposals, baseOffset, 0);
+				proposals.add(new CompletionProposal(""+type,baseOffset,0,0));
+			}
+		}
+	}
+
+	//++ EXPR_MESSAGE -> EXPR_BASE { '.' SEND_MSG }
+	protected ICode readExprMessage() {
+
+		ICode result = readExprBase();
+		if (result != null) {
+			while (readCharacter('.')) {
+				ICode lastResult = result;
+				result = readSendMsg(result);
+				if (result == null) {
+					return lastResult;
+				}
+				// update source of completion
+				IType type = lastResult.getType(currentSlot, currentPrototype);
+				//if (type != null && ! type.equals(TypeSimple.getTypeSelf())) {
+				if (type != null && "SELF".compareTo(type.toString()) != 0) {
+					try {
+						currentPrototype = findPrototype(type.toString());
+					} catch(CoreException e) {
+						return null;
+					}
+					if (currentPrototype == null) {
+						return null;
+					}
+					if (result instanceof ITMRead) {
+						currentSlot = currentPrototype.lookupSlot(((ITMRead) result).getName());
+					} else {
+						currentSlot = null;
+					}
+				}
+			}
+		}
+		return result;
+	}
+
+	/**
+	 * Find and parse a lisaac prototype according to its name.
+	 */
+	public static Prototype findPrototype(String prototypeName) throws CoreException {
+		IProject project = null;
+		Prototype result = null;
+
+		IWorkbenchWindow w = LisaacPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow();
+		if (w == null) {
+			return null;
+		}
+		IWorkbenchPart part = w.getPartService().getActivePart();
+		if (part instanceof LisaacEditor) {
+			project = ((LisaacEditor)part).getProject();
+		}
+		if (project != null) {
+			LisaacModel model = LisaacModel.getModel(project);
+
+			Prototype prototype = model.getPrototype(prototypeName);
+			if (prototype != null) {
+				// prototype is already cached
+				return prototype;	
+			}
+
+			// cache new prototype
+			String prototypePath = model.getPathManager().getFullPath(prototypeName);
+			if (prototypePath != null) {
+				IPath location = new Path(prototypePath);
+
+				IFile file = project.getFile(location.lastSegment());
+				if (! file.isAccessible()) {
+					file.createLink(location, IResource.REPLACE, null);
+				}
+				result = model.parsePrototype(prototypeName, file.getContents(), new ILisaacErrorHandler() {
+					public void fatalError(String msg, Position position) {				
+					}
+					public void semanticError(String msg, Position position) {					
+					}
+					public void syntaxError(String msg, Position position) {			
+					}
+					public void warning(String msg, Position position) {
+					}
+				});
+			}
+		}
+		return result;
+	}
+
+	/**
+	 * Find and parse a lisaac prototype.
+	 */
+	public static Prototype findPrototype(String prototypeName, LisaacModel model) throws CoreException {
+		Prototype result = null;
+	
+		Prototype prototype = model.getPrototype(prototypeName);
+		if (prototype != null) {
+			// prototype is already cached
+			return prototype;	
+		}
+
+		// cache new prototype
+		String prototypePath = model.getPathManager().getFullPath(prototypeName);
+		if (prototypePath != null) {
+			IPath location = new Path(prototypePath);
+			IProject project = model.getProject();
+			
+			IFile file = project.getFile(location.lastSegment());
+			if (! file.isAccessible()) {
+				file.createLink(location, IResource.REPLACE, null);
+			}
+			result = model.parsePrototype(prototypeName, file.getContents(), new ILisaacErrorHandler() {
+				public void fatalError(String msg, Position position) {				
+				}
+				public void semanticError(String msg, Position position) {					
+				}
+				public void syntaxError(String msg, Position position) {			
+				}
+				public void warning(String msg, Position position) {
+				}
+			});
+		}
+		return result;
+	}
+}
diff --git a/src/org/eclipse/lisaac/model/LisaacParser.java b/src/org/eclipse/lisaac/model/LisaacParser.java
index c03738e..a4a1874 100644
--- a/src/org/eclipse/lisaac/model/LisaacParser.java
+++ b/src/org/eclipse/lisaac/model/LisaacParser.java
@@ -1,1415 +1,1425 @@
-package org.eclipse.lisaac.model;
-
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.LinkedList;
-import java.util.List;
-
-import org.eclipse.lisaac.builder.LisaacParseException;
-import org.eclipse.lisaac.model.items.*;
-import org.eclipse.lisaac.model.types.*;
-
-/**
- *  Lisaac Prototype Parser
- */
-public class LisaacParser extends AbstractLisaacParser {
-
-	private ILisaacContext sectionContext;
-	private ILisaacContext slotContext;
-
-	//
-	private Slot lastSlot;
-	private ITMList lastGroup;
-	private Section lastSection;
-	//
-
-	public LisaacParser(InputStream contents, ILisaacModel model) {
-		super(contents, model);
-		this.model = model;
-		
-		sectionContext = new SectionContext(this);
-		slotContext = new SlotContext(this);
-
-		initialize();
-	}
-	
-	public LisaacParser(String contents) {
-		super(contents);
-		initialize();
-	}
-
-	public void initialize() {
-		//
-		// initialisations
-		//
-		super.initialize();
-		TypeSimple.init();
-	}
-	
-	public ILisaacContext getSectionContext() {
-		return sectionContext;
-	}
-
-	public Slot getLastSlot() {
-		return lastSlot;
-	}
-
-	public void setLastSection(Section section) {
-		lastSection = section;
-	}
-
-	//
-	// Lisaac Prototype Parser
-	//
-
-	//++ TYPE_LIST    -> TYPE { ',' TYPE }
-	public ITypeMono[] readTypeList(boolean isSection) {
-		ArrayList<ITypeMono> lst=null;
-		ITypeMono t;
-
-		t = readType(false);
-		if (t != null) {
-			if (isSection) {
-				if (! (t instanceof TypeSimple)) {
-					reporter.syntaxError("For a section, the prototype name only (without '('...')').", getPosition());
-					return null;
-				}
-			}
-			lst = new ArrayList<ITypeMono>();
-			lst.add(t);
-			while (readCharacter(',')) {
-				t = readType(false);
-				if (t == null) {
-					reporter.syntaxError("Incorrect type list.", getPosition());
-					return null;
-				}
-				if (isSection) {
-					if (! (t instanceof TypeSimple)) {
-						reporter.syntaxError("For a section, the prototype name only (without '('...')').", getPosition());
-						return null;
-					}
-				}
-				lst.add(t);
-			}
-			// TODO alias lst
-		}
-		if (lst != null) {
-			return lst.toArray(new ITypeMono[lst.size()]);
-		}
-		return null;
-	}
-
-	//++ TYPE         -> '{' [ (TYPE | '(' TYPE_LIST ')') ';' ] [ TYPE_LIST ] '}'
-	//++               | [type] PROTOTYPE [ CONTRACT ]
-	public ITypeMono readType (boolean isLocal) {
-		ITypeMono result=null;
-		ITypeMono[] lst=null;
-		IType typ_arg=null,typ_res=null;
-		String style=null;
-
-		if (readCharacter('{')) {
-			// '{' [ (TYPE | '(' TYPE_LIST ')') ';' ] [ TYPE_LIST ] '}' 
-			if (readCharacter('(')) {
-				// Read vector argument.
-				lst = readTypeList(false);
-				if (lst == null) {
-					reporter.syntaxError("Incorrect type list.", getPosition());
-					return null;
-				}
-				if (lst.length == 1) {
-					typ_arg = lst[0];
-				} else {
-					typ_arg = TypeMulti.get(lst);
-				}
-				if (! readCharacter(')')) {
-					reporter.syntaxError("Added ')'.", getPosition());
-					return null;
-				}
-				if (! readCharacter(';')) {
-					reporter.syntaxError("Added ';'.", getPosition());
-				}
-				// Read result type.
-				lst = readTypeList(false);
-			} else {
-
-				lst = readTypeList(false);
-				if (lst != null) {
-					if (readCharacter(';')) {
-						if (lst.length == 1) {
-							typ_arg = lst[0];
-						} else {
-							typ_arg = TypeMulti.get(lst);
-							// TODO warning "Added 'typ_arg'."
-						}
-						// Read result type.
-						lst = readTypeList(false);
-					}
-				}
-			}
-			if (lst != null) {
-				if (lst.length == 1) {
-					typ_res = lst[0];
-				} else {
-					typ_res = TypeMulti.get(lst);
-				}
-			}
-			if (! readCharacter('}')) {
-				reporter.syntaxError("Added '}'.", getPosition());
-				return null;
-			}
-			result = TypeBlock.get(typ_arg, typ_res);
-		} else {
-			// Expanded | Strict 
-			if (readThisKeyword(ILisaacModel.keyword_expanded) ||
-					readThisKeyword(ILisaacModel.keyword_strict)) {
-
-				style = getLastString();
-				if (isLocal && (style.equals(ILisaacModel.keyword_expanded))) {
-					reporter.syntaxError("`Expanded' is not possible.", getPosition());
-				}
-			}
-			// PROTOTYPE
-			result = readPrototype(style);
-
-			// TODO read contract
-		}
-		return result;
-	}
-
-	//++ PROTOTYPE    -> cap_identifier{('.'|'...')cap_identifier}['('PARAM_TYPE{','PARAM_TYPE}')']
-	public ITypeMono readPrototype(String style) {
-		ITypeMono result=null;
-		String name=null;
-
-		if (readCapIdentifier()) {
-			// TODO syntax {('.'|'...')cap_identifier}
-			name = getString(lastString);
-
-			if (readCharacter('(')) {
-				//
-				// Genericity.
-				//
-				ArrayList<ITypeMono> genericity = new ArrayList<ITypeMono>();
-				do {
-					ITypeMono t = readParamType();
-					if (t == null) {
-						reporter.syntaxError("Type needed.", getPosition());
-						return null;
-					}
-					genericity.add(t);
-				} while (readCharacter(','));
-				// alias genericity array...
-				result = new TypeGeneric(name, style, genericity.toArray(new ITypeMono[genericity.size()]));
-
-				if (! readCharacter(')')) {
-					reporter.syntaxError("Added ')'.", getPosition());
-					return result;
-				}
-			} else {
-				// Simple type.	 
-				if (isParameterType) {
-					if (style != null) {
-						reporter.warning("Style `"+style+"' for parameter type is ignored.", getPosition());
-					}
-					result = TypeParameter.get(name);
-				} else if (style == null) {
-					result = TypeSimple.get(name);
-				} else {
-					if (name.equals(ILisaacModel.prototype_self)) {
-						reporter.warning("Style `"+style+"' ignored.", getPosition());
-						result = TypeSimple.getTypeSelf();
-					} else {
-						result = TypeStyle.get(name,style);
-					}
-				}
-			}
-		}
-		return result;
-	}
-	
-	//++ PARAM_TYPE   -> TYPE
-	//++               | CONSTANT
-	//++               | identifier
-	private ITypeMono readParamType() {
-		ITypeMono result = readType(false);
-		if (result == null) {
-			IConstant cst = readConstant();
-			if (cst != null) {
-				// TODO compiler not yet implemented
-			} else if (readIdentifier()) {
-				// TODO compiler not yet implemented
-			}
-		}
-		return result;
-	}
-	
-	//++ SLOT         -> style TYPE_SLOT [':' (TYPE|'('TYPE_LIST')') ][ affect DEF_SLOT ]';'
-	public boolean readSlot(Prototype prototype) {
-		char affect;
-		boolean result=false;
-		IType t;
-
-		char style = readStyle();
-		if (style != ' ') {
-			//
-			// Classic slot.
-			//
-			result = true;
-			lastSlot = readTypeSlot();
-			if (lastSlot == null) {
-				reporter.syntaxError("Incorrect slot declaration.", getPosition());
-				return false;
-			}
-			lastSlot.setStyle(style);
-
-			if (readAffect()) {
-				affect = lastString.charAt(0);
-			} else {
-				affect = ' ';
-			}
-			// ':' (TYPE|'('TYPE_LIST')'
-			if (affect == ' ' && readCharacter(':')) {
-				if (readCharacter('(')) {
-					ITypeMono[] lt = readTypeList(false);
-					if (lt == null) {
-						reporter.syntaxError("Incorrect result type.", getPosition());
-						return false;
-					}
-					if (! readCharacter(')')) {
-						reporter.warning("Added ')' is needed.", getPosition());
-					}
-					t = TypeMulti.get(lt);
-				} else {
-					t = readType(false);
-					if (t == null) {
-						reporter.syntaxError("Incorrect result type.", getPosition());
-						return false;
-					}
-				}
-				if (readAffect()) {
-					affect = lastString.charAt(0);
-				}
-			} else {
-				t = TypeSimple.getTypeVoid();
-			}
-			lastSlot.setResultType(t);
-			lastSlot.setAffect(affect);
-
-			if (affect != ' ') {
-				readSpace();
-				//old_pos = position;
-				//
-				readDefSlot();
-				//
-			}
-			if (! readCharacter(';')) {
-				reporter.syntaxError("Added ';'.", getPosition());
-				return false;
-			}
-			// Added slot in prototype :
-			Slot s = prototype.getSlot(lastSlot.getName());
-			if (s != null) {
-				reporter.semanticError("Double slot declaration.", getPosition());
-			} else {
-				prototype.addSlot(lastSlot);
-			}
-		}
-		return result;
-	}
-
-	//++ DEF_SLOT     -> [CONTRACT] EXPR [CONTRACT]
-	private void readDefSlot() {
-
-		readRequire();
-		ICode expr = readExpr();
-		if (expr == null) {
-			reporter.syntaxError("Incorrect expression.", getPosition());
-		}
-		lastSlot.setValue(expr);
-		readEnsure();
-	}
-
-	//++ TYPE_SLOT    -> [ LOC_ARG '.' ] identifier [ LOC_ARG { identifier LOC_ARG } ]
-	//++               | [ LOC_ARG ] '\'' operator '\'' [("Left"|"Right") [integer]] [LOC_ARG]
-	public Slot readTypeSlot() {
-		Slot result=null;
-		IArgument arg=null;
-
-		ArrayList<IArgument> list_arg = new ArrayList<IArgument>();
-
-		arg = readLocArg(false,true);
-		if (arg == null) {
-			if (readCharacter('\'')) {
-				result = readSlotOperator(list_arg);
-			} else {
-				//arg = new ITMArgument(ILisaacModel.variable_self, TypeSimple.getTypeSelf());
-				//list_arg.add(arg); no use here? 
-
-				result = readSlotKeyword(list_arg);
-			}
-		} else {
-			list_arg.add(arg);
-			if (readCharacter('.')) {
-				result = readSlotKeyword(list_arg);
-			} else if (readCharacter('\'')) {
-				result = readSlotOperator(list_arg);
-			}
-		}
-		if (result != null) {
-			result.setArgumentList(list_arg.toArray(new IArgument[list_arg.size()]));
-		}
-		return result;
-	}
-
-	private Slot readSlotKeyword(ArrayList<IArgument> list_arg) {
-		Slot result=null;
-		Position slotPosition = getPosition();
-		int start_pos = position;
-
-		if (readIdentifier()) {
-			String n = new String(lastString);
-			
-			ArrayList<String> keywords = new ArrayList<String>();
-			keywords.add(n);
-
-			IArgument arg = readLocArg(false,false);
-			if (arg != null) {
-				list_arg.add(arg);
-				if (readIdentifier()) {
-					// TODO section external -> syntax error
-					do {
-						n += "__" + lastString;
-						keywords.add(new String(lastString));
-						
-						arg = readLocArg(false,false);
-						if (arg == null) {
-							reporter.syntaxError("Incorrect symbol.", getPosition());
-							return null;
-						}
-						list_arg.add(arg);
-					} while (readIdentifier());
-				}
-			}
-			slotPosition.setLength(position - start_pos);
-			result = new Slot(slotPosition, getString(n), lastSection);
-			//
-			result.setKeywordList(keywords.toArray(new String[keywords.size()]));
-			//
-		}
-		return result;
-	}  
-
-	//++ LOC_ARG      -> identifier ':' TYPE
-	//++               | '(' LOCAL ')'
-	public IArgument readLocArg(boolean mute, boolean selfFirst) {
-		IArgument result=null;
-
-		if ((selfFirst && readThisKeyword(ILisaacModel.variable_self)) ||
-				(! selfFirst && readIdentifier())) {
-
-			//Position pos = getPosition(); 
-			String n = new String(lastString);
-			if (readCharacter(':') && lastCharacter() != '=') {
-				ITypeMono t = readType(true);
-				if (t == null) {
-					reporter.syntaxError("Incorrect type.", getPosition());
-					return null;
-				}
-
-				// TODO SELF
-				/*if (selfFirst && (t != TypeSimple.getTypeSelf()) &&
-						((object.name != ALIAS_STR.prototype_block) || 
-					            {tb ?= t; tb = NULL})) {
-					reporter.syntaxError("Type `SELF' is needed.", getPosition());
-				}*/
-				result = new ITMArgument(n, t);
-			} else {
-				if (! mute) {
-					reporter.warning("Added ':' is needed.", getPosition());
-				}
-			}
-		} else if (readCharacter('(')) {
-			result = readLocalArg(mute, selfFirst);
-			if (result == null) {
-				if (! mute) {
-					reporter.syntaxError("Incorrect argument definition.", getPosition());
-					return null;
-				}
-			} else {
-				if (! readCharacter(')')) {
-					reporter.warning("Added ')'.", getPosition());
-				}
-			}
-		}	
-		return result;
-	}
-
-	private IArgument readLocalArg(boolean m, boolean s) {
-		IArgument result=null;
-		boolean mute = m;
-
-		if ((s && readThisKeyword(ILisaacModel.variable_self)) ||
-				readIdentifier()) {
-			List<String> name = new ArrayList<String>();
-			List<ITypeMono> type = new ArrayList<ITypeMono>();
-			int beg = 0;
-
-			do {
-				if (name.size() != 0 && !readIdentifier() && !mute) {
-					reporter.syntaxError("Incorrect argument identifier.", getPosition());
-					return null;
-				}
-				name.add(lastString);
-				if (readCharacter(':') && lastCharacter() != '=') {
-					mute = false;
-					ITypeMono t = readType(true);
-
-					if (t == null) {
-						reporter.syntaxError("Incorrect argument type.", getPosition());
-						return null;
-					}
-					for (int i=beg; i<name.size(); i++) {
-						type.add(t);
-					}
-					beg = name.size();
-				}
-			} while (readCharacter(','));
-
-			if (beg != name.size()) {
-				if (! mute) {
-					reporter.syntaxError("Incorrect argument type.", getPosition());
-					return null;
-				}
-				// free arrays..
-			} else {
-				/*if (s && (
-						type.get(0) != TypeSimple.getTypeSelf() ||
-						)) {
-					// TODO  syntax_error (current_position,"Type `SELF' is needed.");
-				}*/
-
-				if (name.size() == 1) {
-					// Single Argument.
-					result = new ITMArgument(name.get(0), type.get(0));
-					// free arrays
-				} else {
-					// Vector Arguments.
-					// alias arrays...
-					TypeMulti tm = new TypeMulti(type.toArray(new ITypeMono[type.size()]));
-					result = new ITMArgs(name.toArray(new String[name.size()]), tm);
-				}
-			}
-		}
-		return result;
-	}
-
-	private Slot readSlotOperator(ArrayList<IArgument> list_arg) { 
-		Slot result=null;
-		String associativity=null;
-		int priority=0;
-		Position slotPosition = getPosition();
-
-		if (! readOperator()) {
-			reporter.syntaxError("Operator is needed.", getPosition());
-			return null;
-		}
-		if (lastString.equals(ILisaacModel.symbol_equal) ||
-				lastString.equals(ILisaacModel.symbol_not_equal)) {
-			reporter.syntaxError("Incorrect operator.", getPosition());
-			return null;
-		}
-		String name = new String(lastString);
-		slotPosition.setLength(name.length());
-
-		if (! readCharacter('\'')) {
-			reporter.warning("Added `''.", getPosition());
-		}
-		if (readThisKeyword(ILisaacModel.keyword_left) ||
-				readThisKeyword(ILisaacModel.keyword_right)) {
-			associativity = new String(lastString);
-			if (readInteger()) {
-				priority = (int) lastInteger;
-			}
-		}
-		if (list_arg.isEmpty()) {
-			// Prefix operator.
-			IArgument arg = readLocArg(false,true);
-			if (arg == null) {
-				reporter.syntaxError("Operator declaration invalid.", getPosition());
-				return null;
-			}
-			list_arg.add(arg);
-			name = getOperator("__prefix", name);
-			if (associativity != null) {
-				reporter.syntaxError("No associativity for postfix operator.", getPosition());
-			}
-		} else {
-			IArgument arg = readLocArg(false,false);
-			if (arg != null) {
-				// Infix operator.
-				list_arg.add(arg);
-				name = getOperator("__infix", name);
-				if (associativity == null) {
-					associativity = ILisaacModel.keyword_left;
-				}
-			} else {
-				// Postfix operator.
-				name = getOperator("__postfix", name);
-				if (associativity != null) {
-					reporter.syntaxError("No associativity for prefix operator.", getPosition());
-				}
-			}
-		}
-		result = new Slot(slotPosition, name, lastSection);
-		result.setAssociativity(associativity, priority);
-
-		return result;
-	} 
-
-	private String getOperator(String typ, String op) {
-		String s = new String(typ);
-
-		for (int i=0; i<op.length(); i++) {
-			char c = op.charAt(i);
-			switch (c) {
-			case '+': s += "_add"; break;
-			case '-': s += "_sub"; break;
-			case '~': s += "_logicnot"; break;
-			case '!': s += "_not"; break;
-			case '/': s += "_div"; break;
-			case '*': s += "_mul"; break;
-			case '^': s += "_xor"; break;
-			case '%': s += "_mod"; break;
-			case '>': s += "_greater"; break;
-			case '<': s += "_less"; break;
-			case '=': s += "_equal"; break;
-			case '\\': s += "_notdiv"; break;
-			case '|': s += "_or"; break;
-			case '&': s += "_and"; break;
-			case '$': s += "_dollar"; break;
-			case '#': s += "_diese"; break;
-			case '@': s += "_at"; break;
-			case '?': s += "_ask"; break;
-			}
-		}
-		return getString(s); // alias string
-	}
-
-	//++ EXPR         -> { ASSIGN !!AMBIGU!! affect } EXPR_OPERATOR
-	//++ ASSIGN       -> '(' IDF_ASSIGN { ',' IDF_ASSIGN } ')'
-	//++               | IDF_ASSIGN
-	//++ IDF_ASSIGN   -> identifier { identifier }
-	public ICode readExpr() {
-		ICode result=null;
-		boolean again;
-		String string_tmp2="";
-
-		// !! AMBIGU resolution !!    
-		saveContext();
-
-		if (readCharacter('(')) {
-			ArrayList<String> l_assignment = new ArrayList<String>();
-			do {
-				again = false;
-				if (readIdentifier()) {
-					//p = position - lastString.length();
-
-					string_tmp2 = new String(lastString);
-					while (readIdentifier()) {
-						string_tmp2 += "__" + lastString;
-					}
-					String name = getString(string_tmp2);
-					l_assignment.add(name);
-
-					if (readCharacter(',')) {
-						again = true;
-					}
-				}
-			} while(again);
-
-			if (!l_assignment.isEmpty() && readCharacter(')') && readAffect()) {
-				// result = ITM_LIST_IDF
-				// TODO get code result
-				result = new ITMFixme();
-
-				char affect = lastString.charAt(0);
-				ICode value = readExpr();
-				if (value == null) {
-					reporter.syntaxError("Incorrect expression.", getPosition());
-					return null;
-				}
-				switch (affect) {
-				case ':': break; // TODO code
-				case '<':
-					reporter.syntaxError("Impossible '<-' style assignment with vector.", getPosition());
-					return null;
-				case '?': break; // TODO code	
-				}
-			} else {
-				// FREE l_assignment
-			}
-		} else if (readIdentifier()) {
-			//p = position - lastString.length();
-			string_tmp2 = new String(lastString);
-			while (readIdentifier()) {
-				string_tmp2 += "__" + lastString;
-			}
-			String name = getString(string_tmp2);
-
-			if (readAffect()) {
-				result = new ITMRead(name);
-
-				char affect = lastString.charAt(0);
-				ICode value = readExpr();
-				if (value == null) {
-					reporter.syntaxError("Incorrect expression.", getPosition());
-					return null;
-				}
-				switch (affect) {
-				case ':': break; // TODO code
-				case '<': break; // TODO code
-				case '?': break; // TODO code	
-				}
-			}
-		}
-		if (result == null) {
-			restoreContext();
-			result = readExprOperator();
-		}
-		return result;
-	}
-
-	//++ EXPR_OPERATOR-> { operator } EXPR_MESSAGE { operator {operator} EXPR_MESSAGE } {operator}
-	private ICode readExprOperator() {
-		ICode result=null;
-		int first_msg,last_msg;
-
-		ArrayList<ICode> l_expr = new ArrayList<ICode>();
-		while (readOperator()) {
-			ICode expr = new ITMOperator(new String(lastString));
-			l_expr.add(expr);
-		}
-		ICode expr = readExprMessage();
-		if (expr == null) {
-			// Error.
-			if (l_expr.size() > 0) {
-				reporter.syntaxError("Incorrect expression.", getPosition());
-			}
-			// free l_expr
-		} else {
-			// { operator {operator} EXPR_MESSAGE } {operator}
-			first_msg = l_expr.size();
-			do {
-				last_msg = l_expr.size();
-				l_expr.add(expr);
-				if (readOperator()) {
-					do {
-						expr = new ITMOperator(new String(lastString));
-						l_expr.add(expr);
-					} while (readOperator());
-
-					expr = readExprMessage();
-				} else {
-					expr = null;
-				}
-			} while (expr != null);
-
-			// Last Post-fix operator.
-			while (last_msg < l_expr.size()-1) {
-				ITMOperator itm_op = (ITMOperator) l_expr.get(last_msg+1);
-				expr = new ITMReadArg1(getOperator("__postfix", itm_op.getName()), l_expr.get(last_msg));
-
-				l_expr.add(last_msg, expr);
-				l_expr.remove(last_msg+1);
-			}
-			if (last_msg - first_msg < 3) {
-				// First Pre-fix operator.
-				while (first_msg != 0) {
-					ITMOperator itm_op = (ITMOperator) l_expr.get(first_msg - 1);
-					expr = new ITMReadArg1(getOperator("__prefix", itm_op.getName()), l_expr.get(first_msg));
-
-					l_expr.add(first_msg, expr);
-					first_msg = first_msg - 1;
-					l_expr.remove(first_msg);
-				}
-			}
-			if (l_expr.size() == 1) {
-				result = l_expr.get(0);// first
-				// free l_expr
-			} else if (l_expr.size() == 3) {
-				// Simple binary message.
-				ITMOperator itm_op = (ITMOperator) l_expr.get(1);// second
-				result = new ITMReadArg2(getOperator("__infix", itm_op.getName()),
-						l_expr.get(0),
-						l_expr.get(2));
-				// free l_expr
-			} else {
-				// Complex expression.
-				result = new ITMExpression(l_expr.toArray(new ICode[l_expr.size()]));
-			}
-		}
-		return result;
-	}
-
-	//++ EXPR_MESSAGE -> EXPR_BASE { '.' SEND_MSG }
-	protected ICode readExprMessage() {
-
-		ICode result = readExprBase();
-		if (result != null) {
-			while (readCharacter('.')) {
-				result = readSendMsg(result);
-				if (result == null) {
-					reporter.syntaxError("Incorrect message.", getPosition());
-					return null;
-				}
-			}
-		}
-		return result;
-	}
-
-	//++ EXPR_BASE    -> "Old" EXPR
-	//++               | EXPR_PRIMARY
-	//++               | SEND_MSG
-	protected ICode readExprBase() {
-		ICode result=null;
-
-		if (readThisKeyword(ILisaacModel.keyword_old)) {
-			ICode old_value = readExpr();
-			if (old_value == null) {
-				reporter.syntaxError("Incorrect `Old' expression.", getPosition());
-				return null;
-			}
-			result = new ITMOld(old_value);
-		} else {
-			result = readExprPrimary();
-			if (result == null) {
-				result = readSendMsg(null);
-			}
-		}
-		return result;
-	}
-
-	//++ EXPR_PRIMARY -> "Self"
-	//++               | result
-	//++               | PROTOTYPE
-	//++               | CONSTANT
-	//++               | '(' GROUP ')'
-	//++               | '{' [ LOC_ARG ';' !! AMBIGU!! ] GROUP '}'
-	//++               | external [ ':' ['('] TYPE ['{' TYPE_LIST '}'] [')'] ]
-	public ICode readExprPrimary() {
-		ICode result=null;
-		String result_id=null;
-		ITypeMono type=null;
-		ITMList group_sav=null;
-
-		if (readThisKeyword(ILisaacModel.variable_self)) {
-			result = new ITMRead(new String(lastString));
-		} else if (readThisKeyword(ILisaacModel.keyword_result)) {
-			if (lastCharacter() == '_') {
-				position = position + 1;
-				string_tmp = "" + ILisaacModel.keyword_result + "_";
-
-				while (Character.isDigit(lastCharacter())) {
-					string_tmp += lastCharacter();
-					position = position + 1;
-				}
-				if (string_tmp.length() <= 0) {
-					reporter.syntaxError("Incorrect Result number.", getPosition());
-				}
-				result_id = getString(string_tmp);
-			} else {
-				result_id = ILisaacModel.keyword_result;
-			}
-			result = new ITMRead(result_id);
-
-		} else if ((type = readPrototype(null)) != null) {
-			result = new ITMPrototype(type);
-
-		} else if ((result = readConstant()) != null) {
-		} else if (readCharacter('(')) {
-			group_sav = lastGroup;
-			lastGroup = new ITMList();
-			result = lastGroup;
-
-			lastGroup.setCode(readGroup());
-			if (! readCharacter(')')) {
-				reporter.syntaxError("Added ')'.", getPosition());
-				return null;
-			}
-			lastGroup = group_sav;
-		} else if (readCharacter('{')) {
-			group_sav = lastGroup;  
-			lastGroup = new ITMList();
-
-			saveContext(); // !! SAVE CONTEXT !!
-
-			//
-			IArgument arg = readLocArg(true,false);
-			//
-			if (arg != null) {
-				if (! readCharacter(';')) {
-					reporter.syntaxError("Added ';'.", getPosition());
-					return null;
-				}
-			} else {
-				restoreContext(); // !! RESTORE CONTEXT !!
-			}
-			result = new ITMBlock(lastGroup, arg);
-
-			lastGroup.setCode(readGroup());
-			if (! readCharacter('}')) {
-				reporter.syntaxError("Added '}'.", getPosition());
-				return null;
-			}
-			lastGroup = group_sav; 
-		} else if (readExternal()) {
-			if (! readCharacter(':')) {
-				result = new ITMExternal(new String(lastString));
-			} else {
-				boolean persistant = readCharacter('(');
-				ITMExternalType ext = new ITMExternalType(new String(lastString), persistant);
-				type = readType(false);
-				if (type == null) {
-					reporter.syntaxError("Incorrect type.", getPosition());
-					return null;
-				}
-				ext.setType(type);
-				if (readCharacter('{')) {
-					ITypeMono[] ltype = readTypeList(false);
-					if (ltype == null) {
-						reporter.syntaxError("Incorrect live type list.", getPosition());
-						return null;
-					}
-					if (! readCharacter('}')) {
-						reporter.syntaxError("Added '}'.", getPosition());
-						return null;
-					}
-					ext.setTypeList(ltype);
-				}
-				if (ext.isPersistant() && (! readCharacter(')'))) {
-					reporter.syntaxError("Added '}'.", getPosition());
-					return null;
-				}
-				result = ext;
-			}
-		}
-		return result;
-	}
-
-	//++ CONSTANT     -> integer
-	//++               | real
-	//++               | characters
-	//++               | string
-	private IConstant readConstant() {
-		IConstant result=null;
-
-		if (readReal()) {
-			result = new ITMReal(new String(lastReal));
-		} else if (readInteger()) {
-			result = new ITMNumber(lastInteger);
-		} else if (readCharacters()) {
-			result = new ITMCharacter(new String(lastString));
-		} else if (readString()) {
-			result = new ITMString(new String(lastString));
-		}
-		return result;
-	}
-
-	//++ GROUP        -> DEF_LOCAL {EXPR ';'} [ EXPR {',' {EXPR ';'} EXPR } ]
-	private ICode[] readGroup() {		
-		readDefLocal();
-
-		ArrayList<ICode> result = new ArrayList<ICode>();
-		ICode e = readExpr();
-		while (e != null && readCharacter(';')) {
-			result.add(e);
-			e = readExpr();
-		}
-		if (e != null) {
-			if (readCharacter(',')) {
-				do {
-					e = new ITMResult(e);
-					result.add(e);
-					e = readExpr();
-					while (e != null && readCharacter(';')) {
-						result.add(e);
-						e = readExpr();
-					}
-					if (e == null) {
-						reporter.syntaxError("Incorrect multiple result expression.", getPosition());
-						return null;
-					}
-				} while (readCharacter(','));
-			}
-			e = new ITMResult(e);
-			result.add(e);
-		}
-		return result.toArray(new ICode[result.size()]);
-	}
-
-	//++ DEF_LOCAL    -> { style LOCAL ';' } !! AMBIGU !!
-	private void readDefLocal() {
-		List<ITMLocal> loc_lst;
-
-		saveContext(); // !! SAVE CONTEXT !!
-
-		char style = readStyle();
-		ArrayList<ITMLocal> local_list = new ArrayList<ITMLocal>();
-		ArrayList<ITMLocal> static_list = new ArrayList<ITMLocal>();
-
-		while (style != ' ') {
-			loc_lst = readLocal(true);
-			if (loc_lst != null) {
-				if (style == '+') {
-					local_list.addAll(loc_lst);
-				} else {
-					static_list.addAll(loc_lst);
-				}
-				if (! readCharacter(';')) {
-					reporter.syntaxError("Added ';'.", getPosition());
-				}
-				saveContext(); // !! SAVE CONTEXT !!
-
-				style = readStyle();
-			} else {
-				restoreContext(); // !! RESTORE CONTEXT !!
-				style = ' ';
-			}
-		}
-		if (local_list.isEmpty()) {
-			// free local_list
-		} else {
-			lastGroup.setLocalList(local_list.toArray(new ITMLocal[local_list.size()]));
-		}
-		if (static_list.isEmpty()) {
-			// free static_list
-		} else {
-			lastGroup.setStaticList(static_list.toArray(new ITMLocal[static_list.size()]));
-		}
-	}
-
-	//++ SEND_MSG     -> identifier [ ARGUMENT { identifier ARGUMENT } ]
-	protected ICode readSendMsg(ICode firstArg) {
-		ICode result=null;
-
-		if (readIdentifier()) {
-			//
-			// Classic Message.
-			//
-			String n = getString(lastString);// create alias
-
-			// Argument list.
-			LinkedList<ICode> l_arg = new LinkedList<ICode>();
-			ICode arg = readArgument();
-			if (arg != null) {
-				l_arg.addLast(arg);
-				while (readIdentifier()) {
-					n += "__" + lastString; // FIXME: alias pb
-					arg = readArgument();
-					if (arg == null) {
-						reporter.syntaxError("Incorrect argument.", getPosition());
-						return null;
-					}
-					l_arg.addLast(arg);
-				}
-			}
-			String name = getString(n); // FIXME alias pb
-			if (l_arg.isEmpty()) {
-				if (firstArg == null) {
-					// Local ou Implicite Slot without argument.
-					result = new ITMRead(name);
-				} else {
-					result = new ITMReadArg1(name, firstArg);
-				}
-				// free l_arg
-			} else if (l_arg.size() == 1) {
-				result = new ITMReadArg2(name, firstArg, l_arg.get(0));
-				// free l_arg
-			} else {
-				l_arg.addFirst(firstArg);
-				result = new ITMReadArgs(name, l_arg.toArray(new ICode[l_arg.size()]));
-			}
-		}	
-		return result;
-	}
-
-	//++ ARGUMENT     -> EXPR_PRIMARY
-	//++               | identifier
-	private ICode readArgument() {
-		ICode result = readExprPrimary();
-		if (result == null && readIdentifier()) {
-			result = new ITMRead(new String(lastString));
-		}
-		return result;
-	}
-
-	//++ LOCAL        -> { identifier [ ':' TYPE ] ',' } identifier ':' TYPE
-	private List<ITMLocal> readLocal(boolean m) {
-		List<ITMLocal> result=null;
-		int beg = 0;
-
-		boolean mute = m;
-		if (readIdentifier()) {
-			result = new LinkedList<ITMLocal>();			
-			do {
-				if (result.size() != 0 && !readIdentifier() && !mute) {
-					reporter.syntaxError("Incorrect identifier.", getPosition());
-					return null;
-				}
-				ITMLocal loc = new ITMLocal(new String(lastString));
-				result.add(loc);
-				if (readCharacter(':') && lastCharacter() != '=') {
-					mute = false;
-					ITypeMono t = readType(false);
-					if (t == null) {
-						reporter.syntaxError("Incorrect local type.", getPosition());
-						return null;
-					}
-					for (int j=beg; j<result.size(); j++) {
-						result.get(j).setType(t);
-					}
-					beg = result.size(); // upper+1
-				}
-			} while(readCharacter(','));
-			if (beg != result.size()) {
-				if (mute) {
-					// free result
-					result = null;
-				} else {
-					reporter.syntaxError("Incorrect local type.", getPosition());
-					return null;
-				}
-			} else {
-			}
-		}	
-		return result;
-	}
-
-	public boolean readRequire() {
-		boolean result=false;
-		
-		ITMList lst = readContract();
-		if (lst != null) {
-			// lastSlot.setRequire lst
-			result = true;
-		}
-		return result;
-	}
-
-	public boolean readEnsure() {
-		boolean result=false;
-		
-		ITMList lst = readContract();
-		if (lst != null) {
-			// lastSlot.setEnsure lst
-			result = true;
-		}
-		return result;
-	}
-
-	//++ CONTRACT     -> '[' DEF_LOCAL { ( EXPR ';' | "..." ) } ']'
-	private ITMList readContract() {
-		ITMList result = null;
-		
-		if (readCharacter('[')) {
-			result = new ITMList();
-			lastGroup = result;
-			
-			readDefLocal();
-			
-			ArrayList<ICode> lst = new ArrayList<ICode>();
-			boolean doContinue = false;
-			do {
-				ICode e = readExpr();
-				if (e == null) {
-					doContinue = readWord(ILisaacModel.keyword_ldots);
-					if (doContinue) {
-						lst.add(new ITMLDots());
-					}
-				} else {
-					lst.add(e);
-					if (! readCharacter(';')) {
-						reporter.syntaxError("Added ';'.", getPosition());
-						return null;
-					}
-					doContinue = true;
-				}
-			} while (doContinue);
-			
-			if (! readCharacter(']')) {
-				reporter.syntaxError("Added ']'.", getPosition());
-				return null;
-			}
-			// TODO lst add prototype void
-			result.setCode(lst.toArray(new ICode[lst.size()]));
-		}
-		return result;
-	}	   
-	
-	public boolean skipUntilThisKeyword(String st) {
-		int idx;
-		int posold;
-		boolean result=false;
-
-		while (! isEOF() && ! result) {
-			idx = 0;
-			while ((readSpace() || lastCharacter() == '\n') && lastCharacter() != st.charAt(idx)) {
-				position++;
-			}
-			posold = position;
-			position++;
-			idx++;
-			if (! isEOF()) {
-				while (idx <= st.length()-1 && lastCharacter() == st.charAt(idx)) {
-					position++;
-					idx++;
-				}
-				if (idx > st.length()-1) {
-					lastString = st;
-					position = posold;
-					result = true;
-				}
-			}
-		}
-		return result;
-	}
-
-	public String readSlotNameFromOffset(int offset) {
-		String result=null;
-		int oldPosition = position;
-		position = offset;
-
-		//++ TYPE_SLOT    -> [ LOC_ARG '.' ] identifier [ LOC_ARG { identifier LOC_ARG } ]
-		//++               | [ LOC_ARG ] '\'' operator '\'' [("Left"|"Right") [integer]] [LOC_ARG]
-		if (! skipLocalArg(true)) {
-			if (readCharacter('\'')) {
-				result = readSlotNameOperator();
-			} else {
-				result = readSlotNameKeyword();
-			}
-		} else {
-			if (readCharacter('.')) {
-				result = readSlotNameKeyword();
-			} else if (readCharacter('\'')) {
-				result = readSlotNameOperator();
-			}
-		}
-		position = oldPosition;
-		return result;
-	}
-
-	//++ LOC_ARG      -> identifier ':' TYPE
-	//++               | '(' LOCAL ')'
-	public boolean skipLocalArg(boolean selfFirst) {
-		boolean result=false;
-		if ((selfFirst && readThisKeyword(ILisaacModel.variable_self)) ||
-				(! selfFirst && readIdentifier())) {
-			if (readCharacter(':') && lastCharacter() != '=') {
-				return skipType();
-			}
-		} else if (readCharacter('(')) {
-			result = skipLocal(selfFirst);
-			if (! result) {
-				return false;
-			} else {
-				if (! readCharacter(')')) {
-					return false;
-				}
-				result = true;
-			}
-		}	
-		return result;
-	}
-
-	private boolean skipLocal(boolean s) {
-		boolean result = false;
-
-		if ((s && readThisKeyword(ILisaacModel.variable_self)) ||
-				readIdentifier()) {
-			int size = 0;
-			do {
-				if (size != 0 && !readIdentifier()) {
-					return false;
-				}
-				size++;
-				if (readCharacter(':') && lastCharacter() != '=') {
-					if (!skipType()) {
-						return false;
-					}
-					result = true;
-				}
-			} while (readCharacter(','));
-		}
-		return result;
-	}
-	
-	private String readSlotNameKeyword() {
-		String result=null;
-
-		if (readIdentifier()) {
-			result = new String(lastString);
-
-			if (skipLocalArg(false)) {
-				if (readIdentifier()) {
-					do {
-						result += "__" + lastString;
-						if (! skipLocalArg(false)) {
-							return null;
-						}
-					} while (readIdentifier());
-				}
-			}
-		}
-		return result;
-	}  
-
-	private String readSlotNameOperator() { 
-		String result=null;
-
-		if (! readOperator()) {
-			return null;
-		}
-		result = new String(lastString);
-		result = getOperator("__infix", result);// TODO fix!! prefix postfix
-
-		return result;
-	} 
-
-	//++ TYPE         -> '{' [ (TYPE | '(' TYPE_LIST ')') ';' ] [ TYPE_LIST ] '}'
-	//++               | [type] PROTOTYPE [ CONTRACT ]
-	public boolean skipType () {
-		boolean result=false;
-
-		if (readCharacter('{')) {
-			// '{' [ (TYPE | '(' TYPE_LIST ')') ';' ] [ TYPE_LIST ] '}' 
-			if (readCharacter('(')) {
-				// Read vector argument.
-				result = skipTypeList();
-				if (! result) {
-					return false;
-				}
-				if (! readCharacter(')')) {
-					return false;
-				}
-				if (! readCharacter(';')) {
-					return false;
-				}
-				// Read result type.
-				result = skipTypeList();
-			} else {
-
-				result = skipTypeList();
-				if (result) {
-					if (readCharacter(';')) {
-						// Read result type.
-						result = skipTypeList();
-					}
-				}
-			}
-			if (! readCharacter('}')) {
-				return false;
-			}
-			result = true;
-		} else {
-			// Expanded | Strict 
-			if (readThisKeyword(ILisaacModel.keyword_expanded) ||
-					readThisKeyword(ILisaacModel.keyword_strict)) {
-			}
-			// PROTOTYPE
-			result = skipPrototype();
-			// TODO read contract
-		}
-		return result;
-	}
-
-	//++ TYPE_LIST    -> TYPE { ',' TYPE }
-	public boolean skipTypeList() {
-		boolean result=false;
-
-		result = skipType();
-		if (result) {
-			while (readCharacter(',')) {
-				result = skipType();
-				if (! result) {
-					return false;
-				}
-			}
-		}
-		return result;
-	}
-
-	//++ PROTOTYPE    -> cap_identifier{('.'|'...')cap_identifier}['('PARAM_TYPE{','PARAM_TYPE}')']
-	public boolean skipPrototype() {
-		boolean result=false;
-
-		if (readCapIdentifier()) {
-			// TODO syntax {('.'|'...')cap_identifier}
-			if (readCharacter('(')) {
-				//
-				// Genericity.
-				//
-				do {
-					if (! skipParamType()) {
-						return false;
-					}
-				} while (readCharacter(','));
-				if (! readCharacter(')')) {
-					return false;
-				}
-				result = true;
-			} else {
-				// Simple type.	 
-				result = true;
-			}
-		}
-		return result;
-	}
-	
-	//++ PARAM_TYPE   -> TYPE
-	//++               | CONSTANT
-	//++               | identifier
-	private boolean skipParamType() {
-		if (! skipType()) {
-			// TODO compiler not yet implemented
-			return false;
-		}
-		return true;
-	}
-	
-
-	/**
-	 * Read the next context in lisaac code.
-	 * @return Context at parser position
-	 */
-	public ILisaacContext readContext() {
-		readSpace();
-
-		int old_pos = position;
-
-		//
-		// Try read Section Context.
-		//    
-		if (readThisKeyword (ILisaacModel.keyword_section)) {
-			position = old_pos;
-			return sectionContext;
-		}
-
-		//
-		// Try read Slot Context.
-		//
-		if (readCharacter('-') || readCharacter('+')) {
-			position = old_pos;
-			return slotContext;
-		}
-		// restore old position (unread)
-		position = old_pos;
-
-		if (position >= source.length()-1) {
-			return null;
-		} else {
-			// error
-			reporter.syntaxError("Syntax error", getPosition());
-			return sectionContext.getNextContext(); // go to next section
-		}
-	}
-}
+package org.eclipse.lisaac.model;
+
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.lisaac.builder.LisaacParseException;
+import org.eclipse.lisaac.model.items.*;
+import org.eclipse.lisaac.model.types.*;
+
+/**
+ *  Lisaac Prototype Parser
+ */
+public class LisaacParser extends AbstractLisaacParser {
+
+	private ILisaacContext sectionContext;
+	private ILisaacContext slotContext;
+
+	//
+	private Slot lastSlot;
+	private ITMList lastGroup;
+	private Section lastSection;
+	//
+
+	public LisaacParser(InputStream contents, ILisaacModel model) {
+		super(contents, model);
+		this.model = model;
+
+		sectionContext = new SectionContext(this);
+		slotContext = new SlotContext(this);
+
+		initialize();
+	}
+
+	public LisaacParser(String contents) {
+		super(contents);
+		initialize();
+	}
+
+	public void initialize() {
+		//
+		// initialisations
+		//
+		super.initialize();
+		TypeSimple.init();
+	}
+
+	public ILisaacContext getSectionContext() {
+		return sectionContext;
+	}
+
+	public Slot getLastSlot() {
+		return lastSlot;
+	}
+
+	public void setLastSection(Section section) {
+		lastSection = section;
+	}
+
+	//
+	// Lisaac Prototype Parser
+	//
+
+	//++ TYPE_LIST    -> TYPE { ',' TYPE }
+	public ITypeMono[] readTypeList(boolean isSection) {
+		ArrayList<ITypeMono> lst=null;
+		ITypeMono t;
+
+		t = readType(false);
+		if (t != null) {
+			if (isSection) {
+				if (! (t instanceof TypeSimple)) {
+					reporter.syntaxError("For a section, the prototype name only (without '('...')').", getPosition());
+					return null;
+				}
+			}
+			lst = new ArrayList<ITypeMono>();
+			lst.add(t);
+			while (readCharacter(',')) {
+				t = readType(false);
+				if (t == null) {
+					reporter.syntaxError("Incorrect type list.", getPosition());
+					return null;
+				}
+				if (isSection) {
+					if (! (t instanceof TypeSimple)) {
+						reporter.syntaxError("For a section, the prototype name only (without '('...')').", getPosition());
+						return null;
+					}
+				}
+				lst.add(t);
+			}
+			// TODO alias lst
+		}
+		if (lst != null) {
+			return lst.toArray(new ITypeMono[lst.size()]);
+		}
+		return null;
+	}
+
+	//++ TYPE         -> '{' [ (TYPE | '(' TYPE_LIST ')') ';' ] [ TYPE_LIST ] '}'
+	//++               | [type] PROTOTYPE [ CONTRACT ]
+	public ITypeMono readType (boolean isLocal) {
+		ITypeMono result=null;
+		ITypeMono[] lst=null;
+		IType typ_arg=null,typ_res=null;
+		String style=null;
+
+		if (readCharacter('{')) {
+			// '{' [ (TYPE | '(' TYPE_LIST ')') ';' ] [ TYPE_LIST ] '}' 
+			if (readCharacter('(')) {
+				// Read vector argument.
+				lst = readTypeList(false);
+				if (lst == null) {
+					reporter.syntaxError("Incorrect type list.", getPosition());
+					return null;
+				}
+				if (lst.length == 1) {
+					typ_arg = lst[0];
+				} else {
+					typ_arg = TypeMulti.get(lst);
+				}
+				if (! readCharacter(')')) {
+					reporter.syntaxError("Added ')'.", getPosition());
+					return null;
+				}
+				if (! readCharacter(';')) {
+					reporter.syntaxError("Added ';'.", getPosition());
+				}
+				// Read result type.
+				lst = readTypeList(false);
+			} else {
+
+				lst = readTypeList(false);
+				if (lst != null) {
+					if (readCharacter(';')) {
+						if (lst.length == 1) {
+							typ_arg = lst[0];
+						} else {
+							typ_arg = TypeMulti.get(lst);
+							// TODO warning "Added 'typ_arg'."
+						}
+						// Read result type.
+						lst = readTypeList(false);
+					}
+				}
+			}
+			if (lst != null) {
+				if (lst.length == 1) {
+					typ_res = lst[0];
+				} else {
+					typ_res = TypeMulti.get(lst);
+				}
+			}
+			if (! readCharacter('}')) {
+				reporter.syntaxError("Added '}'.", getPosition());
+				return null;
+			}
+			result = TypeBlock.get(typ_arg, typ_res);
+		} else {
+			// Expanded | Strict 
+			if (readThisKeyword(ILisaacModel.keyword_expanded) ||
+					readThisKeyword(ILisaacModel.keyword_strict)) {
+
+				style = getLastString();
+				if (isLocal && (style.equals(ILisaacModel.keyword_expanded))) {
+					reporter.syntaxError("`Expanded' is not possible.", getPosition());
+				}
+			}
+			// PROTOTYPE
+			result = readPrototype(style);
+
+			// TODO read contract
+		}
+		return result;
+	}
+
+	//++ PROTOTYPE    -> cap_identifier{('.'|'...')cap_identifier}['('PARAM_TYPE{','PARAM_TYPE}')']
+	public ITypeMono readPrototype(String style) {
+		ITypeMono result=null;
+		String name=null;
+
+		if (readCapIdentifier()) {
+			// TODO syntax {('.'|'...')cap_identifier}
+			name = getString(lastString);
+
+			if (readCharacter('(')) {
+				//
+				// Genericity.
+				//
+				ArrayList<ITypeMono> genericity = new ArrayList<ITypeMono>();
+				do {
+					ITypeMono t = readParamType();
+					if (t == null) {
+						reporter.syntaxError("Type needed.", getPosition());
+						return null;
+					}
+					genericity.add(t);
+				} while (readCharacter(','));
+				// alias genericity array...
+				result = new TypeGeneric(name, style, genericity.toArray(new ITypeMono[genericity.size()]));
+
+				if (! readCharacter(')')) {
+					reporter.syntaxError("Added ')'.", getPosition());
+					return result;
+				}
+			} else {
+				// Simple type.	 
+				if (isParameterType) {
+					if (style != null) {
+						reporter.warning("Style `"+style+"' for parameter type is ignored.", getPosition());
+					}
+					result = TypeParameter.get(name);
+				} else if (style == null) {
+					result = TypeSimple.get(name);
+				} else {
+					if (name.equals(ILisaacModel.prototype_self)) {
+						reporter.warning("Style `"+style+"' ignored.", getPosition());
+						result = TypeSimple.getTypeSelf();
+					} else {
+						result = TypeStyle.get(name,style);
+					}
+				}
+			}
+		}
+		return result;
+	}
+
+	//++ PARAM_TYPE   -> TYPE
+	//++               | CONSTANT
+	//++               | identifier
+	private ITypeMono readParamType() {
+		ITypeMono result = readType(false);
+		if (result == null) {
+			IConstant cst = readConstant();
+			if (cst != null) {
+				// TODO compiler not yet implemented
+			} else if (readIdentifier()) {
+				// TODO compiler not yet implemented
+			}
+		}
+		return result;
+	}
+
+	//++ SLOT         -> style TYPE_SLOT [':' (TYPE|'('TYPE_LIST')') ][ affect DEF_SLOT ]';'
+	public boolean readSlot(Prototype prototype) {
+		char affect;
+		boolean result=false;
+		IType t;
+
+		char style = readStyle();
+		if (style != ' ') {
+			//
+			// Classic slot.
+			//
+			result = true;
+			lastSlot = readTypeSlot();
+			if (lastSlot == null) {
+				reporter.syntaxError("Incorrect slot declaration.", getPosition());
+				return false;
+			}
+			lastSlot.setStyle(style);
+
+			if (readAffect()) {
+				affect = lastString.charAt(0);
+			} else {
+				affect = ' ';
+			}
+			// ':' (TYPE|'('TYPE_LIST')'
+			if (affect == ' ' && readCharacter(':')) {
+				if (readCharacter('(')) {
+					ITypeMono[] lt = readTypeList(false);
+					if (lt == null) {
+						reporter.syntaxError("Incorrect result type.", getPosition());
+						return false;
+					}
+					if (! readCharacter(')')) {
+						reporter.warning("Added ')' is needed.", getPosition());
+					}
+					t = TypeMulti.get(lt);
+				} else {
+					t = readType(false);
+					if (t == null) {
+						reporter.syntaxError("Incorrect result type.", getPosition());
+						return false;
+					}
+				}
+				if (readAffect()) {
+					affect = lastString.charAt(0);
+				}
+			} else {
+				t = TypeSimple.getTypeVoid();
+			}
+			lastSlot.setResultType(t);
+			lastSlot.setAffect(affect);
+
+			if (affect != ' ') {
+				readSpace();
+				//old_pos = position;
+				//
+				readDefSlot();
+				//
+			}
+			if (! readCharacter(';')) {
+				reporter.syntaxError("Added ';'.", getPosition());
+				return false;
+			}
+			if (lastSection.isInheritOrInsert()) {
+				// Add parent slot
+				Slot s = prototype.getParentSlot(lastSlot.getName());
+				if (s != null) {
+					reporter.semanticError("Double slot declaration.", getPosition());
+				} else {
+					prototype.addParentSlot(lastSlot);
+				}
+			} else {
+				// Added slot in prototype :
+				Slot s = prototype.getSlot(lastSlot.getName());
+				if (s != null) {
+					reporter.semanticError("Double slot declaration.", getPosition());
+				} else {
+					prototype.addSlot(lastSlot);
+				}
+			}
+		}
+		return result;
+	}
+
+	//++ DEF_SLOT     -> [CONTRACT] EXPR [CONTRACT]
+	private void readDefSlot() {
+
+		readRequire();
+		ICode expr = readExpr();
+		if (expr == null) {
+			reporter.syntaxError("Incorrect expression.", getPosition());
+		}
+		lastSlot.setValue(expr);
+		readEnsure();
+	}
+
+	//++ TYPE_SLOT    -> [ LOC_ARG '.' ] identifier [ LOC_ARG { identifier LOC_ARG } ]
+	//++               | [ LOC_ARG ] '\'' operator '\'' [("Left"|"Right") [integer]] [LOC_ARG]
+	public Slot readTypeSlot() {
+		Slot result=null;
+		IArgument arg=null;
+
+		ArrayList<IArgument> list_arg = new ArrayList<IArgument>();
+
+		arg = readLocArg(false,true);
+		if (arg == null) {
+			if (readCharacter('\'')) {
+				result = readSlotOperator(list_arg);
+			} else {
+				//arg = new ITMArgument(ILisaacModel.variable_self, TypeSimple.getTypeSelf());
+				//list_arg.add(arg); no use here? 
+
+				result = readSlotKeyword(list_arg);
+			}
+		} else {
+			list_arg.add(arg);
+			if (readCharacter('.')) {
+				result = readSlotKeyword(list_arg);
+			} else if (readCharacter('\'')) {
+				result = readSlotOperator(list_arg);
+			}
+		}
+		if (result != null) {
+			result.setArgumentList(list_arg.toArray(new IArgument[list_arg.size()]));
+		}
+		return result;
+	}
+
+	private Slot readSlotKeyword(ArrayList<IArgument> list_arg) {
+		Slot result=null;
+		Position slotPosition = getPosition();
+		int start_pos = position;
+
+		if (readIdentifier()) {
+			String n = new String(lastString);
+
+			ArrayList<String> keywords = new ArrayList<String>();
+			keywords.add(n);
+
+			IArgument arg = readLocArg(false,false);
+			if (arg != null) {
+				list_arg.add(arg);
+				if (readIdentifier()) {
+					// TODO section external -> syntax error
+					do {
+						n += "__" + lastString;
+						keywords.add(new String(lastString));
+
+						arg = readLocArg(false,false);
+						if (arg == null) {
+							reporter.syntaxError("Incorrect symbol.", getPosition());
+							return null;
+						}
+						list_arg.add(arg);
+					} while (readIdentifier());
+				}
+			}
+			slotPosition.setLength(position - start_pos);
+			result = new Slot(slotPosition, getString(n), lastSection);
+			//
+			result.setKeywordList(keywords.toArray(new String[keywords.size()]));
+			//
+		}
+		return result;
+	}  
+
+	//++ LOC_ARG      -> identifier ':' TYPE
+	//++               | '(' LOCAL ')'
+	public IArgument readLocArg(boolean mute, boolean selfFirst) {
+		IArgument result=null;
+
+		if ((selfFirst && readThisKeyword(ILisaacModel.variable_self)) ||
+				(! selfFirst && readIdentifier())) {
+
+			//Position pos = getPosition(); 
+			String n = new String(lastString);
+			if (readCharacter(':') && lastCharacter() != '=') {
+				ITypeMono t = readType(true);
+				if (t == null) {
+					reporter.syntaxError("Incorrect type.", getPosition());
+					return null;
+				}
+
+				// TODO SELF
+				/*if (selfFirst && (t != TypeSimple.getTypeSelf()) &&
+						((object.name != ALIAS_STR.prototype_block) || 
+					            {tb ?= t; tb = NULL})) {
+					reporter.syntaxError("Type `SELF' is needed.", getPosition());
+				}*/
+				result = new ITMArgument(n, t);
+			} else {
+				if (! mute) {
+					reporter.warning("Added ':' is needed.", getPosition());
+				}
+			}
+		} else if (readCharacter('(')) {
+			result = readLocalArg(mute, selfFirst);
+			if (result == null) {
+				if (! mute) {
+					reporter.syntaxError("Incorrect argument definition.", getPosition());
+					return null;
+				}
+			} else {
+				if (! readCharacter(')')) {
+					reporter.warning("Added ')'.", getPosition());
+				}
+			}
+		}	
+		return result;
+	}
+
+	private IArgument readLocalArg(boolean m, boolean s) {
+		IArgument result=null;
+		boolean mute = m;
+
+		if ((s && readThisKeyword(ILisaacModel.variable_self)) ||
+				readIdentifier()) {
+			List<String> name = new ArrayList<String>();
+			List<ITypeMono> type = new ArrayList<ITypeMono>();
+			int beg = 0;
+
+			do {
+				if (name.size() != 0 && !readIdentifier() && !mute) {
+					reporter.syntaxError("Incorrect argument identifier.", getPosition());
+					return null;
+				}
+				name.add(lastString);
+				if (readCharacter(':') && lastCharacter() != '=') {
+					mute = false;
+					ITypeMono t = readType(true);
+
+					if (t == null) {
+						reporter.syntaxError("Incorrect argument type.", getPosition());
+						return null;
+					}
+					for (int i=beg; i<name.size(); i++) {
+						type.add(t);
+					}
+					beg = name.size();
+				}
+			} while (readCharacter(','));
+
+			if (beg != name.size()) {
+				if (! mute) {
+					reporter.syntaxError("Incorrect argument type.", getPosition());
+					return null;
+				}
+				// free arrays..
+			} else {
+				/*if (s && (
+						type.get(0) != TypeSimple.getTypeSelf() ||
+						)) {
+					// TODO  syntax_error (current_position,"Type `SELF' is needed.");
+				}*/
+
+				if (name.size() == 1) {
+					// Single Argument.
+					result = new ITMArgument(name.get(0), type.get(0));
+					// free arrays
+				} else {
+					// Vector Arguments.
+					// alias arrays...
+					TypeMulti tm = new TypeMulti(type.toArray(new ITypeMono[type.size()]));
+					result = new ITMArgs(name.toArray(new String[name.size()]), tm);
+				}
+			}
+		}
+		return result;
+	}
+
+	private Slot readSlotOperator(ArrayList<IArgument> list_arg) { 
+		Slot result=null;
+		String associativity=null;
+		int priority=0;
+		Position slotPosition = getPosition();
+
+		if (! readOperator()) {
+			reporter.syntaxError("Operator is needed.", getPosition());
+			return null;
+		}
+		if (lastString.equals(ILisaacModel.symbol_equal) ||
+				lastString.equals(ILisaacModel.symbol_not_equal)) {
+			reporter.syntaxError("Incorrect operator.", getPosition());
+			return null;
+		}
+		String name = new String(lastString);
+		slotPosition.setLength(name.length());
+
+		if (! readCharacter('\'')) {
+			reporter.warning("Added `''.", getPosition());
+		}
+		if (readThisKeyword(ILisaacModel.keyword_left) ||
+				readThisKeyword(ILisaacModel.keyword_right)) {
+			associativity = new String(lastString);
+			if (readInteger()) {
+				priority = (int) lastInteger;
+			}
+		}
+		if (list_arg.isEmpty()) {
+			// Prefix operator.
+			IArgument arg = readLocArg(false,true);
+			if (arg == null) {
+				reporter.syntaxError("Operator declaration invalid.", getPosition());
+				return null;
+			}
+			list_arg.add(arg);
+			name = getOperator("__prefix", name);
+			if (associativity != null) {
+				reporter.syntaxError("No associativity for postfix operator.", getPosition());
+			}
+		} else {
+			IArgument arg = readLocArg(false,false);
+			if (arg != null) {
+				// Infix operator.
+				list_arg.add(arg);
+				name = getOperator("__infix", name);
+				if (associativity == null) {
+					associativity = ILisaacModel.keyword_left;
+				}
+			} else {
+				// Postfix operator.
+				name = getOperator("__postfix", name);
+				if (associativity != null) {
+					reporter.syntaxError("No associativity for prefix operator.", getPosition());
+				}
+			}
+		}
+		result = new Slot(slotPosition, name, lastSection);
+		result.setAssociativity(associativity, priority);
+
+		return result;
+	} 
+
+	private String getOperator(String typ, String op) {
+		String s = new String(typ);
+
+		for (int i=0; i<op.length(); i++) {
+			char c = op.charAt(i);
+			switch (c) {
+			case '+': s += "_add"; break;
+			case '-': s += "_sub"; break;
+			case '~': s += "_logicnot"; break;
+			case '!': s += "_not"; break;
+			case '/': s += "_div"; break;
+			case '*': s += "_mul"; break;
+			case '^': s += "_xor"; break;
+			case '%': s += "_mod"; break;
+			case '>': s += "_greater"; break;
+			case '<': s += "_less"; break;
+			case '=': s += "_equal"; break;
+			case '\\': s += "_notdiv"; break;
+			case '|': s += "_or"; break;
+			case '&': s += "_and"; break;
+			case '$': s += "_dollar"; break;
+			case '#': s += "_diese"; break;
+			case '@': s += "_at"; break;
+			case '?': s += "_ask"; break;
+			}
+		}
+		return getString(s); // alias string
+	}
+
+	//++ EXPR         -> { ASSIGN !!AMBIGU!! affect } EXPR_OPERATOR
+	//++ ASSIGN       -> '(' IDF_ASSIGN { ',' IDF_ASSIGN } ')'
+	//++               | IDF_ASSIGN
+	//++ IDF_ASSIGN   -> identifier { identifier }
+	public ICode readExpr() {
+		ICode result=null;
+		boolean again;
+		String string_tmp2="";
+
+		// !! AMBIGU resolution !!    
+		saveContext();
+
+		if (readCharacter('(')) {
+			ArrayList<String> l_assignment = new ArrayList<String>();
+			do {
+				again = false;
+				if (readIdentifier()) {
+					//p = position - lastString.length();
+
+					string_tmp2 = new String(lastString);
+					while (readIdentifier()) {
+						string_tmp2 += "__" + lastString;
+					}
+					String name = getString(string_tmp2);
+					l_assignment.add(name);
+
+					if (readCharacter(',')) {
+						again = true;
+					}
+				}
+			} while(again);
+
+			if (!l_assignment.isEmpty() && readCharacter(')') && readAffect()) {
+				// result = ITM_LIST_IDF
+				// TODO get code result
+				result = new ITMFixme();
+
+				char affect = lastString.charAt(0);
+				ICode value = readExpr();
+				if (value == null) {
+					reporter.syntaxError("Incorrect expression.", getPosition());
+					return null;
+				}
+				switch (affect) {
+				case ':': break; // TODO code
+				case '<':
+					reporter.syntaxError("Impossible '<-' style assignment with vector.", getPosition());
+					return null;
+				case '?': break; // TODO code	
+				}
+			} else {
+				// FREE l_assignment
+			}
+		} else if (readIdentifier()) {
+			//p = position - lastString.length();
+			string_tmp2 = new String(lastString);
+			while (readIdentifier()) {
+				string_tmp2 += "__" + lastString;
+			}
+			String name = getString(string_tmp2);
+
+			if (readAffect()) {
+				result = new ITMRead(name);
+
+				char affect = lastString.charAt(0);
+				ICode value = readExpr();
+				if (value == null) {
+					reporter.syntaxError("Incorrect expression.", getPosition());
+					return null;
+				}
+				switch (affect) {
+				case ':': break; // TODO code
+				case '<': break; // TODO code
+				case '?': break; // TODO code	
+				}
+			}
+		}
+		if (result == null) {
+			restoreContext();
+			result = readExprOperator();
+		}
+		return result;
+	}
+
+	//++ EXPR_OPERATOR-> { operator } EXPR_MESSAGE { operator {operator} EXPR_MESSAGE } {operator}
+	private ICode readExprOperator() {
+		ICode result=null;
+		int first_msg,last_msg;
+
+		ArrayList<ICode> l_expr = new ArrayList<ICode>();
+		while (readOperator()) {
+			ICode expr = new ITMOperator(new String(lastString));
+			l_expr.add(expr);
+		}
+		ICode expr = readExprMessage();
+		if (expr == null) {
+			// Error.
+			if (l_expr.size() > 0) {
+				reporter.syntaxError("Incorrect expression.", getPosition());
+			}
+			// free l_expr
+		} else {
+			// { operator {operator} EXPR_MESSAGE } {operator}
+			first_msg = l_expr.size();
+			do {
+				last_msg = l_expr.size();
+				l_expr.add(expr);
+				if (readOperator()) {
+					do {
+						expr = new ITMOperator(new String(lastString));
+						l_expr.add(expr);
+					} while (readOperator());
+
+					expr = readExprMessage();
+				} else {
+					expr = null;
+				}
+			} while (expr != null);
+
+			// Last Post-fix operator.
+			while (last_msg < l_expr.size()-1) {
+				ITMOperator itm_op = (ITMOperator) l_expr.get(last_msg+1);
+				expr = new ITMReadArg1(getOperator("__postfix", itm_op.getName()), l_expr.get(last_msg));
+
+				l_expr.add(last_msg, expr);
+				l_expr.remove(last_msg+1);
+			}
+			if (last_msg - first_msg < 3) {
+				// First Pre-fix operator.
+				while (first_msg != 0) {
+					ITMOperator itm_op = (ITMOperator) l_expr.get(first_msg - 1);
+					expr = new ITMReadArg1(getOperator("__prefix", itm_op.getName()), l_expr.get(first_msg));
+
+					l_expr.add(first_msg, expr);
+					first_msg = first_msg - 1;
+					l_expr.remove(first_msg);
+				}
+			}
+			if (l_expr.size() == 1) {
+				result = l_expr.get(0);// first
+				// free l_expr
+			} else if (l_expr.size() == 3) {
+				// Simple binary message.
+				ITMOperator itm_op = (ITMOperator) l_expr.get(1);// second
+				result = new ITMReadArg2(getOperator("__infix", itm_op.getName()),
+						l_expr.get(0),
+						l_expr.get(2));
+				// free l_expr
+			} else {
+				// Complex expression.
+				result = new ITMExpression(l_expr.toArray(new ICode[l_expr.size()]));
+			}
+		}
+		return result;
+	}
+
+	//++ EXPR_MESSAGE -> EXPR_BASE { '.' SEND_MSG }
+	protected ICode readExprMessage() {
+
+		ICode result = readExprBase();
+		if (result != null) {
+			while (readCharacter('.')) {
+				result = readSendMsg(result);
+				if (result == null) {
+					reporter.syntaxError("Incorrect message.", getPosition());
+					return null;
+				}
+			}
+		}
+		return result;
+	}
+
+	//++ EXPR_BASE    -> "Old" EXPR
+	//++               | EXPR_PRIMARY
+	//++               | SEND_MSG
+	protected ICode readExprBase() {
+		ICode result=null;
+
+		if (readThisKeyword(ILisaacModel.keyword_old)) {
+			ICode old_value = readExpr();
+			if (old_value == null) {
+				reporter.syntaxError("Incorrect `Old' expression.", getPosition());
+				return null;
+			}
+			result = new ITMOld(old_value);
+		} else {
+			result = readExprPrimary();
+			if (result == null) {
+				result = readSendMsg(null);
+			}
+		}
+		return result;
+	}
+
+	//++ EXPR_PRIMARY -> "Self"
+	//++               | result
+	//++               | PROTOTYPE
+	//++               | CONSTANT
+	//++               | '(' GROUP ')'
+	//++               | '{' [ LOC_ARG ';' !! AMBIGU!! ] GROUP '}'
+	//++               | external [ ':' ['('] TYPE ['{' TYPE_LIST '}'] [')'] ]
+	public ICode readExprPrimary() {
+		ICode result=null;
+		String result_id=null;
+		ITypeMono type=null;
+		ITMList group_sav=null;
+
+		if (readThisKeyword(ILisaacModel.variable_self)) {
+			result = new ITMRead(new String(lastString));
+		} else if (readThisKeyword(ILisaacModel.keyword_result)) {
+			if (lastCharacter() == '_') {
+				position = position + 1;
+				string_tmp = "" + ILisaacModel.keyword_result + "_";
+
+				while (Character.isDigit(lastCharacter())) {
+					string_tmp += lastCharacter();
+					position = position + 1;
+				}
+				if (string_tmp.length() <= 0) {
+					reporter.syntaxError("Incorrect Result number.", getPosition());
+				}
+				result_id = getString(string_tmp);
+			} else {
+				result_id = ILisaacModel.keyword_result;
+			}
+			result = new ITMRead(result_id);
+
+		} else if ((type = readPrototype(null)) != null) {
+			result = new ITMPrototype(type);
+
+		} else if ((result = readConstant()) != null) {
+		} else if (readCharacter('(')) {
+			group_sav = lastGroup;
+			lastGroup = new ITMList();
+			result = lastGroup;
+
+			lastGroup.setCode(readGroup());
+			if (! readCharacter(')')) {
+				reporter.syntaxError("Added ')'.", getPosition());
+				return null;
+			}
+			lastGroup = group_sav;
+		} else if (readCharacter('{')) {
+			group_sav = lastGroup;  
+			lastGroup = new ITMList();
+
+			saveContext(); // !! SAVE CONTEXT !!
+
+			//
+			IArgument arg = readLocArg(true,false);
+			//
+			if (arg != null) {
+				if (! readCharacter(';')) {
+					reporter.syntaxError("Added ';'.", getPosition());
+					return null;
+				}
+			} else {
+				restoreContext(); // !! RESTORE CONTEXT !!
+			}
+			result = new ITMBlock(lastGroup, arg);
+
+			lastGroup.setCode(readGroup());
+			if (! readCharacter('}')) {
+				reporter.syntaxError("Added '}'.", getPosition());
+				return null;
+			}
+			lastGroup = group_sav; 
+		} else if (readExternal()) {
+			if (! readCharacter(':')) {
+				result = new ITMExternal(new String(lastString));
+			} else {
+				boolean persistant = readCharacter('(');
+				ITMExternalType ext = new ITMExternalType(new String(lastString), persistant);
+				type = readType(false);
+				if (type == null) {
+					reporter.syntaxError("Incorrect type.", getPosition());
+					return null;
+				}
+				ext.setType(type);
+				if (readCharacter('{')) {
+					ITypeMono[] ltype = readTypeList(false);
+					if (ltype == null) {
+						reporter.syntaxError("Incorrect live type list.", getPosition());
+						return null;
+					}
+					if (! readCharacter('}')) {
+						reporter.syntaxError("Added '}'.", getPosition());
+						return null;
+					}
+					ext.setTypeList(ltype);
+				}
+				if (ext.isPersistant() && (! readCharacter(')'))) {
+					reporter.syntaxError("Added '}'.", getPosition());
+					return null;
+				}
+				result = ext;
+			}
+		}
+		return result;
+	}
+
+	//++ CONSTANT     -> integer
+	//++               | real
+	//++               | characters
+	//++               | string
+	private IConstant readConstant() {
+		IConstant result=null;
+
+		if (readReal()) {
+			result = new ITMReal(new String(lastReal));
+		} else if (readInteger()) {
+			result = new ITMNumber(lastInteger);
+		} else if (readCharacters()) {
+			result = new ITMCharacter(new String(lastString));
+		} else if (readString()) {
+			result = new ITMString(new String(lastString));
+		}
+		return result;
+	}
+
+	//++ GROUP        -> DEF_LOCAL {EXPR ';'} [ EXPR {',' {EXPR ';'} EXPR } ]
+	private ICode[] readGroup() {		
+		readDefLocal();
+
+		ArrayList<ICode> result = new ArrayList<ICode>();
+		ICode e = readExpr();
+		while (e != null && readCharacter(';')) {
+			result.add(e);
+			e = readExpr();
+		}
+		if (e != null) {
+			if (readCharacter(',')) {
+				do {
+					e = new ITMResult(e);
+					result.add(e);
+					e = readExpr();
+					while (e != null && readCharacter(';')) {
+						result.add(e);
+						e = readExpr();
+					}
+					if (e == null) {
+						reporter.syntaxError("Incorrect multiple result expression.", getPosition());
+						return null;
+					}
+				} while (readCharacter(','));
+			}
+			e = new ITMResult(e);
+			result.add(e);
+		}
+		return result.toArray(new ICode[result.size()]);
+	}
+
+	//++ DEF_LOCAL    -> { style LOCAL ';' } !! AMBIGU !!
+	private void readDefLocal() {
+		List<ITMLocal> loc_lst;
+
+		saveContext(); // !! SAVE CONTEXT !!
+
+		char style = readStyle();
+		ArrayList<ITMLocal> local_list = new ArrayList<ITMLocal>();
+		ArrayList<ITMLocal> static_list = new ArrayList<ITMLocal>();
+
+		while (style != ' ') {
+			loc_lst = readLocal(true);
+			if (loc_lst != null) {
+				if (style == '+') {
+					local_list.addAll(loc_lst);
+				} else {
+					static_list.addAll(loc_lst);
+				}
+				if (! readCharacter(';')) {
+					reporter.syntaxError("Added ';'.", getPosition());
+				}
+				saveContext(); // !! SAVE CONTEXT !!
+
+				style = readStyle();
+			} else {
+				restoreContext(); // !! RESTORE CONTEXT !!
+				style = ' ';
+			}
+		}
+		if (local_list.isEmpty()) {
+			// free local_list
+		} else {
+			lastGroup.setLocalList(local_list.toArray(new ITMLocal[local_list.size()]));
+		}
+		if (static_list.isEmpty()) {
+			// free static_list
+		} else {
+			lastGroup.setStaticList(static_list.toArray(new ITMLocal[static_list.size()]));
+		}
+	}
+
+	//++ SEND_MSG     -> identifier [ ARGUMENT { identifier ARGUMENT } ]
+	protected ICode readSendMsg(ICode firstArg) {
+		ICode result=null;
+
+		if (readIdentifier()) {
+			//
+			// Classic Message.
+			//
+			String n = getString(lastString);// create alias
+
+			// Argument list.
+			LinkedList<ICode> l_arg = new LinkedList<ICode>();
+			ICode arg = readArgument();
+			if (arg != null) {
+				l_arg.addLast(arg);
+				while (readIdentifier()) {
+					n += "__" + lastString; // FIXME: alias pb
+					arg = readArgument();
+					if (arg == null) {
+						reporter.syntaxError("Incorrect argument.", getPosition());
+						return null;
+					}
+					l_arg.addLast(arg);
+				}
+			}
+			String name = getString(n); // FIXME alias pb
+			if (l_arg.isEmpty()) {
+				if (firstArg == null) {
+					// Local ou Implicite Slot without argument.
+					result = new ITMRead(name);
+				} else {
+					result = new ITMReadArg1(name, firstArg);
+				}
+				// free l_arg
+			} else if (l_arg.size() == 1) {
+				result = new ITMReadArg2(name, firstArg, l_arg.get(0));
+				// free l_arg
+			} else {
+				l_arg.addFirst(firstArg);
+				result = new ITMReadArgs(name, l_arg.toArray(new ICode[l_arg.size()]));
+			}
+		}	
+		return result;
+	}
+
+	//++ ARGUMENT     -> EXPR_PRIMARY
+	//++               | identifier
+	private ICode readArgument() {
+		ICode result = readExprPrimary();
+		if (result == null && readIdentifier()) {
+			result = new ITMRead(new String(lastString));
+		}
+		return result;
+	}
+
+	//++ LOCAL        -> { identifier [ ':' TYPE ] ',' } identifier ':' TYPE
+	private List<ITMLocal> readLocal(boolean m) {
+		List<ITMLocal> result=null;
+		int beg = 0;
+
+		boolean mute = m;
+		if (readIdentifier()) {
+			result = new LinkedList<ITMLocal>();			
+			do {
+				if (result.size() != 0 && !readIdentifier() && !mute) {
+					reporter.syntaxError("Incorrect identifier.", getPosition());
+					return null;
+				}
+				ITMLocal loc = new ITMLocal(new String(lastString));
+				result.add(loc);
+				if (readCharacter(':') && lastCharacter() != '=') {
+					mute = false;
+					ITypeMono t = readType(false);
+					if (t == null) {
+						reporter.syntaxError("Incorrect local type.", getPosition());
+						return null;
+					}
+					for (int j=beg; j<result.size(); j++) {
+						result.get(j).setType(t);
+					}
+					beg = result.size(); // upper+1
+				}
+			} while(readCharacter(','));
+			if (beg != result.size()) {
+				if (mute) {
+					// free result
+					result = null;
+				} else {
+					reporter.syntaxError("Incorrect local type.", getPosition());
+					return null;
+				}
+			} else {
+			}
+		}	
+		return result;
+	}
+
+	public boolean readRequire() {
+		boolean result=false;
+
+		ITMList lst = readContract();
+		if (lst != null) {
+			// lastSlot.setRequire lst
+			result = true;
+		}
+		return result;
+	}
+
+	public boolean readEnsure() {
+		boolean result=false;
+
+		ITMList lst = readContract();
+		if (lst != null) {
+			// lastSlot.setEnsure lst
+			result = true;
+		}
+		return result;
+	}
+
+	//++ CONTRACT     -> '[' DEF_LOCAL { ( EXPR ';' | "..." ) } ']'
+	private ITMList readContract() {
+		ITMList result = null;
+
+		if (readCharacter('[')) {
+			result = new ITMList();
+			lastGroup = result;
+
+			readDefLocal();
+
+			ArrayList<ICode> lst = new ArrayList<ICode>();
+			boolean doContinue = false;
+			do {
+				ICode e = readExpr();
+				if (e == null) {
+					doContinue = readWord(ILisaacModel.keyword_ldots);
+					if (doContinue) {
+						lst.add(new ITMLDots());
+					}
+				} else {
+					lst.add(e);
+					if (! readCharacter(';')) {
+						reporter.syntaxError("Added ';'.", getPosition());
+						return null;
+					}
+					doContinue = true;
+				}
+			} while (doContinue);
+
+			if (! readCharacter(']')) {
+				reporter.syntaxError("Added ']'.", getPosition());
+				return null;
+			}
+			// TODO lst add prototype void
+			result.setCode(lst.toArray(new ICode[lst.size()]));
+		}
+		return result;
+	}	   
+
+	public boolean skipUntilThisKeyword(String st) {
+		int idx;
+		int posold;
+		boolean result=false;
+
+		while (! isEOF() && ! result) {
+			idx = 0;
+			while ((readSpace() || lastCharacter() == '\n') && lastCharacter() != st.charAt(idx)) {
+				position++;
+			}
+			posold = position;
+			position++;
+			idx++;
+			if (! isEOF()) {
+				while (idx <= st.length()-1 && lastCharacter() == st.charAt(idx)) {
+					position++;
+					idx++;
+				}
+				if (idx > st.length()-1) {
+					lastString = st;
+					position = posold;
+					result = true;
+				}
+			}
+		}
+		return result;
+	}
+
+	public String readSlotNameFromOffset(int offset) {
+		String result=null;
+		int oldPosition = position;
+		position = offset;
+
+		//++ TYPE_SLOT    -> [ LOC_ARG '.' ] identifier [ LOC_ARG { identifier LOC_ARG } ]
+		//++               | [ LOC_ARG ] '\'' operator '\'' [("Left"|"Right") [integer]] [LOC_ARG]
+		if (! skipLocalArg(true)) {
+			if (readCharacter('\'')) {
+				result = readSlotNameOperator();
+			} else {
+				result = readSlotNameKeyword();
+			}
+		} else {
+			if (readCharacter('.')) {
+				result = readSlotNameKeyword();
+			} else if (readCharacter('\'')) {
+				result = readSlotNameOperator();
+			}
+		}
+		position = oldPosition;
+		return result;
+	}
+
+	//++ LOC_ARG      -> identifier ':' TYPE
+	//++               | '(' LOCAL ')'
+	public boolean skipLocalArg(boolean selfFirst) {
+		boolean result=false;
+		if ((selfFirst && readThisKeyword(ILisaacModel.variable_self)) ||
+				(! selfFirst && readIdentifier())) {
+			if (readCharacter(':') && lastCharacter() != '=') {
+				return skipType();
+			}
+		} else if (readCharacter('(')) {
+			result = skipLocal(selfFirst);
+			if (! result) {
+				return false;
+			} else {
+				if (! readCharacter(')')) {
+					return false;
+				}
+				result = true;
+			}
+		}	
+		return result;
+	}
+
+	private boolean skipLocal(boolean s) {
+		boolean result = false;
+
+		if ((s && readThisKeyword(ILisaacModel.variable_self)) ||
+				readIdentifier()) {
+			int size = 0;
+			do {
+				if (size != 0 && !readIdentifier()) {
+					return false;
+				}
+				size++;
+				if (readCharacter(':') && lastCharacter() != '=') {
+					if (!skipType()) {
+						return false;
+					}
+					result = true;
+				}
+			} while (readCharacter(','));
+		}
+		return result;
+	}
+
+	private String readSlotNameKeyword() {
+		String result=null;
+
+		if (readIdentifier()) {
+			result = new String(lastString);
+
+			if (skipLocalArg(false)) {
+				if (readIdentifier()) {
+					do {
+						result += "__" + lastString;
+						if (! skipLocalArg(false)) {
+							return null;
+						}
+					} while (readIdentifier());
+				}
+			}
+		}
+		return result;
+	}  
+
+	private String readSlotNameOperator() { 
+		String result=null;
+
+		if (! readOperator()) {
+			return null;
+		}
+		result = new String(lastString);
+		result = getOperator("__infix", result);// TODO fix!! prefix postfix
+
+		return result;
+	} 
+
+	//++ TYPE         -> '{' [ (TYPE | '(' TYPE_LIST ')') ';' ] [ TYPE_LIST ] '}'
+	//++               | [type] PROTOTYPE [ CONTRACT ]
+	public boolean skipType () {
+		boolean result=false;
+
+		if (readCharacter('{')) {
+			// '{' [ (TYPE | '(' TYPE_LIST ')') ';' ] [ TYPE_LIST ] '}' 
+			if (readCharacter('(')) {
+				// Read vector argument.
+				result = skipTypeList();
+				if (! result) {
+					return false;
+				}
+				if (! readCharacter(')')) {
+					return false;
+				}
+				if (! readCharacter(';')) {
+					return false;
+				}
+				// Read result type.
+				result = skipTypeList();
+			} else {
+
+				result = skipTypeList();
+				if (result) {
+					if (readCharacter(';')) {
+						// Read result type.
+						result = skipTypeList();
+					}
+				}
+			}
+			if (! readCharacter('}')) {
+				return false;
+			}
+			result = true;
+		} else {
+			// Expanded | Strict 
+			if (readThisKeyword(ILisaacModel.keyword_expanded) ||
+					readThisKeyword(ILisaacModel.keyword_strict)) {
+			}
+			// PROTOTYPE
+			result = skipPrototype();
+			// TODO read contract
+		}
+		return result;
+	}
+
+	//++ TYPE_LIST    -> TYPE { ',' TYPE }
+	public boolean skipTypeList() {
+		boolean result=false;
+
+		result = skipType();
+		if (result) {
+			while (readCharacter(',')) {
+				result = skipType();
+				if (! result) {
+					return false;
+				}
+			}
+		}
+		return result;
+	}
+
+	//++ PROTOTYPE    -> cap_identifier{('.'|'...')cap_identifier}['('PARAM_TYPE{','PARAM_TYPE}')']
+	public boolean skipPrototype() {
+		boolean result=false;
+
+		if (readCapIdentifier()) {
+			// TODO syntax {('.'|'...')cap_identifier}
+			if (readCharacter('(')) {
+				//
+				// Genericity.
+				//
+				do {
+					if (! skipParamType()) {
+						return false;
+					}
+				} while (readCharacter(','));
+				if (! readCharacter(')')) {
+					return false;
+				}
+				result = true;
+			} else {
+				// Simple type.	 
+				result = true;
+			}
+		}
+		return result;
+	}
+
+	//++ PARAM_TYPE   -> TYPE
+	//++               | CONSTANT
+	//++               | identifier
+	private boolean skipParamType() {
+		if (! skipType()) {
+			// TODO compiler not yet implemented
+			return false;
+		}
+		return true;
+	}
+
+
+	/**
+	 * Read the next context in lisaac code.
+	 * @return Context at parser position
+	 */
+	public ILisaacContext readContext() {
+		readSpace();
+
+		int old_pos = position;
+
+		//
+		// Try read Section Context.
+		//    
+		if (readThisKeyword (ILisaacModel.keyword_section)) {
+			position = old_pos;
+			return sectionContext;
+		}
+
+		//
+		// Try read Slot Context.
+		//
+		if (readCharacter('-') || readCharacter('+')) {
+			position = old_pos;
+			return slotContext;
+		}
+		// restore old position (unread)
+		position = old_pos;
+
+		if (position >= source.length()-1) {
+			return null;
+		} else {
+			// error
+			reporter.syntaxError("Syntax error", getPosition());
+			return sectionContext.getNextContext(); // go to next section
+		}
+	}
+}
diff --git a/src/org/eclipse/lisaac/model/SectionContext.java b/src/org/eclipse/lisaac/model/SectionContext.java
index 485f4c0..169e4e9 100644
--- a/src/org/eclipse/lisaac/model/SectionContext.java
+++ b/src/org/eclipse/lisaac/model/SectionContext.java
@@ -1,263 +1,271 @@
-package org.eclipse.lisaac.model;
-
-import org.eclipse.lisaac.model.items.Prototype;
-import org.eclipse.lisaac.model.items.Section;
-import org.eclipse.lisaac.model.types.ITypeMono;
-
-public class SectionContext implements ILisaacContext {
-
-	private LisaacParser parser;
-	private boolean firstSection;
-
-	public SectionContext(LisaacParser parser) {
-		this.parser = parser;
-		firstSection = true;
-	}
-
-	public boolean parseDefinition(Prototype prototype) {
-
-		parser.readSpace();
-
-		// read Section
-		if (! parser.readThisKeyword (ILisaacModel.keyword_section)) {
-			parser.getReporter().syntaxError("`Section' is needed.", parser.getPosition());
-			return false;
-		}
-
-		if (firstSection) {
-			//
-			// Read Section Header.
-			// 
-			if (! parser.readThisKeyword (ILisaacModel.section_header)) {
-				parser.getReporter().syntaxError("Section `Header' is needed.", parser.getPosition());
-				return false;
-			}    
-			firstSection = false;
-			if (! readSectionHeaderContent(prototype)) {
-				return false;
-			}
-		} else {
-			//
-			// Read Other Section.
-			//
-			if (parser.readKeyword()) {
-				String section = parser.getLastString();
-				if (section.equals(ILisaacModel.section_inherit) ||
-						section.equals(ILisaacModel.section_insert) ||
-						section.equals(ILisaacModel.section_interrupt) ||
-						section.equals(ILisaacModel.section_private) ||
-						section.equals(ILisaacModel.section_public) ||
-						section.equals(ILisaacModel.section_mapping) ||
-						section.equals(ILisaacModel.section_directory) ||
-						section.equals(ILisaacModel.section_external)) {
-
-					Section lastSection = new Section(prototype, section);
-					parser.setLastSection(lastSection);
-					
-					if (lastSection.isInheritOrInsert() &&
-							parser.getLastSlot() != null &&
-							! parser.getLastSlot().getSectionId().isInheritOrInsert()) {
-						parser.getReporter().syntaxError("`Section Inherit/Insert' must to be first section.", parser.getPosition());
-						return false;
-						
-					} else if (prototype.isExpanded() && section.equals(ILisaacModel.section_inherit)) {
-						parser.getReporter().warning("`Section Inherit' is not possible with Expanded object (Use `Section Insert').", parser.getPosition());
-					}
-				} else {
-					parser.getReporter().syntaxError("Incorrect type section.", parser.getPosition());
-					return false;
-				}
-			} else {
-				// TYPE_LIST.
-				ITypeMono[] t = parser.readTypeList(true);
-				if (t == null) {
-					parser.getReporter().syntaxError("Incorrect type section.", parser.getPosition());
-					return false;
-				}
-				parser.setLastSection(new Section(prototype, t));
-			}
-			// content of section is out of this context
-		}
-		return true;
-	}
-
-	private boolean readSectionHeaderContent(Prototype prototype) {
-		boolean result;
-		boolean first=true;
-
-		//
-		// Read Slots of Section Header.
-		//
-		do {
-			result = false;
-
-			char style = parser.readStyle();
-			if (style != ' ') {
-				result = true;
-
-				if (!first && style == '+') {
-					parser.getReporter().warning("Incorrect style slot ('-').", parser.getPosition());
-				}
-				if (first) {
-					first = false;
-
-					if (parser.readWord(ILisaacModel.slot_name)) {
-						//
-						// Read `name' slot.
-						//
-						if (! parser.readSymbol(ILisaacModel.symbol_affect_immediate)) {
-							parser.getReporter().syntaxError("Added ':='.", parser.getPosition());
-							return false;
-						}
-						if (parser.readThisKeyword(ILisaacModel.keyword_expanded) ||
-								parser.readThisKeyword(ILisaacModel.keyword_strict)) {
-							prototype.setTypeStyle(parser.getLastString());
-						}
-						if (! parser.readCapIdentifier()) {
-							parser.getReporter().syntaxError("Prototype identifier is needed.", parser.getPosition());
-							return false;
-						}
-						if (parser.getLastString().compareTo(prototype.getName()) != 0) {
-							parser.getReporter().syntaxError("Incorrect name (filename != name).", parser.getPosition());
-						}
-			
-						if (parser.readCharacter('(')) {
-							//
-							// Generic loader.
-							//
-							// TODO error for non generic object
-							if (parser.readIdentifier()) {
-								return false;
-								// TODO syntax identifier : PROTO
-							} else if (parser.readCapIdentifier()) {
-								// TODO error Identifier parameter type is needed.
-								
-								while (parser.readCharacter(',')) {
-									// TODO error Identifier parameter type is needed.
-									if (! parser.readCapIdentifier()) {
-										parser.getReporter().syntaxError("Identifier parameter type is needed.", parser.getPosition());
-										return false;
-									}
-								}
-								if (! parser.readCharacter(')')) {
-									parser.getReporter().syntaxError("Added ')'.", parser.getPosition());
-									return false;
-								}
-							} else {
-								parser.getReporter().syntaxError("Identifier parameter type is needed.", parser.getPosition());
-								return false;
-							}
-						}
-						   
-					} else {
-						parser.getReporter().syntaxError("Slot `name' must to be first slot.", parser.getPosition());
-					}
-					
-				} else if (parser.readWord(ILisaacModel.slot_export) ||
-						parser.readWord(ILisaacModel.slot_import)) {
-					
-					// - ("export"|"import") ':=' TYPE_LIST 
-					if (! parser.readSymbol(ILisaacModel.symbol_affect_immediate)) {
-						parser.getReporter().syntaxError("Added ':='.", parser.getPosition());
-						return false;
-					}
-					if (parser.readTypeList(false) == null) {
-						parser.getReporter().syntaxError("Incorrect type list.", parser.getPosition());
-						return false;
-					}
-					//  TODO store export / import
-					
-				} else if (parser.readWord(ILisaacModel.slot_external)) {	
-					// - "external" ':=' `<code_c>`
-					
-					if (! parser.readSymbol(ILisaacModel.symbol_affect_immediate)) {
-						parser.getReporter().syntaxError("Added ':='.", parser.getPosition());
-						return false;
-					}
-					if (! parser.readExternal()) {
-						parser.getReporter().syntaxError("Incorrect external.", parser.getPosition());
-						return false;
-					}
-				} else if (parser.readWord(ILisaacModel.slot_default)) {
-					// '-' "default" ':=' EXPR_PRIMARY
-					
-					if (! parser.readSymbol(ILisaacModel.symbol_affect_immediate)) {
-						parser.getReporter().syntaxError("Added ':='.", parser.getPosition());
-						return false;
-					}
-					if (parser.readExprPrimary() == null) {
-						parser.getReporter().syntaxError("Incorrect expr.", parser.getPosition());
-						return false;
-					}
-					// TODO check double default slot
-					// TODO set prototyp default value
-				} else if (parser.readWord(ILisaacModel.slot_type)) {
-					// '-' "type" ':=' `<type C>`
-					
-					if (! parser.readSymbol(ILisaacModel.symbol_affect_immediate)) {
-						parser.getReporter().syntaxError("Added ':='.", parser.getPosition());
-						return false;
-					}
-					if (! parser.readExternal()) {
-						parser.getReporter().syntaxError("Incorrect external.", parser.getPosition());
-						return false;
-					}
-					// TODO check double type declaration
-					
-				} else if (parser.readWord(ILisaacModel.slot_version)) {
-					//
-					// Read `version' slot.
-					//
-
-					// '-' "version" ':=' integer
-					if (! parser.readSymbol(ILisaacModel.symbol_affect_immediate)) {
-						parser.getReporter().syntaxError("Added ':='.", parser.getPosition());
-						return false;
-					}
-					if (! parser.readInteger()) {
-						parser.getReporter().syntaxError("Incorrect number.", parser.getPosition());
-						return false;
-					}
-					// } else if () { TODO lip
-				} else if (parser.readWord(ILisaacModel.slot_date) ||
-						parser.readWord(ILisaacModel.slot_comment) ||
-						parser.readWord(ILisaacModel.slot_author) ||
-						parser.readWord(ILisaacModel.slot_bibliography) ||
-						parser.readWord(ILisaacModel.slot_language) ||
-						parser.readWord(ILisaacModel.slot_copyright) ||
-						parser.readWord(ILisaacModel.slot_bug_report)) {
-					//						  
-					// Read `date', `comment', `author', `bibliography', 
-					// `language', `copyright' or `bug_report' slots.
-					//
-
-					// '-' ("date"|"comment"|"author"|"bibliography"|"language"|"copyright"|"bug_report") 
-					// ':=' string
-					if (! parser.readSymbol(ILisaacModel.symbol_affect_immediate)) {
-						parser.getReporter().syntaxError("Added ':='.", parser.getPosition());
-						return false;
-					}
-					if (! parser.readString()) {
-						parser.getReporter().syntaxError("Incorrect string.", parser.getPosition());
-						return false;
-					}
-				} else {
-					parser.getReporter().syntaxError("Incorrect slot.", parser.getPosition());
-					return false;
-				}
-				if (! parser.readCharacter(';')) {
-					parser.getReporter().warning("Added ';'.", parser.getPosition());
-				}
-			}
-		} while (! parser.isEOF() && result);
-
-		return true;
-	}
-
-	public ILisaacContext getNextContext() {
-		if (parser.skipUntilThisKeyword(ILisaacModel.keyword_section)) {
-			return this;
-		}
-		return null;
-	}
-}
+package org.eclipse.lisaac.model;
+
+import org.eclipse.lisaac.model.items.Prototype;
+import org.eclipse.lisaac.model.items.Section;
+import org.eclipse.lisaac.model.types.ITypeMono;
+
+public class SectionContext implements ILisaacContext {
+
+	private LisaacParser parser;
+	private boolean firstSection;
+
+	public SectionContext(LisaacParser parser) {
+		this.parser = parser;
+		firstSection = true;
+	}
+
+	public boolean parseDefinition(Prototype prototype) {
+
+		parser.readSpace();
+
+		// read Section
+		if (! parser.readThisKeyword (ILisaacModel.keyword_section)) {
+			parser.getReporter().syntaxError("`Section' is needed.", parser.getPosition());
+			return false;
+		}
+
+		if (firstSection) {
+			//
+			// Read Section Header.
+			// 
+			if (! parser.readThisKeyword (ILisaacModel.section_header)) {
+				parser.getReporter().syntaxError("Section `Header' is needed.", parser.getPosition());
+				return false;
+			}    
+			firstSection = false;
+			if (! readSectionHeaderContent(prototype)) {
+				return false;
+			}
+		} else {
+			//
+			// Read Other Section.
+			//
+			if (parser.readKeyword()) {
+				String section = parser.getLastString();
+				if (section.equals(ILisaacModel.section_inherit) ||
+						section.equals(ILisaacModel.section_insert) ||
+						section.equals(ILisaacModel.section_interrupt) ||
+						section.equals(ILisaacModel.section_private) ||
+						section.equals(ILisaacModel.section_public) ||
+						section.equals(ILisaacModel.section_mapping) ||
+						section.equals(ILisaacModel.section_directory) ||
+						section.equals(ILisaacModel.section_external)) {
+
+					Section lastSection = new Section(prototype, section);
+					parser.setLastSection(lastSection);
+					
+					if (lastSection.isInheritOrInsert() &&
+							parser.getLastSlot() != null &&
+							! parser.getLastSlot().getSectionId().isInheritOrInsert()) {
+						parser.getReporter().syntaxError("`Section Inherit/Insert' must to be first section.", parser.getPosition());
+						return false;
+						
+					} else if (prototype.isExpanded() && section.equals(ILisaacModel.section_inherit)) {
+						parser.getReporter().warning("`Section Inherit' is not possible with Expanded object (Use `Section Insert').", parser.getPosition());
+					}
+				} else {
+					parser.getReporter().syntaxError("Incorrect type section.", parser.getPosition());
+					return false;
+				}
+			} else {
+				// TYPE_LIST.
+				ITypeMono[] t = parser.readTypeList(true);
+				if (t == null) {
+					parser.getReporter().syntaxError("Incorrect type section.", parser.getPosition());
+					return false;
+				}
+				parser.setLastSection(new Section(prototype, t));
+			}
+			// content of section is out of this context
+		}
+		return true;
+	}
+
+	private boolean readSectionHeaderContent(Prototype prototype) {
+		boolean result,comment=false;
+		boolean first=true;
+
+		//
+		// Read Slots of Section Header.
+		//
+		do {
+			result = false;
+
+			char style = parser.readStyle();
+			if (style != ' ') {
+				result = true;
+
+				if (!first && style == '+') {
+					parser.getReporter().warning("Incorrect style slot ('-').", parser.getPosition());
+				}
+				if (first) {
+					first = false;
+
+					if (parser.readWord(ILisaacModel.slot_name)) {
+						//
+						// Read `name' slot.
+						//
+						if (! parser.readSymbol(ILisaacModel.symbol_affect_immediate)) {
+							parser.getReporter().syntaxError("Added ':='.", parser.getPosition());
+							return false;
+						}
+						if (parser.readThisKeyword(ILisaacModel.keyword_expanded) ||
+								parser.readThisKeyword(ILisaacModel.keyword_strict)) {
+							prototype.setTypeStyle(parser.getLastString());
+						}
+						if (! parser.readCapIdentifier()) {
+							parser.getReporter().syntaxError("Prototype identifier is needed.", parser.getPosition());
+							return false;
+						}
+						if (parser.getLastString().compareTo(prototype.getName()) != 0) {
+							parser.getReporter().syntaxError("Incorrect name (filename != name).", parser.getPosition());
+						}
+			
+						if (parser.readCharacter('(')) {
+							//
+							// Generic loader.
+							//
+							// TODO error for non generic object
+							if (parser.readIdentifier()) {
+								return false;
+								// TODO syntax identifier : PROTO
+							} else if (parser.readCapIdentifier()) {
+								// TODO error Identifier parameter type is needed.
+								
+								while (parser.readCharacter(',')) {
+									// TODO error Identifier parameter type is needed.
+									if (! parser.readCapIdentifier()) {
+										parser.getReporter().syntaxError("Identifier parameter type is needed.", parser.getPosition());
+										return false;
+									}
+								}
+								if (! parser.readCharacter(')')) {
+									parser.getReporter().syntaxError("Added ')'.", parser.getPosition());
+									return false;
+								}
+							} else {
+								parser.getReporter().syntaxError("Identifier parameter type is needed.", parser.getPosition());
+								return false;
+							}
+						}
+						   
+					} else {
+						parser.getReporter().syntaxError("Slot `name' must to be first slot.", parser.getPosition());
+					}
+					
+				} else if (parser.readWord(ILisaacModel.slot_export) ||
+						parser.readWord(ILisaacModel.slot_import)) {
+					
+					// - ("export"|"import") ':=' TYPE_LIST 
+					if (! parser.readSymbol(ILisaacModel.symbol_affect_immediate)) {
+						parser.getReporter().syntaxError("Added ':='.", parser.getPosition());
+						return false;
+					}
+					if (parser.readTypeList(false) == null) {
+						parser.getReporter().syntaxError("Incorrect type list.", parser.getPosition());
+						return false;
+					}
+					//  TODO store export / import
+					
+				} else if (parser.readWord(ILisaacModel.slot_external)) {	
+					// - "external" ':=' `<code_c>`
+					
+					if (! parser.readSymbol(ILisaacModel.symbol_affect_immediate)) {
+						parser.getReporter().syntaxError("Added ':='.", parser.getPosition());
+						return false;
+					}
+					if (! parser.readExternal()) {
+						parser.getReporter().syntaxError("Incorrect external.", parser.getPosition());
+						return false;
+					}
+				} else if (parser.readWord(ILisaacModel.slot_default)) {
+					// '-' "default" ':=' EXPR_PRIMARY
+					
+					if (! parser.readSymbol(ILisaacModel.symbol_affect_immediate)) {
+						parser.getReporter().syntaxError("Added ':='.", parser.getPosition());
+						return false;
+					}
+					if (parser.readExprPrimary() == null) {
+						parser.getReporter().syntaxError("Incorrect expr.", parser.getPosition());
+						return false;
+					}
+					// TODO check double default slot
+					// TODO set prototyp default value
+				} else if (parser.readWord(ILisaacModel.slot_type)) {
+					// '-' "type" ':=' `<type C>`
+					
+					if (! parser.readSymbol(ILisaacModel.symbol_affect_immediate)) {
+						parser.getReporter().syntaxError("Added ':='.", parser.getPosition());
+						return false;
+					}
+					if (! parser.readExternal()) {
+						parser.getReporter().syntaxError("Incorrect external.", parser.getPosition());
+						return false;
+					}
+					// TODO check double type declaration
+					
+				} else if (parser.readWord(ILisaacModel.slot_version)) {
+					//
+					// Read `version' slot.
+					//
+
+					// '-' "version" ':=' integer
+					if (! parser.readSymbol(ILisaacModel.symbol_affect_immediate)) {
+						parser.getReporter().syntaxError("Added ':='.", parser.getPosition());
+						return false;
+					}
+					if (! parser.readInteger()) {
+						parser.getReporter().syntaxError("Incorrect number.", parser.getPosition());
+						return false;
+					}
+					// } else if () { TODO lip
+				} else if (parser.readWord(ILisaacModel.slot_date) ||
+						parser.readWord(ILisaacModel.slot_comment) ||
+						parser.readWord(ILisaacModel.slot_author) ||
+						parser.readWord(ILisaacModel.slot_bibliography) ||
+						parser.readWord(ILisaacModel.slot_language) ||
+						parser.readWord(ILisaacModel.slot_copyright) ||
+						parser.readWord(ILisaacModel.slot_bug_report)) {
+					//						  
+					// Read `date', `comment', `author', `bibliography', 
+					// `language', `copyright' or `bug_report' slots.
+					//
+
+					String headerSlot = new String(parser.getLastString());
+					
+					// '-' ("date"|"comment"|"author"|"bibliography"|"language"|"copyright"|"bug_report") 
+					// ':=' string
+					if (! parser.readSymbol(ILisaacModel.symbol_affect_immediate)) {
+						parser.getReporter().syntaxError("Added ':='.", parser.getPosition());
+						return false;
+					}
+					if (! parser.readString()) {
+						parser.getReporter().syntaxError("Incorrect string.", parser.getPosition());
+						return false;
+					}
+					if (headerSlot.equals(ILisaacModel.slot_comment)) {
+						prototype.setHeaderComment(new String(parser.getLastString()));
+					} else {
+						prototype.addHeaderData(headerSlot,new String(parser.getLastString()));
+					}
+					
+				} else {
+					parser.getReporter().syntaxError("Incorrect slot.", parser.getPosition());
+					return false;
+				}
+				if (! parser.readCharacter(';')) {
+					parser.getReporter().warning("Added ';'.", parser.getPosition());
+				}
+			}
+		} while (! parser.isEOF() && result);
+
+		return true;
+	}
+
+	public ILisaacContext getNextContext() {
+		if (parser.skipUntilThisKeyword(ILisaacModel.keyword_section)) {
+			return this;
+		}
+		return null;
+	}
+}
diff --git a/src/org/eclipse/lisaac/model/items/ICode.java b/src/org/eclipse/lisaac/model/items/ICode.java
index 7983b18..613ff5b 100644
--- a/src/org/eclipse/lisaac/model/items/ICode.java
+++ b/src/org/eclipse/lisaac/model/items/ICode.java
@@ -1,8 +1,8 @@
-package org.eclipse.lisaac.model.items;
-
-import org.eclipse.lisaac.model.types.IType;
-
-public interface ICode {
-
-	IType getType(Slot slot);
-}
+package org.eclipse.lisaac.model.items;
+
+import org.eclipse.lisaac.model.types.IType;
+
+public interface ICode {
+
+	IType getType(Slot slot, Prototype prototype);
+}
diff --git a/src/org/eclipse/lisaac/model/items/ITMArgs.java b/src/org/eclipse/lisaac/model/items/ITMArgs.java
index ebfd082..76ec72a 100644
--- a/src/org/eclipse/lisaac/model/items/ITMArgs.java
+++ b/src/org/eclipse/lisaac/model/items/ITMArgs.java
@@ -1,51 +1,70 @@
-package org.eclipse.lisaac.model.items;
-
-import org.eclipse.lisaac.model.types.IType;
-import org.eclipse.lisaac.model.types.TypeMulti;
-
-public class ITMArgs implements IArgument {
-
-	protected String[] name;
-	protected TypeMulti type;
-
-	public ITMArgs(String[] name, TypeMulti type) {
-		this.name = name;
-		this.type = type;
-	}
-
-	public String getName() {
-		return "(ARGS)"; // TODO print arguments
-	}
-
-	private int lastIndexOf(String word) {
-		for (int i=0; i<name.length; i++) {
-			if (name[i].compareTo(word) == 0) {
-				return i;
-			}
-		}
-		return -1;
-	}
-	
-	public boolean hasArgument(String word) {
-		return lastIndexOf(word) != -1;
-	}
-
-	public IType getType() {
-		// TODO Auto-generated method stub
-		return null;// FIXME list arg type
-	}
-	
-	public IType getArgType(String name) {
-		int index = lastIndexOf(name);
-		if (index != -1) {
-			return type.getSubType(index);
-		}
-		return null;
-	}
-	
-	public void printIn(StringBuffer buffer) {
-		// TODO print multi
-		buffer.append("TODO");
-	}
-}
+package org.eclipse.lisaac.model.items;
+
+import org.eclipse.lisaac.model.types.IType;
+import org.eclipse.lisaac.model.types.TypeMulti;
+
+public class ITMArgs implements IArgument {
+
+	protected String[] name;
+	protected TypeMulti type;
+
+	public ITMArgs(String[] name, TypeMulti type) {
+		this.name = name;
+		this.type = type;
+	}
+
+	public String getName() {
+		StringBuffer buffer = new StringBuffer("(");
+		for (int i=0; i<name.length; i++) {
+			buffer.append(name[i]);
+			
+			if (i != name.length-1) {
+				buffer.append(", ");
+			}
+		}
+		buffer.append(")");
+		return buffer.toString();
+	}
+
+	private int lastIndexOf(String word) {
+		for (int i=0; i<name.length; i++) {
+			if (name[i].compareTo(word) == 0) {
+				return i;
+			}
+		}
+		return -1;
+	}
+	
+	public boolean hasArgument(String word) {
+		return lastIndexOf(word) != -1;
+	}
+
+	public IType getType() {
+		// TODO Auto-generated method stub
+		return null;// FIXME list arg type
+	}
+	
+	public IType getArgType(String name) {
+		int index = lastIndexOf(name);
+		if (index != -1) {
+			return type.getSubType(index);
+		}
+		return null;
+	}
+	
+	public void printIn(StringBuffer buffer) {
+		buffer.append("(");
+		for (int i=0; i<name.length; i++) {
+			IType subType = type.getSubType(i);
+			buffer.append(name[i]);
+			buffer.append(":");
+			buffer.append(subType.toString());
+			
+			if (i != name.length-1) {
+				buffer.append(", ");
+			}
+		}
+		buffer.append(")");
+	}
+}
 	
\ No newline at end of file
diff --git a/src/org/eclipse/lisaac/model/items/ITMBlock.java b/src/org/eclipse/lisaac/model/items/ITMBlock.java
index ee9077b..0fba3b3 100644
--- a/src/org/eclipse/lisaac/model/items/ITMBlock.java
+++ b/src/org/eclipse/lisaac/model/items/ITMBlock.java
@@ -1,18 +1,18 @@
-package org.eclipse.lisaac.model.items;
-
-import org.eclipse.lisaac.model.types.IType;
-import org.eclipse.lisaac.model.types.TypeBlock;
-
-public class ITMBlock implements ICode {
-	protected ITMList list;
-	protected IArgument argument;
-	
-	public ITMBlock(ITMList list, IArgument argument) {
-		this.list = list;
-		this.argument = argument;
-	}
-
-	public IType getType(Slot slot) {
-		return TypeBlock.get(null, null); // FIXME empty block
-	}
-}
+package org.eclipse.lisaac.model.items;
+
+import org.eclipse.lisaac.model.types.IType;
+import org.eclipse.lisaac.model.types.TypeBlock;
+
+public class ITMBlock implements ICode {
+	protected ITMList list;
+	protected IArgument argument;
+	
+	public ITMBlock(ITMList list, IArgument argument) {
+		this.list = list;
+		this.argument = argument;
+	}
+
+	public IType getType(Slot slot, Prototype prototype) {
+		return TypeBlock.get(null, null); // FIXME empty block
+	}
+}
diff --git a/src/org/eclipse/lisaac/model/items/ITMCharacter.java b/src/org/eclipse/lisaac/model/items/ITMCharacter.java
index 87c9253..3dc02f6 100644
--- a/src/org/eclipse/lisaac/model/items/ITMCharacter.java
+++ b/src/org/eclipse/lisaac/model/items/ITMCharacter.java
@@ -1,17 +1,17 @@
-package org.eclipse.lisaac.model.items;
-
-import org.eclipse.lisaac.model.ILisaacModel;
-import org.eclipse.lisaac.model.types.IType;
-import org.eclipse.lisaac.model.types.TypeSimple;
-
-public class ITMCharacter implements IConstant {
-
-	public ITMCharacter(String string) {
-		// TODO Auto-generated constructor stub
-	}
-
-	public IType getType(Slot slot) {
-		return TypeSimple.get(ILisaacModel.prototype_character);
-	}
-
-}
+package org.eclipse.lisaac.model.items;
+
+import org.eclipse.lisaac.model.ILisaacModel;
+import org.eclipse.lisaac.model.types.IType;
+import org.eclipse.lisaac.model.types.TypeSimple;
+
+public class ITMCharacter implements IConstant {
+
+	public ITMCharacter(String string) {
+		// TODO Auto-generated constructor stub
+	}
+
+	public IType getType(Slot slot, Prototype prototype) {
+		return TypeSimple.get(ILisaacModel.prototype_character);
+	}
+
+}
diff --git a/src/org/eclipse/lisaac/model/items/ITMExpression.java b/src/org/eclipse/lisaac/model/items/ITMExpression.java
index 7c827e5..4d2cee7 100644
--- a/src/org/eclipse/lisaac/model/items/ITMExpression.java
+++ b/src/org/eclipse/lisaac/model/items/ITMExpression.java
@@ -1,21 +1,21 @@
-package org.eclipse.lisaac.model.items;
-
-import org.eclipse.lisaac.model.types.IType;
-
-/**
- * operator list message
- */
-public class ITMExpression implements ICode {
-	protected ICode[] valueList;
-	
-	public ITMExpression(ICode[] list) {
-		valueList = list;
-	}
-
-	public IType getType(Slot slot) {
-		if (valueList != null && valueList.length > 0) {
-			return valueList[valueList.length-1].getType(slot); // FIXME expr type
-		}
-		return null;
-	}
-}
+package org.eclipse.lisaac.model.items;
+
+import org.eclipse.lisaac.model.types.IType;
+
+/**
+ * operator list message
+ */
+public class ITMExpression implements ICode {
+	protected ICode[] valueList;
+	
+	public ITMExpression(ICode[] list) {
+		valueList = list;
+	}
+
+	public IType getType(Slot slot, Prototype prototype) {
+		if (valueList != null && valueList.length > 0) {
+			return valueList[valueList.length-1].getType(slot, prototype); // FIXME expr type
+		}
+		return null;
+	}
+}
diff --git a/src/org/eclipse/lisaac/model/items/ITMExternal.java b/src/org/eclipse/lisaac/model/items/ITMExternal.java
index 793dec1..bc72078 100644
--- a/src/org/eclipse/lisaac/model/items/ITMExternal.java
+++ b/src/org/eclipse/lisaac/model/items/ITMExternal.java
@@ -1,15 +1,15 @@
-package org.eclipse.lisaac.model.items;
-
-import org.eclipse.lisaac.model.types.IType;
-
-public class ITMExternal implements ICode {
-	protected String extern;
-
-	public ITMExternal(String extern) {
-		this.extern = extern;
-	}
-
-	public IType getType(Slot slot) {
-		return null;
-	}
-}
+package org.eclipse.lisaac.model.items;
+
+import org.eclipse.lisaac.model.types.IType;
+
+public class ITMExternal implements ICode {
+	protected String extern;
+
+	public ITMExternal(String extern) {
+		this.extern = extern;
+	}
+
+	public IType getType(Slot slot, Prototype prototype) {
+		return null;
+	}
+}
diff --git a/src/org/eclipse/lisaac/model/items/ITMFixme.java b/src/org/eclipse/lisaac/model/items/ITMFixme.java
index 6c9f69c..ac18e40 100644
--- a/src/org/eclipse/lisaac/model/items/ITMFixme.java
+++ b/src/org/eclipse/lisaac/model/items/ITMFixme.java
@@ -1,10 +1,10 @@
-package org.eclipse.lisaac.model.items;
-
-import org.eclipse.lisaac.model.types.IType;
-
-public class ITMFixme implements ICode {
-
-	public IType getType(Slot slot) {
-		return null;
-	}
-}
+package org.eclipse.lisaac.model.items;
+
+import org.eclipse.lisaac.model.types.IType;
+
+public class ITMFixme implements ICode {
+
+	public IType getType(Slot slot, Prototype prototype) {
+		return null;
+	}
+}
diff --git a/src/org/eclipse/lisaac/model/items/ITMLDots.java b/src/org/eclipse/lisaac/model/items/ITMLDots.java
index b030a66..7415819 100644
--- a/src/org/eclipse/lisaac/model/items/ITMLDots.java
+++ b/src/org/eclipse/lisaac/model/items/ITMLDots.java
@@ -1,10 +1,10 @@
-package org.eclipse.lisaac.model.items;
-
-import org.eclipse.lisaac.model.types.IType;
-
-public class ITMLDots implements ICode {
-
-	public IType getType(Slot slot) {
-		return null;
-	}
-}
+package org.eclipse.lisaac.model.items;
+
+import org.eclipse.lisaac.model.types.IType;
+
+public class ITMLDots implements ICode {
+
+	public IType getType(Slot slot, Prototype prototype) {
+		return null;
+	}
+}
diff --git a/src/org/eclipse/lisaac/model/items/ITMList.java b/src/org/eclipse/lisaac/model/items/ITMList.java
index c6f437e..9534bde 100644
--- a/src/org/eclipse/lisaac/model/items/ITMList.java
+++ b/src/org/eclipse/lisaac/model/items/ITMList.java
@@ -1,52 +1,52 @@
-package org.eclipse.lisaac.model.items;
-
-import org.eclipse.lisaac.model.types.IType;
-
-public class ITMList implements ICode {
-	protected ICode[] code;
-	protected ITMLocal[] localList;
-	protected ITMLocal[] staticList;
-
-	public ITMList() {
-	}
-
-	public void setCode(ICode[] code) {
-		this.code = code;
-	}
-
-	public void setLocalList(ITMLocal[] list) {
-		localList = list;
-	}
-	public void setStaticList(ITMLocal[] list) {
-		staticList = list;
-	}
-
-	public boolean hasVariableDefinition(String word) {		
-		return getLocal(word) != null;
-	}
-
-	public ITMLocal getLocal(String word) {		
-		if (localList != null) {
-			for (int i=0; i<localList.length; i++) {
-				if (localList[i].name.compareTo(word) == 0) {
-					return localList[i];
-				}
-			}
-		}
-		if (staticList != null) {
-			for (int i=0; i<staticList.length; i++) {
-				if (staticList[i].name.compareTo(word) == 0) {
-					return staticList[i];
-				}
-			}
-		}
-		return null;
-	}
-	
-	public IType getType(Slot slot) {
-		if (code != null && code.length > 0) {
-			return code[code.length-1].getType(slot); // FIXME list type
-		}
-		return null;
-	}
-}
+package org.eclipse.lisaac.model.items;
+
+import org.eclipse.lisaac.model.types.IType;
+
+public class ITMList implements ICode {
+	protected ICode[] code;
+	protected ITMLocal[] localList;
+	protected ITMLocal[] staticList;
+
+	public ITMList() {
+	}
+
+	public void setCode(ICode[] code) {
+		this.code = code;
+	}
+
+	public void setLocalList(ITMLocal[] list) {
+		localList = list;
+	}
+	public void setStaticList(ITMLocal[] list) {
+		staticList = list;
+	}
+
+	public boolean hasVariableDefinition(String word) {		
+		return getLocal(word) != null;
+	}
+
+	public ITMLocal getLocal(String word) {		
+		if (localList != null) {
+			for (int i=0; i<localList.length; i++) {
+				if (localList[i].name.compareTo(word) == 0) {
+					return localList[i];
+				}
+			}
+		}
+		if (staticList != null) {
+			for (int i=0; i<staticList.length; i++) {
+				if (staticList[i].name.compareTo(word) == 0) {
+					return staticList[i];
+				}
+			}
+		}
+		return null;
+	}
+	
+	public IType getType(Slot slot, Prototype prototype) {
+		if (code != null && code.length > 0) {
+			return code[code.length-1].getType(slot, prototype); // FIXME list type
+		}
+		return null;
+	}
+}
diff --git a/src/org/eclipse/lisaac/model/items/ITMNumber.java b/src/org/eclipse/lisaac/model/items/ITMNumber.java
index f98f100..7988d56 100644
--- a/src/org/eclipse/lisaac/model/items/ITMNumber.java
+++ b/src/org/eclipse/lisaac/model/items/ITMNumber.java
@@ -1,16 +1,16 @@
-package org.eclipse.lisaac.model.items;
-
-import org.eclipse.lisaac.model.ILisaacModel;
-import org.eclipse.lisaac.model.types.IType;
-import org.eclipse.lisaac.model.types.TypeSimple;
-
-public class ITMNumber implements IConstant {
-
-	public ITMNumber(long lastInteger) {
-		// TODO Auto-generated constructor stub
-	}
-
-	public IType getType(Slot slot) {
-		return TypeSimple.get(ILisaacModel.prototype_integer);
-	}
-}
+package org.eclipse.lisaac.model.items;
+
+import org.eclipse.lisaac.model.ILisaacModel;
+import org.eclipse.lisaac.model.types.IType;
+import org.eclipse.lisaac.model.types.TypeSimple;
+
+public class ITMNumber implements IConstant {
+
+	public ITMNumber(long lastInteger) {
+		// TODO Auto-generated constructor stub
+	}
+
+	public IType getType(Slot slot, Prototype prototype) {
+		return TypeSimple.get(ILisaacModel.prototype_integer);
+	}
+}
diff --git a/src/org/eclipse/lisaac/model/items/ITMOld.java b/src/org/eclipse/lisaac/model/items/ITMOld.java
index 904d18e..e42d928 100644
--- a/src/org/eclipse/lisaac/model/items/ITMOld.java
+++ b/src/org/eclipse/lisaac/model/items/ITMOld.java
@@ -1,18 +1,18 @@
-package org.eclipse.lisaac.model.items;
-
-import org.eclipse.lisaac.model.types.IType;
-
-public class ITMOld implements ICode {
-	protected ICode value;
-
-	public ITMOld(ICode value) {
-		this.value = value;
-	}
-
-	public IType getType(Slot slot) {
-		if (value != null) {
-			return value.getType(slot);
-		}
-		return null;
-	}
-}
+package org.eclipse.lisaac.model.items;
+
+import org.eclipse.lisaac.model.types.IType;
+
+public class ITMOld implements ICode {
+	protected ICode value;
+
+	public ITMOld(ICode value) {
+		this.value = value;
+	}
+
+	public IType getType(Slot slot, Prototype prototype) {
+		if (value != null) {
+			return value.getType(slot, prototype);
+		}
+		return null;
+	}
+}
diff --git a/src/org/eclipse/lisaac/model/items/ITMOperator.java b/src/org/eclipse/lisaac/model/items/ITMOperator.java
index 89624a9..1ec9d14 100644
--- a/src/org/eclipse/lisaac/model/items/ITMOperator.java
+++ b/src/org/eclipse/lisaac/model/items/ITMOperator.java
@@ -1,20 +1,20 @@
-package org.eclipse.lisaac.model.items;
-
-import org.eclipse.lisaac.model.types.IType;
-
-public class ITMOperator implements ICode {
-	protected String name;
-
-	public ITMOperator(String name) {
-		this.name = name;
-	}
-	
-	public String getName() {
-		return name;
-	}
-
-	public IType getType(Slot slot) {
-		// TODO Auto-generated method stub
-		return null;
-	}
-}
+package org.eclipse.lisaac.model.items;
+
+import org.eclipse.lisaac.model.types.IType;
+
+public class ITMOperator implements ICode {
+	protected String name;
+
+	public ITMOperator(String name) {
+		this.name = name;
+	}
+	
+	public String getName() {
+		return name;
+	}
+
+	public IType getType(Slot slot, Prototype prototype) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+}
diff --git a/src/org/eclipse/lisaac/model/items/ITMPrototype.java b/src/org/eclipse/lisaac/model/items/ITMPrototype.java
index 2e5b9ca..440ad83 100644
--- a/src/org/eclipse/lisaac/model/items/ITMPrototype.java
+++ b/src/org/eclipse/lisaac/model/items/ITMPrototype.java
@@ -1,17 +1,17 @@
-package org.eclipse.lisaac.model.items;
-
-import org.eclipse.lisaac.model.types.IType;
-import org.eclipse.lisaac.model.types.ITypeMono;
-import org.eclipse.lisaac.model.types.TypeSimple;
-
-public class ITMPrototype implements ICode {
-	protected ITypeMono type;
-
-	public ITMPrototype(ITypeMono type) {
-		this.type = type;
-	}
-
-	public IType getType(Slot slot) {
-		return type;
-	}
-}
+package org.eclipse.lisaac.model.items;
+
+import org.eclipse.lisaac.model.types.IType;
+import org.eclipse.lisaac.model.types.ITypeMono;
+import org.eclipse.lisaac.model.types.TypeSimple;
+
+public class ITMPrototype implements ICode {
+	protected ITypeMono type;
+
+	public ITMPrototype(ITypeMono type) {
+		this.type = type;
+	}
+
+	public IType getType(Slot slot, Prototype prototype) {
+		return type;
+	}
+}
diff --git a/src/org/eclipse/lisaac/model/items/ITMRead.java b/src/org/eclipse/lisaac/model/items/ITMRead.java
index 0bbd632..9cca378 100644
--- a/src/org/eclipse/lisaac/model/items/ITMRead.java
+++ b/src/org/eclipse/lisaac/model/items/ITMRead.java
@@ -1,48 +1,47 @@
-package org.eclipse.lisaac.model.items;
-
-import org.eclipse.lisaac.model.ILisaacModel;
-import org.eclipse.lisaac.model.types.IType;
-import org.eclipse.lisaac.model.types.TypeSimple;
-
-public class ITMRead implements ICode {
-	protected String name;
-
-	public ITMRead(String name) {
-		this.name = name;
-	}
-
-	public String getName() {
-		return name;
-	}
-
-	public IType getType(Slot slot) {
-		if (slot != null) {
-			if (name.equals(ILisaacModel.variable_self)) {// type simple?
-				return TypeSimple.get(slot.getPrototype().getName());
-			}
-			IArgument arg = slot.getArgument(name);
-			if (arg != null) {
-				if (arg instanceof ITMArgs) {
-					return ((ITMArgs) arg).getArgType(name);
-				}
-				return arg.getType();
-			}
-			if (slot.getValue() instanceof ITMList) {
-				ITMList list = (ITMList) slot.getValue();
-				ITMLocal local = list.getLocal(name);
-				if (local != null) {
-					return local.getType();
-				}
-			}
-			// TODO lookup in parent proto slots
-			Prototype parent = slot.getPrototype();
-			if (parent != null) {
-				Slot s = parent.getSlot(name);
-				if (s != null) {
-					return s.getResultType();
-				}
-			}
-		}
-		return null;
-	}
-}
+package org.eclipse.lisaac.model.items;
+
+import org.eclipse.lisaac.model.ILisaacModel;
+import org.eclipse.lisaac.model.types.IType;
+import org.eclipse.lisaac.model.types.TypeSimple;
+
+public class ITMRead implements ICode {
+	protected String name;
+
+	public ITMRead(String name) {
+		this.name = name;
+	}
+
+	public String getName() {
+		return name;
+	}
+
+	public IType getType(Slot slot, Prototype prototype) {
+		
+		if (slot != null) {
+			if (name.equals(ILisaacModel.variable_self)) {// type simple?
+				return TypeSimple.get(slot.getPrototype().getName());
+			}
+			IArgument arg = slot.getArgument(name);
+			if (arg != null) {
+				if (arg instanceof ITMArgs) {
+					return ((ITMArgs) arg).getArgType(name);
+				}
+				return arg.getType();
+			}
+			if (slot.getValue() instanceof ITMList) {
+				ITMList list = (ITMList) slot.getValue();
+				ITMLocal local = list.getLocal(name);
+				if (local != null) {
+					return local.getType();
+				}
+			}
+		}
+		if (prototype != null) {
+			Slot s = prototype.lookupSlot(name);
+			if (s != null) {
+				return s.getResultType();
+			}
+		}
+		return null;
+	}
+}
diff --git a/src/org/eclipse/lisaac/model/items/ITMReadArg2.java b/src/org/eclipse/lisaac/model/items/ITMReadArg2.java
index 9a34388..34d21ef 100644
--- a/src/org/eclipse/lisaac/model/items/ITMReadArg2.java
+++ b/src/org/eclipse/lisaac/model/items/ITMReadArg2.java
@@ -1,14 +1,60 @@
-package org.eclipse.lisaac.model.items;
-
-public class ITMReadArg2 extends ITMRead {
-
-	protected ICode argFirst;
-	protected ICode argSecond;
-	
-	public ITMReadArg2(String name, ICode a1, ICode a2) {
-		super(name);
-		this.argFirst = a1;
-		this.argSecond = a2;
-	}
-
-}
+package org.eclipse.lisaac.model.items;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.lisaac.model.LisaacCompletionParser;
+import org.eclipse.lisaac.model.types.IType;
+
+public class ITMReadArg2 extends ITMRead {
+
+	protected ICode argFirst;
+	protected ICode argSecond;
+
+	public ITMReadArg2(String name, ICode a1, ICode a2) {
+		super(name);
+		this.argFirst = a1;
+		this.argSecond = a2;
+	}
+
+	public IType getType(Slot slot, Prototype prototype) {
+		//
+		// operator expression.
+		//
+		if (name.startsWith("__")) { // FIXME __infix __prefix __postfix??
+
+			// Get type of left part of operator.
+			IType type = argFirst.getType(slot, prototype);
+			if (type != null) {
+				try {
+					Prototype operatorPrototype = LisaacCompletionParser.findPrototype(""+type);
+					if (operatorPrototype != null) {
+						Slot operatorSlot = operatorPrototype.lookupSlot(name);
+						if (operatorSlot != null) {
+							// return result type of operator.
+							return operatorSlot.getResultType();
+						}
+					}
+				} catch (CoreException e) {
+				}
+			}
+			// second chance with second argument  FIXME use __postfix?
+			type = argSecond.getType(slot, prototype);
+			if (type != null) {
+				try {
+					Prototype operatorPrototype = LisaacCompletionParser.findPrototype(""+type);
+					if (operatorPrototype != null) {
+						Slot operatorSlot = operatorPrototype.lookupSlot(name);
+						if (operatorSlot != null) {
+							// return result type of operator.
+							return operatorSlot.getResultType();
+						}
+					}
+				} catch (CoreException e) {
+				}
+			}
+		}
+		//
+		// classic slot
+		//
+		return super.getType(slot, prototype);
+	}
+}
diff --git a/src/org/eclipse/lisaac/model/items/ITMReal.java b/src/org/eclipse/lisaac/model/items/ITMReal.java
index 0e2c156..399ca97 100644
--- a/src/org/eclipse/lisaac/model/items/ITMReal.java
+++ b/src/org/eclipse/lisaac/model/items/ITMReal.java
@@ -1,16 +1,16 @@
-package org.eclipse.lisaac.model.items;
-
-import org.eclipse.lisaac.model.ILisaacModel;
-import org.eclipse.lisaac.model.types.IType;
-import org.eclipse.lisaac.model.types.TypeSimple;
-
-public class ITMReal implements IConstant {
-
-	public ITMReal(String string) {
-		// TODO Auto-generated constructor stub
-	}
-
-	public IType getType(Slot slot) {
-		return TypeSimple.get(ILisaacModel.prototype_real);
-	}
-}
+package org.eclipse.lisaac.model.items;
+
+import org.eclipse.lisaac.model.ILisaacModel;
+import org.eclipse.lisaac.model.types.IType;
+import org.eclipse.lisaac.model.types.TypeSimple;
+
+public class ITMReal implements IConstant {
+
+	public ITMReal(String string) {
+		// TODO Auto-generated constructor stub
+	}
+
+	public IType getType(Slot slot, Prototype prototype) {
+		return TypeSimple.get(ILisaacModel.prototype_real);
+	}
+}
diff --git a/src/org/eclipse/lisaac/model/items/ITMResult.java b/src/org/eclipse/lisaac/model/items/ITMResult.java
index fcea19e..3563858 100644
--- a/src/org/eclipse/lisaac/model/items/ITMResult.java
+++ b/src/org/eclipse/lisaac/model/items/ITMResult.java
@@ -1,18 +1,18 @@
-package org.eclipse.lisaac.model.items;
-
-import org.eclipse.lisaac.model.types.IType;
-
-public class ITMResult implements ICode {
-	protected ICode value;
-
-	public ITMResult(ICode value) {
-		this.value = value;
-	}
-
-	public IType getType(Slot slot) {
-		if (value != null) {
-			return value.getType(slot);
-		}
-		return null;
-	}
-}
+package org.eclipse.lisaac.model.items;
+
+import org.eclipse.lisaac.model.types.IType;
+
+public class ITMResult implements ICode {
+	protected ICode value;
+
+	public ITMResult(ICode value) {
+		this.value = value;
+	}
+
+	public IType getType(Slot slot, Prototype prototype) {
+		if (value != null) {
+			return value.getType(slot, prototype);
+		}
+		return null;
+	}
+}
diff --git a/src/org/eclipse/lisaac/model/items/ITMString.java b/src/org/eclipse/lisaac/model/items/ITMString.java
index 154ffb6..ce2447e 100644
--- a/src/org/eclipse/lisaac/model/items/ITMString.java
+++ b/src/org/eclipse/lisaac/model/items/ITMString.java
@@ -1,18 +1,18 @@
-package org.eclipse.lisaac.model.items;
-
-import org.eclipse.lisaac.model.ILisaacModel;
-import org.eclipse.lisaac.model.types.IType;
-import org.eclipse.lisaac.model.types.TypeSimple;
-
-public class ITMString implements IConstant {
-
-	protected String string;
-	
-	public ITMString(String string) {
-		this.string = string;
-	}
-
-	public IType getType(Slot slot) {
-		return TypeSimple.get(ILisaacModel.prototype_string);
-	}
-}
+package org.eclipse.lisaac.model.items;
+
+import org.eclipse.lisaac.model.ILisaacModel;
+import org.eclipse.lisaac.model.types.IType;
+import org.eclipse.lisaac.model.types.TypeSimple;
+
+public class ITMString implements IConstant {
+
+	protected String string;
+	
+	public ITMString(String string) {
+		this.string = string;
+	}
+
+	public IType getType(Slot slot, Prototype prototype) {
+		return TypeSimple.get(ILisaacModel.prototype_string);
+	}
+}
diff --git a/src/org/eclipse/lisaac/model/items/Prototype.java b/src/org/eclipse/lisaac/model/items/Prototype.java
index 1dbd53a..bdeec30 100644
--- a/src/org/eclipse/lisaac/model/items/Prototype.java
+++ b/src/org/eclipse/lisaac/model/items/Prototype.java
@@ -1,173 +1,257 @@
-package org.eclipse.lisaac.model.items;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.jface.text.contentassist.CompletionProposal;
-import org.eclipse.lisaac.model.ILisaacModel;
-import org.eclipse.lisaac.model.LisaacParser;
-import org.eclipse.lisaac.outline.OutlineItem;
-import org.eclipse.lisaac.outline.OutlinePrototype;
-import org.eclipse.lisaac.outline.OutlineSlot;
-import org.eclipse.swt.graphics.Image;
-
-
-public class Prototype {
-	protected String filename;
-	
-	protected ILisaacModel parent;
-	protected LisaacParser parser;
-
-	protected String name;
-	protected String typeStyle;
-
-	protected HashMap<String,Slot> slotList; 
-
-	public Prototype(String filename, String name, ILisaacModel model) {
-		this.filename = filename;
-		this.name = name;
-		this.parent = model;
-		this.parser = model.getParser();
-		
-		slotList = new HashMap<String,Slot>();
-	}
-
-	public ILisaacModel getModel() {
-		return parent;
-	}
-
-	public boolean setName(String n) {
-		if (name != null && name.equals(n)) {
-			return false;
-		}
-		name = n;
-		return true;
-	}
-
-	public String getFileName() {
-		return filename;
-	}
-	public String getName() {
-		return name;
-	}
-	
-	public LisaacParser openParser() {
-		parser.initialize();
-		return parser;
-	}
-
-	public void setTypeStyle(String s) {
-		typeStyle = s;
-	}
-	public String getTypeStyle() {
-		return typeStyle;
-	}
-
-	public boolean isExpanded() {
-		if (typeStyle != null) {
-			return typeStyle.equals(ILisaacModel.keyword_expanded) ||
-			name.equals(ILisaacModel.prototype_true) ||
-			name.equals(ILisaacModel.prototype_false);
-		}
-		return false;
-	}
-
-	public Slot getSlot(String n) {
-		if (slotList.containsKey(n)) {
-			return slotList.get(n);
-		}
-		return null;
-	}
-
-	public Slot getSlot(int offset) {
-		return getSlot(openParser(), offset);
-	}
-	public Slot getSlot(String s, int offset) {
-		return getSlot(new LisaacParser(s), offset);
-	}
-	
-	public Slot getSlot(LisaacParser parser, int offset) {
-		//
-		// Use indentation to get slot
-		//
-		String source = parser.getSource();
-		boolean again;
-		
-		if (offset >= source.length()) {
-			return null;
-		}
-		
-		do {
-			again = false;
-			
-			// find beginning of line
-			while (offset > 0 && source.charAt(offset) != '\n') {
-				offset--;
-			}
-			// look at indentation
-			if (offset > 0 && source.length() > 4) {
-				if (source.charAt(offset+1) == ' ' &&
-						source.charAt(offset+2) == ' ' &&
-						(source.charAt(offset+3) == '+' || source.charAt(offset+3) == '-')) {
-					String slotName = parser.readSlotNameFromOffset(offset+4);
-					if (slotName != null) {
-						return getSlot(slotName);
-					}
-				} else {
-					again = true;
-					offset--;
-				}
-			}
-		} while (again);
-		
-		return null;
-	}
-
-	public void addSlot(Slot s) {
-		slotList.put(s.getName(), s);
-	}
-
-	public List<OutlineItem> getOutlineItems() {
-		List<OutlineItem> slots = new ArrayList<OutlineItem>();
-		
-		Collection<Slot> values = slotList.values() ;
-		Iterator<Slot> it = values.iterator() ;
-		while (it.hasNext()) {
-			Slot slot = it.next();
-			slots.add(new OutlineSlot(slot));
-		}
-		List<OutlineItem> result = new ArrayList<OutlineItem>();
-		result.add(new OutlinePrototype(this, slots));
-		return result;
-	}
-
-	public void getSlotProposals(ArrayList<CompletionProposal> proposals, 
-			int offset, int length) {
-		Collection<Slot> values = slotList.values() ;
-		Iterator<Slot> it = values.iterator() ;
-		while (it.hasNext()) {
-			Slot slot = it.next();
-			Image image = new OutlineSlot(slot).getImage();
-			String displayString = slot.getSignature(true);
-			
-			proposals.add(new CompletionProposal(displayString,
-					offset, length, displayString.length(), image,
-					slot.getSignature(false), null, null));
-		}
-	}
-}
-
-
-
-
-
-
-
-
-
-
-
-
+package org.eclipse.lisaac.model.items;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jface.text.contentassist.CompletionProposal;
+import org.eclipse.lisaac.model.ILisaacModel;
+import org.eclipse.lisaac.model.LisaacCompletionParser;
+import org.eclipse.lisaac.model.LisaacParser;
+import org.eclipse.lisaac.model.types.IType;
+import org.eclipse.lisaac.outline.OutlineItem;
+import org.eclipse.lisaac.outline.OutlinePrototype;
+import org.eclipse.lisaac.outline.OutlineSlot;
+import org.eclipse.swt.graphics.Image;
+
+
+public class Prototype {
+	protected String filename;
+
+	protected ILisaacModel parent;
+	protected LisaacParser parser;
+
+	protected String name;
+	protected String typeStyle;
+
+	protected HashMap<String,Slot> parentList; 
+	protected HashMap<String,Slot> slotList; 
+
+	// hover informations
+	protected String headerData;
+	protected String headerComment;
+	
+	
+	public Prototype(String filename, String name, ILisaacModel model) {
+		this.filename = filename;
+		this.name = name;
+		this.parent = model;
+		this.parser = model.getParser();
+
+		slotList = new HashMap<String,Slot>();
+		parentList = new HashMap<String,Slot>();
+	}
+
+	public ILisaacModel getModel() {
+		return parent;
+	}
+
+	public boolean setName(String n) {
+		if (name != null && name.equals(n)) {
+			return false;
+		}
+		name = n;
+		return true;
+	}
+
+	public String getFileName() {
+		return filename;
+	}
+	public String getName() {
+		return name;
+	}
+
+	public void setHeaderComment(String comment) {
+		this.headerComment = comment;
+	}
+
+	public void addHeaderData(String slotName, String data) {
+		if (headerData == null) {
+			headerData = data;
+		} else {
+			this.headerData += "- "+slotName+" := "+data;
+		}
+	}
+
+	public LisaacParser openParser() {
+		parser.initialize();
+		return parser;
+	}
+
+	public void setTypeStyle(String s) {
+		typeStyle = s;
+	}
+	public String getTypeStyle() {
+		return typeStyle;
+	}
+
+	public boolean isExpanded() {
+		if (typeStyle != null) {
+			return typeStyle.equals(ILisaacModel.keyword_expanded) ||
+			name.equals(ILisaacModel.prototype_true) ||
+			name.equals(ILisaacModel.prototype_false);
+		}
+		return false;
+	}
+
+	public Slot lookupSlot(String n) {
+		Slot result = null;
+
+		//
+		// Search in 'Self'.
+		//
+		result = getSlot(n);
+		if (result == null) {
+			result = getParentSlot(n);
+		}
+		
+		if (result == null) {
+			//
+			// Search in parents.
+			//
+			Collection<Slot> values = parentList.values();
+			Iterator<Slot> it = values.iterator() ;
+			while (it.hasNext()) {
+				Slot slotParent = it.next();
+				IType typeParent = slotParent.getResultType();
+				try {
+					Prototype parent = LisaacCompletionParser.findPrototype(""+typeParent);
+					if (parent != null) {
+						return parent.lookupSlot(n);
+					}
+				} catch (CoreException e) {
+					return null;
+				}
+			}
+		}
+		return result;
+	}
+
+	public Slot getSlot(String n) {
+		//
+		// Search in 'Self' only.
+		//
+		if (slotList.containsKey(n)) {
+			return slotList.get(n);
+		}
+		return null;
+	}
+
+	public Slot getParentSlot(String n) {
+		// Search in 'Self' parent.
+		if (parentList.containsKey(n)) {
+			return parentList.get(n);
+		}
+		return null;
+	}
+
+	public Slot getSlot(int offset) {
+		return getSlot(openParser(), offset);
+	}
+	public Slot getSlot(String s, int offset) {
+		return getSlot(new LisaacParser(s), offset);
+	}
+
+	public Slot getSlot(LisaacParser parser, int offset) {
+		//
+		// Use indentation to get slot
+		//
+		String source = parser.getSource();
+		boolean again;
+
+		if (offset >= source.length()-1) {
+			return null;
+		}
+
+		do {
+			again = false;
+
+			// find beginning of line
+			while (offset > 0 && source.charAt(offset) != '\n') {
+				offset--;
+			}
+			// look at indentation
+			if (offset > 0 && source.length() > 4) {
+				if (source.charAt(offset+1) == ' ' &&
+						source.charAt(offset+2) == ' ' &&
+						(source.charAt(offset+3) == '+' || source.charAt(offset+3) == '-')) {
+					String slotName = parser.readSlotNameFromOffset(offset+4);
+					if (slotName != null) {
+						return getSlot(slotName);
+					}
+				} else {
+					again = true;
+					offset--;
+				}
+			}
+		} while (again);
+
+		return null;
+	}
+
+	public void addSlot(Slot s) {
+		slotList.put(s.getName(), s);
+	}
+
+	public void addParentSlot(Slot s) {
+		parentList.put(s.getName(), s);
+	}
+
+	public String getHoverInformation() {
+		StringBuffer buffer = new StringBuffer();
+		buffer.append("<b>");
+		buffer.append(name);
+		buffer.append("</b>");
+		if (headerComment != null) {
+			buffer.append("<br>"+headerComment);
+		}
+		if (headerData != null) {
+			buffer.append("<br><br>"+headerData);
+		}
+		return buffer.toString();
+	}
+	
+	public List<OutlineItem> getOutlineItems() {
+		List<OutlineItem> slots = new ArrayList<OutlineItem>();
+
+		Collection<Slot> values = slotList.values() ;
+		Iterator<Slot> it = values.iterator() ;
+		while (it.hasNext()) {
+			Slot slot = it.next();
+			slots.add(new OutlineSlot(slot));
+		}
+		List<OutlineItem> result = new ArrayList<OutlineItem>();
+		result.add(new OutlinePrototype(this, slots));
+		return result;
+	}
+
+	public void getSlotProposals(ArrayList<CompletionProposal> proposals, 
+			int offset, int length) {
+		Collection<Slot> values = slotList.values() ;
+		Iterator<Slot> it = values.iterator() ;
+		while (it.hasNext()) {
+			Slot slot = it.next();
+			Image image = new OutlineSlot(slot).getImage();
+			String displayString = slot.getSignature(true);
+
+			proposals.add(new CompletionProposal(displayString,
+					offset, length, displayString.length(), image,
+					slot.getSignature(false), null, null));
+		}
+	}
+}
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/org/eclipse/lisaac/model/types/TypeBlock.java b/src/org/eclipse/lisaac/model/types/TypeBlock.java
index 7e1b839..ed13995 100644
--- a/src/org/eclipse/lisaac/model/types/TypeBlock.java
+++ b/src/org/eclipse/lisaac/model/types/TypeBlock.java
@@ -1,53 +1,55 @@
-package org.eclipse.lisaac.model.types;
-
-import java.util.*;
-
-/**
- * Type block definition
- */
-public class TypeBlock implements ITypeMono {
-
-	private static List<TypeBlock> dico;
-	
-	protected IType typeArgument;
-	protected IType typeResult;
-	
-	TypeBlock(IType typeArgument, IType typeResult) {
-		this.typeArgument = typeArgument;
-		this.typeResult = typeResult;
-	}
-	
-	public static TypeBlock get(IType typ_arg, IType typ_res) {
-		
-		return new TypeBlock(typ_arg, typ_res);
-		
-		/*TypeBlock result=null;
-		
-		if (dico == null) {
-			dico = new ArrayList<TypeBlock>();
-		}
-		int idx = 0;
-		while (idx < dico.size() && 
-				(!dico.get(idx).getTypeArg().equals(typ_arg) || !dico.get(idx).getTypeRes().equals(typ_res))) {
-			idx++;
-		}
-		if (idx <= dico.size()-1) {
-			result = dico.get(idx);
-		} else {
-			result = new TypeBlock(typ_arg, typ_res);
-			dico.add(result);
-		}
-		return result;*/
-	}
-
-	public IType getTypeArg() {
-		return typeArgument;
-	}
-	public IType getTypeRes() {
-		return typeResult;
-	}
-	
-	public String toString() {
-		return "{}"; // TODO block print
-	}
-}
+package org.eclipse.lisaac.model.types;
+
+import java.util.*;
+
+import org.eclipse.lisaac.model.ILisaacModel;
+
+/**
+ * Type block definition
+ */
+public class TypeBlock implements ITypeMono {
+
+	private static List<TypeBlock> dico;
+	
+	protected IType typeArgument;
+	protected IType typeResult;
+	
+	TypeBlock(IType typeArgument, IType typeResult) {
+		this.typeArgument = typeArgument;
+		this.typeResult = typeResult;
+	}
+	
+	public static TypeBlock get(IType typ_arg, IType typ_res) {
+		
+		return new TypeBlock(typ_arg, typ_res);
+		
+		/*TypeBlock result=null;
+		
+		if (dico == null) {
+			dico = new ArrayList<TypeBlock>();
+		}
+		int idx = 0;
+		while (idx < dico.size() && 
+				(!dico.get(idx).getTypeArg().equals(typ_arg) || !dico.get(idx).getTypeRes().equals(typ_res))) {
+			idx++;
+		}
+		if (idx <= dico.size()-1) {
+			result = dico.get(idx);
+		} else {
+			result = new TypeBlock(typ_arg, typ_res);
+			dico.add(result);
+		}
+		return result;*/
+	}
+
+	public IType getTypeArg() {
+		return typeArgument;
+	}
+	public IType getTypeRes() {
+		return typeResult;
+	}
+	
+	public String toString() {
+		return ILisaacModel.prototype_block;
+	}
+}
diff --git a/src/org/eclipse/lisaac/outline/OutlineSlot.java b/src/org/eclipse/lisaac/outline/OutlineSlot.java
index 8a8ea4a..b91c8e1 100644
--- a/src/org/eclipse/lisaac/outline/OutlineSlot.java
+++ b/src/org/eclipse/lisaac/outline/OutlineSlot.java
@@ -1,71 +1,71 @@
-package org.eclipse.lisaac.outline;
-
-import java.util.List;
-
-import org.eclipse.lisaac.model.Position;
-import org.eclipse.lisaac.model.items.Slot;
-import org.eclipse.lisaac.model.types.IType;
-import org.eclipse.swt.graphics.Image;
-
-public class OutlineSlot extends OutlineItem {
-
-	protected Slot slot;
-
-	public OutlineSlot(Slot slot) {
-		this.slot = slot;
-		
-		Position position = slot.getPosition();
-		
-		fstartOffset = position.getStartOffset();
-		fLength = position.length();
-	}
-
-	/**
-	 * Returns the label which corresponds to the element, null otherwise.
-	 * @see ILabelProvider#getText(Object)
-	 */
-	public String getText() {
-		String result=null;
-		if (slot != null) {
-			result = slot.getName();
-			IType t = slot.getResultType();
-			if (t != null && t.toString() != null) {
-				result += " : " + t;// TODO resut type in italics
-			}
-		}
-		return result;
-	}
-
-	public String toString() {
-		return getText();
-	}
-
-	/**
-	 * Returns the image which corresponds to the element, null otherwise.
-	 * @see ILabelProvider#getImage(Object)
-	 */
-	public Image getImage() {
-		if (slot != null) {
-			if (slot.getStyle() == '+') {
-				if (slot.getSectionId() != null && 
-						slot.getSectionId().isPrivateStyle()) {
-					return OutlineImages.PRIVATE_NONSHARED;
-				} else {
-					return OutlineImages.PUBLIC_NONSHARED;
-				}
-			} else {
-				if (slot.getSectionId() != null && 
-						slot.getSectionId().isPrivateStyle()) {
-					return OutlineImages.PRIVATE_SHARED;
-				} else {
-					return OutlineImages.PUBLIC_SHARED;
-				}
-			}
-		}
-		return null;
-	}
-
-	public List<OutlineItem> getChildren() {
-		return null;
-	}
-}
+package org.eclipse.lisaac.outline;
+
+import java.util.List;
+
+import org.eclipse.lisaac.model.Position;
+import org.eclipse.lisaac.model.items.Slot;
+import org.eclipse.lisaac.model.types.IType;
+import org.eclipse.swt.graphics.Image;
+
+public class OutlineSlot extends OutlineItem {
+
+	protected Slot slot;
+
+	public OutlineSlot(Slot slot) {
+		this.slot = slot;
+		
+		Position position = slot.getPosition();
+		
+		fstartOffset = position.getStartOffset();
+		fLength = position.length();
+	}
+
+	/**
+	 * Returns the label which corresponds to the element, null otherwise.
+	 * @see ILabelProvider#getText(Object)
+	 */
+	public String getText() {
+		String result=null;
+		if (slot != null) {
+			result = slot.getName();
+			IType t = slot.getResultType();
+			if (t != null && t.toString() != null) {
+				result += " : " + t;// TODO resut type in italics
+			}
+		}
+		return result;
+	}
+
+	public String toString() {
+		return getText();
+	}
+
+	/**
+	 * Returns the image which corresponds to the element, null otherwise.
+	 * @see ILabelProvider#getImage(Object)
+	 */
+	public Image getImage() {
+		if (slot != null) {
+			if (slot.getStyle() == '+') {
+				if (slot.getSectionId() != null && 
+						slot.getSectionId().isPrivateStyle()) {
+					return OutlineImages.PRIVATE_NONSHARED;
+				} else {
+					return OutlineImages.PUBLIC_NONSHARED;
+				}
+			} else {
+				if (slot.getSectionId() != null && 
+						slot.getSectionId().isPrivateStyle()) {
+					return OutlineImages.PRIVATE_SHARED;
+				} else {
+					return OutlineImages.PUBLIC_SHARED;
+				}
+			}
+		}
+		return null;
+	}
+
+	public List<OutlineItem> getChildren() {
+		return null;
+	}
+}

-- 
Lisaac eclipse plugin



More information about the Lisaac-commits mailing list