[SCM] Lisaac compiler branch, stable, updated. lisaac-0.12-484-g3d6fd6d

Damien Bouvarel dams.bouvarel at wanadoo.fr
Sun Sep 6 12:39:37 UTC 2009


The following commit has been merged in the stable branch:
commit 3d6fd6dd8c8c4caec4bc4a8f7608ad5aaf0961ef
Author: Damien Bouvarel <dams.bouvarel at wanadoo.fr>
Date:   Sun Sep 6 14:38:50 2009 +0200

    fix bug in partitionner (still the /*  */ bug)

diff --git a/editor/eclipse/src/org/lisaac/ldt/builder/ILisaacErrorHandler.java b/editor/eclipse/src/org/lisaac/ldt/builder/ILisaacErrorHandler.java
index 9e43856..4671673 100644
--- a/editor/eclipse/src/org/lisaac/ldt/builder/ILisaacErrorHandler.java
+++ b/editor/eclipse/src/org/lisaac/ldt/builder/ILisaacErrorHandler.java
@@ -11,4 +11,6 @@ public interface ILisaacErrorHandler {
 	void warning(String msg, Position position);
 
 	void semanticError(String msg, Position position);
+
+	void enableErrorReport(boolean enable);
 }
diff --git a/editor/eclipse/src/org/lisaac/ldt/builder/LisaacBuilder.java b/editor/eclipse/src/org/lisaac/ldt/builder/LisaacBuilder.java
index d90bb2c..6e33aae 100644
--- a/editor/eclipse/src/org/lisaac/ldt/builder/LisaacBuilder.java
+++ b/editor/eclipse/src/org/lisaac/ldt/builder/LisaacBuilder.java
@@ -67,25 +67,35 @@ public class LisaacBuilder extends IncrementalProjectBuilder {
 	class LisaacErrorHandler implements ILisaacErrorHandler {
 
 		private IFile file;
-
+		private boolean doReport;
+		
 		public LisaacErrorHandler(IFile file) {
 			this.file = file;
+			this.doReport = true;
 		}
 
 		public void syntaxError(String msg, Position position) {
-			addMarker(file, msg, position, IMarker.SEVERITY_ERROR);
+			if (doReport)
+				addMarker(file, msg, position, IMarker.SEVERITY_ERROR);
 		}
 
 		public void semanticError(String msg, Position position) {
-			addMarker(file, msg, position, IMarker.SEVERITY_ERROR);
+			if (doReport)
+				addMarker(file, msg, position, IMarker.SEVERITY_ERROR);
 		}
 
 		public void fatalError(String msg, Position position) {
-			addMarker(file, msg, position, IMarker.SEVERITY_ERROR);
+			if (doReport)
+				addMarker(file, msg, position, IMarker.SEVERITY_ERROR);
 		}
 
 		public void warning(String msg, Position position) {
-			addMarker(file, msg, position, IMarker.SEVERITY_WARNING);
+			if (doReport)
+				addMarker(file, msg, position, IMarker.SEVERITY_WARNING);
+		}
+
+		public void enableErrorReport(boolean enable) {
+			doReport = enable;
 		}
 	}
 
diff --git a/editor/eclipse/src/org/lisaac/ldt/editors/LisaacPartitionScanner.java b/editor/eclipse/src/org/lisaac/ldt/editors/LisaacPartitionScanner.java
index ae54ee5..2a241c5 100644
--- a/editor/eclipse/src/org/lisaac/ldt/editors/LisaacPartitionScanner.java
+++ b/editor/eclipse/src/org/lisaac/ldt/editors/LisaacPartitionScanner.java
@@ -2,36 +2,33 @@ package org.lisaac.ldt.editors;
 
 import org.eclipse.jface.text.rules.*;
 
+
 /**
  * Define rules to allow document partitioning.<br>
  * We have two types of partition: lisaac code and lisaac comments.
  */
-public class LisaacPartitionScanner extends RuleBasedPartitionScanner {
+
+class LisaacPartitionScanner  extends RuleBasedPartitionScanner {
 	public final static String LISAAC_COMMENT = "__lisaac_comment";
 	public final static String LISAAC_STRING = "__lisaac_string";
 	public final static String LISAAC_EXTERNAL = "__lisaac_external";
 	public final static String LISAAC_DEFAULT = "__lisaac_default";
 
 	public LisaacPartitionScanner() {
-		/*
-		 * Define rules to identify comment partition, the rest of documents is default partition
-		 */
+
 		IToken comment = new Token(LISAAC_COMMENT);
 		IToken string = new Token(LISAAC_STRING);
 		IToken external = new Token(LISAAC_EXTERNAL);
-		
-		IPredicateRule[] rules = new IPredicateRule[6];
 
-		rules[0] = new MultiLineRule("\"", "\"", string);
-		rules[1] = new MultiLineRule("`", "`", external);
-		
+		IPredicateRule[] rules = new IPredicateRule[4];
+
+		rules[0] = new MultiLineRule("\"", "\"", string, '\\');
+		rules[1] = new MultiLineRule("`", "`", external, '\\');
+
 		rules[2] = new MultiLineRule("/*", "*/", comment);
 		rules[3] = new EndOfLineRule("//", comment);
-		
-		// avoid processing comment inside lisaac strings
-		rules[4] = new MultiLineRule("\"", "\"", string, '\0', true);
-		rules[5] = new SingleLineRule("`", "`", external, '\0', true);
-		
+
 		setPredicateRules(rules);
 	}
 }
+
diff --git a/editor/eclipse/src/org/lisaac/ldt/model/AbstractLisaacParser.java b/editor/eclipse/src/org/lisaac/ldt/model/AbstractLisaacParser.java
index 058d2bc..f3fae9e 100644
--- a/editor/eclipse/src/org/lisaac/ldt/model/AbstractLisaacParser.java
+++ b/editor/eclipse/src/org/lisaac/ldt/model/AbstractLisaacParser.java
@@ -203,6 +203,8 @@ public class AbstractLisaacParser {
 			}
 			public void warning(String msg, Position position) {
 			}
+			public void enableErrorReport(boolean enable) {	
+			}
 		};
 		source = contents;
 		initialize();
diff --git a/editor/eclipse/src/org/lisaac/ldt/model/LisaacModel.java b/editor/eclipse/src/org/lisaac/ldt/model/LisaacModel.java
index 353afc3..f7d3e67 100644
--- a/editor/eclipse/src/org/lisaac/ldt/model/LisaacModel.java
+++ b/editor/eclipse/src/org/lisaac/ldt/model/LisaacModel.java
@@ -138,6 +138,8 @@ public class LisaacModel implements ILisaacModel{
 						}
 						public void warning(String msg, Position position) {
 						}
+						public void enableErrorReport(boolean enable) {
+						}
 					});
 				}
 			}
