Enable SourceSpan to remember position of the end-char

Apr 30, 2012 at 11:01 AM

Currently, as far as I can see, the SourceSpan construct has a location consisting of index, line and column, but the end-location is only the index. Would it be possible to extend SourceSpan so it stores line and column for end-position too?

Coordinator
May 1, 2012 at 3:50 AM

may i ask - what for?

May 2, 2012 at 9:49 AM

Sure, it's to convert it into Microsoft.Scripting.SourceSpan (if I remembered the namespace correctly) and working with the DLR.

Coordinator
May 4, 2012 at 5:18 PM

Seriously?! are you digging DLR for real, or just trying it? If it is "just try", then my sincere advice - don't. All you'll get is headache. If it is for DLR, I would not bother doing any modifications in Irony. DLR is a dead mess. If you still insist, then this information can be easily derived from start col/pos and token text - just count new lines inside text.

May 7, 2012 at 3:56 PM
Edited May 7, 2012 at 3:57 PM

I am not a big DLR fan either, but I do want to point out that the CodePlex project (link) has not been touched in two years.

If you are going to use it, I would advise grabbing the code from the IronLanguages project on GitHub (link).  This is the current project for IronRuby and IronPython, and at least there is some movement to better the DLR here.  Microsoft has dropped it's support toward the project, so now it's completely community supported.

-MindCore

May 22, 2012 at 11:08 AM

Yeah, I know, and I'm using the one from the ironlanguages. And I agree with you rivantsov; it's a pain, but it's also quite fun trying to learn. I've been reading ironruby's source-code (the ironpython was way over and about my comprehention at the time, but now that I've got a better understanding of the basics I'm considering going back). What I like is the interoperability of things, and the ability to handle a MyLanguage-object in C# simply by denoting it as "dynamic". Though, there's still a lot I don't understand (and a serious lack of documentation), so it'll probably end up being even more pain than it already is xD. Hopefully, though, I come out a better programmer :). And I only mentioned this here cause I figured it'd be a really simple thing to implement into irony, while if I wan't to implement it "outside" of irony, I have to maintain a string-representation in memory to count newlines as you suggested.