Re: LCB: Error: illegal escape in string

2016-02-24 Thread Stephen MacLean

> On Feb 24, 2016, at 10:41 AM, Peter TB Brett  wrote:
> 
> On 24/02/2016 12:26, Stephen MacLean wrote:
>>> Hi Stephen,
>>> 
>>> In LiveCode Builder, quoted strings treat the '\' character as an escape 
>>> character.  It's explained in the LiveCode Builder Language Reference guide.
>>> 
>>> So, you need to replace your '\' with '\\', and everything should work 
>>> nicely for you.
> >
>> Thanks for that, I will give it a try!
>> 
>> Can you explain why it’s treated that way inside a quoted string? Just 
>> curious:)
> 
> While we were designing LiveCode Builder, we wanted to make it easier to 
> create string literals with *any* character in them, including the quote 
> character, control characters, and non-native characters.
> 
> This requires the use of some sort of "escape character" to indicate the 
> start of special sequences.  We could have come up with our own, 
> LiveCode-specific one, but most programming languages use "\" so that's what 
> we went with.  There didn't seem to be much to gain by being different for 
> the sake of being different.
> 
> This does make writing complex string literals quite a bit easier.  For 
> example, in LiveCode builder you can write:
> 
>   put "\"Come to the pub for a beer,\" she said.\n" into tVar
> 
> rather than the LiveCode Script equivalent:
> 
>   put quote & "Come to the pub for a beer," & quote && "she said." & return 
> into tVar
> 
>> Also, can you point me to the LCB Language Reference guide? Or is that 
>> what’s in the dictionary? I’d love to be able to dive into an actual 
>> reference!
> 
> 1. Open the 8.0.0-dp-15 IDE
> 
> 2. Open the dictionary
> 
> 3. Switch to the "Guides" tab
> 
> 4. Select "LiveCode Builder Language Reference" from the menu.
> 
> There's also a "LiveCode Builder" API reference in the dictionary.
> 
>  Peter
> 

Thanks so much for the explanation and pointer!!

Steve



___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: LCB: Error: illegal escape in string

2016-02-24 Thread Peter TB Brett

On 24/02/2016 12:26, Stephen MacLean wrote:

Hi Stephen,

In LiveCode Builder, quoted strings treat the '\' character as an escape 
character.  It's explained in the LiveCode Builder Language Reference guide.

So, you need to replace your '\' with '\\', and everything should work nicely 
for you.

>

Thanks for that, I will give it a try!

Can you explain why it’s treated that way inside a quoted string? Just curious:)


While we were designing LiveCode Builder, we wanted to make it easier to 
create string literals with *any* character in them, including the quote 
character, control characters, and non-native characters.


This requires the use of some sort of "escape character" to indicate the 
start of special sequences.  We could have come up with our own, 
LiveCode-specific one, but most programming languages use "\" so that's 
what we went with.  There didn't seem to be much to gain by being 
different for the sake of being different.


This does make writing complex string literals quite a bit easier.  For 
example, in LiveCode builder you can write:


   put "\"Come to the pub for a beer,\" she said.\n" into tVar

rather than the LiveCode Script equivalent:

   put quote & "Come to the pub for a beer," & quote && "she said." & 
return into tVar



Also, can you point me to the LCB Language Reference guide? Or is that what’s 
in the dictionary? I’d love to be able to dive into an actual reference!


1. Open the 8.0.0-dp-15 IDE

2. Open the dictionary

3. Switch to the "Guides" tab

4. Select "LiveCode Builder Language Reference" from the menu.

There's also a "LiveCode Builder" API reference in the dictionary.

  Peter

--
Dr Peter Brett 
LiveCode Open Source Team

LiveCode 2016 Conference: https://livecode.com/edinburgh-2016/

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: LCB: Error: illegal escape in string

2016-02-24 Thread Stephen MacLean

> On Feb 24, 2016, at 3:08 AM, Peter TB Brett  wrote:
> 
> On 23/02/2016 21:59, Stephen MacLean wrote:
>> Hi All,
>> 
>> Working to build a library extension and I’m getting an error on this line 
>> when I go to test it in LCB:
>> 
>> put "^[A-Z0-9._%+-]{1,64}@(?:[A-Z0-9-]{1,63}\.){1,125}[A-Z]{2,63}$" into 
>> tRegex
>> 
>> The error is:
>> 
>> illegal escape in string 
>> '^[A-Z0-9._%+-]{1,64}@(?:[A-Z0-9-]{1,63}\.){1,125}[A-Z]{2,63}$’
> 
> Hi Stephen,
> 
> In LiveCode Builder, quoted strings treat the '\' character as an escape 
> character.  It's explained in the LiveCode Builder Language Reference guide.
> 
> So, you need to replace your '\' with '\\', and everything should work nicely 
> for you.
> 
>Peter
> 

Hi Peter,

Thanks for that, I will give it a try! 

Can you explain why it’s treated that way inside a quoted string? Just curious:)

Also, can you point me to the LCB Language Reference guide? Or is that what’s 
in the dictionary? I’d love to be able to dive into an actual reference!

Thanks!

Steve MacLean



___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: LCB: Error: illegal escape in string

2016-02-24 Thread Peter TB Brett

On 23/02/2016 21:59, Stephen MacLean wrote:

Hi All,

Working to build a library extension and I’m getting an error on this line when 
I go to test it in LCB:

put "^[A-Z0-9._%+-]{1,64}@(?:[A-Z0-9-]{1,63}\.){1,125}[A-Z]{2,63}$" into tRegex

The error is:

illegal escape in string 
'^[A-Z0-9._%+-]{1,64}@(?:[A-Z0-9-]{1,63}\.){1,125}[A-Z]{2,63}$’


Hi Stephen,

