fixed parser NPE
diff --git a/plugins/org.eclipse.mylyn.docs.intent.parser/src/org/eclipse/mylyn/docs/intent/parser/internal/IntentDocumentParser.java b/plugins/org.eclipse.mylyn.docs.intent.parser/src/org/eclipse/mylyn/docs/intent/parser/internal/IntentDocumentParser.java
index f6933c6..06f094e 100644
--- a/plugins/org.eclipse.mylyn.docs.intent.parser/src/org/eclipse/mylyn/docs/intent/parser/internal/IntentDocumentParser.java
+++ b/plugins/org.eclipse.mylyn.docs.intent.parser/src/org/eclipse/mylyn/docs/intent/parser/internal/IntentDocumentParser.java
@@ -96,7 +96,7 @@
 				// the beginning to the calculated offset
 				currentlyParsedSentence = remainingContentToParse.substring(0, cursor);
 				// Step 2.2 : We send the appropriate signal to the builder
-				sendSignal(offset, currentlyParsedSentence.trim());
+				sendSignal(offset - currentlyParsedSentence.length(), currentlyParsedSentence.trim());
 
 				// Step 2.3 (optional - if the current parsedSentence is a ModelingUnit declaration)
 				if (currentlyParsedSentence.contains(ModelingUnitParser.MODELING_UNIT_PREFIX)) {
@@ -148,10 +148,11 @@
 				parsedSentence);
 
 		if (parsedSentenceWithoutDescriptionUnit.contains(IntentKeyWords.INTENT_KEYWORD_CLOSE)) {
-			builder.endStructuredElement(offset);
+			builder.endStructuredElement(offset
+					+ parsedSentenceWithoutDescriptionUnit.indexOf(IntentKeyWords.INTENT_KEYWORD_CLOSE));
 		}
 		if (parsedSentenceWithoutDescriptionUnit.contains(IntentKeyWords.INTENT_KEYWORD_DOCUMENT)) {
-			builder.beginDocument(offset - parsedSentence.length(), parsedSentence.trim().length());
+			builder.beginDocument(offset, parsedSentence.trim().length());
 		}
 		if (parsedSentenceWithoutDescriptionUnit.contains(IntentKeyWords.INTENT_KEYWORD_CHAPTER)) {
 			String title = "";
@@ -159,7 +160,7 @@
 			if (m.matches()) {
 				title = m.group(1);
 			}
-			builder.beginChapter(offset - parsedSentence.length(), parsedSentence.trim().length(), title);
+			builder.beginChapter(offset, parsedSentence.trim().length(), title);
 		}
 		if (parsedSentenceWithoutDescriptionUnit.contains(IntentKeyWords.INTENT_KEYWORD_SECTION)) {
 			String title = "";
@@ -168,8 +169,7 @@
 			if (m.matches()) {
 				title = m.group(1);
 			}
-			builder.beginSection(offset - parsedSentenceWithoutDescriptionUnit.trim().length(),
-					parsedSentenceWithoutDescriptionUnit.trim().length(), title);
+			builder.beginSection(offset, parsedSentenceWithoutDescriptionUnit.trim().length(), title);
 		}
 	}
 
@@ -196,7 +196,6 @@
 			Matcher matcher = ptr.matcher(descriptionUnitContent);
 			// If the parsed Sentence contains this keyWord (i.e. ends a description unit), we remove it
 			if (matcher.find()) {
-				// TODO TRIM du INPACT
 				descriptionUnitContent = descriptionUnitContent.substring(0, matcher.start()).trim();
 			}
 		}
@@ -206,7 +205,7 @@
 			parsedSentenceWithoutDescriptionUnit = parsedSentenceWithoutDescriptionUnit.replace(
 					descriptionUnitContent, "");
 
-			builder.descriptionUnitContent(offset - parsedSentence.length(), descriptionUnitContent);
+			builder.descriptionUnitContent(offset, descriptionUnitContent);
 		}
 
 		return parsedSentenceWithoutDescriptionUnit;
