PDA

View Full Version : String Literals - SuperQuotes



Charles Pegge
21-07-2009, 14:08
Oxygen supports multi-line strings using ` (and also " outside of a thinBasic script. )

Below is a new kind of string literal suitable for embedding guest scripts that use quote marks themselves.

( With inline thinBasic scripts however, you can't use single or double quotes)

The format for a superquote is:

quote any_marker_word ... any_marker_word

This can be spread onto more than one line:

quote
any_marker_word
...
any_marker_word


Oxygen Update http://community.thinbasic.com/index.php?topic=2517




'----------
'SUPERQUOTE
'==========


uses "oxygen"

dim src as string

src = "
#basic


function fun() as long


dim a as string

;====================
( ' block test
a=quote

-NorwegianParrotScript-

squawk!
=))o<
` ` `
polygon
pining for the fjords
;lovely plumage

-NorwegianParrotScript- `ok`
;====================
)
print a
end function
fun

"

'msgbox 0,o2_prep src
o2_basic src
if len(o2_error) then
msgbox 0, o2_error : stop
end if
o2_exec

John Spikowski
21-07-2009, 16:12
Charles,

In ScriptBasic the """ is used for multi-line strings and remarks.



PRINT """
<a href="some.url">Example</a>
More text with a """ & myvar & """\" showing a quoted "
string right after the variable.
"""
' """Here is a multi-line
comment"""



John

Charles Pegge
21-07-2009, 16:34
Hi John,

Yes I saw that. Nestable quote marks are very useful.

Superquote is really the nuclear option, since any marker keyword can be used, supporting unlimited quote nesting.

& Oxygen can have up to 3 types of conventional quote available to the programmer - all of them multi-line.
These can be reprogrammed at any time within a program.

Like to keep the options open :)

Charles

John Spikowski
22-07-2009, 05:30
Yes I saw that. Nestable quote marks are very useful.


Oh, this means you tried ScriptBasic.

Thanks for having a peek.

Not only nestable but the original format of the text (indents, tabs, line terminators) is maintained between the triple quote delimiters. Great for encapsulating blocks of verbatim HTML text your pushing out to the browser. 8)

John

Charles Pegge
22-07-2009, 09:46
Well I'm getting close John. I've installed Script Basic and I'm dipping into the manual and documentation from time to time, and thinking about the best way to proceed for a Linux/MS implementation.

BTW You mentioned developing a COM module for scriptBasic - this is one of my current lines of research. COM, particularly on the server side, is a tangle of pointers and I need to establish at this stage how well Oxygen can cope with it avoiding the dogs breakfast of workarounds I had to go through three years ago. I want to ensure that the language supports it cleanly. Let's see if Oxygen can make COM servers intelligible.

Charles

John Spikowski
22-07-2009, 12:02
That's great news !

It might be worth having a look at the BCX Basic to C COM/OLE Automation code written in ANSI C. It might save some time and grief.

Let me know if there is anything I can do from my end to make your experience with SciptBasic a success.