Browse Source

Throw descriptive exception when escape character '@' is at the end of a highlighting expression.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/3.0@3439 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 17 years ago
parent
commit
ce47d3c5db
  1. 6
      src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/HighlightingStrategy/DefaultHighlightingStrategy.cs

6
src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/HighlightingStrategy/DefaultHighlightingStrategy.cs

@ -786,6 +786,8 @@ namespace ICSharpCode.TextEditor.Document @@ -786,6 +786,8 @@ namespace ICSharpCode.TextEditor.Document
switch (expr[i]) {
case '@': // "special" meaning
++i;
if (i == expr.Length)
throw new HighlightingDefinitionInvalidException("Unexpected end of @ sequence, use @@ to look for a single @.");
switch (expr[i]) {
case '!': // don't match the following expression
StringBuilder whatmatch = new StringBuilder();
@ -819,7 +821,8 @@ namespace ICSharpCode.TextEditor.Document @@ -819,7 +821,8 @@ namespace ICSharpCode.TextEditor.Document
switch (expr[i]) {
case '@': // "special" meaning
++i;
if (i < expr.Length) {
if (i == expr.Length)
throw new HighlightingDefinitionInvalidException("Unexpected end of @ sequence, use @@ to look for a single @.");
switch (expr[i]) {
case 'C': // match whitespace or punctuation
if (index + j == lineSegment.Offset || index + j >= lineSegment.Offset + lineSegment.Length) {
@ -882,7 +885,6 @@ namespace ICSharpCode.TextEditor.Document @@ -882,7 +885,6 @@ namespace ICSharpCode.TextEditor.Document
}
break;
}
}
break;
default:
{

Loading…
Cancel
Save