diff --git a/plugins/org.eclipse.mylyn.docs.intent.parser/src/org/eclipse/mylyn/docs/intent/parser/internal/state/IntentGenericState.java b/plugins/org.eclipse.mylyn.docs.intent.parser/src/org/eclipse/mylyn/docs/intent/parser/internal/state/IntentGenericState.java
index a386cd6..76122d8 100644
--- a/plugins/org.eclipse.mylyn.docs.intent.parser/src/org/eclipse/mylyn/docs/intent/parser/internal/state/IntentGenericState.java
+++ b/plugins/org.eclipse.mylyn.docs.intent.parser/src/org/eclipse/mylyn/docs/intent/parser/internal/state/IntentGenericState.java
@@ -169,7 +169,7 @@
 	 */
 	public IntentGenericState modelingUnitContent(int offset, int length, String modelingUnitContent)
 			throws ParseException {
-		throw new ParseException("Can't open any modeling unit here : only in sections.", offset, length);
+		throw new ParseException("Cannot handle any modeling unit here : only in sections.", offset, length);
 	}
 
 	/**
@@ -187,7 +187,8 @@
 	 */
 	public IntentGenericState descriptionUnitContent(int offset, int length, String descriptionUnitContent)
 			throws ParseException {
-		return this;
+		throw new ParseException("Cannot handle any description unit here : only in sections or chapters.",
+				offset, length);
 	}
 
 	public EObject getCurrentElement() {
diff --git a/tests/org.eclipse.mylyn.docs.intent.parser.test/dataTests/intentDocuments/errors/misplacedModelingUnit.intent b/tests/org.eclipse.mylyn.docs.intent.parser.test/dataTests/intentDocuments/errors/misplacedModelingUnit.intent
new file mode 100644
index 0000000..20ac563
--- /dev/null
+++ b/tests/org.eclipse.mylyn.docs.intent.parser.test/dataTests/intentDocuments/errors/misplacedModelingUnit.intent
@@ -0,0 +1,8 @@
+Document {

+	Chapter Title {

+		Text

+		

+		@M

+		M@

+	}

+}

diff --git a/tests/org.eclipse.mylyn.docs.intent.parser.test/dataTests/intentDocuments/errors/newlines.intent b/tests/org.eclipse.mylyn.docs.intent.parser.test/dataTests/intentDocuments/errors/newlines.intent
new file mode 100644
index 0000000..b56b9d0
--- /dev/null
+++ b/tests/org.eclipse.mylyn.docs.intent.parser.test/dataTests/intentDocuments/errors/newlines.intent
@@ -0,0 +1,13 @@
+Document {

+Chapter Chapitre 1

+ {

+	Text

+	

+	

+}

+Chapter Chapitre 2

+ {

+	Text

+}

+

+}
\ No newline at end of file
diff --git a/tests/org.eclipse.mylyn.docs.intent.parser.test/src/org/eclipse/mylyn/docs/intent/parser/errors/test/TestParserErrors.java b/tests/org.eclipse.mylyn.docs.intent.parser.test/src/org/eclipse/mylyn/docs/intent/parser/errors/test/TestParserErrors.java
index 163e1d2..c707a2b 100644
--- a/tests/org.eclipse.mylyn.docs.intent.parser.test/src/org/eclipse/mylyn/docs/intent/parser/errors/test/TestParserErrors.java
+++ b/tests/org.eclipse.mylyn.docs.intent.parser.test/src/org/eclipse/mylyn/docs/intent/parser/errors/test/TestParserErrors.java
@@ -19,13 +19,22 @@
  * @author <a href="mailto:william.piers@obeo.fr">William Piers</a>
  */
 public class TestParserErrors extends AbstractTestParserErrors {
-	// CHECKSTYLE:OFF
 
 	@Test
 	public void testMissingBracket() {
 		testErrorsOnFile("dataTests/intentDocuments/errors/missing_bracket.intent", new ParseException(
-				"There is no element to close.", 38, 1));
+				"Cannot handle any description unit here : only in sections or chapters.", 10, 22));
 	}
 
-	// CHECKSTYLE:ON
+	@Test
+	public void testNewLines() {
+		testErrorsOnFile("dataTests/intentDocuments/errors/newlines.intent", new ParseException(
+				"Cannot handle any description unit here : only in sections or chapters.", 10, 21));
+	}
+
+	@Test
+	public void testMisplacedModelingUnit() {
+		testErrorsOnFile("dataTests/intentDocuments/errors/misplacedModelingUnit.intent", new ParseException(
+				"Cannot handle any modeling unit here : only in sections.", 40, 7));
+	}
 }