Dataphor icon indicating copy to clipboard operation
Dataphor copied to clipboard

D4 parser internal failure - whitespace sensitivity

Open duncand opened this issue 8 years ago • 0 comments

The D4 parser as seen from Dataphoria is sensitive to whitespace differences where it shouldn't be.

create operator Foo() : Integer begin result := 42; end;

If this is executed (all on one line as given), the parser dies with an internal exception:

ArgumentOutOfRangeException --->
Index and length must refer to a location within the string.
Parameter name: length
---- Stack Trace ----
   at System.String.Substring(Int32 startIndex, Int32 length)
   at Alphora.Dataphor.DAE.Debug.SourceUtility.CopySection(String script, LineInfo lineInfo) ...

Whereas, if a line break was added before the "end;", then this parsed and created the operator successfully (which would output 42 when invoked).

The fix is to make the parser not whitespace sensitive when it shouldn't be.

duncand avatar Jul 05 '17 21:07 duncand