
We use a Antlr lexer
Adding a "or a ' do lex the lines after, but deletion of the last non-space character does not (if quote).
Survey ENG "Survey" : STRING[30] '
tMainSurveyID: STRING[36] //GUID of survey. Could be a WAVE
Survey ENG "Survey" : STRING[30] 'sssss
tMainSurveyID: STRING[36] //GUID of survey. Could be a WAVE
So the the deletion of the ' in the second snippet works.
I can solve it with the following code in the mergablelexer:
protected override TextSnapshotRange GetIncrementalParseRange(TextSnapshotRange snapshotRange)
{
TextSnapshotRange? result = null;
if (snapshotRange.StartPosition.DisplayLine+1 == snapshotRange.EndPosition.DisplayLine &&
snapshotRange.StartPosition.Character==0 && snapshotRange.EndPosition.Character == 0)
{
int line = Math.Min(snapshotRange.Snapshot.Lines.Count - 1, snapshotRange.StartPosition.Line + 2);
result = new TextSnapshotRange(snapshotRange.Snapshot, new TextRange(snapshotRange.Snapshot.Lines[snapshotRange.StartPosition.Line].StartOffset, snapshotRange.Snapshot.Lines[line].StartOffset));
System.Diagnostics.Debug.WriteLine($"GetIncrementalParseRange: {result.Value.StartPosition} {result.Value.EndPosition}");
}
if (!result.HasValue)
result = base.GetIncrementalParseRange(snapshotRange);
return result.Value;
}
But it seems to me the default method has a little hickup here:)
Greetz Martin