Precisely Speaking
May 21, 2012, 06:58:41 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: So what's news with you?  Tell us about it in "Getting To Know You"!
 
   Home   Help Calendar Login Register  
Pages: [1]   Go Down
  Print  
Author Topic: Assigning Strings with Semi-Colons in Paragraphs  (Read 823 times)
Tom Pellitieri
Rock Star
*****
Posts: 171


Tom Pellitieri - Toledo, Ohio


« on: January 11, 2011, 07:37:38 AM »

I'm using SB+ 5.4.3.  In /PD.P, I tried to enter the following two lines:

LOCAL TMP
TMP = "X;Y"

When I press F2 to save, I get an error "Line 2 - Error in Expression".

If I removed the semi-colon, it's fine.

Any ideas?Huh?? 

I'm actually trying to set @PARAM before a call to SB.EVAL.EXP to get the text from a Code Table (/TABLE.DEFN).  Alternatively, is there an easier way to do this from a paragraph?

--Tom
Logged
precisonline
President/Chief Technologist
Administrator
Rock Star
*****
Posts: 1532



WWW
« Reply #1 on: January 11, 2011, 07:43:56 AM »

The SB+ paragraph parser thinks a semicolon can only be a statement terminator and therefore it cannot appear in a quoted string.  The semicolon character is a ASCII 59 (as I recall) so you can either concatenate a CHAR(59) where you want the semicolon to be, or you can create a global equate called SEMICOLON or SEMI that equates to CHAR(59) and use that name instead (which I think is more readable).
Logged

-Kevin
Accidents "happen"; success, however, is planned and executed.
Tom Pellitieri
Rock Star
*****
Posts: 171


Tom Pellitieri - Toledo, Ohio


« Reply #2 on: January 11, 2011, 11:38:43 AM »

Thanks, Kevin.  I don't use the semi-colon/statement separator much.  I just found it odd that the parser would give that precedence over string completion.
Logged
precisonline
President/Chief Technologist
Administrator
Rock Star
*****
Posts: 1532



WWW
« Reply #3 on: January 11, 2011, 12:34:03 PM »

Very few actually use the string separator.  But the problem is deeper than the paragraph language; it's actually in the underlying expression language.  For example, this is invalid in a SB+ expression:

SEQ(';')

It's perfectly valid in BASIC, however. The semicolon just messes stuff up.

My apologies, I remember now it's not because of the statement separator, it's because of the way that SB+ creates execution stacks from this stuff.  The semicolon is the delimiter both for expressions and paragraph p-code.  For example, here's the execution stack for SEQ('A'):

CA;Z|Q

Note the ";" between the "constant A" and "function Q".
Logged

-Kevin
Accidents "happen"; success, however, is planned and executed.
Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.7 | SMF © 2006-2008, Simple Machines LLC Valid XHTML 1.0! Valid CSS!