In LiveCode Builder, quoted strings treat the '\' character as an escape 
character.  It's explained in the LiveCode Builder Language Reference guide.


So, you need to replace your '\' with '\\', and everything should work 
nicely for you.


Peter

--
Dr Peter Brett 
LiveCode Open Source Team

LiveCode 2016 Conference https://livecode.com/edinburgh-2016/

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: LCB: Error: illegal escape in string

2016-02-23 Thread Peter Haworth
Doesn't seem like it should be treated as an escape character since it's in
quotes, as you say.  I'd enter a QCC report about it and see what the LCB
team have to say.

On Tue, Feb 23, 2016 at 5:55 PM Stephen MacLean 
wrote:

> Hi Phil,
>
> Thanks for responding, I’m not one either and it works fine with no issues
> when run directly in LC.
>
> Removing the “\” does cure the error, but of course doesn’t work any more.
>
> So the question I guess is two fold: 1) Why is that considered an escape
> character when it is enclosed in quotes and 2) How do you escape it?
>
> Sorry, trying to learn LCB. Documentation is hard to find, at least for
> me. The dictionary for LCB is very light at the moment.
>
> Thanks,
>
> Steve MacLean
>
> > On Feb 23, 2016, at 6:25 PM, Phil Davis  wrote:
> >
> > I'm not much of a regex guy, but what happens if you remove the
> backslash after {1,63} ?  I assume something will probably stop working,
> but that's the only \ in the string.
> >
> > Phil Davis
> >
> >
> >
> > On 2/23/16 1:59 PM, Stephen MacLean wrote:
> >> Hi All,
> >>
> >> Working to build a library extension and I’m getting an error on this
> line when I go to test it in LCB:
> >>
> >> put "^[A-Z0-9._%+-]{1,64}@(?:[A-Z0-9-]{1,63}\.){1,125}[A-Z]{2,63}$"
> into tRegex
> >>
> >> The error is:
> >>
> >> illegal escape in string '^[A-Z0-9._%+-]{1,64}@
> (?:[A-Z0-9-]{1,63}\.){1,125}[A-Z]{2,63}$’
> >>
> >> Any ideas?
> >>
> >> Thanks,
> >>
> >> Steve MacLean
> >>
> >> ___
> >> use-livecode mailing list
> >> use-livecode@lists.runrev.com
> >> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> >> http://lists.runrev.com/mailman/listinfo/use-livecode
> >
> > --
> > Phil Davis
> >
> >
> > ___
> > use-livecode mailing list
> > use-livecode@lists.runrev.com
> > Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> > http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
>
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: LCB: Error: illegal escape in string

2016-02-23 Thread Stephen MacLean
Hi Phil,

Thanks for responding, I’m not one either and it works fine with no issues when 
run directly in LC. 

Removing the “\” does cure the error, but of course doesn’t work any more.

So the question I guess is two fold: 1) Why is that considered an escape 
character when it is enclosed in quotes and 2) How do you escape it?

Sorry, trying to learn LCB. Documentation is hard to find, at least for me. The 
dictionary for LCB is very light at the moment.

Thanks,

Steve MacLean

> On Feb 23, 2016, at 6:25 PM, Phil Davis  wrote:
> 
> I'm not much of a regex guy, but what happens if you remove the backslash 
> after {1,63} ?  I assume something will probably stop working, but that's the 
> only \ in the string.
> 
> Phil Davis
> 
> 
> 
> On 2/23/16 1:59 PM, Stephen MacLean wrote:
>> Hi All,
>> 
>> Working to build a library extension and I’m getting an error on this line 
>> when I go to test it in LCB:
>> 
>> put "^[A-Z0-9._%+-]{1,64}@(?:[A-Z0-9-]{1,63}\.){1,125}[A-Z]{2,63}$" into 
>> tRegex
>> 
>> The error is:
>> 
>> illegal escape in string 
>> '^[A-Z0-9._%+-]{1,64}@(?:[A-Z0-9-]{1,63}\.){1,125}[A-Z]{2,63}$’
>> 
>> Any ideas?
>> 
>> Thanks,
>> 
>> Steve MacLean
>> 
>> ___
>> use-livecode mailing list
>> use-livecode@lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your subscription 
>> preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
> 
> -- 
> Phil Davis
> 
> 
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode



___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: LCB: Error: illegal escape in string

2016-02-23 Thread Phil Davis
I'm not much of a regex guy, but what happens if you remove the 
backslash after {1,63} ?  I assume something will probably stop working, 
but that's the only \ in the string.


Phil Davis



On 2/23/16 1:59 PM, Stephen MacLean wrote:

Hi All,

Working to build a library extension and I’m getting an error on this line when 
I go to test it in LCB:

put "^[A-Z0-9._%+-]{1,64}@(?:[A-Z0-9-]{1,63}\.){1,125}[A-Z]{2,63}$" into tRegex

The error is:

illegal escape in string 
'^[A-Z0-9._%+-]{1,64}@(?:[A-Z0-9-]{1,63}\.){1,125}[A-Z]{2,63}$’

Any ideas?

Thanks,

Steve MacLean

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


--
Phil Davis


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

LCB: Error: illegal escape in string

2016-02-23 Thread Stephen MacLean
Hi All,

Working to build a library extension and I’m getting an error on this line when 
I go to test it in LCB:

put "^[A-Z0-9._%+-]{1,64}@(?:[A-Z0-9-]{1,63}\.){1,125}[A-Z]{2,63}$" into tRegex

The error is:

illegal escape in string 
'^[A-Z0-9._%+-]{1,64}@(?:[A-Z0-9-]{1,63}\.){1,125}[A-Z]{2,63}$’

Any ideas?

Thanks,

Steve MacLean

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode