Shop OBEX P1 Docs P2 Docs Learn Events
Multiline statement support — Parallax Forums

Multiline statement support

rokickirokicki Posts: 1,000
edited 2007-02-15 01:18 in Propeller 1
The current IDE does support multiline statements. Just use a multiline comment to connect lines:

   a := b1 + (b2 << 1) + (b3 << 2) + (b4 << 3) +  {
}        (b5 << 4) + (b6 << 5) + (b7 << 6)




Is this "feature" going to continue to work with new versions of the IDE? Should I replicate this
behavior in my Spin compiler?

There are some other interesting oddities, for instance

   a + = 3




uses the "+=" operator, and

   a := 1and 5




is also valid (a space is not needed after numeric literals).

I'd be interested if these would be classified as bugs, or as just the way the parser works.

Comments

  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2007-02-15 00:45
    Wow! Great discovery! I really like the multiline thing. Even if it wasn't planned that way, it's a pleasing syntax. I hope it stays.

    -Phil
  • QuattroRS4QuattroRS4 Posts: 916
    edited 2007-02-15 00:46
    ditto - nice one Rokicki ..
  • Paul BakerPaul Baker Posts: 6,351
    edited 2007-02-15 01:03
    Interesting, since the carriage return is encapsulated in the block comment it is removed by the parser, it is likely this will continue to be parsed this way since comments are stripped, though Im not the writer of the compiler so I can't state this catagorically.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Paul Baker
    Propeller Applications Engineer

    Parallax, Inc.
  • rokickirokicki Posts: 1,000
    edited 2007-02-15 01:18
    Another interesting thing is if a spin program starts with a CON block, the CON can be omitted; the first block is
    always a CON if there is no other directive at the top.

    I have to say I am impressed with the robustness of the IDE/compiler. Other than the few bugs I've posted in
    the sticky threads at the top, it's pretty much handled everything I can throw at it (and I've been intentionally
    pushing its limits and trying to break it).
Sign In or Register to comment.