diff --git a/editor/eclipse/src/org/lisaac/ldt/model/LisaacParser.java b/editor/eclipse/src/org/lisaac/ldt/model/LisaacParser.java
index cca09f2..cc57e8a 100644
--- a/editor/eclipse/src/org/lisaac/ldt/model/LisaacParser.java
+++ b/editor/eclipse/src/org/lisaac/ldt/model/LisaacParser.java
@@ -84,6 +84,10 @@ public class LisaacParser extends AbstractLisaacParser {
 		super.initialize();
 		TypeSimple.init();
 	}
+	
+	public void enableErrorReport(boolean enable) {
+		reporter.enableErrorReport(enable);
+	}
 
 	public ILisaacContext getSectionContext() {
 		return sectionContext;
@@ -900,7 +904,7 @@ public class LisaacParser extends AbstractLisaacParser {
 
 		readSpace();
 		Position pos = getPosition();
-
+ 
 		if (readThisKeyword(ILisaacModel.variable_self)) {
 			result = new ITMRead(new String(lastString));
 		} else if (readThisKeyword(ILisaacModel.keyword_result)) {
diff --git a/editor/eclipse/src/org/lisaac/ldt/model/items/Prototype.java b/editor/eclipse/src/org/lisaac/ldt/model/items/Prototype.java
index 500dbe0..9874a60 100644
--- a/editor/eclipse/src/org/lisaac/ldt/model/items/Prototype.java
+++ b/editor/eclipse/src/org/lisaac/ldt/model/items/Prototype.java
@@ -309,7 +309,9 @@ public class Prototype {
 		if (offset >= source.length() - 1) {
 			return null;
 		}
-
+		//
+		parser.enableErrorReport(false); // turn off error reporting
+		//
 		while (offset > 0) {
 			//
 			// find beginning of SEND_MSG grammar rule
@@ -365,6 +367,9 @@ public class Prototype {
 								source.charAt(offset - 3) == '\n') {
 							String slotName = parser
 							.readSlotNameFromOffset(offset + 1, false);
+							
+							parser.enableErrorReport(true);// finish with parser
+							
 							if (slotName != null) {
 								result = lookupSlot(slotName);
 								if (result == null) {
@@ -480,6 +485,9 @@ public class Prototype {
 				result = receiver.lookupSlot(slotName);
 			}
 		}
+		//
+		parser.enableErrorReport(true); // turn on error reporting
+		//
 		return result;
 	}
 
diff --git a/lib/collection/fast_array.li b/lib/collection/fast_array.li
index 0e075dd..f419ed0 100644
--- a/lib/collection/fast_array.li
+++ b/lib/collection/fast_array.li
@@ -22,7 +22,7 @@ Section Header
   
   + name     := FAST_ARRAY(V);
 
-
+ 
   - copyright   := "2003-2005 Jérome Boutet, 2003-2007 Benoit Sonntag";
     
   - author      :="Boutet Jerome (boutet at loria.fr)";

-- 
Lisaac compiler



More information about the Lisaac-commits mailing list