Shop OBEX P1 Docs P2 Docs Learn Events
Problem with Propellent (tabs in text) — Parallax Forums

Problem with Propellent (tabs in text)

RaymanRayman Posts: 14,889
edited 2010-08-12 06:02 in Propeller 1
Just overcame (I think) an issue with Propellent (and I guess SPIN in general...).

When there's a compilation error, you can use SrcStart and SrcCount to figure out the string that caused the error.

The usage notes does imply that the <CR><LF> combination is replaced with <CR>.

But, it doesn't mention that <TAB> is replaced with 8 spaces.

Actually, TAB is a real problem with SPIN! I just realized that if the compiler is replacing tabs with 8 spaces before analyzing, then there are potential heirarchy problems...

Anyway, for VisualSpin, I've decided to try replacing <TAB> with 5 spaces before compile. This is my editor window tab setting. But, I'm not sure that guarantees things come out right...

Comments

  • RaymanRayman Posts: 14,889
    edited 2010-08-11 16:48
    I think there are two options:

    1. When the user hits the tab key, insert some number of spaces to give the appearance of a tab. (I think this is what Parallax does.)

    2. Put the tabs in, but at compile time create a duplicate with all the tabs replaced with the appropriate number of spaces. This is what I'm going to try...
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2010-08-11 17:37
    The problem with source files that contain tabs for a language like Spin or Python is that they're not portable from editor to editor. Depending upon an editor's tab settings, the same program could have entirely different semantics between two different editors. It's better never to have tabs in the file in the first place. So I'd go with option 1.

    -Phil
  • RaymanRayman Posts: 14,889
    edited 2010-08-11 18:53
    I see your point. But, I now have a function that replaces all the tabs with the right number of spaces. So, before exporting code from my program, I'll just call that function. That should guarantee compatibility.

    I really like using backspace to untab. You can to this in MS Visual Studio and I like it better that way...

    But, I'm still a little on the fence and may revert to #1...
  • RaymanRayman Posts: 14,889
    edited 2010-08-12 06:02
    Phil,

    Decided you're right and it's safer to not have any tabs in the text. So, I've changed the edit control to insert 5 spaces instead of the tab key. But, I'm not happy with this predicament...
Sign In or Register to comment.